@Test public void testQueryError() { String[] params = {"p1", "param2"}; String errorMessage = "Message with params {}='p1' {}='param2'."; String errorCode = "io.vantiq.extjsdk.ExampleErrorName"; markWsConnected(true); client.sendQueryError(queryAddress, errorCode, errorMessage, params); assert socket.compareData("headers." + ExtensionServiceMessage.RESPONSE_ADDRESS_HEADER, queryAddress); assert socket.compareData("status", 400); assert socket.compareData("body.parameters", new ArrayList<String>(Arrays.asList(params))); assert socket.compareData("body.messageTemplate", errorMessage); assert socket.compareData("body.messageCode", errorCode); }
public void sendQueryError(String replyAddress, String messageCode, String messageTemplate, Object[] parameters) { Map<String, Object> err = new HashMap<>(); err.put("messageCode", messageCode); err.put("messageTemplate", messageTemplate); err.put("parameters", parameters); sendQueryResponse(400, replyAddress, err); }
ExtensionWebSocketClient { public void sendQueryError(String replyAddress, String messageCode, String messageTemplate, Object[] parameters) { Map<String, Object> err = new HashMap<>(); err.put("messageCode", messageCode); err.put("messageTemplate", messageTemplate); err.put("parameters", parameters); sendQueryResponse(400, replyAddress, err); } }
ExtensionWebSocketClient { public void sendQueryError(String replyAddress, String messageCode, String messageTemplate, Object[] parameters) { Map<String, Object> err = new HashMap<>(); err.put("messageCode", messageCode); err.put("messageTemplate", messageTemplate); err.put("parameters", parameters); sendQueryResponse(400, replyAddress, err); } ExtensionWebSocketClient(String sourceName); }
ExtensionWebSocketClient { public void sendQueryError(String replyAddress, String messageCode, String messageTemplate, Object[] parameters) { Map<String, Object> err = new HashMap<>(); err.put("messageCode", messageCode); err.put("messageTemplate", messageTemplate); err.put("parameters", parameters); sendQueryResponse(400, replyAddress, err); } 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 sendQueryError(String replyAddress, String messageCode, String messageTemplate, Object[] parameters) { Map<String, Object> err = new HashMap<>(); err.put("messageCode", messageCode); err.put("messageTemplate", messageTemplate); err.put("parameters", parameters); sendQueryResponse(400, replyAddress, err); } 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; }