org.apache.rocketmq.test.message.MessageQueueMsg Java Examples

The following examples show how to use org.apache.rocketmq.test.message.MessageQueueMsg. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OrderMsgIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendOneQueue() {
    int msgSize = 20;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #2
Source File: OrderMsgIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendOneQueue() {
    int msgSize = 20;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #3
Source File: OrderMsgBroadCastIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;

    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
        new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListener()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #4
Source File: OrderMsgWithTagIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubAll() {
    int msgSize = 10;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #5
Source File: OrderMsgWithTagIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubTag() {
    int msgSize = 5;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #6
Source File: OrderMsgIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsg() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #7
Source File: OrderMsgIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsg() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #8
Source File: OrderMsgIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendOneQueue() {
    int msgSize = 20;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #9
Source File: OrderMsgIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendRandomQueues() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(
        MQMessageFactory.getMessageQueues(mqs.get(0), mqs.get(1), mqs.get(mqs.size() - 1)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #10
Source File: OrderMsgWithTagIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubAll() {
    int msgSize = 10;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #11
Source File: OrderMsgWithTagIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubTag() {
    int msgSize = 5;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #12
Source File: OrderMsgBroadCastIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;

    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
        new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListner()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #13
Source File: OrderMsgBroadCastIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;

    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
        new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListner()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #14
Source File: OrderMsgWithTagIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubTag() {
    int msgSize = 5;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #15
Source File: OrderMsgIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsg() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #16
Source File: OrderMsgBroadCastIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;

    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
        new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListener()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #17
Source File: OrderMsgIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendRandomQueues() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(
        MQMessageFactory.getMessageQueues(mqs.get(0), mqs.get(1), mqs.get(mqs.size() - 1)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #18
Source File: OrderMsgWithTagIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubAll() {
    int msgSize = 10;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #19
Source File: OrderMsgWithTagIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubTag() {
    int msgSize = 5;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #20
Source File: OrderMsgBroadCastIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;

    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
        new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListener()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example #21
Source File: OrderMsgWithTagIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubAll() {
    int msgSize = 10;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #22
Source File: OrderMsgIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendRandomQueues() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(
        MQMessageFactory.getMessageQueues(mqs.get(0), mqs.get(1), mqs.get(mqs.size() - 1)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #23
Source File: OrderMsgIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsg() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #24
Source File: OrderMsgIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendOneQueue() {
    int msgSize = 20;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #25
Source File: OrderMsgIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendRandomQueues() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(
        MQMessageFactory.getMessageQueues(mqs.get(0), mqs.get(1), mqs.get(mqs.size() - 1)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #26
Source File: OrderMsgWithTagIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubAll() {
    int msgSize = 10;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #27
Source File: OrderMsgWithTagIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsgWithTagSubTag() {
    int msgSize = 5;
    String tag = "jueyin_tag";
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQOrderListener());

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #28
Source File: OrderMsgBroadCastIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;

    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
        new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListner()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #29
Source File: OrderMsgIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendOneQueue() {
    int msgSize = 20;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)),
        msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example #30
Source File: OrderMsgIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testOrderMsg() {
    int msgSize = 10;
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(mqMsgs.getMsgBodys());

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
        .isEqualTo(true);
}