Skip to content

Commit

Permalink
feat: Show LPVS logo at the app start (#559)
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
  • Loading branch information
o-kopysov authored Aug 5, 2024
1 parent 7d63c2d commit 420cc39
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/main/java/com/lpvs/LicensePreValidationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public LicensePreValidationService(@Value("${lpvs.cores:8}") int corePoolSize) {
*/
public static void main(String[] args) {
try {
log.info(getEmblem());
ApplicationContext applicationContext =
SpringApplication.run(LicensePreValidationService.class, args);
exitHandler = applicationContext.getBean(LPVSExitHandler.class);
Expand Down Expand Up @@ -85,4 +86,39 @@ public TaskExecutor getAsyncExecutor() {
executor.setThreadNamePrefix("LPVS::");
return executor;
}

/**
* Returns the emblem for the License Pre-Validation Service.
*
* @return the emblem as a String
*/
protected static String getEmblem() {
StringBuilder emblem = new StringBuilder();
emblem.append("\n");
emblem.append(
" .----------------. .----------------. .----------------. .----------------. \n");
emblem.append(
" | .--------------. | | .--------------. | | .--------------. | | .--------------. |\n");
emblem.append(
" | | _____ | | | | ______ | | | | ____ ____ | | | | _______ | |\n");
emblem.append(
" | | |_ _| | | | | |_ __ \\ | | | ||_ _| |_ _| | | | | / ___ | | |\n");
emblem.append(
" | | | | | | | | | |__) | | | | | \\ \\ / / | | | | | (__ \\_| | |\n");
emblem.append(
" | | | | _ | | | | | ___/ | | | | \\ \\ / / | | | | '.___`-. | |\n");
emblem.append(
" | | _| |__/ | | | | | _| |_ | | | | \\ ' / | | | | |`\\____) | | |\n");
emblem.append(
" | | |________| | | | | |_____| | | | | \\_/ | | | | |_______.' | |\n");
emblem.append(
" | | | | | | | | | | | | | | | |\n");
emblem.append(
" | '--------------' | | '--------------' | | '--------------' | | '--------------' |\n");
emblem.append(
" '----------------' '----------------' '----------------' '----------------' \n");
emblem.append(
" :: License Pre-Validation Service :: (v1.5.2)\n");
return emblem.toString();
}
}
7 changes: 7 additions & 0 deletions src/test/java/com/lpvs/LicensePreValidationServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.lang.reflect.Field;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.Mockito.*;

public class LicensePreValidationServiceTest {
Expand Down Expand Up @@ -137,4 +138,10 @@ public void testMain_Exception_N() throws NoSuchFieldException, IllegalAccessExc
LicensePreValidationService.main(args);
Mockito.verify(exitHandler, Mockito.times(0)).exit(anyInt());
}

@Test
public void testGetEmblem() {
String emblem = LicensePreValidationService.getEmblem();
assertNotNull(emblem);
}
}

0 comments on commit 420cc39

Please sign in to comment.