Search in sources :

Example 1 with ServiceInterface3

use of org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface3 in project sling by apache.

the class MockBundleContextDynamicReferencesTest method testAddRemoveOptionalMultipleService.

@Test
public void testAddRemoveOptionalMultipleService() {
    ServiceRegistration reg3a = bundleContext.registerService(ServiceInterface3.class.getName(), dependency3a, null);
    assertDependencies3(dependency3a);
    ServiceRegistration reg3b = bundleContext.registerService(ServiceInterface3.class.getName(), dependency3b, null);
    assertDependencies3(dependency3a, dependency3b);
    reg3a.unregister();
    assertDependencies3(dependency3b);
    reg3b.unregister();
    assertDependencies3();
}
Also used : ServiceInterface3(org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface3) ServiceRegistration(org.osgi.framework.ServiceRegistration) Test(org.junit.Test)

Example 2 with ServiceInterface3

use of org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface3 in project sling by apache.

the class MockBundleContextStaticGreedyReferencesTest method testAddRemoveOptionalMultipleService.

@Test
public void testAddRemoveOptionalMultipleService() {
    ServiceRegistration reg3a = bundleContext.registerService(ServiceInterface3.class.getName(), dependency3a, null);
    assertDependencies3(dependency3a);
    ServiceRegistration reg3b = bundleContext.registerService(ServiceInterface3.class.getName(), dependency3b, null);
    assertDependencies3(dependency3a, dependency3b);
    reg3a.unregister();
    assertDependencies3(dependency3b);
    reg3b.unregister();
    assertDependencies3();
}
Also used : ServiceInterface3(org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface3) ServiceRegistration(org.osgi.framework.ServiceRegistration) Test(org.junit.Test)

Example 3 with ServiceInterface3

use of org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface3 in project sling by apache.

the class MockBundleContextDynamicReferencesOsgiR6Test method testAddRemoveOptionalMultipleService.

@Test
public void testAddRemoveOptionalMultipleService() {
    ServiceRegistration reg3a = bundleContext.registerService(ServiceInterface3.class.getName(), dependency3a, null);
    assertDependencies3(dependency3a);
    ServiceRegistration reg3b = bundleContext.registerService(ServiceInterface3.class.getName(), dependency3b, null);
    assertDependencies3(dependency3a, dependency3b);
    reg3a.unregister();
    assertDependencies3(dependency3b);
    reg3b.unregister();
    assertDependencies3();
}
Also used : ServiceInterface3(org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface3) ServiceRegistration(org.osgi.framework.ServiceRegistration) Test(org.junit.Test)

Aggregations

ServiceInterface3 (org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface3)3 Test (org.junit.Test)3 ServiceRegistration (org.osgi.framework.ServiceRegistration)3