Search in sources :

Example 1 with BeanCItf

use of org.apache.aries.blueprint.testbundlee.BeanCItf in project aries by apache.

the class SpringExtenderTest method testSpringBundle.

@Test
public void testSpringBundle() throws Exception {
    try {
        context().getService(BeanCItf.class, 1);
        fail("The service should not be registered");
    } catch (RuntimeException e) {
    // Expected
    }
    Bundle bundles = context().getBundleByName("org.apache.aries.blueprint.testbundlee");
    assertNotNull(bundles);
    bundles.start();
    BlueprintContainer container = startBundleBlueprint("org.apache.aries.blueprint.testbundlee");
    assertNotNull(container);
    BeanCItf beanC1 = context().getService(BeanCItf.class, "(name=BeanC-1)");
    assertEquals(1, beanC1.getInitialized());
    BeanCItf beanC2 = context().getService(BeanCItf.class, "(name=BeanC-2)");
    assertEquals(1, beanC2.getInitialized());
}
Also used : BlueprintContainer(org.osgi.service.blueprint.container.BlueprintContainer) Bundle(org.osgi.framework.Bundle) Helper.mvnBundle(org.apache.aries.blueprint.itests.Helper.mvnBundle) BeanCItf(org.apache.aries.blueprint.testbundlee.BeanCItf) Test(org.junit.Test)

Aggregations

Helper.mvnBundle (org.apache.aries.blueprint.itests.Helper.mvnBundle)1 BeanCItf (org.apache.aries.blueprint.testbundlee.BeanCItf)1 Test (org.junit.Test)1 Bundle (org.osgi.framework.Bundle)1 BlueprintContainer (org.osgi.service.blueprint.container.BlueprintContainer)1