use of org.apache.kafka.common.errors.LogDirNotFoundException in project kafka by apache.
the class AlterReplicaLogDirsRequestTest method testErrorResponse.
@Test
public void testErrorResponse() {
AlterReplicaLogDirsRequestData data = new AlterReplicaLogDirsRequestData().setDirs(new AlterReplicaLogDirCollection(singletonList(new AlterReplicaLogDir().setPath("/data0").setTopics(new AlterReplicaLogDirTopicCollection(singletonList(new AlterReplicaLogDirTopic().setName("topic").setPartitions(asList(0, 1, 2))).iterator()))).iterator()));
AlterReplicaLogDirsResponse errorResponse = new AlterReplicaLogDirsRequest.Builder(data).build().getErrorResponse(123, new LogDirNotFoundException("/data0"));
assertEquals(1, errorResponse.data().results().size());
AlterReplicaLogDirTopicResult topicResponse = errorResponse.data().results().get(0);
assertEquals("topic", topicResponse.topicName());
assertEquals(3, topicResponse.partitions().size());
for (int i = 0; i < 3; i++) {
assertEquals(i, topicResponse.partitions().get(i).partitionIndex());
assertEquals(Errors.LOG_DIR_NOT_FOUND.code(), topicResponse.partitions().get(i).errorCode());
}
}
Aggregations