Java Code Examples for org.apache.rocketmq.test.util.RandomUtils#getStringByUUID()

The following examples show how to use org.apache.rocketmq.test.util.RandomUtils#getStringByUUID() . 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: TagMessageWithSameGroupConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartWithInterval() {
    String tag = "jueyin";
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize, 100);
    TestUtils.waitForMonment(5);
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    TestUtils.waitForMonment(5);

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 2
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartWithInterval() {
    String tag = "jueyin";
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize, 100);
    TestUtils.waitForMonment(5);
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    TestUtils.waitForMonment(5);

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 3
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerWithSameGroup() {
    String tag = "jueyin";
    int msgSize = 20;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 4
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartTwoAndCrashOneAfterWhile() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));

    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    consumer2.shutdown();
    mqClients.remove(1);
    TestUtils.waitForMoment(5);

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 5
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartWithInterval() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    TestUtils.waitForMoment(5);

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 6
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerWithSameGroup() {
    int msgSize = 20;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 7
Source File: TagMessageWithSameGroupConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartTwoAndCrashOneAfterWhile() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));

    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    consumer2.shutdown();
    mqClients.remove(1);
    TestUtils.waitForMoment(5);

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 8
Source File: TagMessageWithSameGroupConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartWithInterval() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    TestUtils.waitForMoment(5);

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 9
Source File: TagMessageWithSameGroupConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerWithSameGroup() {
    int msgSize = 20;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 10
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartTwoAndCrashOnsAfterWhile() {
    String tag = "jueyin";
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));

    producer.send(tag, msgSize, 100);
    TestUtils.waitForMonment(5);
    consumer2.shutdown();
    mqClients.remove(1);
    TestUtils.waitForMonment(5);

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 11
Source File: TagMessageWithSameGroupConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerWithSameGroup() {
    int msgSize = 20;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 12
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerWithSameGroup() {
    String tag = "jueyin";
    int msgSize = 20;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 13
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartTwoAndCrashOneAfterWhile() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));

    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    consumer2.shutdown();
    mqClients.remove(1);
    TestUtils.waitForMoment(5);

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 14
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartTwoAndCrashOnsAfterWhile() {
    String tag = "jueyin";
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListner(originMsgDCName, msgBodyDCName));

    producer.send(tag, msgSize, 100);
    TestUtils.waitForMonment(5);
    consumer2.shutdown();
    mqClients.remove(1);
    TestUtils.waitForMonment(5);

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 15
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerWithSameGroup() {
    int msgSize = 20;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 16
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartTwoAndCrashOneAfterWhile() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));

    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    consumer2.shutdown();
    mqClients.remove(1);
    TestUtils.waitForMoment(5);

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 17
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartWithInterval() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    TestUtils.waitForMoment(5);

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 18
Source File: TagMessageWithSameGroupConsumerIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testTwoConsumerWithSameGroup() {
    int msgSize = 20;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 19
Source File: TagMessageWithSameGroupConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartTwoAndCrashOneAfterWhile() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));

    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    consumer2.shutdown();
    mqClients.remove(1);
    TestUtils.waitForMoment(5);

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 20
Source File: TagMessageWithSameGroupConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testConsumerStartWithInterval() {
    int msgSize = 100;
    String originMsgDCName = RandomUtils.getStringByUUID();
    String msgBodyDCName = RandomUtils.getStringByUUID();

    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    producer.send(tag, msgSize, 100);
    TestUtils.waitForMoment(5);
    getConsumer(nsAddr, consumer1.getConsumerGroup(), tag,
        new RMQNormalListener(originMsgDCName, msgBodyDCName));
    TestUtils.waitForMoment(5);

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}