Skip to content

Commit

Permalink
ARTEMIS-4372 small fixes on CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Aug 1, 2023
1 parent 2656643 commit 05f8e5d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ private ConnectionFactory createAMQPConnectionFactory(String brokerURL,
try {
tryConnect(brokerURL, user, password, cf);
} catch (Exception e2) {
e.printStackTrace();
}
return cf;
} catch (JMSException e) {
Expand All @@ -204,7 +203,6 @@ private ConnectionFactory createAMQPConnectionFactory(String brokerURL,
try {
tryConnect(brokerURL, user, password, cf);
} catch (Exception e2) {
e2.printStackTrace();
}
return cf;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public long getMessageCount() {
return messageCount;
}

public DestAbstract setMessageCount(int messageCount) {
public DestAbstract setMessageCount(long messageCount) {
this.messageCount = messageCount;
return this;
}
Expand Down Expand Up @@ -146,6 +146,10 @@ public DestAbstract setSerializer(String serializer) {
public Object execute(ActionContext context) throws Exception {
super.execute(context);

if (oldBatchSize > 0 && txBatchSize > 0) {
throw new IllegalArgumentException("Either select --txt-size or --commit-interval. Cannot use both!");
}

if (oldBatchSize > 0) {
context.out.println("--txt-size is deprecated, please use --commit-interval");
txBatchSize = oldBatchSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ public void testNodeCheckTopology() throws Exception {
Object slave = Artemis.execute(false, false, null, slaveInstance, null, "run");
ActiveMQServerImpl slaveServer = (ActiveMQServerImpl)((Pair)slave).getB();

Wait.assertTrue("Backup isn't announced", () -> slaveServer.getBackupManager() != null &&
slaveServer.getBackupManager().isStarted() && slaveServer.getBackupManager().isBackupAnnounced(), 30000);

try {
Wait.assertTrue("Backup isn't announced", () -> slaveServer.getBackupManager() != null &&
slaveServer.getBackupManager().isStarted() && slaveServer.getBackupManager().isBackupAnnounced(), 30000);

context = new TestActionContext();
nodeCheck = new NodeCheck();
nodeCheck.setUser("admin");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void testDefaultQueues() throws Exception {

@Test
public void testAutoCreatedQueue() throws Exception {
final int messages = 1;
final long messages = 1;
final String queueName = "TEST";
final String messageText = "TEST";

Expand Down Expand Up @@ -105,7 +105,7 @@ public void testAutoCreatedQueue() throws Exception {
consumer.setSilentInput(true);
consumer.setReceiveTimeout(2000);
consumer.setBreakOnNull(true);
int consumed = (int)consumer.execute(new ActionContext());
long consumed = (long)consumer.execute(new ActionContext());

assertEquals(messages, consumed);

Expand Down Expand Up @@ -223,7 +223,7 @@ public void testSendMessageUsingCurrentLogonUser() throws Exception {
createQueueCommand.setAutoCreateAddress(true);
createQueueCommand.execute(new ActionContext());

final int messages = 1;
final long messages = 1;
beforeSendingQueuesPage.refresh(DEFAULT_TIMEOUT);
Wait.assertEquals(1, () -> beforeSendingQueuesPage.countQueue("DLQ"));
Wait.assertEquals(1, () -> beforeSendingQueuesPage.countQueue(queueName));
Expand All @@ -250,7 +250,7 @@ public void testSendMessageUsingCurrentLogonUser() throws Exception {
consumer.setSilentInput(true);
consumer.setReceiveTimeout(2000);
consumer.setBreakOnNull(true);
int consumed = (int)consumer.execute(new ActionContext());
long consumed = (long)consumer.execute(new ActionContext());

assertEquals(messages, consumed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public void testAMQPOnCLI() throws Exception {
public void testCoreOnCLI() throws Exception {

String protocol = "core";
int NUMBER_OF_MESSAGES = 5000;
long NUMBER_OF_MESSAGES = 5000;

internalReceive(protocol, NUMBER_OF_MESSAGES);

}

private void internalReceive(String protocol, int NUMBER_OF_MESSAGES) throws Exception {
private void internalReceive(String protocol, long NUMBER_OF_MESSAGES) throws Exception {
Producer producer = (Producer)new Producer().setMessageSize(1000).setMessageCount(NUMBER_OF_MESSAGES).setTxBatchSize(1000);
producer.setProtocol(protocol);
producer.setSilentInput(true);
Expand All @@ -68,7 +68,7 @@ private void internalReceive(String protocol, int NUMBER_OF_MESSAGES) throws Exc
consumer.setSilentInput(true);
consumer.setReceiveTimeout(2000);
consumer.setBreakOnNull(true);
int consumed = (int)consumer.execute(new ActionContext());
long consumed = (long)consumer.execute(new ActionContext());

Assert.assertEquals(NUMBER_OF_MESSAGES, consumed);
}
Expand Down

0 comments on commit 05f8e5d

Please sign in to comment.