Search in sources :

Example 1 with IPOJOHelper

use of org.ow2.chameleon.testing.helpers.IPOJOHelper in project felix by apache.

the class Common method commonSetUp.

@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);
    if (vendor == null) {
        vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
    }
    String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
    System.out.println("OSGi Framework : " + vendor + " - " + version);
}
Also used : IPOJOHelper(org.ow2.chameleon.testing.helpers.IPOJOHelper) OSGiHelper(org.ow2.chameleon.testing.helpers.OSGiHelper) Before(org.junit.Before)

Example 2 with IPOJOHelper

use of org.ow2.chameleon.testing.helpers.IPOJOHelper in project felix by apache.

the class Common method commonSetUp.

@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);
    if (vendor == null) {
        vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
    }
    String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
    System.out.println("OSGi Framework : " + vendor + " - " + version);
}
Also used : IPOJOHelper(org.ow2.chameleon.testing.helpers.IPOJOHelper) OSGiHelper(org.ow2.chameleon.testing.helpers.OSGiHelper) Before(org.junit.Before)

Example 3 with IPOJOHelper

use of org.ow2.chameleon.testing.helpers.IPOJOHelper in project felix by apache.

the class Common method commonSetUp.

@Before
public void commonSetUp() {
    osgiHelper = new OSGiHelper(context);
    ipojoHelper = new IPOJOHelper(context);
    // Dump OSGi Framework information
    String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
    if (vendor == null) {
        vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
    }
    String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
    System.out.println("OSGi Framework : " + vendor + " - " + version);
}
Also used : IPOJOHelper(org.ow2.chameleon.testing.helpers.IPOJOHelper) OSGiHelper(org.ow2.chameleon.testing.helpers.OSGiHelper) Before(org.junit.Before)

Example 4 with IPOJOHelper

use of org.ow2.chameleon.testing.helpers.IPOJOHelper in project felix by apache.

the class TestFieldProperties method setUp.

@Before
public void setUp() {
    osgiHelper = new OSGiHelper(bc);
    ipojoHelper = new IPOJOHelper(bc);
    Factory fact = ipojoHelper.getFactory("CONFIG-FieldConfigurableCheckService");
    Properties props = new Properties();
    props.put("instance.name", "under-test");
    props.put("b", "1");
    props.put("s", "1");
    props.put("i", "1");
    props.put("l", "1");
    props.put("d", "1");
    props.put("f", "1");
    props.put("c", "a");
    props.put("bool", "true");
    props.put("bs", "{1,2,3}");
    props.put("ss", "{1,2,3}");
    props.put("is", "{1,2,3}");
    props.put("ls", "{1,2,3}");
    props.put("ds", "{1,2,3}");
    props.put("fs", "{1,2,3}");
    props.put("cs", "{a,b,c}");
    props.put("bools", "{true,true,true}");
    props.put("string", "foo");
    props.put("strings", "{foo, bar, baz}");
    try {
        instance = fact.createComponentInstance(props);
    } catch (Exception e) {
        fail("Cannot create the under-test instance : " + e.getMessage());
    }
    try {
        instance2 = fact.createComponentInstance(null);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Cannot create the instance : " + e.getMessage());
    }
}
Also used : IPOJOHelper(org.ow2.chameleon.testing.helpers.IPOJOHelper) Factory(org.apache.felix.ipojo.Factory) Properties(java.util.Properties) OSGiHelper(org.ow2.chameleon.testing.helpers.OSGiHelper) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)4 IPOJOHelper (org.ow2.chameleon.testing.helpers.IPOJOHelper)4 OSGiHelper (org.ow2.chameleon.testing.helpers.OSGiHelper)4 Properties (java.util.Properties)1 Factory (org.apache.felix.ipojo.Factory)1