use of io.confluent.ksql.rest.entity.CommandStatuses in project ksql by confluentinc.
the class KsqlRestClient method makeStatusRequest.
public RestResponse<CommandStatuses> makeStatusRequest() {
Response response = makeGetRequest("status");
CommandStatuses result = response.readEntity(CommandStatuses.class);
response.close();
return RestResponse.successful(result);
}
use of io.confluent.ksql.rest.entity.CommandStatuses in project ksql by confluentinc.
the class MockStatusResource method getAllStatuses.
@GET
public Response getAllStatuses() {
Map<CommandId, CommandStatus.Status> statuses = new HashMap<>();
statuses.put(new CommandId(CommandId.Type.TOPIC, "c1", CommandId.Action.CREATE), CommandStatus.Status.SUCCESS);
statuses.put(new CommandId(CommandId.Type.TOPIC, "c2", CommandId.Action.CREATE), CommandStatus.Status.ERROR);
CommandStatuses commandStatuses = new CommandStatuses(statuses);
return Response.ok(commandStatuses).build();
}
use of io.confluent.ksql.rest.entity.CommandStatuses in project ksql by confluentinc.
the class StatusResourceTest method testGetAllStatuses.
@Test
public void testGetAllStatuses() {
StatusResource testResource = getTestStatusResource();
Object statusesEntity = testResource.getAllStatuses().getEntity();
assertThat(statusesEntity, instanceOf(CommandStatuses.class));
CommandStatuses testCommandStatuses = (CommandStatuses) statusesEntity;
Map<CommandId, CommandStatus.Status> expectedCommandStatuses = CommandStatuses.fromFullStatuses(mockCommandStatuses);
assertEquals(expectedCommandStatuses, testCommandStatuses);
}
use of io.confluent.ksql.rest.entity.CommandStatuses in project ksql by confluentinc.
the class KsqlRestClientTest method testStatus.
@Test
public void testStatus() {
RestResponse<CommandStatuses> commandStatusesRestResponse = ksqlRestClient.makeStatusRequest();
Assert.assertNotNull(commandStatusesRestResponse);
Assert.assertTrue(commandStatusesRestResponse.isSuccessful());
CommandStatuses commandStatuses = commandStatusesRestResponse.getResponse();
Assert.assertTrue(commandStatuses.size() == 2);
Assert.assertTrue(commandStatuses.get(new CommandId(CommandId.Type.TOPIC, "c1", CommandId.Action.CREATE)) == CommandStatus.Status.SUCCESS);
Assert.assertTrue(commandStatuses.get(new CommandId(CommandId.Type.TOPIC, "c2", CommandId.Action.CREATE)) == CommandStatus.Status.ERROR);
}
Aggregations