You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2018/01/09 16:34:56 UTC
[3/4] activemq-artemis git commit: ARTEMIS-1545 Fixing compatibility
issues with topic Subscriptions
ARTEMIS-1545 Fixing compatibility issues with topic Subscriptions
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/c8dc7de4
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/c8dc7de4
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/c8dc7de4
Branch: refs/heads/master
Commit: c8dc7de44506745499b830edf3ffec87ff3d0b4b
Parents: ba9d06b
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jan 8 15:11:52 2018 -0500
Committer: Justin Bertram <jb...@apache.org>
Committed: Tue Jan 9 10:34:38 2018 -0600
----------------------------------------------------------------------
.../core/impl/ActiveMQSessionContext.java | 7 +-
tests/compatibility-tests/pom.xml | 4 +
.../artemis/tests/compatibility/GroovyRun.java | 28 +++--
.../main/resources/clients/artemisClient.groovy | 20 +--
.../main/resources/clients/hornetqClient.groovy | 26 ++--
.../main/resources/exportimport/export.groovy | 39 ++++++
.../main/resources/exportimport/export1X.groovy | 38 ++++++
.../main/resources/exportimport/import.groovy | 27 +++++
.../main/resources/exportimport/import1X.groovy | 28 +++++
.../main/resources/meshTest/sendMessages.groovy | 58 ++++++---
.../sendAckTest/sendAckMessages.groovy | 20 +--
.../src/main/resources/serial/serial.groovy | 20 +--
.../main/resources/servers/artemisServer.groovy | 29 ++---
.../main/resources/servers/hornetqServer.groovy | 26 ++--
.../tests/compatibility/ExportImportTest.java | 121 +++++++++++++++++++
.../artemis/tests/compatibility/MeshTest.java | 58 +++++++--
.../tests/compatibility/SendAckTest.java | 26 ++--
.../tests/compatibility/SerializationTest.java | 26 ++--
.../tests/compatibility/ServerBaseTest.java | 41 +++++++
.../tests/compatibility/VersionedBaseTest.java | 95 +++++++--------
.../tests/compatibility/package-info.java | 20 +--
21 files changed, 579 insertions(+), 178 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
index a9c34f7..1a81259 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
@@ -640,8 +640,11 @@ public class ActiveMQSessionContext extends SessionContext {
int maxConsumers,
boolean purgeOnNoConsumers,
boolean autoCreated) throws ActiveMQException {
- CreateQueueMessage request = new CreateQueueMessage_V2(address, queueName, routingType, filterString, durable, temp, maxConsumers, purgeOnNoConsumers, autoCreated, true);
- if (!sessionChannel.getConnection().isVersionBeforeAddressChange()) {
+ if (sessionChannel.getConnection().isVersionBeforeAddressChange()) {
+ CreateQueueMessage request = new CreateQueueMessage(address, queueName, filterString, durable, temp, true);
+ sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
+ } else {
+ CreateQueueMessage request = new CreateQueueMessage_V2(address, queueName, routingType, filterString, durable, temp, maxConsumers, purgeOnNoConsumers, autoCreated, true);
sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/pom.xml b/tests/compatibility-tests/pom.xml
index def806e..7d3ed3c 100644
--- a/tests/compatibility-tests/pom.xml
+++ b/tests/compatibility-tests/pom.xml
@@ -311,6 +311,7 @@
<configuration>
<libListWithDeps>
<arg>org.apache.activemq:artemis-jms-server:${project.version}</arg>
+ <arg>org.apache.activemq:artemis-cli:${project.version}</arg>
<arg>org.apache.activemq:artemis-jms-client:${project.version}</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:${project.version}</arg>
<arg>org.apache.activemq:artemis-amqp-protocol:${project.version}</arg>
@@ -333,6 +334,7 @@
<libListWithDeps>
<arg>org.apache.activemq:artemis-jms-server:2.4.0</arg>
<arg>org.apache.activemq:artemis-jms-client:2.4.0</arg>
+ <arg>org.apache.activemq:artemis-cli:2.4.0</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:2.4.0</arg>
<arg>org.apache.activemq:artemis-amqp-protocol:2.4.0</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:2.4.0</arg>
@@ -354,6 +356,7 @@
<libListWithDeps>
<arg>org.apache.activemq:artemis-jms-server:1.4.0</arg>
<arg>org.apache.activemq:artemis-jms-client:1.4.0</arg>
+ <arg>org.apache.activemq:artemis-cli:1.4.0</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:1.4.0</arg>
<arg>org.apache.activemq:artemis-amqp-protocol:1.4.0</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:1.4.0</arg>
@@ -375,6 +378,7 @@
<libListWithDeps>
<arg>org.apache.activemq:artemis-jms-server:1.5.5</arg>
<arg>org.apache.activemq:artemis-jms-client:1.5.5</arg>
+ <arg>org.apache.activemq:artemis-cli:1.5.5</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:1.5.5</arg>
<arg>org.apache.activemq:artemis-amqp-protocol:1.5.5</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:1.5.5</arg>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java b/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java
index 80c4756..6fd38f7 100644
--- a/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java
+++ b/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java
@@ -1,14 +1,18 @@
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.activemq.artemis.tests.compatibility;
@@ -36,7 +40,7 @@ public class GroovyRun {
public static GroovyShell shell = new GroovyShell(binding);
// Called with reflection
- public static void doMain(String script, String... arg) throws Throwable {
+ public static void doTest(String script, String... arg) throws Throwable {
int i = 0;
for (String a : arg) {
System.out.println("[" + (i++) + "]=" + a);
@@ -62,11 +66,15 @@ public class GroovyRun {
}
URI scriptURI = scriptURL.toURI();
- binding.setVariable(argVariableName, arg);
+ setVariable(argVariableName, arg);
shell.evaluate(scriptURI);
}
+ public static void setVariable(String name, Object arg) {
+ binding.setVariable(name, arg);
+ }
+
// Called with reflection
public static void execute(String script) throws Throwable {
shell.evaluate(script);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/clients/artemisClient.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/clients/artemisClient.groovy b/tests/compatibility-tests/src/main/resources/clients/artemisClient.groovy
index e729ebb..0926e0a 100644
--- a/tests/compatibility-tests/src/main/resources/clients/artemisClient.groovy
+++ b/tests/compatibility-tests/src/main/resources/clients/artemisClient.groovy
@@ -1,15 +1,19 @@
package clients
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
// Create a client connection factory
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/clients/hornetqClient.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/clients/hornetqClient.groovy b/tests/compatibility-tests/src/main/resources/clients/hornetqClient.groovy
index 63bf4e6..b04a01a 100644
--- a/tests/compatibility-tests/src/main/resources/clients/hornetqClient.groovy
+++ b/tests/compatibility-tests/src/main/resources/clients/hornetqClient.groovy
@@ -1,26 +1,24 @@
package clients
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
// This script is called by sendMessages.groovy
-import javax.jms.ConnectionFactory;
-import java.util.HashMap;
-import java.util.Map;
-
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.jms.HornetQJMSConstants;
-import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.remoting.impl.netty.TransportConstants;
import org.hornetq.jms.client.HornetQJMSConnectionFactory;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/exportimport/export.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/exportimport/export.groovy b/tests/compatibility-tests/src/main/resources/exportimport/export.groovy
new file mode 100644
index 0000000..0b6fb73
--- /dev/null
+++ b/tests/compatibility-tests/src/main/resources/exportimport/export.groovy
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.activemq.artemis.cli.commands.ActionContext
+import org.apache.activemq.artemis.cli.commands.tools.xml.XmlDataExporter
+
+
+System.out.println("Arg::" + arg[0]);
+File pagingfile = new File(arg[0] + "/sender/data/paging")
+pagingfile.mkdirs()
+XmlDataExporter exporter = new XmlDataExporter();
+exporter.binding = arg[0] + "/sender/data/bindings"
+exporter.journal = arg[0] + "/sender/data/journal"
+try {
+ exporter.largeMessages = arg[0] + "/sender/data/largeMessages"
+} catch (Throwable e) {
+ exporter.largeMessges = arg[0] + "/sender/data/largeMessages"
+}
+exporter.paging = arg[0] + "/sender/data/paging"
+
+
+PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(arg[0] + "/journal.export")));
+exporter.execute(new ActionContext(System.in, out, System.err))
+out.close();
+//exporter.binding
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/exportimport/export1X.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/exportimport/export1X.groovy b/tests/compatibility-tests/src/main/resources/exportimport/export1X.groovy
new file mode 100644
index 0000000..7667533
--- /dev/null
+++ b/tests/compatibility-tests/src/main/resources/exportimport/export1X.groovy
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.activemq.artemis.cli.commands.ActionContext
+import org.apache.activemq.artemis.cli.commands.tools.XmlDataExporter
+
+System.out.println("Arg::" + arg[0]);
+File pagingfile = new File(arg[0] + "/sender/data/paging")
+pagingfile.mkdirs()
+XmlDataExporter exporter = new XmlDataExporter();
+exporter.binding = arg[0] + "/sender/data/bindings"
+exporter.journal = arg[0] + "/sender/data/journal"
+try {
+ exporter.largeMessages = arg[0] + "/sender/data/largeMessages"
+} catch (Throwable e) {
+ exporter.largeMessges = arg[0] + "/sender/data/largeMessages"
+}
+exporter.paging = arg[0] + "/sender/data/paging"
+
+
+PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(arg[0] + "/journal.export")));
+exporter.execute(new ActionContext(System.in, out, System.err))
+out.close();
+//exporter.binding
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/exportimport/import.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/exportimport/import.groovy b/tests/compatibility-tests/src/main/resources/exportimport/import.groovy
new file mode 100644
index 0000000..6b9cf9b
--- /dev/null
+++ b/tests/compatibility-tests/src/main/resources/exportimport/import.groovy
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import org.apache.activemq.artemis.cli.commands.ActionContext
+import org.apache.activemq.artemis.cli.commands.tools.xml.XmlDataImporter
+
+
+System.out.println("Arg::" + arg[0]);
+File pagingfile = new File(arg[0] + "/sender/data/paging")
+pagingfile.mkdirs()
+XmlDataImporter importer = new XmlDataImporter();
+
+importer.input = arg[0] + "/journal.export"
+importer.execute(new ActionContext(System.in, System.out, System.err))
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/exportimport/import1X.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/exportimport/import1X.groovy b/tests/compatibility-tests/src/main/resources/exportimport/import1X.groovy
new file mode 100644
index 0000000..ceccb03
--- /dev/null
+++ b/tests/compatibility-tests/src/main/resources/exportimport/import1X.groovy
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.activemq.artemis.cli.commands.ActionContext
+import org.apache.activemq.artemis.cli.commands.tools.XmlDataImporter
+
+
+System.out.println("Arg::" + arg[0]);
+File pagingfile = new File(arg[0] + "/sender/data/paging")
+pagingfile.mkdirs()
+XmlDataImporter importer = new XmlDataImporter();
+
+importer.input = arg[0] + "/journal.export"
+importer.execute(new ActionContext(System.in, System.out, System.err))
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/meshTest/sendMessages.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/meshTest/sendMessages.groovy b/tests/compatibility-tests/src/main/resources/meshTest/sendMessages.groovy
index d13fa2f..71d33ef 100644
--- a/tests/compatibility-tests/src/main/resources/meshTest/sendMessages.groovy
+++ b/tests/compatibility-tests/src/main/resources/meshTest/sendMessages.groovy
@@ -5,16 +5,20 @@ import org.apache.activemq.artemis.tests.compatibility.GroovyRun
import javax.jms.*
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
// starts an artemis server
@@ -24,6 +28,7 @@ String operation = arg[2];
String queueName = "queue";
+String topicName = "topic";
int LARGE_MESSAGE_SIZE = 10 * 1024;
@@ -57,9 +62,18 @@ if (clientType.startsWith("ARTEMIS")) {
Connection connection = cf.createConnection();
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
Queue queue = session.createQueue(queueName);
+Topic topic = session.createTopic(topicName);
-if (operation.equals("sendAckMessages")) {
- MessageProducer producer = session.createProducer(queue);
+Destination destination = queue;
+
+if (operation.equals("sendTopic") || operation.equals("receiveNonDurableSubscription")) {
+ destination = topic;
+}
+
+
+if (operation.equals("sendAckMessages") || operation.equals("sendTopic")) {
+ println("sending...")
+ MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
System.out.println("Sending messages");
@@ -67,29 +81,36 @@ if (operation.equals("sendAckMessages")) {
TextMessage message = session.createTextMessage(textBody);
message.setStringProperty(HDR_DUPLICATE_DETECTION_ID, "some-duplicate");
message.setStringProperty("prop", "test");
+ message.setIntProperty("order", 0)
producer.send(message);
BytesMessage bytesMessage = session.createBytesMessage();
bytesMessage.writeBytes(BYTES_BODY);
+ bytesMessage.setIntProperty("order", 1)
producer.send(bytesMessage);
for (int i = 0; i < 10; i++) {
BytesMessage m = session.createBytesMessage();
m.setIntProperty("count", i);
+ m.setIntProperty("order", 2 + i)
m.setObjectProperty(propertyLargeMessage, createFakeLargeStream(LARGE_MESSAGE_SIZE));
producer.send(m);
}
- producer.send(session.createObjectMessage("rapadura"));
+ ObjectMessage objMessage = session.createObjectMessage("rapadura");
+ objMessage.setIntProperty("count", 13)
+ producer.send(objMessage);
MapMessage mapMessage = session.createMapMessage();
mapMessage.setString("prop", "rapadura")
+ mapMessage.setIntProperty("order", 14)
producer.send(mapMessage);
StreamMessage streamMessage = session.createStreamMessage();
+ streamMessage.setIntProperty("order", 15);
streamMessage.writeString("rapadura");
streamMessage.writeString("doce");
streamMessage.writeInt(33);
@@ -97,16 +118,25 @@ if (operation.equals("sendAckMessages")) {
Message plain = session.createMessage();
plain.setStringProperty("plain", "doce");
+ plain.setIntProperty("order", 15)
producer.send(plain);
session.commit();
connection.close();
System.out.println("Message sent");
-} else if (operation.equals("receiveMessages")) {
- MessageConsumer consumer = session.createConsumer(queue);
+}
+
+if (operation.equals("receiveMessages") || operation.equals("receiveNonDurableSubscription")) {
+ MessageConsumer consumer;
+
+ consumer = session.createConsumer(destination);
connection.start();
+ if (latch != null) {
+ latch.countDown();
+ }
+
System.out.println("Receiving messages");
TextMessage message = (TextMessage) consumer.receive(5000);
@@ -165,8 +195,6 @@ if (operation.equals("sendAckMessages")) {
session.commit();
connection.close();
System.out.println("Message received");
-} else {
- throw new RuntimeException("Invalid operation " + operation);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/sendAckTest/sendAckMessages.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/sendAckTest/sendAckMessages.groovy b/tests/compatibility-tests/src/main/resources/sendAckTest/sendAckMessages.groovy
index 3446257..75751f1 100644
--- a/tests/compatibility-tests/src/main/resources/sendAckTest/sendAckMessages.groovy
+++ b/tests/compatibility-tests/src/main/resources/sendAckTest/sendAckMessages.groovy
@@ -7,16 +7,20 @@ import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
// starts an artemis server
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/serial/serial.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/serial/serial.groovy b/tests/compatibility-tests/src/main/resources/serial/serial.groovy
index 1fc9dbd..0756fb3 100644
--- a/tests/compatibility-tests/src/main/resources/serial/serial.groovy
+++ b/tests/compatibility-tests/src/main/resources/serial/serial.groovy
@@ -1,15 +1,19 @@
package clients
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
// Create a client connection factory
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
index eb6383d..9c15a08 100644
--- a/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
+++ b/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
@@ -1,15 +1,19 @@
package servers
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
// starts an artemis server
@@ -36,7 +40,7 @@ System.out.println("folder:: " + folder);
configuration.setBrokerInstance(new File(folder + "/" + id));
configuration.addAcceptorConfiguration("artemis", "tcp://0.0.0.0:61616");
configuration.setSecurityEnabled(false);
-configuration.setPersistenceEnabled(false);
+configuration.setPersistenceEnabled(persistent);
try {
if (!type.startsWith("ARTEMIS-1")) {
configuration.addAddressesSetting("#", new AddressSettings().setAutoCreateAddresses(true));
@@ -53,8 +57,5 @@ server.setConfiguration(configuration);
server.setJmsConfiguration(jmsConfiguration);
server.start();
-// uncomment this next statements to validate https://issues.apache.org/jira/browse/ARTEMIS-1561
-if (producer.toString().startsWith("ARTEMIS-1") && type.equals("ARTEMIS-SNAPSHOT") ||
- producer.toString().startsWith("HORNETQ")) {
- server.getJMSServerManager().createQueue(true, "queue", null, true);
-}
+server.getJMSServerManager().createTopic(true, "topic");
+server.getJMSServerManager().createQueue(true, "queue", null, true);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/main/resources/servers/hornetqServer.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/servers/hornetqServer.groovy b/tests/compatibility-tests/src/main/resources/servers/hornetqServer.groovy
index be92768..6b49f42 100644
--- a/tests/compatibility-tests/src/main/resources/servers/hornetqServer.groovy
+++ b/tests/compatibility-tests/src/main/resources/servers/hornetqServer.groovy
@@ -1,15 +1,19 @@
package servers
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
// starts a hornetq server
@@ -19,7 +23,7 @@ import org.hornetq.core.config.impl.ConfigurationImpl
import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
import org.hornetq.core.remoting.impl.netty.TransportConstants
import org.hornetq.jms.server.config.impl.JMSConfigurationImpl
-import org.hornetq.jms.server.config.impl.JMSQueueConfigurationImpl
+import org.hornetq.jms.server.config.impl.*
import org.hornetq.jms.server.embedded.EmbeddedJMS
String folder = arg[0];
@@ -46,7 +50,11 @@ configuration.getAcceptorConfigurations().add(tpc);
jmsConfiguration = new JMSConfigurationImpl();
JMSQueueConfigurationImpl queueConfiguration = new JMSQueueConfigurationImpl("queue", null, true);
+TopicConfigurationImpl topicConfiguration = new TopicConfigurationImpl("topic");
+
+
jmsConfiguration.getQueueConfigurations().add(queueConfiguration);
+jmsConfiguration.getTopicConfigurations().add(topicConfiguration);
server = new EmbeddedJMS();
server.setConfiguration(configuration);
server.setJmsConfiguration(jmsConfiguration);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ExportImportTest.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ExportImportTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ExportImportTest.java
new file mode 100644
index 0000000..44f9011
--- /dev/null
+++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ExportImportTest.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.compatibility;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.activemq.artemis.utils.FileUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
+import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
+import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.TWO_FOUR;
+
+/**
+ * To run this test on the IDE and debug it, run the compatibility-tests through a command line once:
+ *
+ * cd /compatibility-tests
+ * mvn install -Ptests | tee output.log
+ *
+ * on the output.log you will see the output generated by {@link #getClasspathProperty(String)}
+ *
+ * On your IDE, edit the Run Configuration to your test and add those -D as parameters to your test.
+ * On Idea you would do the following:
+ *
+ * Run->Edit Configuration->Add ArtemisMeshTest and add your properties.
+ */
+@RunWith(Parameterized.class)
+public class ExportImportTest extends VersionedBaseTest {
+
+ // this will ensure that all tests in this class are run twice,
+ // once with "true" passed to the class' constructor and once with "false"
+ @Parameterized.Parameters(name = "server={0}, producer={1}, consumer={2}")
+ public static Collection getParameters() {
+ // we don't need every single version ever released..
+ // if we keep testing current one against 2.4 and 1.4.. we are sure the wire and API won't change over time
+ List<Object[]> combinations = new ArrayList<>();
+
+ /*
+ // during development sometimes is useful to comment out the combinations
+ // and add the ones you are interested.. example:
+ */
+ // combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, ONE_FIVE});
+ // combinations.add(new Object[]{ONE_FIVE, ONE_FIVE, ONE_FIVE});
+
+ combinations.addAll(combinatory(new Object[]{null}, new Object[]{ONE_FIVE, TWO_FOUR, SNAPSHOT}, new Object[]{ONE_FIVE, TWO_FOUR, SNAPSHOT}));
+ return combinations;
+ }
+
+ public ExportImportTest(String server, String sender, String receiver) throws Exception {
+ super(server, sender, receiver);
+ }
+
+ @Before
+ public void removeFolder() throws Throwable {
+ FileUtil.deleteDirectory(serverFolder.getRoot());
+ serverFolder.getRoot().mkdirs();
+ }
+
+ @After
+ public void tearDown() {
+ try {
+ stopServer(serverClassloader);
+ } catch (Throwable ignored) {
+ }
+ try {
+ stopServer(receiverClassloader);
+ } catch (Throwable ignored) {
+ }
+ }
+
+ @Test
+ @Ignore // There's some work to be done on exporter / importer, but I wanted to send it in already
+ public void testSendReceive() throws Throwable {
+ setVariable(senderClassloader, "persistent", Boolean.TRUE);
+ startServer(serverFolder.getRoot(), senderClassloader, "sender");
+ callScript(senderClassloader, "meshTest/sendMessages.groovy", server, sender, "sendAckMessages");
+ stopServer(senderClassloader);
+
+ if (sender.startsWith("ARTEMIS-1")) {
+ callScript(senderClassloader, "exportimport/export1X.groovy", serverFolder.getRoot().getAbsolutePath());
+ } else {
+ callScript(senderClassloader, "exportimport/export.groovy", serverFolder.getRoot().getAbsolutePath());
+ }
+
+ setVariable(receiverClassloader, "persistent", Boolean.TRUE);
+ startServer(serverFolder.getRoot(), receiverClassloader, "receiver");
+
+ if (receiver.startsWith("ARTEMIS-1")) {
+ callScript(receiverClassloader, "exportimport/import1X.groovy", serverFolder.getRoot().getAbsolutePath());
+ } else {
+ callScript(receiverClassloader, "exportimport/import.groovy", serverFolder.getRoot().getAbsolutePath());
+ }
+
+ setVariable(receiverClassloader, "latch", null);
+ callScript(receiverClassloader, "meshTest/sendMessages.groovy", server, receiver, "receiveMessages");
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/MeshTest.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/MeshTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/MeshTest.java
index 0c78255..37978dc 100644
--- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/MeshTest.java
+++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/MeshTest.java
@@ -1,14 +1,18 @@
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.activemq.artemis.tests.compatibility;
@@ -16,7 +20,11 @@ package org.apache.activemq.artemis.tests.compatibility;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -42,7 +50,7 @@ import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.TWO_FOUR
* Run->Edit Configuration->Add ArtemisMeshTest and add your properties.
*/
@RunWith(Parameterized.class)
-public class MeshTest extends VersionedBaseTest {
+public class MeshTest extends ServerBaseTest {
// this will ensure that all tests in this class are run twice,
// once with "true" passed to the class' constructor and once with "false"
@@ -73,8 +81,36 @@ public class MeshTest extends VersionedBaseTest {
@Test
public void testSendReceive() throws Throwable {
- callMain(senderClassloader, GroovyRun.class.getName(), "meshTest/sendMessages.groovy", server, sender, "sendAckMessages");
- callMain(receiverClassloader, GroovyRun.class.getName(), "meshTest/sendMessages.groovy", server, receiver, "receiveMessages");
+ setVariable(receiverClassloader, "latch", null);
+ callScript(senderClassloader, "meshTest/sendMessages.groovy", server, sender, "sendAckMessages");
+ callScript(receiverClassloader, "meshTest/sendMessages.groovy", server, receiver, "receiveMessages");
+ }
+
+ @Test
+ public void testSendReceiveTopicNonDurable() throws Throwable {
+ CountDownLatch latch = new CountDownLatch(1);
+
+ setVariable(receiverClassloader, "latch", latch);
+ AtomicInteger errors = new AtomicInteger(0);
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ try {
+ callScript(receiverClassloader, "meshTest/sendMessages.groovy", server, receiver, "receiveNonDurableSubscription");
+ } catch (Exception e) {
+ e.printStackTrace();
+ errors.incrementAndGet();
+ }
+ }
+ };
+
+ t.start();
+ Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
+ callScript(senderClassloader,"meshTest/sendMessages.groovy", server, sender, "sendTopic");
+
+ t.join();
+
+ Assert.assertEquals(0, errors.get());
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SendAckTest.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SendAckTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SendAckTest.java
index aeec6dc..e915679 100644
--- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SendAckTest.java
+++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SendAckTest.java
@@ -1,14 +1,18 @@
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.activemq.artemis.tests.compatibility;
@@ -40,7 +44,7 @@ import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE
* Run->Edit Configuration->Add ArtemisMeshTest and add your properties.
*/
@RunWith(Parameterized.class)
-public class SendAckTest extends VersionedBaseTest {
+public class SendAckTest extends ServerBaseTest {
// this will ensure that all tests in this class are run twice,
// once with "true" passed to the class' constructor and once with "false"
@@ -72,8 +76,8 @@ public class SendAckTest extends VersionedBaseTest {
@Test
public void testSendReceive() throws Throwable {
- callMain(senderClassloader, GroovyRun.class.getName(), "sendAckTest/sendAckMessages.groovy", server, sender, "sendAckMessages");
- callMain(receiverClassloader, GroovyRun.class.getName(), "sendAckTest/sendAckMessages.groovy", server, receiver, "receiveMessages");
+ callScript(senderClassloader, "sendAckTest/sendAckMessages.groovy", server, sender, "sendAckMessages");
+ callScript(receiverClassloader, "sendAckTest/sendAckMessages.groovy", server, receiver, "receiveMessages");
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SerializationTest.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SerializationTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SerializationTest.java
index b5a871d..6108cec 100644
--- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SerializationTest.java
+++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SerializationTest.java
@@ -1,14 +1,18 @@
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.activemq.artemis.tests.compatibility;
@@ -39,7 +43,7 @@ import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT
* Run->Edit Configuration->Add ArtemisMeshTest and add your properties.
*/
@RunWith(Parameterized.class)
-public class SerializationTest extends VersionedBaseTest {
+public class SerializationTest extends ServerBaseTest {
// this will ensure that all tests in this class are run twice,
// once with "true" passed to the class' constructor and once with "false"
@@ -68,8 +72,8 @@ public class SerializationTest extends VersionedBaseTest {
public void testSerializeFactory() throws Throwable {
File file = serverFolder.newFile("objects.ser");
file.mkdirs();
- callMain(senderClassloader, GroovyRun.class.getName(), "serial/serial.groovy", file.getAbsolutePath(), "write");
- callMain(receiverClassloader, GroovyRun.class.getName(), "serial/serial.groovy", file.getAbsolutePath(), "read");
+ callScript(senderClassloader, "serial/serial.groovy", file.getAbsolutePath(), "write");
+ callScript(receiverClassloader, "serial/serial.groovy", file.getAbsolutePath(), "read");
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ServerBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ServerBaseTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ServerBaseTest.java
new file mode 100644
index 0000000..f519eab
--- /dev/null
+++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/ServerBaseTest.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.compatibility;
+
+import org.apache.activemq.artemis.utils.FileUtil;
+import org.junit.After;
+import org.junit.Before;
+
+public class ServerBaseTest extends VersionedBaseTest {
+
+ public ServerBaseTest(String server, String sender, String receiver) throws Exception {
+ super(server, sender, receiver);
+ }
+
+ @Before
+ public void setUp() throws Throwable {
+ FileUtil.deleteDirectory(serverFolder.getRoot());
+ setVariable(serverClassloader, "persistent", Boolean.FALSE);
+ startServer(serverFolder.getRoot(), serverClassloader, "live");
+ }
+
+ @After
+ public void tearDown() throws Throwable {
+ stopServer(serverClassloader);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/VersionedBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/VersionedBaseTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/VersionedBaseTest.java
index 5423d36..62b98c6 100644
--- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/VersionedBaseTest.java
+++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/VersionedBaseTest.java
@@ -1,14 +1,18 @@
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.activemq.artemis.tests.compatibility;
@@ -24,12 +28,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import org.apache.activemq.artemis.utils.FileUtil;
import org.apache.activemq.artemis.utils.RunnableEx;
-import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assume;
-import org.junit.Before;
import org.junit.ClassRule;
import org.junit.rules.TemporaryFolder;
@@ -48,6 +49,9 @@ public abstract class VersionedBaseTest {
protected static Map<String, ClassLoader> loaderMap = new HashMap<>();
public VersionedBaseTest(String server, String sender, String receiver) throws Exception {
+ if (server == null) {
+ server = sender;
+ }
this.server = server;
this.sender = sender;
this.receiver = receiver;
@@ -72,53 +76,30 @@ public abstract class VersionedBaseTest {
serverFolder = new TemporaryFolder(parent);
}
- @Before
- public void startServer() throws Throwable {
- FileUtil.deleteDirectory(serverFolder.getRoot());
-
- serverFolder.getRoot().mkdirs();
-
- System.out.println("Folder::" + serverFolder.getRoot());
-
- String scriptToUse;
- if (server.startsWith("ARTEMIS")) {
- scriptToUse = "servers/artemisServer.groovy";
- } else {
- scriptToUse = "servers/hornetqServer.groovy";
- }
-
- callMain(serverClassloader, GroovyRun.class.getName(), scriptToUse, serverFolder.getRoot().getAbsolutePath(), "1", server, sender, receiver);
- }
-
- @After
- public void stopServer() throws Throwable {
- callExecute(serverClassloader, GroovyRun.class.getName(), "server.stop()");
-
- // GC help!!!
- serverClassloader = null;
- senderClassloader = null;
- receiverClassloader = null;
- }
-
@AfterClass
public static void cleanup() {
loaderMap.clear();
}
- protected static void callMain(ClassLoader loader,
- String className,
- String script,
- String... arguments) throws Exception {
+ protected static void callScript(ClassLoader loader, String script, String... arguments) throws Exception {
tclCall(loader, () -> {
- Class clazz = loader.loadClass(className);
- Method method = clazz.getMethod("doMain", String.class, String[].class);
+ Class clazz = loader.loadClass(GroovyRun.class.getName());
+ Method method = clazz.getMethod("doTest", String.class, String[].class);
method.invoke(null, script, arguments);
});
}
- protected static void callExecute(ClassLoader loader, String className, String script) throws Exception {
+ protected static void setVariable(ClassLoader loader, String name, Object object) throws Exception {
+ tclCall(loader, () -> {
+ Class clazz = loader.loadClass(GroovyRun.class.getName());
+ Method method = clazz.getMethod("setVariable", String.class, Object.class);
+ method.invoke(null, name, object);
+ });
+ }
+
+ protected static void callExecute(ClassLoader loader, String script) throws Exception {
tclCall(loader, () -> {
- Class clazz = loader.loadClass(className);
+ Class clazz = loader.loadClass(GroovyRun.class.getName());
Method method = clazz.getMethod("execute", String.class);
method.invoke(null, script);
});
@@ -135,7 +116,6 @@ public abstract class VersionedBaseTest {
}
}
-
protected static ClassLoader defineClassLoader(String classPath) throws MalformedURLException {
String[] classPathArray = classPath.split(File.pathSeparator);
URL[] elements = new URL[classPathArray.length];
@@ -176,7 +156,6 @@ public abstract class VersionedBaseTest {
Assume.assumeTrue("Cannot run these tests, no classpath found", ok);
}
-
loader = defineClassLoader(value);
loaderMap.put(name, loader);
@@ -197,4 +176,22 @@ public abstract class VersionedBaseTest {
return combinations;
}
+ public void startServer(File folder, ClassLoader loader, String serverName) throws Throwable {
+ folder.mkdirs();
+
+ System.out.println("Folder::" + folder);
+
+ String scriptToUse;
+ if (server.startsWith("ARTEMIS")) {
+ scriptToUse = "servers/artemisServer.groovy";
+ } else {
+ scriptToUse = "servers/hornetqServer.groovy";
+ }
+
+ callScript(loader, scriptToUse, folder.getAbsolutePath(), serverName, server, sender, receiver);
+ }
+
+ public void stopServer(ClassLoader loader) throws Throwable {
+ callExecute(loader, "server.stop()");
+ }
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c8dc7de4/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/package-info.java
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/package-info.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/package-info.java
index 0c3c124..e78ed58 100644
--- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/package-info.java
+++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/package-info.java
@@ -1,14 +1,18 @@
/*
- * Copyright 2005-2014 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
/**