JsonModule implements StatefulFunctionModule { public void configure(Map<String, String> conf, Binder binder) { try { configureFunctions(binder, Selectors.listAt(spec, Pointers.FUNCTIONS_POINTER)); configureRouters(binder, Selectors.listAt(spec, Pointers.ROUTERS_POINTER)); configureIngress(binder, Selectors.listAt(spec, Pointers.INGRESSES_POINTER)); } catch (Throwable t) { throw new ModuleConfigurationException( format("Error while parsing module at %s", moduleUrl), t); } } JsonModule(JsonNode spec, URL moduleUrl); void configure(Map<String, String> conf, Binder binder);  }
@Test public void testFunctions() { StatefulFunctionModule module = fromPath("bar-module/module.yaml"); StatefulFunctionsUniverse universe = emptyUniverse(); module.configure(Collections.emptyMap(), universe); assertThat( universe.functions(), allOf( hasKey(new FunctionType("com.example", "hello")), hasKey(new FunctionType("com.foo", "world")))); }
@Test public void testRouters() { StatefulFunctionModule module = fromPath("bar-module/module.yaml"); StatefulFunctionsUniverse universe = emptyUniverse(); module.configure(Collections.emptyMap(), universe); assertThat( universe.routers(), hasKey(new IngressIdentifier<>(Message.class, "com.mycomp.igal", "names"))); }
@Test public void testIngresses() { StatefulFunctionModule module = fromPath("bar-module/module.yaml"); StatefulFunctionsUniverse universe = emptyUniverse(); module.configure(Collections.emptyMap(), universe); assertThat( universe.ingress(), hasKey(new IngressIdentifier<>(Message.class, "com.mycomp.igal", "names"))); }