diff options
author | gjoranv <gv@verizonmedia.com> | 2022-09-08 00:13:36 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-09-08 00:13:36 +0200 |
commit | e00663f15d41565c525282930c2983b0f039febd (patch) | |
tree | 16b24baf37814f5fa8aebea6f32e9287d64b20f3 /container-core/src/test/java/com/yahoo/container | |
parent | ceb337dea57c909ac83bc168e1b79872eae6dbfe (diff) |
Always return the set of bundles to uninstall upon completeGen,
regardless of success or failure.
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container')
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java | 17 | ||||
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java | 4 |
2 files changed, 12 insertions, 9 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 fdd44fe358d..8a3243ab1a9 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 @@ -60,7 +60,8 @@ public class ApplicationBundleLoaderTest { bundleLoader.useBundles(List.of(BUNDLE_1_REF)); bundleLoader.completeGeneration(GenerationStatus.SUCCESS); - Set<Bundle> obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF, BUNDLE_2_REF)); + bundleLoader.useBundles(List.of(BUNDLE_1_REF, BUNDLE_2_REF)); + Collection<Bundle> obsoleteBundles = bundleLoader.completeGeneration(GenerationStatus.SUCCESS); // No bundles are obsolete assertTrue(obsoleteBundles.isEmpty()); @@ -71,7 +72,8 @@ public class ApplicationBundleLoaderTest { bundleLoader.useBundles(List.of(BUNDLE_1_REF)); bundleLoader.completeGeneration(GenerationStatus.SUCCESS); - Set<Bundle> obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF, BUNDLE_2_REF)); + bundleLoader.useBundles(List.of(BUNDLE_1_REF, BUNDLE_2_REF)); + Collection<Bundle> obsoleteBundles = bundleLoader.completeGeneration(GenerationStatus.SUCCESS); // No bundles are obsolete assertTrue(obsoleteBundles.isEmpty()); @@ -97,7 +99,8 @@ public class ApplicationBundleLoaderTest { bundleLoader.useBundles(List.of(BUNDLE_1_REF)); bundleLoader.completeGeneration(GenerationStatus.SUCCESS); - Set<Bundle> obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_2_REF)); + bundleLoader.useBundles(List.of(BUNDLE_2_REF)); + Collection<Bundle> obsoleteBundles = bundleLoader.completeGeneration(GenerationStatus.SUCCESS); // The returned set of obsolete bundles contains bundle-1 assertEquals(1, obsoleteBundles.size()); @@ -123,10 +126,9 @@ public class ApplicationBundleLoaderTest { bundleLoader.useBundles(List.of(BUNDLE_1_REF)); bundleLoader.completeGeneration(GenerationStatus.SUCCESS); - Set<Bundle> obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_2_REF)); - assertEquals(BUNDLE_1.getSymbolicName(), obsoleteBundles.iterator().next().getSymbolicName()); + bundleLoader.useBundles(List.of(BUNDLE_2_REF)); - // Revert to the previous generation, as will be done upon a failed reconfig. + // Report the generation as a failure. Collection<Bundle> bundlesToUninstall = bundleLoader.completeGeneration(GenerationStatus.FAILURE); assertEquals(1, bundlesToUninstall.size()); @@ -153,7 +155,8 @@ public class ApplicationBundleLoaderTest { assertEquals(0, bundlesToUninstall.size()); assertEquals(1, osgi.getCurrentBundles().size()); - Set<Bundle> obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + Collection<Bundle> obsoleteBundles = bundleLoader.completeGeneration(GenerationStatus.SUCCESS); assertTrue(obsoleteBundles.isEmpty()); assertEquals(1, osgi.getCurrentBundles().size()); } diff --git a/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java b/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java index d634d7b7ce2..2bd3a325d48 100644 --- a/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java +++ b/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java @@ -65,8 +65,8 @@ public class TestOsgi extends MockOsgi implements com.yahoo.container.di.Osgi { } @Override - public Set<Bundle> useApplicationBundles(Collection<FileReference> bundles, long generation) { - return bundleLoader.useBundles(new ArrayList<>(bundles)); + public void useApplicationBundles(Collection<FileReference> bundles, long generation) { + bundleLoader.useBundles(new ArrayList<>(bundles)); } @Override |