Package org.apache.felix.ipojo

Examples of org.apache.felix.ipojo.ComponentFactory.createComponentInstance()


        // Provider
        ComponentFactory providerFactory = new ComponentFactory(getContext(),
                m_provider);
        providerFactory.start();
        properties.put("instance.name","Emperor of donuts");
        ComponentInstance providerInstance = providerFactory
                .createComponentInstance(properties);
        ServiceReference providerService = IPojoTestUtils
                .getServiceReferenceByName(getContext(), DonutProvider.class
                        .getName(), providerInstance.getInstanceName());
        DonutProvider provider = (DonutProvider) getContext()
View Full Code Here


        ComponentFactory consumerFactory = new ComponentFactory(getContext(),
                m_consumer);
        consumerFactory.start();
        properties.put("instance.name","Homer Simpson");
        properties.put("slow", "false");
        ComponentInstance consumerInstance = consumerFactory
                .createComponentInstance(properties);
        ServiceReference consumerService = IPojoTestUtils
                .getServiceReferenceByName(getContext(), DonutConsumer.class
                        .getName(), consumerInstance.getInstanceName());
        DonutConsumer consumer = (DonutConsumer) getContext()
View Full Code Here

        Dictionary conf = new Hashtable();
        conf.put("instance.name","provider without topics");

        ComponentInstance instance;
        try {
            instance = fact.createComponentInstance(conf);
            // Should not be executed
            instance.dispose();
            fail("The factory must not create instance without specified topics.");
        } catch (ConfigurationException e) {
            // OK
View Full Code Here

        topics.put("donut-publisher", "| |\\| \\/ /-\\ |_ | |)");
        conf.put("event.topics", topics);

        ComponentInstance instance;
        try {
            instance = fact.createComponentInstance(conf);
            // Should not be executed
            instance.dispose();
            fail("The factory must not create instance with invalid specified topics.");
        } catch (ConfigurationException e) {
            // OK
View Full Code Here

        conf.put("instance.name","consumer without topics");
        conf.put("slow", "false");

        ComponentInstance instance;
        try {
            instance = fact.createComponentInstance(conf);
            // Should not be executed
            instance.dispose();
            fail("The factory must not create instance without specified topics.");
        } catch (ConfigurationException e) {
            // OK
View Full Code Here

        topics.put("donut-subscriber", "| |\\| \\/ /-\\ |_ | |)");
        conf.put("event.topics", topics);

        ComponentInstance instance;
        try {
            instance = fact.createComponentInstance(conf);
            // Should not be executed
            instance.dispose();
            fail("The factory must not create instance with invalid specified topics.");
        } catch (ConfigurationException e) {
            // OK
View Full Code Here

    // First inject a configuration triggering an exception of the validate method.
    Properties props = new Properties();
    props.put("prop", "KO");
    ComponentInstance ci = null;
    try {
      ci = factory.createComponentInstance(props);
    } catch (UnacceptableConfiguration e) {
      e.printStackTrace();
    } catch (MissingHandlerException e) {
      e.printStackTrace();
    } catch (ConfigurationException e) {
View Full Code Here

    // First inject a configuration triggering an exception of the validate method.
    Properties props = new Properties();
    props.put("prop", "KO");
    ComponentInstance ci = null;
    try {
      ci = factory.createComponentInstance(props);
    } catch (UnacceptableConfiguration e) {
      e.printStackTrace();
    } catch (MissingHandlerException e) {
      e.printStackTrace();
    } catch (ConfigurationException e) {
View Full Code Here

    // First inject a configuration triggering an exception of the validate method.
    Properties props = new Properties();
    props.put("controller", "false");
    ComponentInstance ci = null;
    try {
      ci = factory.createComponentInstance(props);
    } catch (UnacceptableConfiguration e) {
      e.printStackTrace();
    } catch (MissingHandlerException e) {
      e.printStackTrace();
    } catch (ConfigurationException e) {
View Full Code Here

   
    public void testNothing() {
        try {
            ComponentFactory cf = new ComponentFactory(getContext(), getNothing());
            cf.start();
            ComponentInstance ci = cf.createComponentInstance(props);
            ci.dispose();
            cf.stop();
            fail("A service requirement with neither field and method must be rejected " + cf);
        } catch (ConfigurationException e) {
           // OK
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.