Package org.apache.felix.ipojo.runtime.core.services

Examples of org.apache.felix.ipojo.runtime.core.services.Tota


        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        Integer toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 3", tata.intValue(), 1);
        getContext().ungetService(ref);
        tota = null;
       
        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 4 ("+toto.intValue()+")", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4 ("+toto_2.intValue()+")", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 4", toto_1.intValue(), 3);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 4", tata.intValue(), 2);
        getContext().ungetService(ref);
        tota = null;
       
        // Stop the factory
        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
       
        totoProv2.stop();
        totoProv.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAllOpt(tota);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 6", tata.intValue(), 1);
        getContext().ungetService(ref);
        tota = null;
       
View Full Code Here


        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        Integer toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 3", tata.intValue(), 1);

        getContext().ungetService(ref);
        tota = null;

        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 4 (" + toto.intValue() + ")", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4 (" + toto_2.intValue() + ")", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 4", toto_1.intValue(), 2);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 4", tata.intValue(), 2);
        getContext().ungetService(ref);
        tota = null;

        // Stop the factory
        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));

        totoProv2.stop();
        totoProv.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAllOpt(tota);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 4", tata.intValue(), 1);
        getContext().ungetService(ref);
        tota = null;
View Full Code Here

        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        Integer tataStr = (Integer) props.get("tataStr");
        Integer tataStrs = (Integer) props.get("tataStrs");
        Integer tata_2 = (Integer) props.get("tata_2");
        Integer tata_3 = (Integer) props.get("tata_3");
        Integer tata1 = (Integer) props.get("tata1");
        Integer tata1_1 = (Integer) props.get("tata1_1");
        Integer tata5 = (Integer) props.get("tata5");
        Integer tata5_1 = (Integer) props.get("tata5_1");
        Integer tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 3", tata.intValue(), 1);
        assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
        assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
        assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
        assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
        assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
        assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
        assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
        assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
        getContext().ungetService(ref);
        tota = null;

        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 4", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
        tata1 = (Integer) props.get("tata1");
        tata1_1 = (Integer) props.get("tata1_1");
        tata5 = (Integer) props.get("tata5");
        tata5_1 = (Integer) props.get("tata5_1");
        tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 4", tata.intValue(), 2);
        assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
        assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
        assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
        assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
        assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
        assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
        assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
        assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);

        getContext().ungetService(ref);
        tota = null;

        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));

        totoProv2.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 6", toto.intValue(), 3);
        assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
        assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
        assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
View Full Code Here

        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 3", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        Integer tataStr = (Integer) props.get("tataStr");
        Integer tataStrs = (Integer) props.get("tataStrs");
        Integer tata_2 = (Integer) props.get("tata_2");
        Integer tata_3 = (Integer) props.get("tata_3");
        Integer tata1 = (Integer) props.get("tata1");
        Integer tata1_1 = (Integer) props.get("tata1_1");
        Integer tata5 = (Integer) props.get("tata5");
        Integer tata5_1 = (Integer) props.get("tata5_1");
        Integer tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 3", tata.intValue(), 1);
        assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
        assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
        assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
        assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
        assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
        assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
        assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
        assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);

        getContext().ungetService(ref);
        tota = null;

        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 4", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
        tata1 = (Integer) props.get("tata1");
        tata1_1 = (Integer) props.get("tata1_1");
        tata5 = (Integer) props.get("tata5");
        tata5_1 = (Integer) props.get("tata5_1");
        tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 4", tata.intValue(), 2);
        assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
        assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
        assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
        assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
        assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
        assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
        assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
        assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);

        getContext().ungetService(ref);
        tota = null;

        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));

        totoProv2.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 6", toto.intValue(), 3);
        assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
        assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
        assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
