summaryrefslogtreecommitdiffstats
path: root/container-di/src/test/java/com/yahoo/container/di/ContainerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-di/src/test/java/com/yahoo/container/di/ContainerTest.java')
-rw-r--r--container-di/src/test/java/com/yahoo/container/di/ContainerTest.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/container-di/src/test/java/com/yahoo/container/di/ContainerTest.java b/container-di/src/test/java/com/yahoo/container/di/ContainerTest.java
index 9c4891c7db2..90bda0ef8a8 100644
--- a/container-di/src/test/java/com/yahoo/container/di/ContainerTest.java
+++ b/container-di/src/test/java/com/yahoo/container/di/ContainerTest.java
@@ -14,6 +14,8 @@ import com.yahoo.container.di.componentgraph.core.Node;
import com.yahoo.container.di.config.RestApiContext;
import org.junit.Ignore;
import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
import java.util.Collection;
import java.util.concurrent.ExecutionException;
@@ -283,13 +285,16 @@ public class ContainerTest extends ContainerTestBase {
public void providers_are_destructed() {
writeBootstrapConfigs("id1", DestructableProvider.class);
- ComponentDeconstructor deconstructor = components -> components.forEach(component -> {
- if (component instanceof AbstractComponent) {
- ((AbstractComponent) component).deconstruct();
- } else if (component instanceof Provider) {
- ((Provider<?>) component).deconstruct();
- }
- });
+ ComponentDeconstructor deconstructor = (components, bundles) -> {
+ components.forEach(component -> {
+ if (component instanceof AbstractComponent) {
+ ((AbstractComponent) component).deconstruct();
+ } else if (component instanceof Provider) {
+ ((Provider<?>) component).deconstruct();
+ }
+ });
+ if (! bundles.isEmpty()) throw new IllegalArgumentException("This test should not use bundles");
+ };
Container container = newContainer(dirConfigSource, deconstructor);
@@ -373,13 +378,14 @@ public class ContainerTest extends ContainerTestBase {
public static class TestDeconstructor implements ComponentDeconstructor {
@Override
- public void deconstruct(Collection<Object> components) {
+ public void deconstruct(Collection<Object> components, Collection<Bundle> bundles) {
components.forEach(component -> {
if (component instanceof DestructableComponent) {
DestructableComponent vespaComponent = (DestructableComponent) component;
vespaComponent.deconstruct();
}
});
+ if (! bundles.isEmpty()) throw new IllegalArgumentException("This test should not use bundles");
}
}