Search in sources :

Example 1 with ClientKillUnusedSegmentsTaskQuery

use of org.apache.druid.client.indexing.ClientKillUnusedSegmentsTaskQuery in project druid by druid-io.

the class ClientKillUnusedSegmentsTaskQuerySerdeTest method testClientKillUnusedSegmentsTaskQueryToKillUnusedSegmentsTask.

@Test
public void testClientKillUnusedSegmentsTaskQueryToKillUnusedSegmentsTask() throws IOException {
    final ClientKillUnusedSegmentsTaskQuery taskQuery = new ClientKillUnusedSegmentsTaskQuery("killTaskId", "datasource", Intervals.of("2020-01-01/P1D"), true);
    final byte[] json = objectMapper.writeValueAsBytes(taskQuery);
    final KillUnusedSegmentsTask fromJson = (KillUnusedSegmentsTask) objectMapper.readValue(json, Task.class);
    Assert.assertEquals(taskQuery.getId(), fromJson.getId());
    Assert.assertEquals(taskQuery.getDataSource(), fromJson.getDataSource());
    Assert.assertEquals(taskQuery.getInterval(), fromJson.getInterval());
    Assert.assertEquals(taskQuery.getMarkAsUnused(), fromJson.isMarkAsUnused());
}
Also used : ClientKillUnusedSegmentsTaskQuery(org.apache.druid.client.indexing.ClientKillUnusedSegmentsTaskQuery) Test(org.junit.Test)

Example 2 with ClientKillUnusedSegmentsTaskQuery

use of org.apache.druid.client.indexing.ClientKillUnusedSegmentsTaskQuery in project druid by druid-io.

the class ClientKillUnusedSegmentsTaskQuerySerdeTest method testKillUnusedSegmentsTaskToClientKillUnusedSegmentsTaskQuery.

@Test
public void testKillUnusedSegmentsTaskToClientKillUnusedSegmentsTaskQuery() throws IOException {
    final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(null, "datasource", Intervals.of("2020-01-01/P1D"), null, true);
    final byte[] json = objectMapper.writeValueAsBytes(task);
    final ClientKillUnusedSegmentsTaskQuery taskQuery = (ClientKillUnusedSegmentsTaskQuery) objectMapper.readValue(json, ClientTaskQuery.class);
    Assert.assertEquals(task.getId(), taskQuery.getId());
    Assert.assertEquals(task.getDataSource(), taskQuery.getDataSource());
    Assert.assertEquals(task.getInterval(), taskQuery.getInterval());
    Assert.assertEquals(task.isMarkAsUnused(), taskQuery.getMarkAsUnused());
}
Also used : ClientKillUnusedSegmentsTaskQuery(org.apache.druid.client.indexing.ClientKillUnusedSegmentsTaskQuery) ClientTaskQuery(org.apache.druid.client.indexing.ClientTaskQuery) Test(org.junit.Test)

Aggregations

ClientKillUnusedSegmentsTaskQuery (org.apache.druid.client.indexing.ClientKillUnusedSegmentsTaskQuery)2 Test (org.junit.Test)2 ClientTaskQuery (org.apache.druid.client.indexing.ClientTaskQuery)1