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());
}
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());
}
Aggregations