public DirectProvider() { this.services = new ServiceContainer(); getServices().addService(ControlService.class, new JsonControlService()); }
public DirectProvider() { this.services = new ServiceContainer(); getServices().addService(ControlService.class, new JsonControlService()); }
@Test //@Ignore("This test relies on an existing war in a given location ... need to refactor this") public void testAppServiceJar() throws Exception { DirectProvider provider = new DirectProvider(); JsonControlService control = new JsonControlService(); provider.getServices().addService(ControlService.class, control); AppService.createAndRegister(provider, provider); File testAppsJar = getServerJar(); assertNotNull(testAppsJar); assertTrue(testAppsJar.exists()); System.out.println("Using server jar at: " + testAppsJar.toString()); URL testAppsJarURL = testAppsJar.toURI().toURL(); JsonObject registerJar = newRegisterJarRequest(testAppsJarURL.toExternalForm()); JsonElement crr = control.controlRequest(registerJar); assertTrue(crr.getAsBoolean()); Thread.sleep(500); JsonObject submitAppTwo = newSubmitRequest("SecondJarApp"); crr = control.controlRequest(submitAppTwo); assertTrue(crr.getAsBoolean()); Thread.sleep(500); }
@Test public void test1ArgString() throws Exception { JsonControlService control = new JsonControlService();
@Test public void test1ArgInt() throws Exception { JsonControlService control = new JsonControlService();
@Test public void testAppService() throws Exception { DirectProvider provider = new DirectProvider(); JsonControlService control = new JsonControlService(); provider.getServices().addService(ControlService.class, control); AppService.createAndRegister(provider, provider); IotTestApps.registerApplications(provider); JsonObject submitAppOne = newSubmitRequest("AppOne"); JsonElement crr = control.controlRequest(submitAppOne); assertTrue(crr.getAsBoolean()); }
@Test public void test2ArgLongDouble() throws Exception { JsonControlService control = new JsonControlService();
@Test public void testNoArg() throws Exception { JsonControlService control = new JsonControlService(); MyBeanImpl cb1 = new MyBeanImpl(); MyBeanImpl cb2 = new MyBeanImpl(); assertFalse(cb1.isDoneIt()); assertFalse(cb2.isDoneIt()); control.registerControl("myb", "1", null, MyBean.class, cb1); control.registerControl("myb", "2", null, MyBean.class, cb2); assertFalse(cb1.isDoneIt()); assertFalse(cb2.isDoneIt()); JsonObject req = new JsonObject(); req.addProperty(JsonControlService.TYPE_KEY, "myb"); req.addProperty(JsonControlService.ALIAS_KEY, "1"); req.addProperty(JsonControlService.OP_KEY, "doIt"); control.controlRequest(req); assertTrue(cb1.isDoneIt()); assertFalse(cb2.isDoneIt()); req = new JsonObject(); req.addProperty(JsonControlService.TYPE_KEY, "myb"); req.addProperty(JsonControlService.ALIAS_KEY, "2"); req.addProperty(JsonControlService.OP_KEY, "doIt"); control.controlRequest(req); assertTrue(cb1.isDoneIt()); assertTrue(cb2.isDoneIt()); }
@Test public void test3ArgBooleanEnum() throws Exception { JsonControlService control = new JsonControlService();