Package org.apache.felix.ipojo

Examples of org.apache.felix.ipojo.Factory


          // OK.  
        }
    }
   
    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


               // OK
            }
    }
   
    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

            //OK
        }
    }
   
    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

        return opt;
    }

    @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

  }
 
  public void testLevelOne1() {
    ServiceContext sc2 = Utils.getServiceContext(empty);
   
    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");
    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

  }
 
  public void testLevelOne2() {
    ServiceContext sc2 = Utils.getServiceContext(empty);
   
    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");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2, sc2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
View Full Code Here

  }
 
  public void testLevelOne3() {
    ServiceContext sc2 = Utils.getServiceContext(empty);
   
    Factory fact1 = Utils.getFactoryByName(getContext(), "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(getContext(), "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2, sc2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
View Full Code Here

    }
  }
 
  public void testLevelTwo1() {
    ServiceContext sc1 = Utils.getServiceContext(empty);   
    Factory fact = Utils.getFactoryByName(sc1, "composite.empty");
    Properties p = new Properties();
    p.put("instance.name","empty2");
    ComponentInstance empty2 = null;
    try {
      empty2 = fact.createComponentInstance(p);
    } catch(Exception e) {
      fail("Cannot instantiate empty2 instance : " + e.getMessage());
    }
   
    ServiceContext sc2 = Utils.getServiceContext(empty2);
   
    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");
    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

    empty2.dispose();
  }
 
  public void testLevelTwo2() {
    ServiceContext sc1 = Utils.getServiceContext(empty);   
    Factory fact = Utils.getFactoryByName(sc1, "composite.empty");
    Properties p = new Properties();
    p.put("instance.name","empty2");
    ComponentInstance empty2 = null;
    try {
      empty2 = fact.createComponentInstance(p);
    } catch(Exception e) {
      fail("Cannot instantiate empty2 instance : " + e.getMessage());
    }
   
    ServiceContext sc2 = Utils.getServiceContext(empty2);
   
    Factory fact1 = Utils.getFactoryByName(sc1, "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(sc1, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2, sc2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
View Full Code Here

    empty2.dispose();
  }
 
  public void testLevelTwo3() {
    ServiceContext sc1 = Utils.getServiceContext(empty);   
    Factory fact = Utils.getFactoryByName(sc1, "composite.empty");
    Properties p = new Properties();
    p.put("instance.name","empty2");
    ComponentInstance empty2 = null;
    try {
      empty2 = fact.createComponentInstance(p);
    } catch(Exception e) {
      fail("Cannot instantiate empty2 instance : " + e.getMessage());
    }
   
    ServiceContext sc2 = Utils.getServiceContext(empty2);
   
    Factory fact1 = Utils.getFactoryByName(getContext(), "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(getContext(), "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2, sc2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.Factory

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.