Search in sources :

Example 1 with TagMessage

use of org.apache.rocketmq.test.factory.TagMessage in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class MulTagSubIT method testNoMatch.

@Test
public void testNoMatch() {
    String[] tags = { "jueyin1", "jueyin2", "jueyin3" };
    String subExpress = "no_match";
    int msgSize = 10;
    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListner());
    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length, producer.getAllUndupMsgBody().size());
    TestUtils.waitForSeconds(5);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody()).size()).isEqualTo(0);
}
Also used : RMQNormalListner(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner) RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) TagMessage(org.apache.rocketmq.test.factory.TagMessage) Test(org.junit.Test)

Example 2 with TagMessage

use of org.apache.rocketmq.test.factory.TagMessage in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class MulTagSubIT method testSubThreeTabAndMatchTwo.

@Test
public void testSubThreeTabAndMatchTwo() {
    String[] tags = { "jueyin1", "jueyin2", "jueyin3" };
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;
    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListner());
    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length, producer.getAllUndupMsgBody().size());
    consumer.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
Also used : RMQNormalListner(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner) RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) TagMessage(org.apache.rocketmq.test.factory.TagMessage) Test(org.junit.Test)

Example 3 with TagMessage

use of org.apache.rocketmq.test.factory.TagMessage in project rocketmq by apache.

the class MulTagSubIT method testSubTwoTabAndMatchTwo.

@Test
public void testSubTwoTabAndMatchTwo() {
    String[] tags = { "jueyin1", "jueyin2" };
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;
    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener());
    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length, producer.getAllUndupMsgBody().size());
    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) TagMessage(org.apache.rocketmq.test.factory.TagMessage) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 4 with TagMessage

use of org.apache.rocketmq.test.factory.TagMessage in project rocketmq by apache.

the class MulTagSubIT method testSubThreeTabAndMatchTwo.

@Test
public void testSubThreeTabAndMatchTwo() {
    String[] tags = { "jueyin1", "jueyin2", "jueyin3" };
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;
    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener());
    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length, producer.getAllUndupMsgBody().size());
    consumer.getListener().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) TagMessage(org.apache.rocketmq.test.factory.TagMessage) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 5 with TagMessage

use of org.apache.rocketmq.test.factory.TagMessage in project rocketmq by apache.

the class MulTagSubIT method testNoMatch.

@Test
public void testNoMatch() {
    String[] tags = { "jueyin1", "jueyin2", "jueyin3" };
    String subExpress = "no_match";
    int msgSize = 10;
    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener());
    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length, producer.getAllUndupMsgBody().size());
    TestUtils.waitForSeconds(5);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody()).size()).isEqualTo(0);
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) TagMessage(org.apache.rocketmq.test.factory.TagMessage) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Aggregations

RMQNormalConsumer (org.apache.rocketmq.test.client.rmq.RMQNormalConsumer)12 TagMessage (org.apache.rocketmq.test.factory.TagMessage)12 Test (org.junit.Test)12 RMQNormalListener (org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener)6 RMQNormalListner (org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner)6