Package de.bamberg.ha.api.processing

Examples of de.bamberg.ha.api.processing.ServiceRegistry.lookup()


  @Override
  public DistributedExecutionResult call() throws Exception {
    Object callResult=null;
    ServiceRegistry serviceRegistry=CentralServiceRegistryHolder.getInstance().getServiceRegistry();
    if (serviceRegistry!=null) {
      Object obj=serviceRegistry.lookup(serviceName);
      Method method=obj.getClass().getMethod(methodName, determineParameterClasses(parameter) );
      callResult=method.invoke(obj, parameter);
    }
    DistributedExecutionResult result=new DistributedExecutionResult(callResult);
    return result;
View Full Code Here


  public void testRegisterService() throws Exception {
    ServiceRegistry registry=DefaultServiceRegistry.getInstance();
    TestService ts=new TestServiceImpl();
    registry.registerService(ts, TestService.class,TestService2.class);
   
    TestService service1=(TestService) registry.lookup(TestService.class);
    assertNotNull(service1);
    TestService service2=(TestService) registry.lookup(TestService2.class);
    assertNotNull(service2);

    assertTrue(ts==service1);
View Full Code Here

    TestService ts=new TestServiceImpl();
    registry.registerService(ts, TestService.class,TestService2.class);
   
    TestService service1=(TestService) registry.lookup(TestService.class);
    assertNotNull(service1);
    TestService service2=(TestService) registry.lookup(TestService2.class);
    assertNotNull(service2);

    assertTrue(ts==service1);
    assertTrue(ts==service2);
    assertTrue(service1==service2);
View Full Code Here

  }

  @Test (expected=ServiceNotAvailableException.class)
  public void testLookupUnknownService() throws Exception {
    ServiceRegistry registry=DefaultServiceRegistry.getInstance();
    registry.lookup(TestService3.class);
  }

}

interface TestService {
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.