diff options
Diffstat (limited to 'container-core/src')
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java | 18 | ||||
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/di/ContainerTest.java | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java b/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java index 54ef2d41ac6..2236a1b250a 100644 --- a/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java +++ b/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java @@ -116,4 +116,22 @@ public class ApplicationBundleLoaderTest { assertEquals(BUNDLE_1_REF, bundleLoader.getActiveFileReferences().get(0)); } + @Test + void bundles_are_unaffected_by_failed_reconfig_with_unchanged_bundles() { + bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + Set<Bundle> obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + assertTrue(obsoleteBundles.isEmpty()); + + // Revert to the previous generation, as will be done upon a failed reconfig. + Collection<Bundle> bundlesToUninstall = bundleLoader.revertToPreviousGeneration(); + + assertEquals(0, bundlesToUninstall.size()); + assertEquals(1, osgi.getCurrentBundles().size()); + + bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + assertTrue(obsoleteBundles.isEmpty()); + assertEquals(1, osgi.getCurrentBundles().size()); + } + } diff --git a/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java b/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java index c5be05b5c82..23649f8de72 100644 --- a/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java +++ b/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java @@ -10,6 +10,7 @@ import com.yahoo.container.di.componentgraph.core.ComponentGraphTest.SimpleCompo import com.yahoo.container.di.componentgraph.core.ComponentNode.ComponentConstructorException; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.osgi.framework.Bundle; import java.util.List; import java.util.concurrent.ExecutorService; |