diff --git a/integration-test.bndrun b/integration-test.bndrun index c84de8b..8489b8b 100644 --- a/integration-test.bndrun +++ b/integration-test.bndrun @@ -6,7 +6,8 @@ bnd.identity;id='org.glassfish.jakarta.json' -runproperties: \ - localRepositoryPath=${project.build.directory}/m2Repo + localRepositoryPath=${project.build.directory}/m2Repo,\ + gosh.args=-s -resolve.effective: active diff --git a/src/main/java/com/kentyou/featurelauncher/impl/FeatureLauncherImpl.java b/src/main/java/com/kentyou/featurelauncher/impl/FeatureLauncherImpl.java index 997d512..5f5a1a2 100644 --- a/src/main/java/com/kentyou/featurelauncher/impl/FeatureLauncherImpl.java +++ b/src/main/java/com/kentyou/featurelauncher/impl/FeatureLauncherImpl.java @@ -13,8 +13,6 @@ */ package com.kentyou.featurelauncher.impl; -import static com.kentyou.featurelauncher.impl.FeatureLauncherImplConstants.FRAMEWORK_STORAGE_CLEAN_TESTONLY; - import java.io.IOException; import java.io.InputStream; import java.io.Reader; @@ -396,7 +394,7 @@ private void logBundleEvent(BundleEvent bundleEvent) { } private void cleanup(Framework framework) { - + // Stopping the framework will stop all of the bundles try { framework.stop(); @@ -404,7 +402,7 @@ private void cleanup(Framework framework) { } catch (BundleException | InterruptedException e) { LOG.error("A problem occurred while cleaning up the framework", e); } - + Collections.reverse(installedBundles); if (!installedBundles.isEmpty()) { diff --git a/src/test/java/com/kentyou/featurelauncher/impl/FeatureLauncherImplTest.java b/src/test/java/com/kentyou/featurelauncher/impl/FeatureLauncherImplTest.java index 1148f69..170f2f8 100644 --- a/src/test/java/com/kentyou/featurelauncher/impl/FeatureLauncherImplTest.java +++ b/src/test/java/com/kentyou/featurelauncher/impl/FeatureLauncherImplTest.java @@ -29,6 +29,7 @@ import java.util.Optional; import java.util.ServiceLoader; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -80,6 +81,20 @@ public void setUp(TestInfo info) throws InterruptedException, IOException { throw new IllegalStateException("Error loading feature launcher!"); } } + + // The use of Gogo Shell requires that Std In is connected to a live + // terminal, which breaks builds using batch mode (like CI). + // We therefore tell gogo to be non-interactive + + @BeforeEach + public void replaceStdInForGogo() throws IOException { + System.setProperty("gosh.args", "-s"); + } + + @AfterEach + public void resetStdIn() { + System.clearProperty("gosh.args"); + } @Test public void testLaunchFeatureWithNoConfigWithDefaultFramework()