Search in sources :

Example 1 with MockBundleContext

use of org.eclipse.gemini.blueprint.mock.MockBundleContext in project motech by motech.

the class MotechOsgiApplicationContextCreatorTest method shouldReturnApplicationOfTypeWebApplicationContext.

@Test
public void shouldReturnApplicationOfTypeWebApplicationContext() throws Exception {
    MockBundle bundle = new MockBundle();
    MockBundleContext bundleContext = new MockBundleContext(bundle);
    ConfigurationScanner configurationScanner = mock(ConfigurationScanner.class);
    when(configurationScanner.getConfigurations(bundle)).thenReturn(new String[] { "resource.xml" });
    MotechOsgiApplicationContextCreator contextCreator = new MotechOsgiApplicationContextCreator();
    contextCreator.setConfigurationScanner(configurationScanner);
    MotechOsgiConfigurableApplicationContext applicationContext = (MotechOsgiConfigurableApplicationContext) contextCreator.createApplicationContext(bundleContext);
    assertThat(applicationContext, notNullValue());
}
Also used : MockBundleContext(org.eclipse.gemini.blueprint.mock.MockBundleContext) MockBundle(org.eclipse.gemini.blueprint.mock.MockBundle) ConfigurationScanner(org.eclipse.gemini.blueprint.extender.support.scanning.ConfigurationScanner) Test(org.junit.Test)

Aggregations

ConfigurationScanner (org.eclipse.gemini.blueprint.extender.support.scanning.ConfigurationScanner)1 MockBundle (org.eclipse.gemini.blueprint.mock.MockBundle)1 MockBundleContext (org.eclipse.gemini.blueprint.mock.MockBundleContext)1 Test (org.junit.Test)1