Search in sources :

Example 1 with LogDirNotFoundException

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());
    }
}
Also used : AlterReplicaLogDir(org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDir) AlterReplicaLogDirTopicCollection(org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDirTopicCollection) AlterReplicaLogDirsRequestData(org.apache.kafka.common.message.AlterReplicaLogDirsRequestData) LogDirNotFoundException(org.apache.kafka.common.errors.LogDirNotFoundException) AlterReplicaLogDirTopicResult(org.apache.kafka.common.message.AlterReplicaLogDirsResponseData.AlterReplicaLogDirTopicResult) AlterReplicaLogDirTopic(org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDirTopic) AlterReplicaLogDirCollection(org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDirCollection) Test(org.junit.jupiter.api.Test)

Aggregations

LogDirNotFoundException (org.apache.kafka.common.errors.LogDirNotFoundException)1 AlterReplicaLogDirsRequestData (org.apache.kafka.common.message.AlterReplicaLogDirsRequestData)1 AlterReplicaLogDir (org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDir)1 AlterReplicaLogDirCollection (org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDirCollection)1 AlterReplicaLogDirTopic (org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDirTopic)1 AlterReplicaLogDirTopicCollection (org.apache.kafka.common.message.AlterReplicaLogDirsRequestData.AlterReplicaLogDirTopicCollection)1 AlterReplicaLogDirTopicResult (org.apache.kafka.common.message.AlterReplicaLogDirsResponseData.AlterReplicaLogDirTopicResult)1 Test (org.junit.jupiter.api.Test)1