Search in sources :

Example 1 with BeanCItf

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

the class SpringTest method testSpringBundle.

@Test
public void testSpringBundle() throws Exception {
    Bundle bundles = context().getBundleByName("org.apache.aries.blueprint.testbundles");
    assertNotNull(bundles);
    bundles.start();
    BlueprintContainer container = startBundleBlueprint("org.apache.aries.blueprint.testbundles");
    List list = (List) container.getComponentInstance("springList");
    System.out.println(list);
    BeanCItf beanC = (BeanCItf) list.get(4);
    assertEquals(1, beanC.getInitialized());
    try {
        beanC.doSomething();
        fail("Should have thrown an exception because the transaction manager is not defined");
    } catch (NoSuchBeanDefinitionException e) {
    // expected
    }
}
Also used : BlueprintContainer(org.osgi.service.blueprint.container.BlueprintContainer) Helper.mvnBundle(org.apache.aries.blueprint.itests.Helper.mvnBundle) CoreOptions.mavenBundle(org.ops4j.pax.exam.CoreOptions.mavenBundle) Bundle(org.osgi.framework.Bundle) List(java.util.List) NoSuchBeanDefinitionException(org.springframework.beans.factory.NoSuchBeanDefinitionException) BeanCItf(org.apache.aries.blueprint.testbundles.BeanCItf) Test(org.junit.Test)

Aggregations

List (java.util.List)1 Helper.mvnBundle (org.apache.aries.blueprint.itests.Helper.mvnBundle)1 BeanCItf (org.apache.aries.blueprint.testbundles.BeanCItf)1 Test (org.junit.Test)1 CoreOptions.mavenBundle (org.ops4j.pax.exam.CoreOptions.mavenBundle)1 Bundle (org.osgi.framework.Bundle)1 BlueprintContainer (org.osgi.service.blueprint.container.BlueprintContainer)1 NoSuchBeanDefinitionException (org.springframework.beans.factory.NoSuchBeanDefinitionException)1