use of org.apache.aries.blueprint.container.BlueprintRepository in project aries by apache.
the class WiringTest method testCircularBreaking.
public void testCircularBreaking() throws Exception {
BlueprintRepository repository;
repository = createBlueprintContainer().getRepository();
assertNotNull(repository.create("c1"));
repository = createBlueprintContainer().getRepository();
assertNotNull(repository.create("c2"));
repository = createBlueprintContainer().getRepository();
assertNotNull(repository.create("c3"));
}
use of org.apache.aries.blueprint.container.BlueprintRepository in project aries by apache.
the class WiringTest method testCircularPrototype.
public void testCircularPrototype() throws Exception {
BlueprintRepository repository = createBlueprintContainer().getRepository();
try {
repository.create("circularPrototypeDriver");
fail("Did not throw exception");
} catch (CircularDependencyException e) {
// that's what we expect
}
try {
repository.create("circularPrototype");
fail("Did not throw exception");
} catch (CircularDependencyException e) {
// that's what we expect
}
}
use of org.apache.aries.blueprint.container.BlueprintRepository in project aries by apache.
the class WiringTest method testRecursive.
public void testRecursive() throws Exception {
BlueprintRepository repository = createBlueprintContainer().getRepository();
try {
repository.create("recursiveConstructor");
fail("Did not throw exception");
} catch (ComponentDefinitionException e) {
if (e.getCause() instanceof CircularDependencyException) {
// that's what we expect
} else {
fail("Did not throw expected exception");
throw e;
}
}
PojoRecursive pojo;
pojo = (PojoRecursive) repository.create("recursiveSetter");
assertNotNull(pojo);
pojo = (PojoRecursive) repository.create("recursiveInitMethod");
assertNotNull(pojo);
}
use of org.apache.aries.blueprint.container.BlueprintRepository in project aries by apache.
the class WiringTest method testCircular.
public void testCircular() throws Exception {
BlueprintRepository repository = createBlueprintContainer().getRepository();
// this should pass (we allow circular dependencies for components without init method)
Object obj1 = repository.create("a");
// test service and listener circular dependencies
Object obj2 = repository.create("service");
assertNotNull(obj2);
assertTrue(obj2 instanceof ServiceRegistration);
Object obj3 = repository.create("listener");
assertNotNull(obj3);
assertTrue(obj3 instanceof PojoListener);
assertEquals(obj2, ((PojoListener) obj3).getService());
}
Aggregations