ARTEMIS-4037 Use random alphanumeric strings for MQTTRetainMessageManagerTest

This commit is contained in:
Domenico Francesco Bruscino 2022-10-11 10:24:03 +02:00 committed by Robbie Gemmell
parent 4a0bca3f64
commit 5a42de5fa6
2 changed files with 2 additions and 12 deletions

View File

@ -115,12 +115,6 @@
<artifactId>org.eclipse.paho.mqttv5.client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>0.15</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>

View File

@ -33,6 +33,7 @@ import org.apache.activemq.artemis.core.server.MessageReference;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.junit.EmbeddedJMSResource;
import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
import org.apache.commons.lang3.RandomStringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.junit.After;
@ -44,9 +45,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
import com.github.javafaker.ChuckNorris;
import com.github.javafaker.Faker;
@SuppressWarnings("deprecation")
public class MQTTRetainMessageManagerTest {
@ -74,8 +72,6 @@ public class MQTTRetainMessageManagerTest {
private final String topic = "fact";
private final ChuckNorris chuckNorris = (new Faker()).chuckNorris();
private final int numberOfMessages = 1000;
private final int numberOfTests = 10;
@ -186,7 +182,7 @@ public class MQTTRetainMessageManagerTest {
protected void publish(final int qos) throws MqttException {
mqttConsumerCount.subscribe(topic, qos);
IntStream.range(0, numberOfMessages).forEach(i -> {
final String fact = String.format("[%s] %s", i, chuckNorris.fact());
final String fact = String.format("[%s] %s", i, RandomStringUtils.randomAlphanumeric(128));
final MqttMessage message = message(fact, qos, true);
mqttPublisher.publish(topic, message);
lastMessagePublished.set(message);