Esempio n. 1
0
  @BeforeClass
  public static void setUpClass() {
    DummyService dummyService = new DummyService();
    DummyService dummyService2 = new DummyService();
    MasterService masterService = new MasterServiceImpl();

    Core.addService(dummyService);
    Core.addService(new ServiceInfo("DummyService", DummyService.class), dummyService2);
    Core.addService(masterService);
  }
Esempio n. 2
0
 private void execServiceMethod(String serviceName, String userName) {
   MasterService masterService = Core.getService(MasterServiceImpl.class);
   DummyService dummyService = Core.getService(DummyService.class);
   DummyService.HelloWorldArgument argument = dummyService.new HelloWorldArgument(userName);
   String argumentJson = GsonHelper.toJson(argument);
   ServiceCallReturn result =
       masterService.execServiceMethod(serviceName, "helloWorld", new String[] {argumentJson});
   assertTrue(result.getErrorMessage(), result.getSuccess());
   DummyService.HelloWorldResult helloWorldResult =
       GsonHelper.fromJson(DummyService.HelloWorldResult.class, result.getReturnValue());
   assertTrue(helloWorldResult.getSuccess());
   assertEquals(String.format("Hello %s", userName), helloWorldResult.getMessage());
 }