Search in sources :

Example 11 with TaskDone

use of org.apache.kafka.trogdor.rest.TaskDone 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)11 MockScheduler (org.apache.kafka.common.utils.MockScheduler)9 MockTime (org.apache.kafka.common.utils.MockTime)9 ExpectedTasks (org.apache.kafka.trogdor.common.ExpectedTasks)9 ExpectedTaskBuilder (org.apache.kafka.trogdor.common.ExpectedTasks.ExpectedTaskBuilder)9 CreateTaskRequest (org.apache.kafka.trogdor.rest.CreateTaskRequest)9 TaskPending (org.apache.kafka.trogdor.rest.TaskPending)9 TaskRunning (org.apache.kafka.trogdor.rest.TaskRunning)9 NoOpTaskSpec (org.apache.kafka.trogdor.task.NoOpTaskSpec)9 Scheduler (org.apache.kafka.common.utils.Scheduler)8 MiniTrogdorCluster (org.apache.kafka.trogdor.common.MiniTrogdorCluster)8 WorkerRunning (org.apache.kafka.trogdor.rest.WorkerRunning)8 WorkerDone (org.apache.kafka.trogdor.rest.WorkerDone)7 Test (org.junit.jupiter.api.Test)7 TextNode (com.fasterxml.jackson.databind.node.TextNode)5 AgentClient (org.apache.kafka.trogdor.agent.AgentClient)4 StopTaskRequest (org.apache.kafka.trogdor.rest.StopTaskRequest)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 DestroyTaskRequest (org.apache.kafka.trogdor.rest.DestroyTaskRequest)3 TaskRequest (org.apache.kafka.trogdor.rest.TaskRequest)2