Package org.apache.felix.ipojo.api

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


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

        SingletonComponentType type = createAProvider();
        ci = type.create();
        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 Exception {
        assertThat( context, is( notNullValue() ) );
        ComponentInstance ci = null;
        SingletonComponentType type = createAProvider();
        ci = type.create();
        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;

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

    }
View Full Code Here

        assertThat("cons is valid", cons.getState(), is(ComponentInstance.VALID));

    }

    private SingletonComponentType createAProvider() {
        PrimitiveComponentType type =  new SingletonComponentType()
        .setBundleContext(context)
        .setClassName(FooImpl.class.getName())
        .addService(new Service()); // Provide the FooService

        return (SingletonComponentType) type;
View Full Code Here

        return (SingletonComponentType) type;
    }

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

        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

        .setClassName(FooImpl.class.getName())
        .addService(new Service()); // Provide the FooService
    }

    private PrimitiveComponentType createAConsumer() {
        return new SingletonComponentType()
        .setBundleContext(context)
        .setClassName(org.example.service.impl.MyComponentImpl.class.getName())
        .addDependency(new Dependency().setField("myFoo"))
        .setValidateMethod("start");
    }
View Full Code Here

        .addDependency(new Dependency().setField("myFoo"))
        .setValidateMethod("start");
    }

    private PrimitiveComponentType createAnOptionalConsumer() {
        return 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

TOP

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

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.