use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer 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());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer 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());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer 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());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer 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());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer in project rocketmq by apache.
the class TagMessageWith1ConsumerIT method testSubTagWithKindsOfMessage.
@Test
public void testSubTagWithKindsOfMessage() {
String tag1 = null;
String tag2 = "jueyin";
String subExpress = tag2;
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(MQMessageFactory.getMessageBody(tag2Msgs), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag2Msgs));
}
Aggregations