Search in sources :

Example 1 with OSGiHelper

use of org.ow2.chameleon.testing.helpers.OSGiHelper 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 OSGiHelper

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

the class OnlineManipulatorTest method before.

@Before
public void before() {
    helper = new OSGiHelper(context);
    waitForStability(context);
    helper.waitForService(URLStreamHandlerService.class, null, 1000);
    Assert.assertEquals("Check online manipulator bundle state", helper.getBundle("org.apache.felix.ipojo.manipulator.online").getState(), Bundle.ACTIVE);
    URLStreamHandlerService svc = helper.getServiceObject(URLStreamHandlerService.class, null);
    Assert.assertNotNull("URL Stream handler exported", svc);
    System.out.println(svc);
}
Also used : URLStreamHandlerService(org.osgi.service.url.URLStreamHandlerService) OSGiHelper(org.ow2.chameleon.testing.helpers.OSGiHelper) Before(org.junit.Before)

Example 3 with OSGiHelper

use of org.ow2.chameleon.testing.helpers.OSGiHelper 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 4 with OSGiHelper

use of org.ow2.chameleon.testing.helpers.OSGiHelper 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 5 with OSGiHelper

use of org.ow2.chameleon.testing.helpers.OSGiHelper 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)5 OSGiHelper (org.ow2.chameleon.testing.helpers.OSGiHelper)5 IPOJOHelper (org.ow2.chameleon.testing.helpers.IPOJOHelper)4 Properties (java.util.Properties)1 Factory (org.apache.felix.ipojo.Factory)1 URLStreamHandlerService (org.osgi.service.url.URLStreamHandlerService)1