@ -366,7 +366,7 @@ public class KafkaConsumerTest {
@@ -366,7 +366,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -407,7 +407,7 @@ public class KafkaConsumerTest {
@@ -407,7 +407,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -448,7 +448,7 @@ public class KafkaConsumerTest {
@@ -448,7 +448,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -484,7 +484,7 @@ public class KafkaConsumerTest {
@@ -484,7 +484,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -534,7 +534,7 @@ public class KafkaConsumerTest {
@@ -534,7 +534,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -581,7 +581,7 @@ public class KafkaConsumerTest {
@@ -581,7 +581,7 @@ public class KafkaConsumerTest {
topicMetadata . put ( unmatchedTopic , 1 ) ;
Cluster cluster = TestUtils . clusterWith ( 1 , topicMetadata ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -621,7 +621,7 @@ public class KafkaConsumerTest {
@@ -621,7 +621,7 @@ public class KafkaConsumerTest {
topicMetadata . put ( otherTopic , 1 ) ;
Cluster cluster = TestUtils . clusterWith ( 1 , topicMetadata ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -664,7 +664,7 @@ public class KafkaConsumerTest {
@@ -664,7 +664,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -720,7 +720,7 @@ public class KafkaConsumerTest {
@@ -720,7 +720,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
final Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
final MockClient client = new MockClient ( time , metadata ) ;
@ -760,7 +760,7 @@ public class KafkaConsumerTest {
@@ -760,7 +760,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( singletonMap ( topic , 1 ) ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -808,7 +808,7 @@ public class KafkaConsumerTest {
@@ -808,7 +808,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( tpCounts ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -928,7 +928,7 @@ public class KafkaConsumerTest {
@@ -928,7 +928,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( tpCounts ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -996,7 +996,7 @@ public class KafkaConsumerTest {
@@ -996,7 +996,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( tpCounts ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -1061,7 +1061,7 @@ public class KafkaConsumerTest {
@@ -1061,7 +1061,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( tpCounts ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -1122,7 +1122,7 @@ public class KafkaConsumerTest {
@@ -1122,7 +1122,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 2 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -1268,7 +1268,7 @@ public class KafkaConsumerTest {
@@ -1268,7 +1268,7 @@ public class KafkaConsumerTest {
Cluster cluster = TestUtils . singletonCluster ( topic , 1 ) ;
Node node = cluster . nodes ( ) . get ( 0 ) ;
Metadata metadata = new Metadata ( 0 , Long . MAX_VALUE ) ;
Metadata metadata = createMetadata ( ) ;
metadata . update ( cluster , Collections . < String > emptySet ( ) , time . milliseconds ( ) ) ;
MockClient client = new MockClient ( time , metadata ) ;
@ -1372,6 +1372,10 @@ public class KafkaConsumerTest {
@@ -1372,6 +1372,10 @@ public class KafkaConsumerTest {
} ;
}
private Metadata createMetadata ( ) {
return new Metadata ( 0 , Long . MAX_VALUE , true ) ;
}
private Node prepareRebalance ( MockClient client , Node node , final Set < String > subscribedTopics , PartitionAssignor assignor , List < TopicPartition > partitions , Node coordinator ) {
if ( coordinator = = null ) {
// lookup coordinator