Package org.apache.felix.scr.integration.components

Examples of org.apache.felix.scr.integration.components.SimpleComponent2


        final SimpleService2Impl srv2 = SimpleService2Impl.create( bundleContext, "srv2" );

        String name ="test_multi_service_bind_unbind_order";
        ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(name, ComponentConfigurationDTO.ACTIVE);

        final SimpleComponent2 comp10 = SimpleComponent2.INSTANCE;
        TestCase.assertNotNull( comp10 );
        TestCase.assertEquals( 2, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );

        disableAndCheck(cc);
        delay();

        TestCase.assertEquals( 4, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );
        TestCase.assertEquals( "unbindSimpleService2", comp10.getBindings().get( 2 ) );
        TestCase.assertEquals( "unbindSimpleService", comp10.getBindings().get( 3 ) );

        srv1.drop();
        srv2.drop();
    }
View Full Code Here


    }

    protected void doTest(String componentName) throws Exception
    {
        ServiceRegistration dep1Reg = register(new SimpleComponent(), 0);
        ServiceRegistration dep2Reg = register(new SimpleComponent2(), 1000);
       
        final ComponentDescriptionDTO main = findComponentDescriptorByName(componentName);
        TestCase.assertNotNull(main);

        asyncEnable(main); //needs to be async
        delay(300); //dep2 getService has not yet returned
        dep1Reg.unregister();
        delay(2000); //dep2 getService has returned

        Felix4350Component.check(0, 0, false);

        dep1Reg = register(new SimpleComponent(), 0);
        delay(300);

        Felix4350Component.check(1, 0, true);

        disableAndCheck(main)//does not need to be asyncv??
        dep1Reg.unregister();
        dep2Reg.unregister();

        Felix4350Component.check(1, 1, false);
        dep1Reg = register(new SimpleComponent(), 0);
        dep2Reg = register(new SimpleComponent2(), 1000);
        Felix4350Component.check(1, 1, false);
       
        asyncEnable(main); //needs to be async
        delay(300);
        dep1Reg.unregister();
View Full Code Here

        final SimpleService2Impl srv2 = SimpleService2Impl.create( bundleContext, "srv2" );

        String name ="test_multi_service_bind_unbind_order";
        ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(name, ComponentConfigurationDTO.ACTIVE);

        final SimpleComponent2 comp10 = SimpleComponent2.INSTANCE;
        TestCase.assertNotNull( comp10 );
        TestCase.assertEquals( 2, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );

        disableAndCheck(cc);
        delay();

        TestCase.assertEquals( 4, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );
        TestCase.assertEquals( "unbindSimpleService2", comp10.getBindings().get( 2 ) );
        TestCase.assertEquals( "unbindSimpleService", comp10.getBindings().get( 3 ) );

        srv1.drop();
        srv2.drop();
    }
View Full Code Here

        // async enabling
        component.enable();
        delay();

        TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
        final SimpleComponent2 comp10 = SimpleComponent2.INSTANCE;
        TestCase.assertNotNull( comp10 );
        TestCase.assertEquals( 2, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );

        component.disable();
        delay();

        TestCase.assertEquals( 4, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );
        TestCase.assertEquals( "unbindSimpleService2", comp10.getBindings().get( 2 ) );
        TestCase.assertEquals( "unbindSimpleService", comp10.getBindings().get( 3 ) );

        srv1.drop();
        srv2.drop();
    }
View Full Code Here

        // async enabling
        component.enable();
        delay();

        TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
        final SimpleComponent2 comp10 = SimpleComponent2.INSTANCE;
        TestCase.assertNotNull( comp10 );
        TestCase.assertEquals( 2, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );

        component.disable();
        delay();

        TestCase.assertEquals( 4, comp10.getBindings().size() );
        TestCase.assertEquals( "bindSimpleService", comp10.getBindings().get( 0 ) );
        TestCase.assertEquals( "bindSimpleService2", comp10.getBindings().get( 1 ) );
        TestCase.assertEquals( "unbindSimpleService2", comp10.getBindings().get( 2 ) );
        TestCase.assertEquals( "unbindSimpleService", comp10.getBindings().get( 3 ) );

        srv1.drop();
        srv2.drop();
    }
View Full Code Here

    {
        final Component main = findComponentByName(componentName);
        TestCase.assertNotNull(main);

        ServiceRegistration dep1Reg = register(new SimpleComponent(), 0);
        ServiceRegistration dep2Reg = register(new SimpleComponent2(), 1000);
        main.enable();
        delay(300);
        dep1Reg.unregister();
        delay(2000);

        ComponentInstance mainCompInst = main.getComponentInstance();
        TestCase.assertNull(mainCompInst);

        dep1Reg = register(new SimpleComponent(), 0);
        delay(300);

        mainCompInst = main.getComponentInstance();
        TestCase.assertNotNull(mainCompInst);

        main.disable();
        dep1Reg.unregister();
        dep2Reg.unregister();

        dep1Reg = register(new SimpleComponent(), 0);
        dep2Reg = register(new SimpleComponent2(), 1000);
        main.enable();
        delay(300);
        dep1Reg.unregister();
        delay(100);
        dep1Reg = register(new SimpleComponent(), 0);
View Full Code Here

TOP

Related Classes of org.apache.felix.scr.integration.components.SimpleComponent2

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.