@Override public void servicesRemoved(String serviceName, int count) { puts("servicesRemoved", serviceName, count); } };
@Override public void accept(Long integer) { puts("Last ten second count for abc.count", integer); } }, "abc.count");
@Override public void servicePoolChanged(String serviceName) { servicePoolChangedServiceNameFromListener.set(serviceName); puts(serviceName); }
@Override public void onError(Throwable error) { puts("We got", error.getMessage()); ok = "Hi hi 5".equals(error.getMessage()); wasError.set(true); } };
@Listen("NEW_RECORD_LIST") public void newRecords(List<Record> records) { puts("GOT NEW RECORDS", records); records.forEach(blockingQueue::add); } }
@RequestMapping("/todo/list/") public List<Todo> list() { puts("List serviceCall was called", items); return new ArrayList<>(items); }
/** * This is a fire and forget style. * There is no return and the client cannot get any exception that this might throw. * * @param employee employee */ @RequestMapping(value = "/employee-add-async-no-return", method = RequestMethod.POST) public void addEmployee(final Employee employee) { employeeList.add(employee); puts(employee); }
@RequestMapping(value = "/throw", method = RequestMethod.POST) public void addEmployeeThrowException(final Callback<Boolean> callback, final Employee employee) { puts(employee); throw new RuntimeException("OH NO"); }
@Override public void event(String arg) { puts("GOT EVENT", arg); event.set(sputs("GOT EVENT", arg)); } }
void doSomeWork2(Callback<Integer> value) { count++; totalCount++; puts(count, totalCount); value.accept(count); }
@Listen("NEW_RECORD") public void newRecord(final Record record) { puts("GOT NEW RECORD", record); blockingQueue.add(record); }
@RequestMapping("/timeOut") public String timeOut() { puts("TIMEOUT"); Sys.sleep(30000); return "ok"; }
private void loadServices(String serviceName) { for (int index = 0; index < 10; index++) { Sys.sleep(1000); final List<EndpointDefinition> endpointDefinitions = serviceDiscovery.loadServices(serviceName); puts(endpointDefinitions); if (endpointDefinitions.size() > 0) { break; } } Sys.sleep(100); }
@Test public void testAddService() throws Exception { serviceBundle.addServiceObject("/adder", adderService); final List<String> endPoints = serviceBundle.endPoints(); puts(endPoints); endPoints.contains("/foo/adder"); }
private void loadServices(String serviceName) { for (int index = 0; index < 10; index++) { Sys.sleep(1000); final List<EndpointDefinition> endpointDefinitions = serviceDiscovery.loadServices(serviceName); puts(endpointDefinitions); if (endpointDefinitions.size() > 0) { break; } } Sys.sleep(100); }
@Test public void addEmployeeThrowException() { final HttpTextResponse httpResponse = httpServerSimulator.postBody("/es/throw", new Employee(1, "Rick")); assertEquals(500, httpResponse.code()); assertTrue(httpResponse.body().contains("\"message\":")); puts(httpResponse.body()); }
@Test public void test() throws Exception { final ServiceMeta myService = service("myService", "/myservice"); puts(toJson(myService)); }
@Test public void testNoJSONParseWithBytes() { final HttpTextResponse httpResponse = httpServerSimulator.sendRequest( httpRequestBuilder.setUri("/es/body/bytes") .setMethodPost().setContentType("foo") .setBody("foo") .build() ); puts(httpResponse); assertEquals(200, httpResponse.code()); assertEquals("true", httpResponse.body()); }
@Test public void testCallBack() throws Exception { client.start(); Sys.sleep(100); final ServiceMock mockService = client.createProxy(ServiceMock.class, "mockService"); mockService.sum(integer -> puts("SUM", integer)); ((ClientProxy) mockService).clientProxyFlush(); Sys.sleep(100); ok = httpSendWebSocketCalled || die(); }
public static void main(String... args) { final HttpClient httpClient = httpClientBuilder().setAutoFlush(true).setPort(9999).build(); httpClient.startClient(); final WebSocket webSocket = httpClient.createWebSocket("/hello"); webSocket.setTextMessageConsumer(message -> puts("\n\n\n", message, "\n\n") ); webSocket.openAndWait(); webSocket.sendText("Hello"); Sys.sleep(100000); } }