mirror of
https://github.com/apache/rocketmq.git
synced 2026-08-31 02:20:15 +08:00
style(client):Enable checkstyle for test code (#5211)
This commit is contained in:
@@ -59,4 +59,28 @@
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>${maven-checkstyle-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>validate</id>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<configLocation>${project.parent.basedir}/style/rmq_checkstyle.xml</configLocation>
|
||||
<inputEncoding>UTF-8</inputEncoding>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<failsOnError>true</failsOnError>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ValidatorsTest {
|
||||
Validators.checkBrokerConfig(brokerConfig);
|
||||
|
||||
try {
|
||||
brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_PRIORITY));;
|
||||
brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_PRIORITY));
|
||||
Validators.checkBrokerConfig(brokerConfig);
|
||||
} catch (MQClientException e) {
|
||||
assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
|
||||
@@ -162,7 +162,7 @@ public class ValidatorsTest {
|
||||
}
|
||||
|
||||
try {
|
||||
brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_PRIORITY | PermName.PERM_INHERIT));;
|
||||
brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_PRIORITY | PermName.PERM_INHERIT));
|
||||
Validators.checkBrokerConfig(brokerConfig);
|
||||
} catch (MQClientException e) {
|
||||
assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class DefaultLitePullConsumerTest {
|
||||
assertThat(result.get(0).getTopic()).isEqualTo(topic);
|
||||
assertThat(result.get(0).getBody()).isEqualTo(new byte[] {'a'});
|
||||
|
||||
Set<MessageQueue> assignment= litePullConsumer.assignment();
|
||||
Set<MessageQueue> assignment = litePullConsumer.assignment();
|
||||
assertThat(assignment.stream().findFirst().get()).isEqualTo(messageQueueSet.stream().findFirst().get());
|
||||
} finally {
|
||||
litePullConsumer.shutdown();
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class DefaultMQPushConsumerTest {
|
||||
private PullAPIWrapper pullAPIWrapper;
|
||||
private RebalanceImpl rebalanceImpl;
|
||||
private static DefaultMQPushConsumer pushConsumer;
|
||||
private AtomicLong queueOffset = new AtomicLong(1024);;
|
||||
private AtomicLong queueOffset = new AtomicLong(1024);
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
|
||||
+26
-54
@@ -56,10 +56,10 @@ public class AllocateMachineRoomNearByTest {
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
testWhenIDCSizeEquals(5,20,10, false);
|
||||
testWhenIDCSizeEquals(5,20,20, false);
|
||||
testWhenIDCSizeEquals(5,20,30, false);
|
||||
testWhenIDCSizeEquals(5,20,0, false );
|
||||
testWhenIDCSizeEquals(5,20,10);
|
||||
testWhenIDCSizeEquals(5,20,20);
|
||||
testWhenIDCSizeEquals(5,20,30);
|
||||
testWhenIDCSizeEquals(5,20,0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,18 +80,18 @@ public class AllocateMachineRoomNearByTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testRun10RandomCase(){
|
||||
for(int i=0;i<10;i++){
|
||||
int consumerSize = new Random().nextInt(200)+1;//1-200
|
||||
int queueSize = new Random().nextInt(100)+1;//1-100
|
||||
int brokerIDCSize = new Random().nextInt(10)+1;//1-10
|
||||
int consumerIDCSize = new Random().nextInt(10)+1;//1-10
|
||||
public void testRun10RandomCase() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int consumerSize = new Random().nextInt(200) + 1;//1-200
|
||||
int queueSize = new Random().nextInt(100) + 1;//1-100
|
||||
int brokerIDCSize = new Random().nextInt(10) + 1;//1-10
|
||||
int consumerIDCSize = new Random().nextInt(10) + 1;//1-10
|
||||
|
||||
if (brokerIDCSize == consumerIDCSize) {
|
||||
testWhenIDCSizeEquals(brokerIDCSize,queueSize,consumerSize,false);
|
||||
testWhenIDCSizeEquals(brokerIDCSize,queueSize,consumerSize);
|
||||
}
|
||||
else if (brokerIDCSize > consumerIDCSize) {
|
||||
testWhenConsumerIDCIsLess(brokerIDCSize,brokerIDCSize- consumerIDCSize, queueSize, consumerSize, false);
|
||||
testWhenConsumerIDCIsLess(brokerIDCSize,brokerIDCSize - consumerIDCSize, queueSize, consumerSize, false);
|
||||
} else {
|
||||
testWhenConsumerIDCIsMore(brokerIDCSize, consumerIDCSize - brokerIDCSize, queueSize, consumerSize, false);
|
||||
}
|
||||
@@ -101,36 +101,23 @@ public class AllocateMachineRoomNearByTest {
|
||||
|
||||
|
||||
|
||||
public void testWhenIDCSizeEquals(int IDCSize, int queueSize, int consumerSize, boolean print) {
|
||||
if (print) {
|
||||
System.out.println("Test : IDCSize = "+ IDCSize +"queueSize = " + queueSize +" consumerSize = " + consumerSize);
|
||||
}
|
||||
List<String> cidAll = prepareConsumer(IDCSize, consumerSize);
|
||||
List<MessageQueue> mqAll = prepareMQ(IDCSize, queueSize);
|
||||
public void testWhenIDCSizeEquals(int idcSize, int queueSize, int consumerSize) {
|
||||
List<String> cidAll = prepareConsumer(idcSize, consumerSize);
|
||||
List<MessageQueue> mqAll = prepareMQ(idcSize, queueSize);
|
||||
List<MessageQueue> resAll = new ArrayList<MessageQueue>();
|
||||
for (String currentID : cidAll) {
|
||||
List<MessageQueue> res = allocateMessageQueueStrategy.allocate("Test-C-G",currentID,mqAll,cidAll);
|
||||
if (print) {
|
||||
System.out.println("cid: "+currentID+"--> res :" +res);
|
||||
}
|
||||
for (MessageQueue mq : res) {
|
||||
Assert.assertTrue(machineRoomResolver.brokerDeployIn(mq).equals(machineRoomResolver.consumerDeployIn(currentID)));
|
||||
}
|
||||
resAll.addAll(res);
|
||||
}
|
||||
Assert.assertTrue(hasAllocateAllQ(cidAll,mqAll,resAll));
|
||||
|
||||
if (print) {
|
||||
System.out.println("-------------------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
public void testWhenConsumerIDCIsMore(int brokerIDCSize, int consumerMore, int queueSize, int consumerSize, boolean print) {
|
||||
if (print) {
|
||||
System.out.println("Test : IDCSize = "+ brokerIDCSize +" queueSize = " + queueSize +" consumerSize = " + consumerSize);
|
||||
}
|
||||
Set<String> brokerIDCWithConsumer = new TreeSet<String>();
|
||||
List<String> cidAll = prepareConsumer(brokerIDCSize +consumerMore, consumerSize);
|
||||
List<String> cidAll = prepareConsumer(brokerIDCSize + consumerMore, consumerSize);
|
||||
List<MessageQueue> mqAll = prepareMQ(brokerIDCSize, queueSize);
|
||||
for (MessageQueue mq : mqAll) {
|
||||
brokerIDCWithConsumer.add(machineRoomResolver.brokerDeployIn(mq));
|
||||
@@ -139,11 +126,8 @@ public class AllocateMachineRoomNearByTest {
|
||||
List<MessageQueue> resAll = new ArrayList<MessageQueue>();
|
||||
for (String currentID : cidAll) {
|
||||
List<MessageQueue> res = allocateMessageQueueStrategy.allocate("Test-C-G",currentID,mqAll,cidAll);
|
||||
if (print) {
|
||||
System.out.println("cid: "+currentID+"--> res :" +res);
|
||||
}
|
||||
for (MessageQueue mq : res) {
|
||||
if (brokerIDCWithConsumer.contains(machineRoomResolver.brokerDeployIn(mq))) {//healthy idc, so only consumer in this idc should be allocated
|
||||
if (brokerIDCWithConsumer.contains(machineRoomResolver.brokerDeployIn(mq))) { //healthy idc, so only consumer in this idc should be allocated
|
||||
Assert.assertTrue(machineRoomResolver.brokerDeployIn(mq).equals(machineRoomResolver.consumerDeployIn(currentID)));
|
||||
}
|
||||
}
|
||||
@@ -151,15 +135,9 @@ public class AllocateMachineRoomNearByTest {
|
||||
}
|
||||
|
||||
Assert.assertTrue(hasAllocateAllQ(cidAll,mqAll,resAll));
|
||||
if (print) {
|
||||
System.out.println("-------------------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
public void testWhenConsumerIDCIsLess(int brokerIDCSize, int consumerIDCLess, int queueSize, int consumerSize, boolean print) {
|
||||
if (print) {
|
||||
System.out.println("Test : IDCSize = "+ brokerIDCSize +" queueSize = " + queueSize +" consumerSize = " + consumerSize);
|
||||
}
|
||||
Set<String> healthyIDC = new TreeSet<String>();
|
||||
List<String> cidAll = prepareConsumer(brokerIDCSize - consumerIDCLess, consumerSize);
|
||||
List<MessageQueue> mqAll = prepareMQ(brokerIDCSize, queueSize);
|
||||
@@ -172,10 +150,7 @@ public class AllocateMachineRoomNearByTest {
|
||||
for (String currentID : cidAll) {
|
||||
String currentIDC = machineRoomResolver.consumerDeployIn(currentID);
|
||||
List<MessageQueue> res = allocateMessageQueueStrategy.allocate("Test-C-G",currentID,mqAll,cidAll);
|
||||
if (print) {
|
||||
System.out.println("cid: "+currentID+"--> res :" +res);
|
||||
}
|
||||
if ( !idc2Res.containsKey(currentIDC)) {
|
||||
if (!idc2Res.containsKey(currentIDC)) {
|
||||
idc2Res.put(currentIDC, new ArrayList<MessageQueue>());
|
||||
}
|
||||
idc2Res.get(currentIDC).addAll(res);
|
||||
@@ -189,14 +164,11 @@ public class AllocateMachineRoomNearByTest {
|
||||
}
|
||||
|
||||
Assert.assertTrue(hasAllocateAllQ(cidAll,mqAll,resAll));
|
||||
if (print) {
|
||||
System.out.println("-------------------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean hasAllocateAllQ(List<String> cidAll,List<MessageQueue> mqAll, List<MessageQueue> allocatedResAll) {
|
||||
if (cidAll.isEmpty()){
|
||||
if (cidAll.isEmpty()) {
|
||||
return allocatedResAll.isEmpty();
|
||||
}
|
||||
return mqAll.containsAll(allocatedResAll) && allocatedResAll.containsAll(mqAll) && mqAll.size() == allocatedResAll.size();
|
||||
@@ -206,7 +178,7 @@ public class AllocateMachineRoomNearByTest {
|
||||
private List<String> createConsumerIdList(String machineRoom, int size) {
|
||||
List<String> consumerIdList = new ArrayList<String>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
consumerIdList.add(machineRoom +"-"+CID_PREFIX + String.valueOf(i));
|
||||
consumerIdList.add(machineRoom + "-" + CID_PREFIX + String.valueOf(i));
|
||||
}
|
||||
return consumerIdList;
|
||||
}
|
||||
@@ -214,7 +186,7 @@ public class AllocateMachineRoomNearByTest {
|
||||
private List<MessageQueue> createMessageQueueList(String machineRoom, int size) {
|
||||
List<MessageQueue> messageQueueList = new ArrayList<MessageQueue>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
MessageQueue mq = new MessageQueue(topic, machineRoom+"-brokerName", i);
|
||||
MessageQueue mq = new MessageQueue(topic, machineRoom + "-brokerName", i);
|
||||
messageQueueList.add(mq);
|
||||
}
|
||||
return messageQueueList;
|
||||
@@ -222,17 +194,17 @@ public class AllocateMachineRoomNearByTest {
|
||||
|
||||
private List<MessageQueue> prepareMQ(int brokerIDCSize, int queueSize) {
|
||||
List<MessageQueue> mqAll = new ArrayList<MessageQueue>();
|
||||
for (int i=1;i<=brokerIDCSize;i++) {
|
||||
mqAll.addAll(createMessageQueueList("IDC"+i, queueSize));
|
||||
for (int i = 1; i <= brokerIDCSize; i++) {
|
||||
mqAll.addAll(createMessageQueueList("IDC" + i, queueSize));
|
||||
}
|
||||
|
||||
return mqAll;
|
||||
}
|
||||
|
||||
private List<String> prepareConsumer( int IDCSize, int consumerSize) {
|
||||
private List<String> prepareConsumer(int idcSize, int consumerSize) {
|
||||
List<String> cidAll = new ArrayList<String>();
|
||||
for (int i=1;i<=IDCSize;i++) {
|
||||
cidAll.addAll(createConsumerIdList("IDC"+i, consumerSize));
|
||||
for (int i = 1; i <= idcSize; i++) {
|
||||
cidAll.addAll(createConsumerIdList("IDC" + i, consumerSize));
|
||||
}
|
||||
return cidAll;
|
||||
}
|
||||
|
||||
+2
-22
@@ -38,23 +38,12 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
topic = "topic_test";
|
||||
}
|
||||
|
||||
public void printMessageQueue(List<MessageQueue> messageQueueList, String name) {
|
||||
if (messageQueueList == null || messageQueueList.size() < 1)
|
||||
return;
|
||||
System.out.println(name + ".......................................start");
|
||||
for (MessageQueue messageQueue : messageQueueList) {
|
||||
System.out.println(messageQueue);
|
||||
}
|
||||
System.out.println(name + ".......................................end");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCurrentCIDNotExists() {
|
||||
String currentCID = String.valueOf(Integer.MAX_VALUE);
|
||||
List<String> consumerIdList = createConsumerIdList(2);
|
||||
List<MessageQueue> messageQueueList = createMessageQueueList(6);
|
||||
List<MessageQueue> result = new AllocateMessageQueueConsistentHash().allocate("", currentCID, messageQueueList, consumerIdList);
|
||||
printMessageQueue(result, "testCurrentCIDNotExists");
|
||||
Assert.assertEquals(result.size(), 0);
|
||||
}
|
||||
|
||||
@@ -106,7 +95,6 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
AllocateMessageQueueStrategy allocateMessageQueueConsistentHash = new AllocateMessageQueueConsistentHash(3);
|
||||
|
||||
List<MessageQueue> mqAll = createMessageQueueList(queueSize);
|
||||
//System.out.println("mqAll:" + mqAll.toString());
|
||||
|
||||
List<String> cidAll = createConsumerIdList(consumerSize);
|
||||
List<MessageQueue> allocatedResAll = new ArrayList<MessageQueue>();
|
||||
@@ -117,14 +105,12 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
|
||||
List<String> cidBegin = new ArrayList<String>(cidAll);
|
||||
|
||||
//System.out.println("cidAll:" + cidBegin.toString());
|
||||
for (String cid : cidBegin) {
|
||||
List<MessageQueue> rs = allocateMessageQueueConsistentHash.allocate("testConsumerGroup", cid, mqAll, cidBegin);
|
||||
for (MessageQueue mq : rs) {
|
||||
allocateToAllOrigin.put(mq, cid);
|
||||
}
|
||||
allocatedResAll.addAll(rs);
|
||||
//System.out.println("rs[" + cid + "]:" + rs.toString());
|
||||
}
|
||||
|
||||
Assert.assertTrue(
|
||||
@@ -136,7 +122,6 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
//test allocate remove one cid
|
||||
{
|
||||
String removeCID = cidAfterRemoveOne.remove(0);
|
||||
//System.out.println("removing one cid "+removeCID);
|
||||
List<MessageQueue> mqShouldOnlyChanged = new ArrayList<MessageQueue>();
|
||||
Iterator<Map.Entry<MessageQueue, String>> it = allocateToAllOrigin.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
@@ -146,7 +131,6 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
}
|
||||
}
|
||||
|
||||
//System.out.println("cidAll:" + cidAfterRemoveOne.toString());
|
||||
List<MessageQueue> allocatedResAllAfterRemove = new ArrayList<MessageQueue>();
|
||||
for (String cid : cidAfterRemoveOne) {
|
||||
List<MessageQueue> rs = allocateMessageQueueConsistentHash.allocate("testConsumerGroup", cid, mqAll, cidAfterRemoveOne);
|
||||
@@ -154,7 +138,6 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
for (MessageQueue mq : rs) {
|
||||
allocateToAllAfterRemoveOne.put(mq, cid);
|
||||
}
|
||||
//System.out.println("rs[" + cid + "]:" + "[" + rs.size() + "]" + rs.toString());
|
||||
}
|
||||
|
||||
Assert.assertTrue("queueSize" + queueSize + "consumerSize:" + consumerSize + "\nmqAll:" + mqAll + "\nallocatedResAllAfterRemove" + allocatedResAllAfterRemove,
|
||||
@@ -166,10 +149,8 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
//test allocate add one more cid
|
||||
{
|
||||
String newCid = CID_PREFIX + "NEW";
|
||||
//System.out.println("add one more cid "+newCid);
|
||||
cidAfterAdd.add(newCid);
|
||||
List<MessageQueue> mqShouldOnlyChanged = new ArrayList<MessageQueue>();
|
||||
//System.out.println("cidAll:" + cidAfterAdd.toString());
|
||||
List<MessageQueue> allocatedResAllAfterAdd = new ArrayList<MessageQueue>();
|
||||
Map<MessageQueue, String> allocateToAll3 = new TreeMap<MessageQueue, String>();
|
||||
for (String cid : cidAfterAdd) {
|
||||
@@ -181,7 +162,6 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
mqShouldOnlyChanged.add(mq);
|
||||
}
|
||||
}
|
||||
//System.out.println("rs[" + cid + "]:" + "[" + rs.size() + "]" + rs.toString());
|
||||
}
|
||||
|
||||
Assert.assertTrue(
|
||||
@@ -204,7 +184,7 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
String allocateToOrigin = allocateToBefore.get(mq);
|
||||
if (allocateToOrigin.equals(removeCID)) {
|
||||
|
||||
} else {//the rest queue should be the same
|
||||
} else { //the rest queue should be the same
|
||||
Assert.assertTrue(allocateAfter.get(mq).equals(allocateToOrigin));//should be the same
|
||||
}
|
||||
}
|
||||
@@ -217,7 +197,7 @@ public class AllocateMessageQueueConsitentHashTest {
|
||||
String allocateToAfter = allocateAfter.get(mq);
|
||||
if (allocateToAfter.equals(newCID)) {
|
||||
|
||||
} else {//the rest queue should be the same
|
||||
} else { //the rest queue should be the same
|
||||
Assert.assertTrue("it was allocated to " + allocateToOrigin + ". Now, it is to " + allocateAfter.get(mq) + " mq:" + mq, allocateAfter.get(mq).equals(allocateToOrigin));//should be the same
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -256,7 +256,6 @@ public class ConsumeMessageConcurrentlyServiceTest {
|
||||
PullMessageService pullMessageService = mQClientFactory.getPullMessageService();
|
||||
pullMessageService.executePullRequestImmediately(createPullRequest());
|
||||
countDownLatch.await();
|
||||
System.out.println(consumeThreadName.get());
|
||||
if (consumeGroup2.length() <= 100) {
|
||||
assertThat(consumeThreadName.get()).startsWith("ConsumeMessageThread_" + consumeGroup2 + "_");
|
||||
} else {
|
||||
|
||||
-1
@@ -225,7 +225,6 @@ public class ConsumeMessageOrderlyServiceTest {
|
||||
PullMessageService pullMessageService = mQClientFactory.getPullMessageService();
|
||||
pullMessageService.executePullRequestImmediately(createPullRequest());
|
||||
countDownLatch.await();
|
||||
System.out.println(consumeThreadName.get());
|
||||
if (consumeGroup2.length() <= 100) {
|
||||
assertThat(consumeThreadName.get()).startsWith("ConsumeMessageThread_" + consumeGroup2 + "_");
|
||||
} else {
|
||||
|
||||
-1
@@ -65,7 +65,6 @@ public class DefaultMQPushConsumerImplTest {
|
||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
|
||||
ConsumeConcurrentlyContext context) {
|
||||
System.out.println(" Receive New Messages: " + msgs);
|
||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
||||
}
|
||||
});
|
||||
|
||||
+3
-3
@@ -53,9 +53,9 @@ public class RebalanceLitePullImplTest {
|
||||
@Test
|
||||
public void testComputePullFromWhereWithException_ne_minus1() throws MQClientException {
|
||||
for (ConsumeFromWhere where : new ConsumeFromWhere[]{
|
||||
ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_TIMESTAMP}) {
|
||||
ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_TIMESTAMP}) {
|
||||
consumer.setConsumeFromWhere(where);
|
||||
|
||||
when(offsetStore.readOffset(any(MessageQueue.class), any(ReadOffsetType.class))).thenReturn(0L);
|
||||
|
||||
+3
-3
@@ -175,9 +175,9 @@ public class RebalancePushImplTest {
|
||||
@Test
|
||||
public void testComputePullFromWhereWithException_ne_minus1() throws MQClientException {
|
||||
for (ConsumeFromWhere where : new ConsumeFromWhere[]{
|
||||
ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_TIMESTAMP}) {
|
||||
ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET,
|
||||
ConsumeFromWhere.CONSUME_FROM_TIMESTAMP}) {
|
||||
consumer.setConsumeFromWhere(where);
|
||||
|
||||
when(offsetStore.readOffset(any(MessageQueue.class), any(ReadOffsetType.class))).thenReturn(0L);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class SelectMessageQueueRetryTest {
|
||||
topicPublishInfo.setMessageQueueList(messageQueueList);
|
||||
|
||||
Set<String> retryBrokerNameSet = retryBroker(topicPublishInfo);
|
||||
//always in Set (broker-0,broker-1,broker-2)
|
||||
//always in Set (broker-0, broker-1, broker-2)
|
||||
assertThat(retryBroker(topicPublishInfo)).isEqualTo(retryBrokerNameSet);
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -54,7 +54,11 @@ import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
|
||||
Reference in New Issue
Block a user