Search in sources :

Example 1 with Ensure

use of test.Ensure in project felix by apache.

the class ConfigurationDependencyImplTest method testInvokeFancyUpdatedMethodOk.

@Test
public void testInvokeFancyUpdatedMethodOk() throws Exception {
    Ensure ensure = createEnsure();
    FancyService service = new FancyService(ensure);
    ConfigurationDependencyImpl cdi = createConfigurationDependency(service);
    cdi.setCallback(service, "updated", MyConfiguration.class);
    cdi.updated(createDictionary());
    ensure.waitForStep(1, 1000);
    cdi.updated(null);
    ensure.waitForStep(2, 1000);
}
Also used : Ensure(test.Ensure) Test(org.junit.Test)

Example 2 with Ensure

use of test.Ensure in project felix by apache.

the class ConfigurationDependencyImplTest method testInvokePlainUpdatedMethodOk.

@Test
public void testInvokePlainUpdatedMethodOk() throws Exception {
    Ensure ensure = createEnsure();
    PlainService service = new PlainService(ensure);
    ConfigurationDependencyImpl cdi = createConfigurationDependency(service);
    cdi.updated(createDictionary());
    ensure.waitForStep(1, 1000);
    cdi.updated(null);
    ensure.waitForStep(2, 1000);
}
Also used : Ensure(test.Ensure) Test(org.junit.Test)

Example 3 with Ensure

use of test.Ensure in project felix by apache.

the class ConfigurationDependencyImplTest method testDoNotInvokeFancyUpdatedMethodWithWrongSignatureOk.

@Test
public void testDoNotInvokeFancyUpdatedMethodWithWrongSignatureOk() throws Exception {
    Ensure ensure = createEnsure();
    FancyService service = new FancyService(ensure);
    ConfigurationDependencyImpl cdi = createConfigurationDependency(service);
    cdi.setCallback(service, "updated", Dictionary.class);
    ensure.step(1);
    cdi.updated(createDictionary());
    TimeUnit.SECONDS.sleep(1L);
    // Our step shouldn't be changed...
    ensure.waitForStep(1, 1000);
}
Also used : Ensure(test.Ensure) Test(org.junit.Test)

Example 4 with Ensure

use of test.Ensure in project felix by apache.

the class ConfigurationDependencyImplTest method testInvokeManagedServiceUpdatedMethodOk.

@Test
public void testInvokeManagedServiceUpdatedMethodOk() throws Exception {
    Ensure ensure = createEnsure();
    AManagedService service = new AManagedService(ensure);
    ConfigurationDependencyImpl cdi = createConfigurationDependency(service);
    cdi.updated(createDictionary());
    ensure.waitForStep(1, 1000);
    cdi.updated(null);
    ensure.waitForStep(2, 1000);
}
Also used : Ensure(test.Ensure) Test(org.junit.Test)

Example 5 with Ensure

use of test.Ensure in project felix by apache.

the class FactoryConfigurationAdapterImplTest method testInvokePlainUpdatedMethodOk.

@Test
public void testInvokePlainUpdatedMethodOk() throws Exception {
    Ensure ensure = createEnsure();
    PlainService service = new PlainService(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 : PlainService(org.apache.felix.dm.impl.ConfigurationDependencyImplTest.PlainService) 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