Skip to content

Commit

Permalink
ARTEMIS-5035 Change some tests to use a random choice for protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Sep 5, 2024
1 parent 8b265f4 commit daba842
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,12 @@ protected void clearServers() {
public ActiveMQTestBase() {

}

protected static String randomProtocol() {
String[] protocols = {"AMQP", "OPENWIRE", "CORE"};

return protocols[org.apache.activemq.artemis.tests.util.RandomUtil.randomPositiveInt() % 3];
String protocol = protocols[org.apache.activemq.artemis.tests.util.RandomUtil.randomPositiveInt() % 3];
logger.info("Selecting {} protocol", protocol);
return protocol;
}

protected <T> T serialClone(Object object) throws Exception {
logger.debug("object::{}", object);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Expand All @@ -247,7 +246,6 @@ protected <T> T serialClone(Object object) throws Exception {
return (T) obinp.readObject();

}

@AfterEach
public void tearDown() throws Exception {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,8 @@ private void transactSend(Session session, MessageProducer producer, int initial


@Test
public void testAMQP() throws Exception {
testACKs("AMQP");
}

@Test
public void testCORE() throws Exception {
testACKs("CORE");
public void testRandomProtocol() throws Exception {
testACKs(randomProtocol());
}

private void testACKs(final String protocol) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,10 @@ public void cleanupServers() {

@Test
@Timeout(240)
public void testAMQP() throws Exception {
testInterrupt("AMQP");
public void testRandomProtocol() throws Exception {
testInterrupt(randomProtocol());
}

@Test
@Timeout(240)
public void testCORE() throws Exception {
testInterrupt("CORE");
}

private void preCreateInternalQueues(String serverLocation) throws Exception {
Configuration configuration = createDefaultConfig(0, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,8 @@ public void cleanupServers() {

@Test
@Timeout(240)
public void testAMQP() throws Exception {
testAccumulateAndSend("AMQP");
}

@Test
@Timeout(240)
public void testCORE() throws Exception {
testAccumulateAndSend("CORE");
}

@Test
public void testOpenWire() throws Exception {
testAccumulateAndSend("OPENWIRE");
public void testRandomProtocol() throws Exception {
testAccumulateAndSend(randomProtocol());
}

private void testAccumulateAndSend(final String protocol) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,8 @@ public void setUp() throws Exception {
}

@Test
public void testAMQP() throws Exception {
testSendReceive("AMQP");
}

@Test
public void testCORE() throws Exception {
testSendReceive("CORE");
}

@Test
public void testOpenWire() throws Exception {
testSendReceive("OPENWIRE");
public void testRandomProtocol() throws Exception {
testSendReceive(randomProtocol());
}

public void testSendReceive(String protocol) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,8 @@ public void before() throws Exception {


@Test
public void testM_and_M_AMQP() throws Exception {
test_M_and_M_Sorting( "AMQP", 2000, 2, 2, 500);
}

@Test
public void testM_and_M_CORE() throws Exception {
test_M_and_M_Sorting( "CORE", 2000, 2, 2, 500);
public void testM_and_M_RandomProtocol() throws Exception {
test_M_and_M_Sorting(randomProtocol(), 2000, 2, 2, 500);
}

public void test_M_and_M_Sorting(String protocol, int batchSize, int restarts, int clientRuns, int killClientEveryX) throws Exception {
Expand Down

0 comments on commit daba842

Please sign in to comment.