Search in sources :

Example 1 with Ensure

use of org.apache.felix.dm.itest.util.Ensure in project felix by apache.

the class MethodSignaturesTest method testFactoryPidUpdatedSignature1.

/**
 * Validates FactoryConfigurationAdapter updated callback signatures.
 */
public void testFactoryPidUpdatedSignature1() {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, MethodSignatures.ENSURE_FACTORYPID);
    e.waitForStep(3, 5000);
    sr.unregister();
    // make sure configurations are deleted
    e.waitForStep(6, 5000);
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 2 with Ensure

use of org.apache.felix.dm.itest.util.Ensure in project felix by apache.

the class MultipleAnnotationsTest method testMultipleAnnotations.

public void testMultipleAnnotations() {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, MultipleAnnotations.ENSURE);
    e.waitForStep(7, 10000);
    sr.unregister();
    e.waitForStep(11, 10000);
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 3 with Ensure

use of org.apache.felix.dm.itest.util.Ensure in project felix by apache.

the class OptionalConfigurationTest method testOptionalConfig.

public void testOptionalConfig() throws Throwable {
    Ensure e = new Ensure();
    ServiceRegistration ensureConsumer = register(e, OptionalConfiguration.ENSURE_CONF_CONSUMER);
    // consumer called in updated with testKey="default" config, and then called in start
    e.waitForStep(1, 5000);
    // will register a "testKey=testvalue" configuration, using config admin.
    ServiceRegistration ensureConfCreator = register(e, OptionalConfiguration.ENSURE_CONF_CREATOR);
    // consumer called in updated with testKey="testvalue"
    e.waitForStep(2, 5000);
    // remove configuration.
    ensureConfCreator.unregister();
    // consumer called in updated with default "testkey=default" property (using the default method from the config interface.
    e.waitForStep(3, 5000);
    // stop the OptionalConfigurationConsumer component
    ensureConsumer.unregister();
    // consumer stopped
    e.waitForStep(4, 5000);
    e.ensure();
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 4 with Ensure

use of org.apache.felix.dm.itest.util.Ensure in project felix by apache.

the class PropagateAnnotationTest method testServiceDependencyPropagate.

public void testServiceDependencyPropagate() {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, PropagateAnnotation.ENSURE);
    e.waitForStep(3, 10000);
    sr.unregister();
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 5 with Ensure

use of org.apache.felix.dm.itest.util.Ensure in project felix by apache.

the class ProviderSwappedByAspectTest method testAnnotatedAspect.

public void testAnnotatedAspect() {
    Ensure e = new Ensure();
    ServiceRegistration consumer = register(e, ProviderSwappedByAspect.Consumer.ENSURE);
    ServiceRegistration provider = register(e, ProviderSwappedByAspect.Provider.ENSURE);
    // client bound to provider (1), and client calls provider (2)
    e.waitForStep(2, 5000);
    ServiceRegistration aspect = register(e, ProviderSwappedByAspect.ProviderAspect.ENSURE);
    // provider swapped with aspect (3), aspect called (4), original provider called (5)
    e.waitForStep(5, 5000);
    aspect.unregister();
    // aspect swapped by provider (6), provider called (7)
    e.waitForStep(7, 5000);
    provider.unregister();
    // provider unbound (8), provider called (9)
    e.waitForStep(9, 5000);
    consumer.unregister();
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Aggregations

Ensure (org.apache.felix.dm.itest.util.Ensure)135 Component (org.apache.felix.dm.Component)90 DependencyManager (org.apache.felix.dm.DependencyManager)90 ServiceRegistration (org.osgi.framework.ServiceRegistration)42 Hashtable (java.util.Hashtable)32 Dictionary (java.util.Dictionary)8 URL (java.net.URL)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 ResourceHandler (org.apache.felix.dm.ResourceHandler)5 IOException (java.io.IOException)4 Dependency (org.apache.felix.dm.Dependency)4 ServiceDependency (org.apache.felix.dm.ServiceDependency)4 ConfigurationAdmin (org.osgi.service.cm.ConfigurationAdmin)4 ArrayList (java.util.ArrayList)2 ForkJoinPool (java.util.concurrent.ForkJoinPool)2 TimeUnit (java.util.concurrent.TimeUnit)2 ComponentStateListener (org.apache.felix.dm.ComponentStateListener)2 TestBase (org.apache.felix.dm.itest.util.TestBase)2 Bundle (org.osgi.framework.Bundle)2