@Test public void testPostMessage() throws RemoteApiException { Map<String, String> headerParams = new HashMap<>(); headerParams.put("sessionToken", MOCK_SESSION); headerParams.put("keyManagerToken", MOCK_KM_SESSION); Map<String, String> queryParams = new HashMap<>(); Message message = mockMessage(); String path = "/v2/stream/" + MOCK_STREAM_ID + "/message/create"; doReturn(MOCK_STREAM_ID).when(httpClient).escapeString(MOCK_STREAM_ID); doReturn(message).when(httpClient).doPost(path, headerParams, queryParams, message, Message.class); Message result = apiClient.postMessage(MOCK_SESSION, MOCK_KM_SESSION, MOCK_STREAM_ID, message); assertEquals(message, result); }
public Message postMessage(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { validateParams(sessionToken, kmToken, streamId, message); String path = "/v2/stream/" + apiClient.escapeString(streamId) + "/message/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); headerParams.put(KM_TOKEN_HEADER_PARAM, kmToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), message, Message.class); }
V2MessageApiClient extends BaseMessageApiClient { public Message postMessage(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { validateParams(sessionToken, kmToken, streamId, message); String path = "/v2/stream/" + apiClient.escapeString(streamId) + "/message/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); headerParams.put(KM_TOKEN_HEADER_PARAM, kmToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), message, Message.class); } }
V2MessageApiClient extends BaseMessageApiClient { public Message postMessage(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { validateParams(sessionToken, kmToken, streamId, message); String path = "/v2/stream/" + apiClient.escapeString(streamId) + "/message/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); headerParams.put(KM_TOKEN_HEADER_PARAM, kmToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), message, Message.class); } V2MessageApiClient(HttpApiClient apiClient, LogMessageSource logMessage); }
V2MessageApiClient extends BaseMessageApiClient { public Message postMessage(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { validateParams(sessionToken, kmToken, streamId, message); String path = "/v2/stream/" + apiClient.escapeString(streamId) + "/message/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); headerParams.put(KM_TOKEN_HEADER_PARAM, kmToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), message, Message.class); } V2MessageApiClient(HttpApiClient apiClient, LogMessageSource logMessage); Message postMessage(String sessionToken, String kmToken, String streamId, Message message); }
V2MessageApiClient extends BaseMessageApiClient { public Message postMessage(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { validateParams(sessionToken, kmToken, streamId, message); String path = "/v2/stream/" + apiClient.escapeString(streamId) + "/message/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); headerParams.put(KM_TOKEN_HEADER_PARAM, kmToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), message, Message.class); } V2MessageApiClient(HttpApiClient apiClient, LogMessageSource logMessage); Message postMessage(String sessionToken, String kmToken, String streamId, Message message);  }