Search in sources :

Example 11 with RMQNormalListener

use of org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener in project rocketmq by apache.

the class TagMessageWith1ConsumerIT method testSubAllMessageWithTag.

@Test
public void testSubAllMessageWithTag() {
    String tag = "jueyin";
    String subExpress = "*";
    int msgSize = 10;
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener());
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 12 with RMQNormalListener

use of org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener in project rocketmq by apache.

the class TagMessageWith1ConsumerIT method testSubAllMessageNoTag.

@Test
public void testSubAllMessageNoTag() {
    String subExprress = "*";
    int msgSize = 10;
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExprress, new RMQNormalListener());
    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 13 with RMQNormalListener

use of org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener in project rocketmq by apache.

the class TagMessageWith1ConsumerIT method testSubAllWithKindsOfMessage.

@Test
public void testSubAllWithKindsOfMessage() {
    String tag1 = null;
    String tag2 = "jueyin";
    String subExpress = "*";
    int msgSize = 10;
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener());
    List<Object> tag1Msgs = MQMessageFactory.getRMQMessage(tag1, topic, msgSize);
    List<Object> tag2Msgs = MQMessageFactory.getRMQMessage(tag2, topic, msgSize);
    producer.send(tag1Msgs);
    producer.send(tag2Msgs);
    producer.send(10);
    Assert.assertEquals("Not all are sent", msgSize * 3, producer.getAllUndupMsgBody().size());
    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 14 with RMQNormalListener

use of org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener in project rocketmq by apache.

the class TagMessageWith1ConsumerIT method testTagSmoke.

@Test
public void testTagSmoke() {
    String tag = "jueyin";
    int msgSize = 10;
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQNormalListener());
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 15 with RMQNormalListener

use of org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener in project rocketmq by apache.

the class TagMessageWith1ConsumerIT method testSubNullWithTagNull.

@Test
public void testSubNullWithTagNull() {
    String tag = null;
    String subExpress = null;
    int msgSize = 10;
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener());
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Aggregations

RMQNormalListener (org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener)54 Test (org.junit.Test)54 RMQNormalConsumer (org.apache.rocketmq.test.client.rmq.RMQNormalConsumer)44 RMQBroadCastConsumer (org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer)9 MQAsyncProducer (org.apache.rocketmq.test.client.mq.MQAsyncProducer)6 TagMessage (org.apache.rocketmq.test.factory.TagMessage)6 Message (org.apache.rocketmq.common.message.Message)4 MessageQueue (org.apache.rocketmq.common.message.MessageQueue)4 MessageQueueSelector (org.apache.rocketmq.client.producer.MessageQueueSelector)2 MessageSelector (org.apache.rocketmq.client.consumer.MessageSelector)1 RMQSqlConsumer (org.apache.rocketmq.test.client.rmq.RMQSqlConsumer)1