Search in sources :

Example 1 with BundleContextWrapper

use of org.motechproject.osgi.web.BundleContextWrapper in project motech by motech.

the class BundleContextWrapperBundleIT method testThatBundleContextWrapperReturnsCorrectApplicationContext.

@Test
public void testThatBundleContextWrapperReturnsCorrectApplicationContext() throws InterruptedException {
    BundleContextWrapper bundleContextWrapper = new BundleContextWrapper(bundleContext);
    Bundle bundle = bundleContext.getBundle();
    assertEquals(bundle.getSymbolicName(), bundleContextWrapper.getCurrentBundleSymbolicName());
    new Wait(new ContextPublishedWaitCondition(bundleContext), 5000).start();
    ApplicationContext applicationContextForCurrentBundle = bundleContextWrapper.getBundleApplicationContext();
    assertNotNull(applicationContextForCurrentBundle);
    Object testBundleContextWrapper = applicationContextForCurrentBundle.getBean("testBundleContextWrapper");
    assertNotNull(testBundleContextWrapper);
}
Also used : BundleContextWrapper(org.motechproject.osgi.web.BundleContextWrapper) ContextPublishedWaitCondition(org.motechproject.testing.osgi.wait.ContextPublishedWaitCondition) ApplicationContext(org.springframework.context.ApplicationContext) Bundle(org.osgi.framework.Bundle) Wait(org.motechproject.testing.osgi.wait.Wait) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 BundleContextWrapper (org.motechproject.osgi.web.BundleContextWrapper)1 ContextPublishedWaitCondition (org.motechproject.testing.osgi.wait.ContextPublishedWaitCondition)1 Wait (org.motechproject.testing.osgi.wait.Wait)1 Bundle (org.osgi.framework.Bundle)1 ApplicationContext (org.springframework.context.ApplicationContext)1