@Test public void testQueryResponseMapArray() { Map<String, Object>[] queryData = new Map[2]; queryData[0] = new LinkedHashMap<>(); queryData[0].put("msg", "val"); queryData[0].put("val", "msg"); queryData[1] = new LinkedHashMap<>(); queryData[1].put("message", "value"); queryData[1].put("value", "message"); markWsConnected(true); client.sendQueryResponse(200, queryAddress, queryData); assert socket.compareData("body", new ArrayList<Map>(Arrays.asList(queryData))); assert socket.compareData("headers." + ExtensionServiceMessage.RESPONSE_ADDRESS_HEADER, queryAddress); assert socket.compareData("status", 200); }
public void sendQueryResponse(int httpCode, String replyAddress, Map body){ Response response = new Response() .status(httpCode) .addHeader(ExtensionServiceMessage.RESPONSE_ADDRESS_HEADER, replyAddress) .body(body); send(response); }
ExtensionWebSocketClient { public void sendQueryResponse(int httpCode, String replyAddress, Map body){ Response response = new Response() .status(httpCode) .addHeader(ExtensionServiceMessage.RESPONSE_ADDRESS_HEADER, replyAddress) .body(body); send(response); } }
ExtensionWebSocketClient { public void sendQueryResponse(int httpCode, String replyAddress, Map body){ Response response = new Response() .status(httpCode) .addHeader(ExtensionServiceMessage.RESPONSE_ADDRESS_HEADER, replyAddress) .body(body); send(response); } ExtensionWebSocketClient(String sourceName); }
ExtensionWebSocketClient { public void sendQueryResponse(int httpCode, String replyAddress, Map body){ Response response = new Response() .status(httpCode) .addHeader(ExtensionServiceMessage.RESPONSE_ADDRESS_HEADER, replyAddress) .body(body); send(response); } ExtensionWebSocketClient(String sourceName); ExtensionWebSocketListener getListener(); String getSourceName(); CompletableFuture<Boolean> initiateFullConnection(String url, String token); synchronized CompletableFuture<Boolean> initiateWebsocketConnection(String url); CompletableFuture<Boolean> getWebsocketConnectionFuture(); void sendNotification(Object data); void sendQueryResponseEmpty(String replyAddress); void sendQueryResponse(int httpCode, String replyAddress, Map body); void sendQueryResponse(int httpCode, String replyAddress, Map[] body); void sendQueryError(String replyAddress, String messageCode, String messageTemplate, Object[] parameters); void send(Object obj); synchronized CompletableFuture<Boolean> authenticate(String user, String pass); synchronized CompletableFuture<Boolean> authenticate(String token); CompletableFuture<Boolean> getAuthenticationFuture(); synchronized CompletableFuture<Boolean> connectToSource(); CompletableFuture<Boolean> getSourceConnectionFuture(); void sourceHasDisconnected(); void setAutoReconnect(boolean value); boolean isOpen(); boolean isAuthed(); boolean isConnected(); void close(); void stop(); void useHandlersFrom(ExtensionWebSocketListener listener); void useHandlersFrom(ExtensionWebSocketClient client); void setCloseHandler(Handler<ExtensionWebSocketClient> closeHandler); void setHttpHandler(Handler<Response> httpHandler); void setPublishHandler(Handler<ExtensionServiceMessage> publishHandler); void setQueryHandler(Handler<ExtensionServiceMessage> queryHandler); void setConfigHandler(Handler<ExtensionServiceMessage> configHandler); void setAuthHandler(Handler<Response> authHandler); void setReconnectHandler(Handler<ExtensionServiceMessage> reconnectHandler); }
ExtensionWebSocketClient { public void sendQueryResponse(int httpCode, String replyAddress, Map body){ Response response = new Response() .status(httpCode) .addHeader(ExtensionServiceMessage.RESPONSE_ADDRESS_HEADER, replyAddress) .body(body); send(response); } ExtensionWebSocketClient(String sourceName); ExtensionWebSocketListener getListener(); String getSourceName(); CompletableFuture<Boolean> initiateFullConnection(String url, String token); synchronized CompletableFuture<Boolean> initiateWebsocketConnection(String url); CompletableFuture<Boolean> getWebsocketConnectionFuture(); void sendNotification(Object data); void sendQueryResponseEmpty(String replyAddress); void sendQueryResponse(int httpCode, String replyAddress, Map body); void sendQueryResponse(int httpCode, String replyAddress, Map[] body); void sendQueryError(String replyAddress, String messageCode, String messageTemplate, Object[] parameters); void send(Object obj); synchronized CompletableFuture<Boolean> authenticate(String user, String pass); synchronized CompletableFuture<Boolean> authenticate(String token); CompletableFuture<Boolean> getAuthenticationFuture(); synchronized CompletableFuture<Boolean> connectToSource(); CompletableFuture<Boolean> getSourceConnectionFuture(); void sourceHasDisconnected(); void setAutoReconnect(boolean value); boolean isOpen(); boolean isAuthed(); boolean isConnected(); void close(); void stop(); void useHandlersFrom(ExtensionWebSocketListener listener); void useHandlersFrom(ExtensionWebSocketClient client); void setCloseHandler(Handler<ExtensionWebSocketClient> closeHandler); void setHttpHandler(Handler<Response> httpHandler); void setPublishHandler(Handler<ExtensionServiceMessage> publishHandler); void setQueryHandler(Handler<ExtensionServiceMessage> queryHandler); void setConfigHandler(Handler<ExtensionServiceMessage> configHandler); void setAuthHandler(Handler<Response> authHandler); void setReconnectHandler(Handler<ExtensionServiceMessage> reconnectHandler); static final int QUERY_CHUNK_CODE; static final int QUERY_DATA_CODE; static final int QUERY_NODATA_CODE; }