Search in sources :

Example 1 with PojoRecursive

use of org.apache.aries.blueprint.pojos.PojoRecursive 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);
}
Also used : ComponentDefinitionException(org.osgi.service.blueprint.container.ComponentDefinitionException) BlueprintRepository(org.apache.aries.blueprint.container.BlueprintRepository) CircularDependencyException(org.apache.aries.blueprint.di.CircularDependencyException) PojoRecursive(org.apache.aries.blueprint.pojos.PojoRecursive)

Aggregations

BlueprintRepository (org.apache.aries.blueprint.container.BlueprintRepository)1 CircularDependencyException (org.apache.aries.blueprint.di.CircularDependencyException)1 PojoRecursive (org.apache.aries.blueprint.pojos.PojoRecursive)1 ComponentDefinitionException (org.osgi.service.blueprint.container.ComponentDefinitionException)1