ARTEMIS-2116 Set text message content on producer CLI command

This commit is contained in:
Francesco Nigro 2018-10-09 18:04:00 +02:00 committed by Clebert Suconic
parent bcc3eb6375
commit d561ca34ff
3 changed files with 8 additions and 3 deletions

View File

@ -46,10 +46,13 @@ public class Producer extends DestAbstract {
@Option(name = "--message-size", description = "Size of each byteMessage (The producer will use byte message on this case)")
int messageSize = 0;
@Option(name = "--message", description = "Content of each textMessage (The producer will use text message on this case)")
String message = null;
@Option(name = "--text-size", description = "Size of each textMessage (The producer will use text message on this case)")
int textMessageSize;
@Option(name = "--object-size", description = "Size of each ObjectMessage (The producer will use object mesasge on this case)")
@Option(name = "--object-size", description = "Size of each ObjectMessage (The producer will use object message on this case)")
int objectSize;
@Option(name = "--msgttl", description = "TTL for each message")
@ -121,7 +124,7 @@ public class Producer extends DestAbstract {
threadsArray[i] = new ProducerThread(session, dest, i);
threadsArray[i].setVerbose(verbose).setSleep(sleep).setPersistent(!nonpersistent).
setMessageSize(messageSize).setTextMessageSize(textMessageSize).setObjectSize(objectSize).
setMessageSize(messageSize).setTextMessageSize(textMessageSize).setMessage(message).setObjectSize(objectSize).
setMsgTTL(msgTTL).setMsgGroupID(msgGroupID).setTransactionBatchSize(txBatchSize).
setMessageCount(messageCount).setQueueId(queueId);
}

View File

@ -53,7 +53,7 @@ public class ProducerThread extends Thread {
int transactions = 0;
final AtomicInteger sentCount = new AtomicInteger(0);
String message;
String message = null;
String messageText = null;
String payloadUrl = null;
byte[] payload = null;

View File

@ -587,6 +587,8 @@ public class ArtemisTest extends CliTestBase {
assertEquals(Integer.valueOf(10), Artemis.internalExecute("consumer", "--break-on-null", "--receive-timeout", "100", "--user", "admin", "--password", "admin"));
assertEquals(Integer.valueOf(10), Artemis.internalExecute("producer", "--message-size", "500", "--message-count", "10", "--user", "admin", "--password", "admin"));
assertEquals(Integer.valueOf(10), Artemis.internalExecute("consumer", "--break-on-null", "--receive-timeout", "100", "--user", "admin", "--password", "admin"));
assertEquals(Integer.valueOf(10), Artemis.internalExecute("producer", "--message", "message", "--message-count", "10", "--user", "admin", "--password", "admin"));
assertEquals(Integer.valueOf(10), Artemis.internalExecute("consumer", "--break-on-null", "--receive-timeout", "100", "--user", "admin", "--password", "admin"));
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
Connection connection = cf.createConnection("admin", "admin");