Examples of MyService


Examples of org.jboss.as.subsystem.test.otherservices.subsystem.MyService

        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(OtherServicesSubsystemExtension.SUBSYSTEM_NAME));

        Assert.assertNotNull(services.getContainer().getService(OtherService.NAME));
        Assert.assertNotNull(services.getContainer().getService(MyService.NAME));
        MyService myService = (MyService)services.getContainer().getService(MyService.NAME).getValue();
        Assert.assertNotNull(myService.otherValue.getValue());
    }
View Full Code Here

Examples of org.jboss.ejb3.core.test.ejbthree1593.MyService

   }
  
   @Test
   public void testInjection() throws Exception
   {
      MyService service = lookup("MyServiceBean/local", MyService.class);
      service.testEjbContext();
   }
View Full Code Here

Examples of org.springframework.osgi.iandt.simpleservice.MyService

    ServiceReference[] refs = bundleContext.getServiceReferences(DEPENDENT_CLASS_NAME, null);

    assertEquals(2, refs.length);

    MyService service1 = (MyService) bundleContext.getService(refs[0]);
    MyService service2 = (MyService) bundleContext.getService(refs[1]);

    assertNotNull(service1);
    assertNotNull(service2);

    String msg1 = service1.stringValue();
    String msg2 = service2.stringValue();

    String jmsg = "Bond.  James Bond.";
    String cmsg = "Connery.  Sean Connery #1";
    System.out.println(msg1);
    System.out.println(msg2);
View Full Code Here

Examples of org.springframework.osgi.iandt.simpleservice.MyService

    System.getProperties().remove(ANNOTATION_CONST);
  }

  public void testReferenceProxyLifecycle() throws Exception {

    MyService reference = ServiceReferer.serviceReference;

    assertNotNull("reference not initialized", reference);
    assertNotNull("no value specified in the reference", reference.stringValue());

    Bundle simpleServiceBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
      "org.springframework.osgi.iandt.simpleservice");

    assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
    System.out.println("stopping bundle");
    simpleServiceBundle.stop();

    while (simpleServiceBundle.getState() == Bundle.STOPPING) {
      System.out.println("waiting for bundle to stop");
      Thread.sleep(10);
    }
    System.out.println("bundle stopped");

    // Service should be unavailable
    try {
      reference.stringValue();
      fail("ServiceUnavailableException should have been thrown!");
    }
    catch (ServiceUnavailableException e) {
      // Expected
    }

    System.out.println("starting bundle");
    simpleServiceBundle.start();

    waitOnContextCreation("org.springframework.osgi.iandt.simpleservice");

    System.out.println("bundle started");
    // Service should be running
    assertNotNull(reference.stringValue());
  }
View Full Code Here

Examples of org.springframework.osgi.iandt.simpleservice.MyService

      "org.springframework.osgi.iandt, reference.proxy," + getSpringDMVersion() };
  }

  public void testReferenceProxyLifecycle() throws Exception {

    MyService reference = ServiceReferer.serviceReference;

    assertNotNull("reference not initialized", reference);
    assertNotNull("no value specified in the reference", reference.stringValue());

    Bundle simpleServiceBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
      "org.springframework.osgi.iandt.simpleservice");

    assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
    System.out.println("stopping bundle");
    simpleServiceBundle.stop();

    while (simpleServiceBundle.getState() == Bundle.STOPPING) {
      System.out.println("waiting for bundle to stop");
      Thread.sleep(10);
    }
    System.out.println("bundle stopped");

    // Service should be unavailable
    try {
      reference.stringValue();
      fail("ServiceUnavailableException should have been thrown!");
    }
    catch (ServiceUnavailableException e) {
      // Expected
    }

    System.out.println("starting bundle");
    simpleServiceBundle.start();

    waitOnContextCreation("org.springframework.osgi.iandt.simpleservice");

    System.out.println("bundle started");
    // Service should be running
    assertNotNull(reference.stringValue());
  }
View Full Code Here

Examples of org.springframework.osgi.iandt.simpleservice.MyService

   *
   * @throws Exception
   */
  public void testProxyDestruction() throws Exception {

    MyService reference = ServiceReferer.serviceReference;

    assertNotNull("reference not initialized", reference);
    assertNotNull("no value specified in the reference", reference.stringValue());

    Bundle simpleServiceBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
      "org.springframework.osgi.iandt.simpleservice");

    assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
    System.out.println("stopping service bundle");
    simpleServiceBundle.stop();

    while (simpleServiceBundle.getState() == Bundle.STOPPING) {
      System.out.println("waiting for service bundle to stop...");
      Thread.sleep(500);
    }
    System.out.println("service bundle stopped");

    final Bundle proxyDestructionBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
      "org.springframework.osgi.iandt.proxy.destruction");

    Thread t = new Thread() {

      public void run() {
        try {
          // wait a bit so the proxy invocation executes
          Thread.sleep(3000);
        }
        catch (InterruptedException e) {
          e.printStackTrace();
        }
        try {
          System.out.println("Stopping referring bundle...");
          proxyDestructionBundle.stop();
        }
        catch (BundleException e) {
          e.printStackTrace();
        }
      }

    };
    t.start();

    // Service should be unavailable
    try {
      System.out.println("Invoking method on OSGi service proxy...");
      reference.stringValue();
      fail("ServiceProxyDestroyedException should have been thrown!");
    }
    catch (ServiceProxyDestroyedException e) {
      // Expected
    }
View Full Code Here

Examples of org.springframework.osgi.samples.simpleservice.MyService

  public void testSimpleServiceExported() {
    waitOnContextCreation("org.springframework.osgi.samples.simpleservice");
        ServiceReference ref = bundleContext.getServiceReference(MyService.class.getName());
        assertNotNull("Service Reference is null", ref);
        try {
            MyService simpleService = (MyService) bundleContext.getService(ref);
            assertNotNull("Cannot find the service", simpleService);
            assertEquals("simple service at your service", simpleService.stringValue());
        } finally {
            bundleContext.ungetService(ref);
        }
  }
View Full Code Here

Examples of org.springframework.osgi.samples.simpleservice.MyService

* @author Adrian Colyer
*/
public class MyServiceTest extends TestCase {

  public void testStringValue() {
    MyService service = new MyServiceImpl();
    assertEquals("simple service at your service",service.stringValue());
  }
View Full Code Here

Examples of powermock.examples.service.MyService

* method.
*/
public class MyServiceUser {

  public int getNumberOfPersons() {
    MyService myService = DependencyManager.getInstance().getMyService();
    Set<Person> allPersons = myService.getAllPersons();
    return allPersons.size();
  }
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.