public DirectProvider() { this.services = new ServiceContainer(); getServices().addService(ControlService.class, new JsonControlService()); }
public DirectProvider() { this.services = new ServiceContainer(); getServices().addService(ControlService.class, new JsonControlService()); }
static void startProvider(DirectProvider provider) throws InterruptedException, ExecutionException { provider.getServices().addService(ControlService.class, new JMXControlService("org.apache.edgent.test.apps.runtime", new Hashtable<>())); AppService.createAndRegister(provider, provider); JobRegistry.createAndRegister(provider.getServices()); }
@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 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()); }
DirectProvider dp = new DirectProvider(); dp.getServices().addService(PublishSubscribeService.class, new ProviderPubSub());
@Test(timeout=10000) public void testProviderServiceSingleSubscriber() throws Exception { DirectProvider dp = new DirectProvider(); dp.getServices().addService(PublishSubscribeService.class, new ProviderPubSub()); TStream<String> publishedStream = createPublisher(dp, "t1", String.class, getStrs()); Tester testPub = publishedStream.topology().getTester(); Condition<List<String>> tcPub = testPub.streamContents(publishedStream, getStrs()); TStream<String> subscribedStream = createSubscriber(dp, "t1", String.class); Tester testSub = subscribedStream.topology().getTester(); Condition<List<String>> tcSub = testSub.streamContents(subscribedStream, getStrs()); // Expect all tuples Job js = dp.submit(subscribedStream.topology()).get(); // Give the subscriber a chance to setup. while (js.getCurrentState() != State.RUNNING) Thread.sleep(50); Job jp = dp.submit(publishedStream.topology()).get(); while (!tcSub.valid() || !tcPub.valid()) Thread.sleep(50); assertTrue(tcPub.valid()); assertTrue(tcSub.valid()); js.stateChange(Action.CLOSE); jp.stateChange(Action.CLOSE); }
DirectProvider dp = new DirectProvider(); dp.getServices().addService(PublishSubscribeService.class, new ProviderPubSub());
DirectProvider dp = new DirectProvider(); dp.getServices().addService(PublishSubscribeService.class, new ProviderPubSub());