ARTEMIS-4996: update to junit 5.11.0

Move parameters out of base classes where needed to avoid clashes with
subclasses [re-]defining their own params. Needed due to change of
field + method annotation search handling to adopt Java hiding/shadowing
semantics, leading to ParameterizedTestExtension discovering both parent
and subclass parameter definition methods and throwing.
This commit is contained in:
Robbie Gemmell 2024-08-19 11:51:39 +01:00
parent 11611d091c
commit 87cc15700f
28 changed files with 217 additions and 33 deletions

View File

@ -164,7 +164,7 @@
<version.micrometer>1.13.3</version.micrometer> <version.micrometer>1.13.3</version.micrometer>
<hamcrest.version>3.0</hamcrest.version> <hamcrest.version>3.0</hamcrest.version>
<junit.version>4.13.2</junit.version> <junit.version>4.13.2</junit.version>
<junit5.version>5.10.3</junit5.version> <junit5.version>5.11.0</junit5.version>
<version.jaxb.runtime>2.3.9</version.jaxb.runtime> <version.jaxb.runtime>2.3.9</version.jaxb.runtime>
<paho.client.mqtt.version>1.2.5</paho.client.mqtt.version> <paho.client.mqtt.version>1.2.5</paho.client.mqtt.version>
<postgresql.version>42.7.3</postgresql.version> <postgresql.version>42.7.3</postgresql.version>

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -29,18 +31,24 @@ import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.settings.impl.DeletionPolicy; import org.apache.activemq.artemis.core.settings.impl.DeletionPolicy;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
//Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class AddressSettingsConfigurationStorageTest extends StorageManagerTestBase { public class AddressSettingsConfigurationStorageTest extends StorageManagerTestBase {
private Map<SimpleString, PersistedAddressSettingJSON> mapExpectedAddresses; private Map<SimpleString, PersistedAddressSettingJSON> mapExpectedAddresses;
@Parameters(name = "storeType={0}")
public static Collection<Object[]> data() {
Object[][] params = new Object[][]{{StoreConfiguration.StoreType.FILE}, {StoreConfiguration.StoreType.DATABASE}};
return Arrays.asList(params);
}
public AddressSettingsConfigurationStorageTest(StoreConfiguration.StoreType storeType) { public AddressSettingsConfigurationStorageTest(StoreConfiguration.StoreType storeType) {
super(storeType); super(storeType);
} }

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -25,6 +26,7 @@ import org.apache.activemq.artemis.core.config.StoreConfiguration;
import org.apache.activemq.artemis.core.config.TransformerConfiguration; import org.apache.activemq.artemis.core.config.TransformerConfiguration;
import org.apache.activemq.artemis.core.persistence.config.PersistedBridgeConfiguration; import org.apache.activemq.artemis.core.persistence.config.PersistedBridgeConfiguration;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -32,10 +34,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
//Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class BridgeConfigurationStorageTest extends StorageManagerTestBase { public class BridgeConfigurationStorageTest extends StorageManagerTestBase {
@Parameters(name = "storeType={0}")
public static Collection<Object[]> data() {
Object[][] params = new Object[][]{{StoreConfiguration.StoreType.FILE}, {StoreConfiguration.StoreType.DATABASE}};
return Arrays.asList(params);
}
public BridgeConfigurationStorageTest(StoreConfiguration.StoreType storeType) { public BridgeConfigurationStorageTest(StoreConfiguration.StoreType storeType) {
super(storeType); super(storeType);
} }

View File

