ApplicationMasterRestClient implements Closeable { public Map<String, Object> getConfig() throws IOException { String jsonString = getEntityAsJson("/config", "config"); return jsonMapper.readValue(jsonString, new TypeReference<Map<String, Object>>() { }); } ApplicationMasterRestClient(CloseableHttpClient client, String amHostName, int amRpcPort); Map<String, Map<String, Object>> getMetrics(); Map<String, Object> getTaskContext(); Map<String, Object> getAmState(); Map<String, Object> getConfig(); @Override void close(); @Override String toString();  }
@Test public void testGetConfigSuccess() throws IOException { SamzaApplicationState samzaAppState = createSamzaApplicationState(); Map<String, String> configMap = ImmutableMap.of("key1", "value1", "key2", "value2"); Config config = new MapConfig(configMap); String response = ApplicationMasterRestServlet.getConfig(jsonMapper, config); setupMockClientResponse(HttpStatus.SC_OK, "Success", response); ApplicationMasterRestClient client = new ApplicationMasterRestClient(mockClient, AM_HOST_NAME, AM_RPC_PORT); Map<String, Object> configResult = client.getConfig(); assertEquals(configMap, configResult); }
@Test public void testGetConfigError() throws IOException { setupErrorTest("config"); ApplicationMasterRestClient client = new ApplicationMasterRestClient(mockClient, AM_HOST_NAME, AM_RPC_PORT); client.getConfig(); }