use of org.motechproject.testing.osgi.wait.Wait in project motech by motech.
the class BaseIT method waitForBundleState.
protected void waitForBundleState(final Bundle bundle, final int state) throws InterruptedException {
new Wait(new WaitCondition() {
@Override
public boolean needsToWait() {
return state == bundle.getState();
}
}, 2000).start();
assertEquals(state, bundle.getState());
}
use of org.motechproject.testing.osgi.wait.Wait 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);
}
Aggregations