Search in sources :

Example 1 with FancyService

use of org.apache.felix.dm.impl.ConfigurationDependencyImplTest.FancyService in project felix by apache.

the class FactoryConfigurationAdapterImplTest method testInvokeFancyUpdatedMethodOk.

@Test
public void testInvokeFancyUpdatedMethodOk() throws Exception {
    Ensure ensure = createEnsure();
    FancyService service = new FancyService(ensure);
    FactoryConfigurationAdapterImpl cdi = createConfigurationDependency(service, MyConfiguration.class);
    ((ManagedServiceFactory) cdi.m_component.getInstance()).updated(CONF_PID, (Dictionary<String, ?>) createDictionary());
    ensure.waitForStep(1, 1000);
    ((ManagedServiceFactory) cdi.m_component.getInstance()).deleted(CONF_PID);
    ensure.waitForStep(2, 1000);
}
Also used : FancyService(org.apache.felix.dm.impl.ConfigurationDependencyImplTest.FancyService) Ensure(test.Ensure) ManagedServiceFactory(org.osgi.service.cm.ManagedServiceFactory) Test(org.junit.Test)

Example 2 with FancyService

use of org.apache.felix.dm.impl.ConfigurationDependencyImplTest.FancyService in project felix by apache.

the class FactoryConfigurationAdapterImplTest method testDoNotInvokeFancyUpdatedMethodWithWrongSignatureOk.

@Test
public void testDoNotInvokeFancyUpdatedMethodWithWrongSignatureOk() throws Exception {
    Ensure ensure = createEnsure();
    FancyService service = new FancyService(ensure);
    FactoryConfigurationAdapterImpl cdi = createConfigurationDependency(service, Map.class);
    ensure.step(1);
    ((ManagedServiceFactory) cdi.m_component.getInstance()).updated(CONF_PID, (Dictionary<String, ?>) createDictionary());
    TimeUnit.SECONDS.sleep(1L);
    // Our step shouldn't be changed...
    ensure.waitForStep(1, 1000);
}
Also used : FancyService(org.apache.felix.dm.impl.ConfigurationDependencyImplTest.FancyService) Ensure(test.Ensure) ManagedServiceFactory(org.osgi.service.cm.ManagedServiceFactory) Test(org.junit.Test)

Aggregations

FancyService (org.apache.felix.dm.impl.ConfigurationDependencyImplTest.FancyService)2 Test (org.junit.Test)2 ManagedServiceFactory (org.osgi.service.cm.ManagedServiceFactory)2 Ensure (test.Ensure)2