@ -16,21 +16,29 @@
*/ */
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import org.apache.activemq.artemis.core.config.StoreConfiguration; import org.apache.activemq.artemis.core.config.StoreConfiguration;
import org.apache.activemq.artemis.core.persistence.config.PersistedConnector; import org.apache.activemq.artemis.core.persistence.config.PersistedConnector;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
//Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class ConnectorStorageTest extends StorageManagerTestBase { public class ConnectorStorageTest extends StorageManagerTestBase {
@Parameters(name = "storeType={0}")
public static Collection<Object[]> data() {
Object[][] params = new Object[][]{{StoreConfiguration.StoreType.FILE}, {StoreConfiguration.StoreType.DATABASE}};
return Arrays.asList(params);
}
public ConnectorStorageTest(StoreConfiguration.StoreType storeType) { public ConnectorStorageTest(StoreConfiguration.StoreType storeType) {
super(storeType); super(storeType);
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -24,6 +26,7 @@ import org.apache.activemq.artemis.core.config.StoreConfiguration;
import org.apache.activemq.artemis.core.config.TransformerConfiguration; import org.apache.activemq.artemis.core.config.TransformerConfiguration;
import org.apache.activemq.artemis.core.persistence.config.PersistedDivertConfiguration; import org.apache.activemq.artemis.core.persistence.config.PersistedDivertConfiguration;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -31,10 +34,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
//Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class DivertConfigurationStorageTest extends StorageManagerTestBase { public class DivertConfigurationStorageTest extends StorageManagerTestBase {
@Parameters(name = "storeType={0}")
public static Collection<Object[]> data() {
Object[][] params = new Object[][]{{StoreConfiguration.StoreType.FILE}, {StoreConfiguration.StoreType.DATABASE}};
return Arrays.asList(params);
}
public DivertConfigurationStorageTest(StoreConfiguration.StoreType storeType) { public DivertConfigurationStorageTest(StoreConfiguration.StoreType storeType) {
super(storeType); super(storeType);
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -27,6 +29,7 @@ import org.apache.activemq.artemis.core.postoffice.DuplicateIDCache;
import org.apache.activemq.artemis.core.postoffice.impl.DuplicateIDCaches; import org.apache.activemq.artemis.core.postoffice.impl.DuplicateIDCaches;
import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.RandomUtil;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -34,10 +37,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
//Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class DuplicateCacheTest extends StorageManagerTestBase { public class DuplicateCacheTest extends StorageManagerTestBase {
@Parameters(name = "storeType={0}")
public static Collection<Object[]> data() {
Object[][] params = new Object[][]{{StoreConfiguration.StoreType.FILE}, {StoreConfiguration.StoreType.DATABASE}};
return Arrays.asList(params);
}
public DuplicateCacheTest(StoreConfiguration.StoreType storeType) { public DuplicateCacheTest(StoreConfiguration.StoreType storeType) {
super(storeType); super(storeType);
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -24,18 +26,24 @@ import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.StoreConfiguration; import org.apache.activemq.artemis.core.config.StoreConfiguration;
import org.apache.activemq.artemis.core.persistence.config.PersistedSecuritySetting; import org.apache.activemq.artemis.core.persistence.config.PersistedSecuritySetting;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
//Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class RolesConfigurationStorageTest extends StorageManagerTestBase { public class RolesConfigurationStorageTest extends StorageManagerTestBase {
private Map<SimpleString, PersistedSecuritySetting> mapExpectedSets; private Map<SimpleString, PersistedSecuritySetting> mapExpectedSets;
@Parameters(name = "storeType={0}")
public static Collection<Object[]> data() {
Object[][] params = new Object[][]{{StoreConfiguration.StoreType.FILE}, {StoreConfiguration.StoreType.DATABASE}};
return Arrays.asList(params);
}
public RolesConfigurationStorageTest(StoreConfiguration.StoreType storeType) { public RolesConfigurationStorageTest(StoreConfiguration.StoreType storeType) {
super(storeType); super(storeType);
} }

View File

@ -17,8 +17,6 @@
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
@ -28,8 +26,6 @@ import org.apache.activemq.artemis.core.config.StoreConfiguration;
import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager; import org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader; import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader;
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice; import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
@ -37,9 +33,7 @@ import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer; import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class)
public abstract class StorageManagerTestBase extends ActiveMQTestBase { public abstract class StorageManagerTestBase extends ActiveMQTestBase {
protected ExecutorService executor; protected ExecutorService executor;
@ -56,12 +50,6 @@ public abstract class StorageManagerTestBase extends ActiveMQTestBase {
this.storeType = storeType; this.storeType = storeType;
} }
@Parameters(name = "storeType={0}")
public static Collection<Object[]> data() {
Object[][] params = new Object[][]{{StoreConfiguration.StoreType.FILE}, {StoreConfiguration.StoreType.DATABASE}};
return Arrays.asList(params);
}
@Override @Override
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -92,6 +92,10 @@ public class StompPluginTest extends StompTestBase {
return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}}); return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}});
} }
public StompPluginTest(String scheme) {
super(scheme);
}
@Override @Override
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -56,6 +56,10 @@ public class FQQNStompTest extends StompTestBase {
return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}}); return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}});
} }
public FQQNStompTest(String scheme) {
super(scheme);
}
@Override @Override
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.stomp; package org.apache.activemq.artemis.tests.integration.stomp;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -27,6 +29,7 @@ import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
import org.apache.activemq.artemis.logs.AuditLogger; import org.apache.activemq.artemis.logs.AuditLogger;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
@ -49,6 +52,15 @@ public class StompAuditLoggingTest extends StompTestBase {
private final String pass = user; private final String pass = user;
private final String role = "nopriv"; private final String role = "nopriv";
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompAuditLoggingTest(String scheme) {
super(scheme);
}
@Override @Override
public boolean isSecurityEnabled() { public boolean isSecurityEnabled() {
return true; return true;

View File

@ -29,11 +29,16 @@ import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
// Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompConnectionCleanupTest extends StompTest { public class StompConnectionCleanupTest extends StompTest {
private static final long CONNECTION_TTL = 2000; private static final long CONNECTION_TTL = 2000;
public StompConnectionCleanupTest(String scheme) {
super(scheme);
}
// ARTEMIS-231 // ARTEMIS-231
@TestTemplate @TestTemplate
public void testConnectionCleanupWithTopicSubscription() throws Exception { public void testConnectionCleanupWithTopicSubscription() throws Exception {

View File

@ -20,6 +20,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -27,6 +29,7 @@ import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
@ -47,6 +50,15 @@ public class StompLVQTest extends StompTestBase {
private final String queue = "lvq"; private final String queue = "lvq";
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompLVQTest(String scheme) {
super(scheme);
}
@Override @Override
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -46,6 +46,10 @@ public class StompPropertiesInterceptorTest extends StompTestBase {
return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}}); return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}});
} }
public StompPropertiesInterceptorTest(String scheme) {
super(scheme);
}
@Override @Override
public List<String> getIncomingInterceptors() { public List<String> getIncomingInterceptors() {
List<String> stompIncomingInterceptor = new ArrayList<>(); List<String> stompIncomingInterceptor = new ArrayList<>();

View File

@ -25,6 +25,8 @@ import java.io.ByteArrayOutputStream;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -67,6 +69,7 @@ import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
import org.apache.activemq.artemis.reader.MessageUtil; import org.apache.activemq.artemis.reader.MessageUtil;
import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.mqtt.FuseMQTTClientProvider; import org.apache.activemq.artemis.tests.integration.mqtt.FuseMQTTClientProvider;
import org.apache.activemq.artemis.tests.integration.mqtt.MQTTClientProvider; import org.apache.activemq.artemis.tests.integration.mqtt.MQTTClientProvider;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
@ -96,6 +99,15 @@ public class StompTest extends StompTestBase {
protected StompClientConnection conn; protected StompClientConnection conn;
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompTest(String scheme) {
super(scheme);
}
@Override @Override
protected ActiveMQServer createServer() throws Exception { protected ActiveMQServer createServer() throws Exception {
ActiveMQServer server = super.createServer(); ActiveMQServer server = super.createServer();

View File

@ -34,8 +34,6 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -56,34 +54,23 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameter;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.AbstractStompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.AbstractStompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ExtendWith(ParameterizedTestExtension.class)
public abstract class StompTestBase extends ActiveMQTestBase { public abstract class StompTestBase extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Parameter(index = 0)
public String scheme; public String scheme;
protected URI uri; protected URI uri;
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
protected String hostname = "127.0.0.1"; protected String hostname = "127.0.0.1";
protected final int port = 61613; protected final int port = 61613;
@ -104,6 +91,10 @@ public abstract class StompTestBase extends ActiveMQTestBase {
protected String defPass = "wombats"; protected String defPass = "wombats";
public StompTestBase(String scheme) {
this.scheme = scheme;
}
// Implementation methods // Implementation methods
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
public boolean isCompressLargeMessages() { public boolean isCompressLargeMessages() {

View File

@ -19,23 +19,34 @@ package org.apache.activemq.artemis.tests.integration.stomp;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import java.net.URI; import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.UUID; import java.util.UUID;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
// Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompTestMultiThreaded extends StompTestBase { public class StompTestMultiThreaded extends StompTestBase {
private static final SimpleString QUEUE = SimpleString.of("x"); private static final SimpleString QUEUE = SimpleString.of("x");
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompTestMultiThreaded(String scheme) {
super(scheme);
}
class SomeConsumer extends Thread { class SomeConsumer extends Thread {
private final StompClientConnection conn; private final StompClientConnection conn;

View File

@ -55,6 +55,10 @@ public class StompWebSocketMaxFrameTest extends StompTestBase {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"ws+v11.stomp"}, {"ws+v12.stomp"}}); return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"ws+v11.stomp"}, {"ws+v12.stomp"}});
} }
public StompWebSocketMaxFrameTest(String scheme) {
super(scheme);
}
@BeforeEach @BeforeEach
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -21,6 +21,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import javax.security.auth.Subject; import javax.security.auth.Subject;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.util.Arrays;
import java.util.Collection;
import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
@ -33,6 +35,7 @@ import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager
import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.apache.activemq.artemis.spi.core.security.jaas.NoCacheLoginException; import org.apache.activemq.artemis.spi.core.security.jaas.NoCacheLoginException;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
@ -41,6 +44,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompWithClientIdValidationTest extends StompTestBase { public class StompWithClientIdValidationTest extends StompTestBase {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompWithClientIdValidationTest(String scheme) {
super(scheme);
}
@Override @Override
public boolean isSecurityEnabled() { public boolean isSecurityEnabled() {
return true; return true;

View File

@ -20,6 +20,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -29,6 +31,7 @@ import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor; import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
@ -39,6 +42,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompWithInterceptorsTest extends StompTestBase { public class StompWithInterceptorsTest extends StompTestBase {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompWithInterceptorsTest(String scheme) {
super(scheme);
}
@Override @Override
public List<String> getIncomingInterceptors() { public List<String> getIncomingInterceptors() {
List<String> stompIncomingInterceptor = new ArrayList<>(); List<String> stompIncomingInterceptor = new ArrayList<>();

View File

@ -53,6 +53,10 @@ public class StompWithLargeMessagesTest extends StompTestBase {
return Arrays.asList(new Object[][]{{"tcp+v10.stomp"}, {"tcp+v12.stomp"}}); return Arrays.asList(new Object[][]{{"tcp+v10.stomp"}, {"tcp+v12.stomp"}});
} }
public StompWithLargeMessagesTest(String scheme) {
super(scheme);
}
@Override @Override
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -24,9 +24,13 @@ import javax.jms.Message;
import javax.jms.MessageConsumer; import javax.jms.MessageConsumer;
import javax.jms.QueueBrowser; import javax.jms.QueueBrowser;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration; import java.util.Enumeration;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
@ -36,6 +40,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompWithMessageIDTest extends StompTestBase { public class StompWithMessageIDTest extends StompTestBase {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompWithMessageIDTest(String scheme) {
super(scheme);
}
@Override @Override
public boolean isEnableStompMessageId() { public boolean isEnableStompMessageId() {
return true; return true;

View File

@ -20,6 +20,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -29,6 +31,7 @@ import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor; import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
@ -39,6 +42,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompWithRejectingInterceptorTest extends StompTestBase { public class StompWithRejectingInterceptorTest extends StompTestBase {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompWithRejectingInterceptorTest(String scheme) {
super(scheme);
}
@Override @Override
public List<String> getIncomingInterceptors() { public List<String> getIncomingInterceptors() {
List<String> stompIncomingInterceptor = new ArrayList<>(); List<String> stompIncomingInterceptor = new ArrayList<>();

View File

@ -21,6 +21,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
@ -28,6 +30,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
@ -38,6 +41,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompWithSecurityPerAcceptorTest extends StompTestBase { public class StompWithSecurityPerAcceptorTest extends StompTestBase {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompWithSecurityPerAcceptorTest(String scheme) {
super(scheme);
}
static { static {
String path = System.getProperty("java.security.auth.login.config"); String path = System.getProperty("java.security.auth.login.config");
if (path == null) { if (path == null) {

View File

@ -20,10 +20,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Collection;
import javax.jms.MessageConsumer; import javax.jms.MessageConsumer;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension; import org.apache.activemq.artemis.tests.extensions.parameterized.ParameterizedTestExtension;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
@ -33,6 +37,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class) @ExtendWith(ParameterizedTestExtension.class)
public class StompWithSecurityTest extends StompTestBase { public class StompWithSecurityTest extends StompTestBase {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{{"ws+v10.stomp"}, {"tcp+v10.stomp"}});
}
public StompWithSecurityTest(String scheme) {
super(scheme);
}
@Override @Override
public boolean isSecurityEnabled() { public boolean isSecurityEnabled() {
return true; return true;

View File

@ -55,6 +55,10 @@ public class ExtraStompTest extends StompTestBase {
return Arrays.asList(new Object[][]{{"ws+v11.stomp"}, {"tcp+v11.stomp"}}); return Arrays.asList(new Object[][]{{"ws+v11.stomp"}, {"tcp+v11.stomp"}});
} }
public ExtraStompTest(String scheme) {
super(scheme);
}
@Override @Override
public boolean isPersistenceEnabled() { public boolean isPersistenceEnabled() {
return true; return true;

View File

@ -79,6 +79,10 @@ public class StompV11Test extends StompTestBase {
return Arrays.asList(new Object[][]{{"ws+v11.stomp"}, {"tcp+v11.stomp"}}); return Arrays.asList(new Object[][]{{"ws+v11.stomp"}, {"tcp+v11.stomp"}});
} }
public StompV11Test(String scheme) {
super(scheme);
}
@Override @Override
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -83,6 +83,10 @@ public class StompV12Test extends StompTestBase {
return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}}); return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}});
} }
public StompV12Test(String scheme) {
super(scheme);
}
@Override @Override
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {