Search in sources :

Example 31 with MockScheduler

use of org.apache.kafka.common.utils.MockScheduler in project kafka by apache.

the class CoordinatorTest method testCoordinatorUptime.

@Test
public void testCoordinatorUptime() throws Exception {
    MockTime time = new MockTime(0, 200, 0);
    Scheduler scheduler = new MockScheduler(time);
    try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder().addCoordinator("node01").scheduler(scheduler).build()) {
        UptimeResponse uptime = cluster.coordinatorClient().uptime();
        assertEquals(cluster.coordinator().uptime(), uptime);
        time.setCurrentTimeMs(250);
        assertNotEquals(cluster.coordinator().uptime(), uptime);
    }
}
Also used : UptimeResponse(org.apache.kafka.trogdor.rest.UptimeResponse) MockScheduler(org.apache.kafka.common.utils.MockScheduler) MockScheduler(org.apache.kafka.common.utils.MockScheduler) Scheduler(org.apache.kafka.common.utils.Scheduler) MiniTrogdorCluster(org.apache.kafka.trogdor.common.MiniTrogdorCluster) MockTime(org.apache.kafka.common.utils.MockTime) Test(org.junit.jupiter.api.Test)

Aggregations

MockScheduler (org.apache.kafka.common.utils.MockScheduler)31 MockTime (org.apache.kafka.common.utils.MockTime)31 ExpectedTaskBuilder (org.apache.kafka.trogdor.common.ExpectedTasks.ExpectedTaskBuilder)24 Test (org.junit.jupiter.api.Test)24 ExpectedTasks (org.apache.kafka.trogdor.common.ExpectedTasks)22 WorkerRunning (org.apache.kafka.trogdor.rest.WorkerRunning)19 NoOpTaskSpec (org.apache.kafka.trogdor.task.NoOpTaskSpec)18 Scheduler (org.apache.kafka.common.utils.Scheduler)15 MiniTrogdorCluster (org.apache.kafka.trogdor.common.MiniTrogdorCluster)15 TextNode (com.fasterxml.jackson.databind.node.TextNode)14 CreateTaskRequest (org.apache.kafka.trogdor.rest.CreateTaskRequest)14 WorkerDone (org.apache.kafka.trogdor.rest.WorkerDone)14 TaskPending (org.apache.kafka.trogdor.rest.TaskPending)12 TaskRunning (org.apache.kafka.trogdor.rest.TaskRunning)12 CreateWorkerRequest (org.apache.kafka.trogdor.rest.CreateWorkerRequest)10 TaskDone (org.apache.kafka.trogdor.rest.TaskDone)9 Test (org.junit.Test)7 DestroyTaskRequest (org.apache.kafka.trogdor.rest.DestroyTaskRequest)6 StopTaskRequest (org.apache.kafka.trogdor.rest.StopTaskRequest)6 Subject (javax.security.auth.Subject)5