Search in sources :

Example 6 with Ensure

use of test.Ensure 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 7 with Ensure

use of test.Ensure 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)

Example 8 with Ensure

use of test.Ensure in project felix by apache.

the class FactoryConfigurationAdapterImplTest method testInvokeManagedServiceUpdatedMethodOk.

@Test
public void testInvokeManagedServiceUpdatedMethodOk() throws Exception {
    Ensure ensure = createEnsure();
    AManagedService service = new AManagedService(ensure);
    FactoryConfigurationAdapterImpl cdi = createConfigurationDependency(service);
    ((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 : AManagedService(org.apache.felix.dm.impl.ConfigurationDependencyImplTest.AManagedService) Ensure(test.Ensure) ManagedServiceFactory(org.osgi.service.cm.ManagedServiceFactory) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 Ensure (test.Ensure)8 ManagedServiceFactory (org.osgi.service.cm.ManagedServiceFactory)4 FancyService (org.apache.felix.dm.impl.ConfigurationDependencyImplTest.FancyService)2 AManagedService (org.apache.felix.dm.impl.ConfigurationDependencyImplTest.AManagedService)1 PlainService (org.apache.felix.dm.impl.ConfigurationDependencyImplTest.PlainService)1