Package org.apache.felix.dm.test.components

Examples of org.apache.felix.dm.test.components.Ensure


     * Tests a Bundle Adapter, which adapts the dependency manager bundle to a "ServiceInterface" service.
     * @throws Throwable
     */
    @Test
    public void testBundleAdapterServiceAnnotation() throws Throwable {
        Ensure e = new Ensure();
        ServiceRegistration sr = register(e, BundleDependencyAnnotation.ENSURE_ADAPTER);
        e.waitForStep(3, 10000);
        e.ensure();
        sr.unregister();
    }
View Full Code Here


    /**
     * Tests if a Service can provide its service properties from its start method.
     */
    @Test
    public void testExtraServiceProperties() {
        Ensure e = new Ensure();
        ServiceRegistration sr = register(e, ExtraServiceProperties.ENSURE);
        e.waitForStep(2, 10000);
        sr.unregister();
    }
View Full Code Here

    /**
     * Tests if a Service instantiated by a Factory can provide its service properties from its start method.
     */
    @Test
    public void testExtraFactoryServiceProperties() {
        Ensure e = new Ensure();
        ServiceRegistration sr = register(e, ExtraFactoryServiceProperties.ENSURE);
        e.waitForStep(3, 10000);
        sr.unregister();
    }
View Full Code Here

    /**
     * Tests if an AdapterService can provide its service properties from its start method.
     */
    @Test
    public void testExtraAdapterServiceProperties() {
        Ensure e = new Ensure();
        ServiceRegistration sr = register(e, ExtraAdapterServiceProperties.ENSURE);
        e.waitForStep(3, 10000);
        sr.unregister();
    }
View Full Code Here

    /**
     * Tests if an AspectService can provide its service properties from its start method.
     */
    @Test
    public void testExtraAspectServiceProperties() {
        Ensure e = new Ensure();
        ServiceRegistration sr = register(e, ExtraAspectServiceProperties.ENSURE);
        e.waitForStep(3, 10000);
        sr.unregister();
    }
View Full Code Here

        super(true /* start test components bundle */);
    }

    @Test
    public void testComposite() {
        Ensure e = new Ensure();
        ServiceRegistration sr1 = register(e, C1.ENSURE);
        ServiceRegistration sr2 = register(e, Dependency1.ENSURE);
        ServiceRegistration sr3 = register(e, Dependency2.ENSURE);
        e.waitForStep(4, 10000);
        stopTestBundle();
        e.waitForStep(12, 10000);
        sr3.unregister();
        sr2.unregister();
        sr1.unregister();
    }
View Full Code Here

        super(true /* start test components bundle */);
    }

    @Test
    public void testFactoryConfigurationAdapterAnnotation() throws Throwable {
        Ensure e = new Ensure();
        ServiceRegistration sr = register(e, ServiceProvider.ENSURE);
        ConfigurationAdmin cm = (ConfigurationAdmin) context.getService(context
                .getServiceReference(ConfigurationAdmin.class.getName()));
        try {
            // Create a factory configuration in order to instantiate the ServiceProvider
            org.osgi.service.cm.Configuration cf = cm.createFactoryConfiguration("FactoryPidTest", null);
            cf.update(new Hashtable() {
                {
                    put("foo2", "bar2");
                }
            });
            // Wait for the ServiceProvider activation.
            e.waitForStep(2, 10000);
            // Update conf
            cf.update(new Hashtable() {
                {
                    put("foo2", "bar2_modified");
                }
            });
            // Wait for effective update
            e.waitForStep(4, 10000);
            // Remove configuration.
            cf.delete();
            // Check if ServiceProvider has been stopped.
            e.waitForStep(6, 1000);
            e.ensure();
            sr.unregister();
        } catch (IOException err) {
            err.printStackTrace();
            Assert.fail("can't create factory configuration");
        }
View Full Code Here

        super(true /* start test components bundle */);
    }

    @Test
    public void testAspectChain() throws Throwable {
        Ensure e = new Ensure();
        // Activate service consumer
        ServiceRegistration scSequencer = register(e, ServiceConsumer.ENSURE);
        // Activate service provider
        ServiceRegistration spSequencer = register(e, ServiceProvider.ENSURE);
        // Activate service aspect 2
        ServiceRegistration sa2Sequencer = register(e, ServiceAspect2.ENSURE);
        // Activate service aspect 3
        ServiceRegistration sa3Sequencer = register(e, ServiceAspect3.ENSURE);
        // Activate service aspect 1
        ServiceRegistration sa1Sequencer = register(e, ServiceAspect1.ENSURE);

        e.step();
        e.waitForStep(6, 10000);

        // Deactivate service provider
        spSequencer.unregister();
        // Make sure that service aspect 1 has been called in ts removed and stop callbacks
        e.waitForStep(8, 10000);
        e.ensure();

        scSequencer.unregister();
        sa1Sequencer.unregister();
        sa2Sequencer.unregister();
        sa3Sequencer.unregister();
View Full Code Here

        super(true /* start test components bundle */);
    }

    @Test
    public void testAnnotatedAspect() {
        Ensure e = new Ensure();
        // Provide the Sequencer server to the ServiceProvider service
        ServiceRegistration sr1 = register(e, ServiceProvider.ENSURE);
        // Check if the ServiceProvider has been injected in the AspectTest service.
        e.waitForStep(1, 10000);
        // Provide the Sequencer server to the ServiceProviderAspect service
        ServiceRegistration sr2 = register(e, ServiceProviderAspect.ENSURE);
        // Check if the AspectTest has been injected with the aspect
        e.waitForStep(3, 10000);
        // Remove the ServiceProviderAspect service
        sr2.unregister();
        // And check if the aspect has been called in its stop/destroy methods.
        e.waitForStep(7, 10000);
        sr1.unregister();
    }
View Full Code Here

        super(true /* start test components bundle */);
    }

    @Test
    public void testServiceDependencyPropagate() {
        Ensure e = new Ensure();
        ServiceRegistration sr = register(e, PropagateAnnotation.ENSURE);
        e.waitForStep(3, 10000);
        sr.unregister();
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.dm.test.components.Ensure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.