View Full Code Here

        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        Integer gtoto = (Integer) props.get("gtoto");
        Integer gtoto_2 = (Integer) props.get("gtoto_2");
        Integer gtoto_3 = (Integer) props.get("gtoto_3");
        Integer gtoto_4 = (Integer) props.get("gtoto_4");
        assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 0);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        assertEquals("Assert gtoto - 3 (" + gtoto.intValue() + ")", gtoto.intValue(), 1);
        assertEquals("Assert gtoto_2 - 3", gtoto_2.intValue(), 1);
        assertEquals("Assert gtoto_3 - 3", gtoto_3.intValue(), 1);
        assertEquals("Assert gtoto_4 - 3", gtoto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        Integer tataStr = (Integer) props.get("tataStr");
        Integer tataStrs = (Integer) props.get("tataStrs");
        Integer tata_2 = (Integer) props.get("tata_2");
        Integer tata_3 = (Integer) props.get("tata_3");
        Integer tata1 = (Integer) props.get("tata1");
        Integer tata1_1 = (Integer) props.get("tata1_1");
        Integer tata5 = (Integer) props.get("tata5");
        Integer tata5_1 = (Integer) props.get("tata5_1");
        Integer tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 3", tata.intValue(), 1);
        assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
        assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
        assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
        assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
        assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
        assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
        assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
        assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
        getContext().ungetService(ref);
        tota = null;

        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        gtoto = (Integer) props.get("gtoto");
        gtoto_2 = (Integer) props.get("gtoto_2");
        gtoto_3 = (Integer) props.get("gtoto_3");
        gtoto_4 = (Integer) props.get("gtoto_4");
        assertEquals("Assert toto - 4", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 0);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        assertEquals("Assert gtoto - 4 (" + gtoto.intValue() + ")", gtoto.intValue(), 2);
        assertEquals("Assert gtoto_2 - 4", gtoto_2.intValue(), 2);
        assertEquals("Assert gtoto_3 - 4", gtoto_3.intValue(), 2);
        assertEquals("Assert gtoto_4 - 4", gtoto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
        tata1 = (Integer) props.get("tata1");
        tata1_1 = (Integer) props.get("tata1_1");
        tata5 = (Integer) props.get("tata5");
        tata5_1 = (Integer) props.get("tata5_1");
        tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 4", tata.intValue(), 2);
        assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
        assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
        assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
        assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
        assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
        assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
        assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
        assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);

        getContext().ungetService(ref);
        tota = null;

        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));

        totoProv2.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        gtoto = (Integer) props.get("gtoto");
        gtoto_2 = (Integer) props.get("gtoto_2");
        gtoto_3 = (Integer) props.get("gtoto_3");
        gtoto_4 = (Integer) props.get("gtoto_4");
        assertEquals("Assert toto - 6", toto.intValue(), 3);
        assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
        assertEquals("Assert toto_3 - 6", toto_3.intValue(), 0);
        assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
        assertEquals("Assert gtoto - 6 (" + gtoto.intValue() + ")", gtoto.intValue(), 3);
        assertEquals("Assert gtoto_2 - 6", gtoto_2.intValue(), 3);
        assertEquals("Assert gtoto_3 - 6", gtoto_3.intValue(), 3);
        assertEquals("Assert gtoto_4 - 6", gtoto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
View Full Code Here

        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);

        invokeAll(tota);

        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        Integer toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 3", tata.intValue(), 1);

        getContext().ungetService(ref);
        tota = null;

        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 4 (" + toto.intValue() + ")", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4 (" + toto_2.intValue() + ")", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 4", toto_1.intValue(), 3);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 4", tata.intValue(), 2);

        getContext().ungetService(ref);
        tota = null;

        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));

        totoProv2.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 6 (" + toto.intValue() + ")", toto.intValue(), 3);
        assertEquals("Assert toto_2 - 6 (" + toto_2.intValue() + ")", toto_2.intValue(), 3);
        assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
        assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 6", toto_1.intValue(), 4);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 6", tata.intValue(), 1);

        getContext().ungetService(ref);
        tota = null;
View Full Code Here

        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        Integer toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 3", tata.intValue(), 1);
        getContext().ungetService(ref);
        tota = null;

        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        toto_1 = (Integer) props.get("toto1");
        assertEquals("Assert toto - 4 (" + toto.intValue() + ")", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4 (" + toto_2.intValue() + ")", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        assertEquals("Assert toto1 - 4", toto_1.intValue(), 2);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 4", tata.intValue(), 2);
        getContext().ungetService(ref);
        tota = null;

        // Stop the factory
        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));

        totoProv2.stop();
        totoProv.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAllOpt(tota);
        // Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        assertEquals("Assert tata - 6", tata.intValue(), 1);
        getContext().ungetService(ref);
        tota = null;
View Full Code Here

        // Start the factory
        tataFactory.start();
        assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
        ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
        Tota tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        Properties props = tota.getProps();
        Integer toto = (Integer) props.get("toto");
        Integer toto_2 = (Integer) props.get("toto_2");
        Integer toto_3 = (Integer) props.get("toto_3");
        Integer toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1);
        assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
        assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
        assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        Integer tata = (Integer) props.get("tata");
        Integer tataStr = (Integer) props.get("tataStr");
        Integer tataStrs = (Integer) props.get("tataStrs");
        Integer tata_2 = (Integer) props.get("tata_2");
        Integer tata_3 = (Integer) props.get("tata_3");
        Integer tata1 = (Integer) props.get("tata1");
        Integer tata1_1 = (Integer) props.get("tata1_1");
        Integer tata5 = (Integer) props.get("tata5");
        Integer tata5_1 = (Integer) props.get("tata5_1");
        Integer tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 3", tata.intValue(), 1);
        assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
        assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
        assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
        assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
        assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
        assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
        assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
        assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);

        getContext().ungetService(ref);
        tota = null;

        // Start a second import
        totoProv2.start();
        assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 4", toto.intValue(), 2);
        assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
        assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
        assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
        tata1 = (Integer) props.get("tata1");
        tata1_1 = (Integer) props.get("tata1_1");
        tata5 = (Integer) props.get("tata5");
        tata5_1 = (Integer) props.get("tata5_1");
        tata5_2 = (Integer) props.get("tata5_2");
        assertEquals("Assert tata - 4", tata.intValue(), 2);
        assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
        assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
        assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
        assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
        assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
        assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
        assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
        assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
        assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);

        getContext().ungetService(ref);
        tota = null;

        tataFactory.stop();
        assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
        assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));

        totoProv2.stop();
        tataFactory.start();
        assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
        assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
        ref = getContext().getServiceReference(Tota.class.getName());
        tota = (Tota) getContext().getService(ref);
        invokeAll(tota);
        // Check toto
        props = tota.getProps();
        toto = (Integer) props.get("toto");
        toto_2 = (Integer) props.get("toto_2");
        toto_3 = (Integer) props.get("toto_3");
        toto_4 = (Integer) props.get("toto_4");
        assertEquals("Assert toto - 6", toto.intValue(), 3);
        assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
        assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
        assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
        //Check tata
        props = tota.getPropsTata();
        tata = (Integer) props.get("tata");
        tataStr = (Integer) props.get("tataStr");
        tataStrs = (Integer) props.get("tataStrs");
        tata_2 = (Integer) props.get("tata_2");
        tata_3 = (Integer) props.get("tata_3");
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.runtime.core.services.Tota

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.