Search in sources :

Example 6 with Ensure

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

the class PublisherAnnotationTest method testAdapterServiceWithPublisher.

/**
 * Test an AdapterService which provides its interface using a @ServiceLifecycle.
 */
public void testAdapterServiceWithPublisher() {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, AdapterServiceTestWithPublisher.ENSURE);
    e.waitForStep(6, 10000);
    sr.unregister();
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 7 with Ensure

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

the class PublisherAnnotationTest method testFactoryAdapterServiceWithPublisher.

/**
 * Test a FactoryConfigurationAdapterService which provides its interface using a @ServiceLifecycle.
 */
public void testFactoryAdapterServiceWithPublisher() {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, FactoryConfigurationAdapterServiceTestWithPublisher.ENSURE);
    e.waitForStep(5, 10000);
    sr.unregister();
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 8 with Ensure

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

the class ResourceAnnotationTest method testResourceAdapterAnnotation.

/**
 * Tests a ResourceAdapter
 * @param context
 */
public void testResourceAdapterAnnotation() throws Throwable {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, ResourceAnnotation.ENSURE_ADAPTER);
    ServiceRegistration sr2 = register(e, ResourceAnnotation.ENSURE_PROVIDER);
    sr.unregister();
    sr2.unregister();
    e.waitForStep(2, 10000);
    e.ensure();
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 9 with Ensure

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

the class ResourceAnnotationTest method testResourceAnnotation.

/**
 * Tests a simple ResourceConsumer
 * @param context
 */
public void testResourceAnnotation() {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, ResourceAnnotation.ENSURE_RESOURCE);
    ServiceRegistration sr2 = register(e, ResourceAnnotation.ENSURE_PROVIDER);
    sr.unregister();
    sr2.unregister();
    e.waitForStep(1, 10000);
}
Also used : Ensure(org.apache.felix.dm.itest.util.Ensure) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 10 with Ensure

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

the class ResourceAnnotationTest method testResourceAnnotationAutoConfig.

/**
 * Tests a simple ResourceConsumer using a class field for resource injection
 */
public void testResourceAnnotationAutoConfig() {
    Ensure e = new Ensure();
    ServiceRegistration sr = register(e, ResourceAnnotation.ENSURE_FIELD);
    ServiceRegistration sr2 = register(e, ResourceAnnotation.ENSURE_PROVIDER);
    sr.unregister();
    sr2.unregister();
    e.waitForStep(1, 10000);
}
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