Examples of FooService


Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import3);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    foo2.stop();
    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import3);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // Stop the second provider
    foo1.stop();   
    assertTrue("Test component validity - 2", import3.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import3);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 0);
   
    foo1.start();
    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import3);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 3", refs);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
  }
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import1);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    foo1.stop();
    assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import1);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 2", refs);
    assertEquals("Test foo availability inside the composite - 2.2", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // Stop the second provider
    foo2.stop();   
    assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID);
   
    foo2.start();
    assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import1);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 3", refs);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
  }
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import1);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    foo2.stop();
    assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import1);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // Stop the second provider
    foo1.stop();   
    assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID);
   
    foo1.start();
    assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import1);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 3", refs);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
  }
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import2);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2 ("+refs.length+")", refs.length, 2);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    FooService fs2 = (FooService) sc.getService(refs[1]);
    assertTrue("Test foo invocation", fs2.foo());
    sc.ungetService(refs[0]);
    sc.ungetService(refs[1]);
   
    // Stop the second provider
    foo2.dispose();
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import2);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2 ("+refs.length+")", refs.length, 2);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    FooService fs2 = (FooService) sc.getService(refs[1]);
    assertTrue("Test foo invocation", fs2.foo());
    sc.ungetService(refs[0]);
    sc.ungetService(refs[1]);
   
    // Stop the first provider
    foo1.stop();
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

   
    assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(under);
    ServiceReference ref = sc.getServiceReference(FooService.class.getName());
    assertNotNull("Check refs not null", ref);
    FooService foo = (FooService) sc.getService(ref);
    Properties p = foo.fooProps();
    boolean b = ((Boolean) p.get("boolProp")).booleanValue();
    String s = (String) p.get("strProp");
    int i = ( (Integer) p.get("intProp")).intValue();
    assertTrue("Test boolean", b);
    assertEquals("Test string", s, "foo");
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import3);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // Stop the second provider
    foo2.dispose();
    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import3);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 2", refs);
    assertEquals("Test foo availability inside the composite - 2.1 ("+refs.length+")", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // stop the foo provider
    foo.stop();
   
    // No provider -> Invalid
    assertTrue("Test component invalidity - 2", import3.getState() == ComponentInstance.VALID);
   
    foo.start();
    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import3);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 3", refs);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    foo.dispose();
    // No provider -> Invalid
    assertTrue("Test component invalidity - 3", import3.getState() == ComponentInstance.VALID);
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import3);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // Stop the second provider
    foo1.stop();
    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import3);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 2", refs);
    assertEquals("Test foo availability inside the composite - 2.1 ("+refs.length+")", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // stop the foo provider
    foo2.dispose();
   
    // No provider -> Invalid
    assertTrue("Test component invalidity - 2", import3.getState() == ComponentInstance.VALID);
   
    foo1.start();
    assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import3);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 3", refs);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    foo1.dispose();
    // No provider -> Invalid
    assertTrue("Test component invalidity - 3", import3.getState() == ComponentInstance.VALID);
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import4);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 2);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
    fs = (FooService) sc.getService(refs[1]);
    assertTrue("Test foo invocation (2)", fs.foo());
    sc.ungetService(refs[1]);
   
    foo1.stop();
    assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import4);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // Stop the second provider
    foo2.stop();   
    assertTrue("Test component validity - 2", import4.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import4);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertEquals("Test foo availability inside the composite - 1", refs.length, 0);
   
    foo2.start();
    assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import4);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 3", refs);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
  }
View Full Code Here

Examples of org.apache.felix.ipojo.test.composite.service.FooService

    assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID);
    ServiceContext sc = Utils.getServiceContext(import4);
    ServiceReference[] refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 2);
    FooService fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
    fs = (FooService) sc.getService(refs[1]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[1]);
   
    foo2.stop();
    assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import4);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 1", refs);
    assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
   
    // Stop the second provider
    foo1.stop();   
    assertTrue("Test component validity - 2", import4.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import4);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertEquals("Test foo availability inside the composite - 1", refs.length, 0);
   
    foo1.start();
    assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID);
    sc = Utils.getServiceContext(import4);
    refs = Utils.getServiceReferences(sc, FooService.class.getName(), null);
    assertNotNull("Test foo availability inside the composite - 3", refs);
    assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1);
    fs = (FooService) sc.getService(refs[0]);
    assertTrue("Test foo invocation", fs.foo());
    sc.ungetService(refs[0]);
  }
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.