Examples of createComponentInstance()


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

            return null;
        }

        // if(fact.isAcceptable(configuration)) {
        try {
            return fact.createComponentInstance(configuration);
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail("Cannot create the instance from " + factoryName + " : " + e.getMessage());
            return null;
        }
View Full Code Here

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

        }

        try {
            Properties props = new Properties();
            props.put("instance.name",name);
            return fact.createComponentInstance(props);
        } catch (Exception e) {
            System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
            e.printStackTrace();
            return null;
        }
View Full Code Here

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

        if (fact == null) { return null; }

        if (fact.isAcceptable(configuration)) {
            try {
                return fact.createComponentInstance(configuration);
            } catch (Exception e) {
                System.err.println(e.getMessage());
                e.printStackTrace();
                return null;
            }
View Full Code Here

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

    public void testCreationOnBadConstructor() {
            Factory factory = Utils.getFactoryByName(getContext(), "BAD-BadConstructor");
            ComponentInstance ci;
            try {
                // Change in Felix-966, now throws a runtime exception
                ci = factory.createComponentInstance(null);
                //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
                ci.dispose();
                fail("Exception expected");
            } catch (Throwable e) {
               //fail("Exception unexpected : " + e.getMessage());
View Full Code Here

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

    public void testCreationOnBadFactory() {
        Factory factory = Utils.getFactoryByName(getContext(), "BAD-BadFactory");
        ComponentInstance ci;
        try {
            // Change in Felix-966, now throw a runtime exception
            ci = factory.createComponentInstance(null);
            //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
            ci.dispose();
            fail("Exception expected");
        } catch (Throwable e) {
           //fail("Exception unexpected : " + e.getMessage());
View Full Code Here

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

    public void testCreationOnBadFactory2() {
        Factory factory = Utils.getFactoryByName(getContext(), "BAD-BadFactory2");
        ComponentInstance ci;
        try {
            // Change in Felix-966, now throw a runtime exception
            ci = factory.createComponentInstance(null);
            //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
            ci.dispose();
            fail("Exception expected");
        } catch (Throwable e) {
           //fail("Exception unexpected : " + e.getMessage());
View Full Code Here

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

    }

    @Test
    public void testCreation() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
        Factory factory = ipojo.getFactory("optional-log-cons");
        ComponentInstance ci = factory.createComponentInstance(null);

        ci.dispose();
    }

}
View Full Code Here

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

    Factory fact1 = Utils.getFactoryByName(sc2, "COMPO-SimpleCheckServiceProvider");
    Properties props = new Properties();
    props.put("instance.name","client");
    ComponentInstance client = null;
    try {
      client = fact1.createComponentInstance(props);
    } catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
   
    Factory fact2 = Utils.getFactoryByName(sc2, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
View Full Code Here

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

    Factory fact2 = Utils.getFactoryByName(sc2, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
View Full Code Here

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

    Factory fact1 = Utils.getFactoryByName(sc2, "COMPO-SimpleCheckServiceProvider");
    Properties props = new Properties();
    props.put("instance.name","client");
    ComponentInstance client = null;
    try {
      client = fact1.createComponentInstance(props, sc2);
    } catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
   
    Factory fact2 = Utils.getFactoryByName(sc2, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
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.