jyothsnakonisa commented on code in PR #193: URL: https://github.com/apache/cassandra-sidecar/pull/193#discussion_r1980406174
########## client/src/testFixtures/java/org/apache/cassandra/sidecar/client/SidecarClientTest.java: ########## @@ -1624,6 +1629,44 @@ public void onError(Throwable throwable) assertThat(new String(baos.toByteArray(), StandardCharsets.UTF_8)).isEqualTo("Test Content"); } + @Test + public void testsGetServiceSuccessTests() throws IOException, ExecutionException, InterruptedException + { + List<GetServicesConfigPayload.Service> services = new ArrayList<>(); + Map<String, String> kafkaConfigs = new HashMap<>(); + kafkaConfigs.put("k1", "v1"); + kafkaConfigs.put("k2", "v2"); + Map<String, String> cdcConfigs = new HashMap<>(); + cdcConfigs.put("k1", "v1"); + cdcConfigs.put("k2", "v2"); + services.add(new GetServicesConfigPayload.Service("kafka", kafkaConfigs)); + services.add(new GetServicesConfigPayload.Service("cdc", cdcConfigs)); + GetServicesConfigPayload expectedResponse = new GetServicesConfigPayload(services); + + MockResponse response = new MockResponse(); + response.setResponseCode(200); + response.setHeader("content-type", "application/json"); + ObjectMapper mapper = new ObjectMapper(); + response.setBody(mapper.writeValueAsString(expectedResponse)); + enqueue(response); + assertThat(client.getServiceConfig().get()).isEqualTo(expectedResponse); + } + + @Test + public void testsPutCdcServiceSuccessTests() throws IOException, ExecutionException, InterruptedException + { + Map<String, String> payload = new HashMap<>(); + payload.put("testKey", "testValue"); + PutCdcServiceConfigPayload putResponse = new PutCdcServiceConfigPayload(payload); + MockResponse response = new MockResponse(); + response.setResponseCode(200); + response.setHeader("content-type", "application/json"); + ObjectMapper mapper = new ObjectMapper(); + response.setBody(mapper.writeValueAsString(putResponse)); + enqueue(response); + assertThat(client.putCdcServiceConfig(ServiceConfig.CDC, payload).get()).isEqualTo(putResponse); Review Comment: @frankgh Added those assertions. @bbotella I think using client, It is not possible to test the invalid scenario with service and map. Since service is an enum a wrong value can't be passed and for the configs, as long as they are a map of strings we shouldn't see any errors and users can't pass anything other than map of strings. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org