Package org.apache.aries.blueprint.namespace

Examples of org.apache.aries.blueprint.namespace.ComponentDefinitionRegistryImpl


import org.osgi.service.blueprint.container.ComponentDefinitionException;

public class WiringTest extends AbstractBlueprintTest {

    public void testWiring() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-wiring.xml");
        Repository repository = new TestBlueprintContainer(registry).getRepository();
       
        Object obj1 = repository.create("pojoA");
        assertNotNull(obj1);
        assertTrue(obj1 instanceof PojoA);
View Full Code Here


        // test destroy-method
        assertEquals(true, pojob.getDestroyCalled());
    }
   
    public void testSetterDisambiguation() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-wiring.xml");
        Repository repository = new TestBlueprintContainer(registry).getRepository();

        AmbiguousPojo pojo = (AmbiguousPojo) repository.create("ambiguousViaInt");
        assertEquals(5, pojo.getSum());
       
View Full Code Here

       
       
    }
   
    public void testFieldInjection() throws Exception {
      ComponentDefinitionRegistryImpl registry = parse("/test-wiring.xml");
      Repository repository = new TestBlueprintContainer(registry).getRepository();
     
      Object fiTestBean = repository.create("FITestBean");
      assertNotNull(fiTestBean);
      assertTrue(fiTestBean instanceof FITestBean);
View Full Code Here

          Assert.fail("Expected exception");
      } catch (ComponentDefinitionException cde) {}
    }
   
    public void testCompoundProperties() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-wiring.xml");
        Repository repository = new TestBlueprintContainer(registry).getRepository();
       
        Object obj5 = repository.create("compound");
        assertNotNull(obj5);
        assertTrue(obj5 instanceof PojoB);
View Full Code Here

        assertEquals("pojoA", bean.getName());
    }

    public void testIdRefs() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-bad-id-ref.xml");

        try {
            new TestBlueprintContainer(registry).getRepository();
            fail("Did not throw exception");
        } catch (RuntimeException e) {
View Full Code Here

    }
   
    public void testDependencies() throws Exception {
        CallbackTracker.clear();

        ComponentDefinitionRegistryImpl registry = parse("/test-depends-on.xml");
        Repository repository = new TestBlueprintContainer(registry).getRepository();
        Map instances = repository.createAll(Arrays.asList("c", "d", "e"));
       
        List<Callback> callback = CallbackTracker.getCallbacks();
        assertEquals(3, callback.size());
View Full Code Here

        assertEquals(Callback.DESTROY, callback.getType());
        assertEquals(obj, callback.getObject());
    }
   
    public void testConstructor() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-constructor.xml");
        Repository repository = new TestBlueprintContainer(registry).getRepository();

        Object obj1 = repository.create("pojoA");
        assertNotNull(obj1);
        assertTrue(obj1 instanceof PojoA);
View Full Code Here

        assertEquals(stringValue, ((Multiple)obj).getString());
        assertEquals(integerValue, ((Multiple)obj).getInteger());       
    }

    public void testGenerics() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-generics.xml");
        Repository repository = new TestBlueprintContainer(registry).getRepository();

        List<Integer> expectedList = new ArrayList<Integer>();
        expectedList.add(new Integer(10));
        expectedList.add(new Integer(20));
View Full Code Here

        repository = createBlueprintContainer().getRepository();       
        assertNotNull(repository.create("c3"));
    }
   
    private TestBlueprintContainer createBlueprintContainer() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-circular.xml");
        return new TestBlueprintContainer(registry);
    }
View Full Code Here

        };
        return parse(name, handlers);
    }

    protected ComponentDefinitionRegistryImpl parse(String name, NamespaceHandlerRegistry.NamespaceHandlerSet handlers) throws Exception {
        ComponentDefinitionRegistryImpl registry = new ComponentDefinitionRegistryImpl();
        Parser parser = new Parser();
        parser.parse(Collections.singletonList(getClass().getResource(name)));
        parser.populate(handlers, registry);
        return registry;
    }
View Full Code Here

TOP

Related Classes of org.apache.aries.blueprint.namespace.ComponentDefinitionRegistryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.