Examples of IPOJOHelper


Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

  private ComponentInstance instancec1;
  private ComponentInstance instancec2;
  private ComponentInstance instancec3;

  public void setUp() {
    ipojo = new IPOJOHelper(this);
    // Create the instances
    instancec1 = ipojo.createComponentInstance(C1);
    instancec2 = ipojo.createComponentInstance(C2);
    instancec3 = ipojo.createComponentInstance(C3);
  }
View Full Code Here

Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

public class StaticPropsReconfiguration extends OSGiTestCase {

  IPOJOHelper helper;
   
    public void setUp() {
        helper = new IPOJOHelper(this);
       
    String type = "PS-FooProviderType-2";
    helper.createComponentInstance(type, "FooProvider-1");
   
    Properties p2 = new Properties();
View Full Code Here

Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

    private Factory pi1, pi11, pi12, pi2, pi21, pi3;
   
    private IPOJOHelper helper;
   
    public void setUp() {
        helper = new IPOJOHelper(this);
        pi1 = helper.getFactory("PS-PI1");
        pi11 = helper.getFactory("PS-PI1-1");
        pi12 = helper.getFactory("PS-PI1-2");
       
        pi2 = helper.getFactory("PS-PI2");
View Full Code Here

Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

import org.osgi.framework.ServiceReference;

public class OSGiPropertiesTest extends OSGiTestCase {
   
    public void testOSGiProperties() {
        IPOJOHelper helper = new IPOJOHelper(this);
       
        String factName = "PS-FooProviderType-1";
        String compName = "FooProvider-1";
        ServiceReference ref = null;
       
        // Check that no Foo Service are available
        ref = getServiceReference(FooService.class.getName());
       
        assertNull("FS already available", ref);
   
        // Get the factory to create a component instance
        Factory fact = helper.getFactory(factName);
        assertNotNull("Cannot find the factory FooProvider-1", fact);
       
        Dictionary conf = new Properties();
        conf.put(Constants.SERVICE_DESCRIPTION, "description");
        conf.put(Constants.SERVICE_RANKING, "10");
        conf.put(Constants.SERVICE_VENDOR, "ASF");
        conf.put(Constants.SERVICE_PID, "my.pid");
       
        helper.createComponentInstance(factName, compName, conf);
       
        // Get a FooService provider
        ref = getServiceReference(FooService.class.getName(), "(" + "instance.name" + "=" + compName + ")");

        assertNotNull("FS not available", ref);
       
        // Check properties
        assertEquals("description", ref.getProperty(Constants.SERVICE_DESCRIPTION));
        assertEquals(new Integer(10), ref.getProperty(Constants.SERVICE_RANKING));
        assertEquals("ASF", ref.getProperty(Constants.SERVICE_VENDOR));
        assertEquals("my.pid", ref.getProperty(Constants.SERVICE_PID));
       
       
        // Test foo invocation
        FooService fs = (FooService) getServiceObject(ref);
        assertTrue("FooService invocation failed", fs.foo());
       
        helper.dispose();

       
        // Check that there is no more FooService
        ref = getServiceReference(FooService.class.getName(), null);
       
View Full Code Here

Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

  ComponentInstance fooProvider3, fooProvider4;
 
  IPOJOHelper helper;

    public void setUp() {
        helper = new IPOJOHelper(this);   
    String type2 = "PS-FooProviderType-Dyn2";
    Properties p3 = new Properties();
    p3.put("instance.name","FooProvider-3");
    p3.put("int", new Integer(0));
    p3.put("boolean", new Boolean(true));
View Full Code Here

Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

    /**
     * Initialize test.
     */
    public void setUp() {
        m_helper = new IPOJOHelper(this);
        m_server = ManagementFactory.getPlatformMBeanServer();
    }
View Full Code Here

Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

public class Dependency extends OSGiTestCase {
   
    private IPOJOHelper helper;
   
    public void setUp() {
        helper = new IPOJOHelper(this);
    }
View Full Code Here

Examples of org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper

import org.osgi.framework.ServiceReference;

public class SimplePS extends OSGiTestCase {

  public void testPS() {
      IPOJOHelper helper = new IPOJOHelper(this);

    String factName = "PS-FooProviderType-1";
    String compName = "FooProvider-1";
    ServiceReference ref = null;

    // Check that no Foo Service are available
    ref = getServiceReference(FooService.class.getName());

    assertNull("FS already available", ref);

    // Get the factory to create a component instance
    Factory fact = helper.getFactory(factName);
    assertNotNull("Cannot find the factory FooProvider-1", fact);

    helper.createComponentInstance(factName, compName);

    // Get a FooService provider
    ref = getServiceReference(FooService.class.getName(), "(" + "instance.name" + "=" + compName + ")");

    assertNotNull("FS not available", ref);

    // Test foo invocation
    FooService fs = (FooService) getServiceObject(ref);
    assertTrue("FooService invocation failed", fs.foo());

    helper.dispose();


    // Check that there is no more FooService
    ref = getServiceReference(FooService.class.getName(), null);
View Full Code Here

Examples of org.ow2.chameleon.testing.helpers.IPOJOHelper

    }

    @Before
    public void commonSetUp() {
        osgiHelper = new OSGiHelper(bc);
        ipojoHelper = new IPOJOHelper(bc);

        testedBundle = osgiHelper.getBundle("test.bundle");

        // Dump OSGi Framework information
        String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
View Full Code Here

Examples of org.ow2.chameleon.testing.helpers.IPOJOHelper

  private Version version;

  public OBRMANHelper(BundleContext pContext) {
    context = pContext;
    osgi = new OSGiHelper(context);
    ipojo = new IPOJOHelper(context);
    version = getBundleVersion();
  }
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.