Search in sources :

Example 1 with TaskStopping

use of org.apache.kafka.trogdor.rest.TaskStopping in project kafka by apache.

the class CoordinatorClientTest method testPrettyPrintTaskInfo.

@Test
public void testPrettyPrintTaskInfo() {
    assertEquals("Will start at 2019-01-08T07:05:59.85Z", CoordinatorClient.prettyPrintTaskInfo(new TaskPending(new NoOpTaskSpec(1546931159850L, 9000)), ZoneOffset.UTC));
    assertEquals("Started 2009-07-07T01:45:59.85Z; will stop after 9s", CoordinatorClient.prettyPrintTaskInfo(new TaskRunning(new NoOpTaskSpec(1146931159850L, 9000), 1246931159850L, JsonNodeFactory.instance.objectNode()), ZoneOffset.UTC));
    assertEquals("Started 2009-07-07T01:45:59.85Z", CoordinatorClient.prettyPrintTaskInfo(new TaskStopping(new NoOpTaskSpec(1146931159850L, 9000), 1246931159850L, JsonNodeFactory.instance.objectNode()), ZoneOffset.UTC));
    assertEquals("FINISHED at 2019-01-08T20:59:29.85Z after 10s", CoordinatorClient.prettyPrintTaskInfo(new TaskDone(new NoOpTaskSpec(0, 1000), 1546981159850L, 1546981169850L, "", false, JsonNodeFactory.instance.objectNode()), ZoneOffset.UTC));
    assertEquals("CANCELLED at 2019-01-08T20:59:29.85Z after 10s", CoordinatorClient.prettyPrintTaskInfo(new TaskDone(new NoOpTaskSpec(0, 1000), 1546981159850L, 1546981169850L, "", true, JsonNodeFactory.instance.objectNode()), ZoneOffset.UTC));
    assertEquals("FAILED at 2019-01-08T20:59:29.85Z after 10s", CoordinatorClient.prettyPrintTaskInfo(new TaskDone(new NoOpTaskSpec(0, 1000), 1546981159850L, 1546981169850L, "foobar", true, JsonNodeFactory.instance.objectNode()), ZoneOffset.UTC));
}
Also used : TaskPending(org.apache.kafka.trogdor.rest.TaskPending) TaskDone(org.apache.kafka.trogdor.rest.TaskDone) TaskRunning(org.apache.kafka.trogdor.rest.TaskRunning) NoOpTaskSpec(org.apache.kafka.trogdor.task.NoOpTaskSpec) TaskStopping(org.apache.kafka.trogdor.rest.TaskStopping) Test(org.junit.jupiter.api.Test)

Aggregations

TaskDone (org.apache.kafka.trogdor.rest.TaskDone)1 TaskPending (org.apache.kafka.trogdor.rest.TaskPending)1 TaskRunning (org.apache.kafka.trogdor.rest.TaskRunning)1 TaskStopping (org.apache.kafka.trogdor.rest.TaskStopping)1 NoOpTaskSpec (org.apache.kafka.trogdor.task.NoOpTaskSpec)1 Test (org.junit.jupiter.api.Test)1