From 2700d91caac1948581d9ebc691200f4846c84062 Mon Sep 17 00:00:00 2001 From: Kiryl Valkovich Date: Wed, 14 Jan 2026 09:51:05 +0300 Subject: [PATCH 1/2] [DXP-2558] Remove Java wrapper --- .../java/dev/streamx/cli/StreamxCommand.java | 20 ++++++ .../src/main/resources/application.properties | 2 +- .../dev/streamx/cli/StreamxCommandTest.java | 14 ++--- distribution/pom.xml | 6 +- entrypoint/pom.xml | 52 ---------------- .../java/dev/streamx/cli/EntrypointMain.java | 61 ------------------- .../java/dev/streamx/cli/StreamxCommand.java | 20 ------ pom.xml | 11 ++-- 8 files changed, 33 insertions(+), 153 deletions(-) rename entrypoint/src/test/java/dev/streamx/cli/EntrypointMainTest.java => core/src/test/java/dev/streamx/cli/StreamxCommandTest.java (86%) delete mode 100644 entrypoint/pom.xml delete mode 100644 entrypoint/src/main/java/dev/streamx/cli/EntrypointMain.java delete mode 100644 entrypoint/src/test/java/dev/streamx/cli/StreamxCommand.java diff --git a/core/src/main/java/dev/streamx/cli/StreamxCommand.java b/core/src/main/java/dev/streamx/cli/StreamxCommand.java index c16b95aa..1d383669 100644 --- a/core/src/main/java/dev/streamx/cli/StreamxCommand.java +++ b/core/src/main/java/dev/streamx/cli/StreamxCommand.java @@ -18,6 +18,8 @@ import io.quarkus.runtime.QuarkusApplication; import io.quarkus.runtime.annotations.QuarkusMain; import jakarta.inject.Inject; +import java.text.SimpleDateFormat; +import java.util.Date; import org.jetbrains.annotations.Nullable; import picocli.CommandLine; import picocli.CommandLine.ArgGroup; @@ -39,6 +41,10 @@ }, versionProvider = VersionProvider.class) public class StreamxCommand implements QuarkusApplication { + private static final SimpleDateFormat DATE_FORMAT = + new SimpleDateFormat("yyyy_MM_dd__HH_mm_ss_SSS"); + private static final String LOG_FILE_PATH_PROPERTY_NAME = "%prod.quarkus.log.file.path"; + private static final String STREAMX_LOG_FILE_NAME_PATTERN = "%s/.streamx/logs/streamx-%s.log"; @Inject CommandLine.IFactory factory; @@ -67,6 +73,8 @@ public class StreamxCommand implements QuarkusApplication { public static void main(String... args) { initializeArgumentConfigSource(args); + overrideLogFileName(); + Quarkus.run(StreamxCommand.class, args); } @@ -121,6 +129,18 @@ private int executionStrategy(ParseResult parseResult) { } } + private static void overrideLogFileName() { + if (System.getProperty(LOG_FILE_PATH_PROPERTY_NAME) != null) { + return; + } + + String userHome = System.getProperty("user.home"); + String date = DATE_FORMAT.format(new Date()); + String streamxLogPath = String.format(STREAMX_LOG_FILE_NAME_PATTERN, userHome, date); + + System.setProperty(LOG_FILE_PATH_PROPERTY_NAME, streamxLogPath); + } + private void init() { bannerPrinter.initialize(commandLine, args); diff --git a/core/src/main/resources/application.properties b/core/src/main/resources/application.properties index 7dea5d25..9d7d0126 100644 --- a/core/src/main/resources/application.properties +++ b/core/src/main/resources/application.properties @@ -19,7 +19,7 @@ streamx.runner.generated-keys.location=${user.home}/.streamx/config/generated %prod.quarkus.log.console.enable=false %prod.quarkus.log.file.enable=true -# WARNING! %prod.quarkus.log.file.path is overridden by EntrypointMain +# WARNING! %prod.quarkus.log.file.path is overridden by StreamxCommand # Log name is overriden to log to date-specific log to allow multiple commands to be run paralleled. %prod.quarkus.log.file.path=${user.home}/.streamx/logs/streamx.log %prod.quarkus.log.file.rotation.max-backup-index=10 diff --git a/entrypoint/src/test/java/dev/streamx/cli/EntrypointMainTest.java b/core/src/test/java/dev/streamx/cli/StreamxCommandTest.java similarity index 86% rename from entrypoint/src/test/java/dev/streamx/cli/EntrypointMainTest.java rename to core/src/test/java/dev/streamx/cli/StreamxCommandTest.java index a790c2e5..2b2bb8bc 100644 --- a/entrypoint/src/test/java/dev/streamx/cli/EntrypointMainTest.java +++ b/core/src/test/java/dev/streamx/cli/StreamxCommandTest.java @@ -1,22 +1,18 @@ package dev.streamx.cli; -import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.PrintStream; import java.nio.file.Files; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -public class EntrypointMainTest { +public class StreamxCommandTest { public static final String TIMESTAMP_REGEX = "[0-9]{4}_[0-9]{2}_[0-9]{2}__[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{3}"; private static final String STREAMX_LOG_REGEX = ".*/\\.streamx/logs/streamx-" + TIMESTAMP_REGEX + "\\.log"; +<<<<<<< HEAD:entrypoint/src/test/java/dev/streamx/cli/EntrypointMainTest.java @BeforeEach void setup() { StreamxCommand.clearLaunched(); @@ -57,6 +53,8 @@ void shouldFailTooLowJavaVersions(String javaVersion) { ); } +======= +>>>>>>> d870d23 ([DXP-2558] Remove Java wrapper):core/src/test/java/dev/streamx/cli/StreamxCommandTest.java @Test void shouldOverrideProdFileLogName() throws IOException { // given @@ -65,7 +63,7 @@ void shouldOverrideProdFileLogName() throws IOException { System.setProperty("user.home", userHome); // when - EntrypointMain.main(new String[] {}); + StreamxCommand.main(new String[] {}); // then String fileName = System.getProperty("%prod.quarkus.log.file.path"); @@ -79,7 +77,7 @@ void shouldUseProvidedProdFileLogName() { System.setProperty("%prod.quarkus.log.file.path", ".streamx.log"); // when - EntrypointMain.main(new String[] {}); + StreamxCommand.main(new String[] {}); // then String fileName = System.getProperty("%prod.quarkus.log.file.path"); diff --git a/distribution/pom.xml b/distribution/pom.xml index f88258bb..e8f05bbf 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -20,10 +20,6 @@ - - dev.streamx.cli - streamx-cli-entrypoint - dev.streamx.cli streamx-cli-core @@ -47,7 +43,7 @@ - dev.streamx.cli.EntrypointMain + dev.streamx.cli.StreamxCommand diff --git a/entrypoint/pom.xml b/entrypoint/pom.xml deleted file mode 100644 index 63bc6d6d..00000000 --- a/entrypoint/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - dev.streamx.cli - streamx-cli - 1.1.3-SNAPSHOT - - - streamx-cli-entrypoint - - StreamX Cli : Entrypoint - - - 8 - 8 - UTF-8 - - - - - org.junit - junit-bom - 5.12.1 - pom - import - - - - - - - org.junit.jupiter - junit-jupiter - test - - - org.junit.jupiter - junit-jupiter-params - test - - - - - - - maven-surefire-plugin - 3.5.3 - - - - diff --git a/entrypoint/src/main/java/dev/streamx/cli/EntrypointMain.java b/entrypoint/src/main/java/dev/streamx/cli/EntrypointMain.java deleted file mode 100644 index 81edfde6..00000000 --- a/entrypoint/src/main/java/dev/streamx/cli/EntrypointMain.java +++ /dev/null @@ -1,61 +0,0 @@ -package dev.streamx.cli; - -import java.lang.reflect.Method; -import java.text.SimpleDateFormat; -import java.util.Date; - -public class EntrypointMain { - - private static final SimpleDateFormat DATE_FORMAT = - new SimpleDateFormat("yyyy_MM_dd__HH_mm_ss_SSS"); - private static final String LOG_FILE_PATH_PROPERTY_NAME = "%prod.quarkus.log.file.path"; - private static final String STREAMX_LOG_FILE_NAME_PATTERN = "%s/.streamx/logs/streamx-%s.log"; - - public static void main(String[] args) { - int javaVersion = getJavaVersion(); - - if (javaVersion < 17) { - System.out.println("Java 17 or higher is required!"); - return; - } - - overrideLogFileName(); - runStreamxCommand(args); - } - - private static int getJavaVersion() { - String version = System.getProperty("java.version"); - if (version.startsWith("1.")) { - version = version.substring(2, 3); - } else { - int dot = version.indexOf("."); - if (dot != -1) { - version = version.substring(0, dot); - } - } - return Integer.parseInt(version); - } - - private static void overrideLogFileName() { - if (System.getProperty(LOG_FILE_PATH_PROPERTY_NAME) != null) { - return; - } - - String userHome = System.getProperty("user.home"); - String date = DATE_FORMAT.format(new Date()); - String streamxLogPath = String.format(STREAMX_LOG_FILE_NAME_PATTERN, userHome, date); - - System.setProperty(LOG_FILE_PATH_PROPERTY_NAME, streamxLogPath); - } - - private static void runStreamxCommand(String[] args) { - try { - Class streamxCommand = Class.forName("dev.streamx.cli.StreamxCommand"); - Method main = streamxCommand.getDeclaredMethod("main", String[].class); - - main.invoke(null, new Object[]{args}); - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/entrypoint/src/test/java/dev/streamx/cli/StreamxCommand.java b/entrypoint/src/test/java/dev/streamx/cli/StreamxCommand.java deleted file mode 100644 index 5d1fc44c..00000000 --- a/entrypoint/src/test/java/dev/streamx/cli/StreamxCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.streamx.cli; - -import java.util.concurrent.atomic.AtomicBoolean; - -public class StreamxCommand { - - private static final AtomicBoolean LAUNCHED = new AtomicBoolean(false); - - public static void main(String[] args) { - LAUNCHED.set(true); - } - - public static boolean isLaunched() { - return LAUNCHED.get(); - } - - public static void clearLaunched() { - LAUNCHED.set(false); - } -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index e0ec4b0a..551882eb 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,6 @@ StreamX Cli : Parent - entrypoint core distribution e2e-tests @@ -64,11 +63,6 @@ import - - dev.streamx.cli - streamx-cli-entrypoint - ${project.version} - dev.streamx.cli streamx-cli-core @@ -234,6 +228,11 @@ check + + + dev.streamx.cli/StreamxCommand.class + BUNDLE From 968a6630a3a14bab9b870da02e03a5de82dda51c Mon Sep 17 00:00:00 2001 From: Kiryl Valkovich Date: Wed, 14 Jan 2026 11:08:22 +0300 Subject: [PATCH 2/2] Fix merge conflicts --- .../dev/streamx/cli/StreamxCommandTest.java | 43 ------------------- 1 file changed, 43 deletions(-) diff --git a/core/src/test/java/dev/streamx/cli/StreamxCommandTest.java b/core/src/test/java/dev/streamx/cli/StreamxCommandTest.java index 2b2bb8bc..3f322284 100644 --- a/core/src/test/java/dev/streamx/cli/StreamxCommandTest.java +++ b/core/src/test/java/dev/streamx/cli/StreamxCommandTest.java @@ -12,49 +12,6 @@ public class StreamxCommandTest { private static final String STREAMX_LOG_REGEX = ".*/\\.streamx/logs/streamx-" + TIMESTAMP_REGEX + "\\.log"; -<<<<<<< HEAD:entrypoint/src/test/java/dev/streamx/cli/EntrypointMainTest.java - @BeforeEach - void setup() { - StreamxCommand.clearLaunched(); - } - - @Test - void shouldLaunchStreamxCommand() { - // when - EntrypointMain.main(new String[] {}); - - // then - Assertions.assertTrue(StreamxCommand.isLaunched()); - } - - @ParameterizedTest - @ValueSource(strings = { - "1.8.0_211", - "9.0.1", - "11.0.4", - "12", - "12.0.1" - }) - void shouldFailTooLowJavaVersions(String javaVersion) { - // given - System.clearProperty("java.version"); - System.setProperty("java.version", javaVersion); - - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - System.setOut(new PrintStream(byteArrayOutputStream)); - - // when - EntrypointMain.main(new String[] {}); - - // then - Assertions.assertFalse(StreamxCommand.isLaunched()); - Assertions.assertTrue( - byteArrayOutputStream.toString().contains("Java 17 or higher is required!") - ); - } - -======= ->>>>>>> d870d23 ([DXP-2558] Remove Java wrapper):core/src/test/java/dev/streamx/cli/StreamxCommandTest.java @Test void shouldOverrideProdFileLogName() throws IOException { // given