Package org.apache.felix.ipojo.api

Examples of org.apache.felix.ipojo.api.PrimitiveComponentType


        return (SingletonComponentType) type;
    }

    private SingletonComponentType createAnOptionalConsumer() {
        PrimitiveComponentType type =  new SingletonComponentType()
        .setBundleContext(context)
        .setClassName(org.example.service.impl.MyComponentImpl.class.getName())
        .addDependency(new Dependency().setField("myFoo").setOptional(true))
        .setValidateMethod("start");
View Full Code Here


        return opt;
    }

    @Test
    public void createAHost() throws Exception {
        PrimitiveComponentType type = createAWhiteboardHost();
        ComponentInstance ci = type.createInstance();
        assertThat (ci.getState(), is (ComponentInstance.VALID));
        HandlerDescription hd = ci.getInstanceDescription().getHandlerDescription(Whiteboard.NAMESPACE + ":" + Whiteboard.NAME);
        assertThat (hd, is (notNullValue()));
    }
View Full Code Here

        assertThat (hd, is (notNullValue()));
    }

    @Test
    public void createDoubleHost() throws Exception {
        PrimitiveComponentType type = createASecondWhiteboardHost();
        ComponentInstance ci = type.createInstance();
        assertThat (ci.getState(), is (ComponentInstance.VALID));
        HandlerDescription hd = ci.getInstanceDescription().getHandlerDescription(Whiteboard.NAMESPACE + ":" + Whiteboard.NAME);
        assertThat (hd, is (notNullValue()));
    }
View Full Code Here

        HandlerDescription hd = ci.getInstanceDescription().getHandlerDescription(Whiteboard.NAMESPACE + ":" + Whiteboard.NAME);
        assertThat (hd, is (notNullValue()));
    }

    private PrimitiveComponentType createAWhiteboardHost() {
        return new PrimitiveComponentType()
        .setBundleContext(context)
        .setClassName(HostImpl.class.getName())
        .addHandler(new Whiteboard()
            .onArrival("arrival")
            .onDeparture("departure")
View Full Code Here

            .setFilter("(foo=foo)")
         );
    }

    private PrimitiveComponentType createASecondWhiteboardHost() {
        return new PrimitiveComponentType()
        .setBundleContext(context)
        .setClassName(HostImpl.class.getName())
        .addHandler(new Whiteboard()
            .onArrival("arrival")
            .onDeparture("departure")
View Full Code Here

    @Test
    public void createAServiceProvider() throws Exception {
        assertThat( context, is( notNullValue() ) );
        ComponentInstance ci = null;

        PrimitiveComponentType type = createAProvider();
        ci = type.createInstance();
        assertThat("Ci is valid", ci.getState(), is(ComponentInstance.VALID));
        ServiceReference ref = ipojo.getServiceReferenceByName(Foo.class
                .getName(), ci.getInstanceName());
        assertThat(ref, is(notNullValue()));
View Full Code Here

    @Test
    public void killTheFactory() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
        assertThat( context, is( notNullValue() ) );
        ComponentInstance ci = null;

        PrimitiveComponentType type = createAProvider();
        ci = type.createInstance();
        assertThat("Ci is valid", ci.getState(), is(ComponentInstance.VALID));
        ServiceReference ref = ipojo.getServiceReferenceByName(Foo.class
                .getName(), ci.getInstanceName());
        assertThat(ref, is(notNullValue()));
        type.stop();
        assertThat("Ci is disposed", ci.getState(),
                is(ComponentInstance.DISPOSED));
        ref = ipojo.getServiceReferenceByName(Foo.class.getName(), ci
                .getInstanceName());
        assertThat(ref, is(nullValue()));
View Full Code Here

    @Test
    public void createAServiceCons() throws Exception {
        assertThat( context, is( notNullValue() ) );
        ComponentInstance ci = null;

        PrimitiveComponentType type = createAConsumer();
        ci = type.createInstance();
        assertThat("Ci is invalid", ci.getState(),
                is(ComponentInstance.INVALID));

    }
View Full Code Here

        assertThat("cons is invalid", cons1.getState(), is(ComponentInstance.INVALID));
        assertThat("cons2 is valid", cons2.getState(), is(ComponentInstance.VALID));
    }

    private PrimitiveComponentType createAProvider() {
        return new PrimitiveComponentType()
        .setBundleContext(context)
        .setClassName(FooImpl.class.getName())
        .addService(new Service()); // Provide the FooService
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.api.PrimitiveComponentType

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.