Search in sources :

Example 1 with CommandStatuses

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);
}
Also used : Response(javax.ws.rs.core.Response) CommandStatuses(io.confluent.ksql.rest.entity.CommandStatuses)

Example 2 with CommandStatuses

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();
}
Also used : CommandStatus(io.confluent.ksql.rest.entity.CommandStatus) CommandStatuses(io.confluent.ksql.rest.entity.CommandStatuses) HashMap(java.util.HashMap) CommandId(io.confluent.ksql.rest.server.computation.CommandId) GET(javax.ws.rs.GET)

Example 3 with CommandStatuses

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);
}
Also used : CommandStatus(io.confluent.ksql.rest.entity.CommandStatus) CommandStatuses(io.confluent.ksql.rest.entity.CommandStatuses) EasyMock.anyObject(org.easymock.EasyMock.anyObject) CommandId(io.confluent.ksql.rest.server.computation.CommandId) Test(org.junit.Test)

Example 4 with CommandStatuses

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);
}
Also used : CommandStatuses(io.confluent.ksql.rest.entity.CommandStatuses) CommandId(io.confluent.ksql.rest.server.computation.CommandId) Test(org.junit.Test)

Aggregations

CommandStatuses (io.confluent.ksql.rest.entity.CommandStatuses)4 CommandId (io.confluent.ksql.rest.server.computation.CommandId)3 CommandStatus (io.confluent.ksql.rest.entity.CommandStatus)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 GET (javax.ws.rs.GET)1 Response (javax.ws.rs.core.Response)1 EasyMock.anyObject (org.easymock.EasyMock.anyObject)1