Package org.apache.felix.ipojo.test.scenarios.configadmin.service

Examples of org.apache.felix.ipojo.test.scenarios.configadmin.service.FooService


       
        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertNotNull("FS availability", ref);
       
        FooService fs = (FooService) getContext().getService(ref);
        Properties p = fs.fooProps();
        String mes = p.getProperty("message");
      //  int count1 = ((Integer) p.get("count")).intValue();
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertEquals("Check message - 1 (" + mes +")", "message2", mes); // Already reconfigured.
       // assertEquals("Check count", 2, count); // Two : 1) "message" on immediate, "message2" on the reconfiguration,
                                                // not necessary as the property can be set before the immediate instance creation
       
        instance.dispose();
       
        //Reconfiguration
        try {
            configuration = admin.getConfiguration(msp);
            Dictionary prc = configuration.getProperties();
            if (prc == null) {
                prc = new Properties();
            }
            prc.put("message", "message3");
            configuration.update(prc);
            listener.waitForEvent(msp, "1");
        } catch (Exception e) {
            fail(e.getMessage());
        }
       
        // Recreation of the instance.
        props = new Properties();
        props.put("managed.service.pid", msp);
        props.put("message", "message");
        instance  = null;
        try {
            instance =  factImm.createComponentInstance(props);
            Thread.sleep(ConfigurationTestSuite.UPDATE_WAIT_TIME * 2);
        } catch (Exception e) {
           fail(e.getMessage());
        }
        ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertNotNull("FS availability", ref);
       
        fs = (FooService) getContext().getService(ref);
        p = fs.fooProps();
        mes = p.getProperty("message");
       // int count = ((Integer) p.get("count")).intValue();
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertEquals("Check message already reconfigured", "message3", mes); // Already reconfigured.
        //assertEquals("Check count", count1 + 1, count); // message before the reconfiguration, message3 after the reconfiguration
View Full Code Here


       
        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertNotNull("FS availability", ref);
       
        FooService fs = (FooService) getContext().getService(ref);
        Properties p = fs.fooProps();
        String mes = p.getProperty("message");
      // int count = ((Integer) p.get("count")).intValue();
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertEquals("Check message", "message2", mes); // Already reconfigured.
        //assertEquals("Check count", 1, count);
       
        //Reconfiguration
        try {
            configuration = admin.getConfiguration(msp);
            Dictionary prc = configuration.getProperties();
            if (prc == null) {
                prc = new Properties();
            }
            prc.put("message", "message3");
            configuration.update(prc);
            //Thread.sleep(ConfigurationTestSuite.UPDATE_WAIT_TIME);
            listener.waitForEvent(msp, "1");
        } catch (Exception e) {
            fail(e.getMessage());
        }
       
        instance.dispose();
       
        // Recreation of the instance.
        props = new Properties();
        props.put("managed.service.pid", msp);
        props.put("message", "message");
        instance  = null;
        try {
            instance =  factImm.createComponentInstance(props);
        } catch (Exception e) {
           fail(e.getMessage());
        }
       
        ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertNotNull("FS availability", ref);
       
        fs = (FooService) getContext().getService(ref);
        p = fs.fooProps();
        mes = p.getProperty("message");
      //  count = ((Integer) p.get("count")).intValue();
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length);
        assertEquals("Check message", "message3", mes); // Already reconfigured.
       // assertEquals("Check count", 1, count);
View Full Code Here

        Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
        Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Check object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length);
       
        FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        Properties p = fs.fooProps();
        String mes = p.getProperty("message");
        int count = ((Integer) p.get("count")).intValue();
        //architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Assert Message", "message", mes);
        assertEquals("Assert count", 1, count);
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length);
       
        props.put("message", "message2");
        try {
            configuration.update(props);
            // Update the configuration ...
            Thread.sleep(ConfigurationTestSuite.UPDATE_WAIT_TIME);
        } catch (Exception e) {
            fail(e.getMessage());
        }
       
        fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        p = fs.fooProps();
        mes = p.getProperty("message");
        count = ((Integer) p.get("count")).intValue();
        //architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Assert Message", "message2", mes);
View Full Code Here

        //architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Check object -2", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length);
       
        //Invoke
        FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        Properties p = fs.fooProps();
        String mes = p.getProperty("message");
        int count = ((Integer) p.get("count")).intValue();
       // architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Assert Message", "message2", mes);
View Full Code Here

        Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
        Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Check object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length);
       
        FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        Properties p = fs.fooProps();
        String mes = p.getProperty("message");
        int count = ((Integer) p.get("count")).intValue();
        //architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Assert Message", "message", mes);
        assertEquals("Assert count", 1, count);
        assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length);
       
        props.put("message", "message2");
        try {
            configuration.update(props);
            // Update the configuration ...
            Thread.sleep(ConfigurationTestSuite.UPDATE_WAIT_TIME);
        } catch (Exception e) {
            fail(e.getMessage());
        }
       
        fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        p = fs.fooProps();
        mes = p.getProperty("message");
        count = ((Integer) p.get("count")).intValue();
       // architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Assert Message", "message2", mes);
View Full Code Here

        //architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Check object -1", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length);
       
        //Invoke
        FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        Properties p = fs.fooProps();
        String mes = p.getProperty("message");
        int count = ((Integer) p.get("count")).intValue();
       // architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
       
        assertEquals("Assert Message", "message2", mes);
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.test.scenarios.configadmin.service.FooService

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.