From 420cc3986ec8c2e632c89654d3bd48a27ffc8a24 Mon Sep 17 00:00:00 2001 From: Oleg Kopysov Date: Mon, 5 Aug 2024 10:56:30 +0300 Subject: [PATCH] feat: Show LPVS logo at the app start (#559) Signed-off-by: Oleg Kopysov --- .../com/lpvs/LicensePreValidationService.java | 36 +++++++++++++++++++ .../lpvs/LicensePreValidationServiceTest.java | 7 ++++ 2 files changed, 43 insertions(+) diff --git a/src/main/java/com/lpvs/LicensePreValidationService.java b/src/main/java/com/lpvs/LicensePreValidationService.java index 79b375f5..8cb02330 100644 --- a/src/main/java/com/lpvs/LicensePreValidationService.java +++ b/src/main/java/com/lpvs/LicensePreValidationService.java @@ -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); @@ -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(); + } } diff --git a/src/test/java/com/lpvs/LicensePreValidationServiceTest.java b/src/test/java/com/lpvs/LicensePreValidationServiceTest.java index d0a489bc..87ce7f56 100644 --- a/src/test/java/com/lpvs/LicensePreValidationServiceTest.java +++ b/src/test/java/com/lpvs/LicensePreValidationServiceTest.java @@ -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 { @@ -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); + } }