Examples of FooService


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

       
        Utils.waitForService(getContext(), FooService.class.getName(), "(instance.name="+pid+")");      
       
        ServiceReference refx = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        assertNotNull("Check refx", refx);
        FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
        assertNotNull("Check fs", fs);
       
        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);
       
       
        // Wait for the processing of the first configuration.
        try {
            Thread.sleep(ConfigurationTestSuite.UPDATE_WAIT_TIME);
        } catch (InterruptedException e1) {
            fail(e1.getMessage());
        }
       
       
        Dictionary p2 = configuration.getProperties();
        p2.put("message", "message2");
        try {
            System.err.println("The configuration will be updated with message2");

            configuration.update(p2);
            // Update the configuration ...
            Thread.sleep(ConfigurationTestSuite.UPDATE_WAIT_TIME);
        } catch (Exception e) {
            fail(e.getMessage());
        }
       
        System.err.println("The configuration should be updated with message2");
       
        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

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

    assertEquals("Check foo equality -2", fooP, "foo");
    assertEquals("Check bar equality -2", barP, new Integer(2));
    assertEquals("Check baz equality -2", bazP, "zab");

     // Get Service
        FooService fs = (FooService) context.getService(fooRef);
        Integer updated = (Integer) fs.fooProps().get("updated");

        assertEquals("Check updated", 1, updated.intValue());

    getContext().ungetService(msRef);
View Full Code Here

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

        assertEquals("Check foo equality -2", fooP, "foo");
        assertEquals("Check bar equality -2", barP, new Integer(2));
        assertEquals("Check baz equality -2", bazP, "zab");

        // Get Service
        FooService fs = (FooService) context.getService(fooRef);
        Integer updated = (Integer) fs.fooProps().get("updated");

        assertEquals("Check updated", 1, updated.intValue());

        getContext().ungetService(msRef);
    }
View Full Code Here

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

      assertEquals("Check foo equality", fooP, "oof");
      assertEquals("Check bar equality", barP, new Integer(0));
      assertEquals("Check baz equality", bazP, "zab");

      // Check field value
      FooService fs = (FooService) getContext().getService(fooRef);
      Properties p = fs.fooProps();
      fooP = (String) p.get("foo");
      barP = (Integer) p.get("bar");

      assertEquals("Check foo field equality", fooP, "oof");
      assertEquals("Check bar field equality", barP, new Integer(0));

        Integer updated = (Integer) fs.fooProps().get("updated");

        assertEquals("Check updated", 1, updated.intValue());

      getContext().ungetService(fooRef);
      getContext().ungetService(msRef);
View Full Code Here

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

    ref = helper.getServiceReferenceByName(FooService.class.getName(),  compName);
   
    assertNotNull("FS not available", ref);
   
    // Get foo object
    FooService fs = (FooService) getServiceObject(ref);
   
    // Cast to POJO
    Pojo pojo = (Pojo) fs;
   
    // GetComponentInstance
View Full Code Here

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

        assertEquals("ASF", ref.getProperty(Constants.SERVICE_VENDOR));
        assertEquals("my.pid", ref.getProperty(Constants.SERVICE_PID));
       
       
        // Test foo invocation
        FooService fs = (FooService) getServiceObject(ref);
        assertTrue("FooService invocation failed", fs.foo());
       
        helper.dispose();

       
        // Check that there is no more FooService
View Full Code Here

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

        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);
        assertEquals("check modify -1", ((Integer)props.get("modified")).intValue(), 1); // Already called inside the method
       
       
        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider.getInstanceName());
        FooService fs = (FooService) getContext().getService(ref);
       
        fs.foo(); // Update
       
        props = cs.getProps();
        //Check properties
        assertTrue("check CheckService invocation -1.1", ((Boolean)props.get("result")).booleanValue());
        assertEquals("check void bind invocation -1.1 ("+((Integer)props.get("voidB")).intValue()+")", ((Integer)props.get("voidB")).intValue(), 1);
View Full Code Here

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

        assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 0);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);
        assertEquals("check modify -1 (" + ((Integer)props.get("modified")).intValue() + ")", ((Integer)props.get("modified")).intValue(), 1);

        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider.getInstanceName());
        FooService fs = (FooService) getContext().getService(ref);
       
        fs.foo(); // Update
       
        props = cs.getProps();
        //Check properties
        assertEquals("check modify -1.1", ((Integer)props.get("modified")).intValue(), 3);
       
View Full Code Here

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

        assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 0);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);
        assertEquals("check modify -1 (" + ((Integer)props.get("modified")).intValue() + ")", ((Integer)props.get("modified")).intValue(), 1);

        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider.getInstanceName());
        FooService fs = (FooService) getContext().getService(ref);
       
        fs.foo(); // Update
       
        props = cs.getProps();
        //Check properties
        assertEquals("check modify -1.1", ((Integer)props.get("modified")).intValue(), 3);
       
View Full Code Here

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

        assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 1);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);
        assertEquals("check modify -1 (" + ((Integer)props.get("modified")).intValue() + ")", ((Integer)props.get("modified")).intValue(), 1);

        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider.getInstanceName());
        FooService fs = (FooService) getContext().getService(ref);
       
        fs.foo(); // Update
       
        props = cs.getProps();
        //Check properties
        assertEquals("check modify -1.1", ((Integer)props.get("modified")).intValue(), 3);
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.