public void OffsetFetchResponse( [Values("test", "a really long name, with spaces and punctuation!")] string topicName, [Values(1, 10)] int topicsPerRequest, [Values(1, 5)] int partitionsPerTopic, [Values( ErrorResponseCode.None, ErrorResponseCode.UnknownTopicOrPartition, ErrorResponseCode.GroupLoadInProgress, ErrorResponseCode.NotCoordinatorForGroup, ErrorResponseCode.IllegalGeneration, ErrorResponseCode.UnknownMemberId, ErrorResponseCode.TopicAuthorizationFailed, ErrorResponseCode.GroupAuthorizationFailed )] ErrorResponseCode errorCode) { var topics = new List <OffsetFetchResponse.Topic>(); for (var t = 0; t < topicsPerRequest; t++) { for (var partitionId = 0; partitionId < partitionsPerTopic; partitionId++) { var offset = (long)_randomizer.Next(int.MinValue, int.MaxValue); topics.Add(new OffsetFetchResponse.Topic(topicName + t, partitionId, errorCode, offset, offset >= 0 ? topicName : string.Empty)); } } var response = new OffsetFetchResponse(topics); response.AssertCanEncodeDecodeResponse(0); }
public void OffsetFetchResponse( [Values("testTopic")] string topicName, [Values(1, 10)] int topicsPerRequest, [Values(1, 5)] int partitionsPerTopic, [Values( ErrorCode.NONE, ErrorCode.UNKNOWN_TOPIC_OR_PARTITION, ErrorCode.GROUP_LOAD_IN_PROGRESS, ErrorCode.NOT_COORDINATOR_FOR_GROUP, ErrorCode.ILLEGAL_GENERATION, ErrorCode.UNKNOWN_MEMBER_ID, ErrorCode.TOPIC_AUTHORIZATION_FAILED, ErrorCode.GROUP_AUTHORIZATION_FAILED )] ErrorCode errorCode) { var topics = new List <OffsetFetchResponse.Topic>(); for (var t = 0; t < topicsPerRequest; t++) { for (var partitionId = 0; partitionId < partitionsPerTopic; partitionId++) { var offset = (long)_randomizer.Next(int.MinValue, int.MaxValue); topics.Add(new OffsetFetchResponse.Topic(topicName + t, partitionId, errorCode, offset, offset >= 0 ? topicName : string.Empty)); } } var response = new OffsetFetchResponse(topics); response.AssertCanEncodeDecodeResponse(0); }