You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2018/01/10 16:22:32 UTC
[1/2] activemq-artemis git commit: ARTEMIS-1595 Fixing serialization
issues between Artemis 1.5 and master
Repository: activemq-artemis
Updated Branches:
refs/heads/master 247ed5996 -> 9e68d8464
ARTEMIS-1595 Fixing serialization issues between Artemis 1.5 and master
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/12ef662b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/12ef662b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/12ef662b
Branch: refs/heads/master
Commit: 12ef662b919b373ee8e4ec8e35fea6a57b00bfe1
Parents: 247ed59
Author: Clebert Suconic <cl...@apache.org>
Authored: Tue Jan 9 20:27:17 2018 -0500
Committer: Michael Pearce <mi...@me.com>
Committed: Wed Jan 10 16:19:55 2018 +0000
----------------------------------------------------------------------
.../jms/client/ActiveMQConnectionFactory.java | 4 +-
.../artemis/jms/client/ActiveMQDestination.java | 39 ++++++--
.../maven/ArtemisDependencyScanPlugin.java | 2 +-
tests/compatibility-tests/pom.xml | 6 ++
.../artemis/tests/compatibility/GroovyRun.java | 7 ++
.../src/main/resources/serial/jbmserial.groovy | 99 ++++++++++++++++++++
.../tests/compatibility/SerializationTest.java | 37 +++++++-
7 files changed, 181 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ef662b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
index 31f39f2..aad68a9 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
@@ -195,7 +195,9 @@ public class ActiveMQConnectionFactory extends JNDIStorable implements Connectio
serverLocator = locatorParser.newObject(uri, null);
parser.populateObject(uri, this);
} catch (Exception e) {
- throw new InvalidObjectException(e.getMessage());
+ InvalidObjectException ex = new InvalidObjectException(e.getMessage());
+ ex.initCause(e);
+ throw ex;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ef662b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
index d374265..626dd4d 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
@@ -231,7 +231,11 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
*/
private SimpleString simpleAddress;
- private final TYPE type;
+ private final boolean temporary;
+
+ private final boolean queue;
+
+ private transient TYPE thetype;
private final transient ActiveMQSession session;
@@ -242,9 +246,13 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
final ActiveMQSession session) {
this.simpleAddress = SimpleString.toSimpleString(address);
- this.type = type;
+ this.thetype = type;
this.session = session;
+
+ this.temporary = TYPE.isTemporary(type);
+
+ this.queue = TYPE.isQueue(type);
}
protected ActiveMQDestination(final SimpleString address,
@@ -252,9 +260,13 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
final ActiveMQSession session) {
this.simpleAddress = address;
- this.type = type;
+ this.thetype = type;
this.session = session;
+
+ this.temporary = TYPE.isTemporary(type);
+
+ this.queue = TYPE.isQueue(type);
}
public void setAddress(String address) {
@@ -283,7 +295,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
}
public boolean isQueue() {
- return TYPE.isQueue(type);
+ return queue;
}
// Public --------------------------------------------------------
@@ -301,11 +313,26 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
}
public boolean isTemporary() {
- return TYPE.isTemporary(type);
+ return temporary;
}
public TYPE getType() {
- return type;
+ if (thetype == null) {
+ if (temporary) {
+ if (isQueue()) {
+ thetype = TYPE.TEMP_QUEUE;
+ } else {
+ thetype = TYPE.TEMP_TOPIC;
+ }
+ } else {
+ if (isQueue()) {
+ thetype = TYPE.QUEUE;
+ } else {
+ thetype = TYPE.TOPIC;
+ }
+ }
+ }
+ return thetype;
}
@Override
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ef662b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
index 2c653fa..9091535 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
@@ -138,7 +138,7 @@ public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin {
private void setVariable(String classPathGenerated) {
if (variableName != null) {
project.getProperties().setProperty(variableName, classPathGenerated);
- getLog().info("dependency-scan setting: " + variableName + "=" + classPathGenerated);
+ getLog().info("dependency-scan setting: -D" + variableName + "=\"" + classPathGenerated + "\"");
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ef662b/tests/compatibility-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/pom.xml b/tests/compatibility-tests/pom.xml
index 7d3ed3c..8c1fc52 100644
--- a/tests/compatibility-tests/pom.xml
+++ b/tests/compatibility-tests/pom.xml
@@ -275,6 +275,11 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.marshalling</groupId>
+ <artifactId>jboss-marshalling-river</artifactId>
+ <version>2.0.2.Final</version>
+ </dependency>
</dependencies>
<build>
@@ -383,6 +388,7 @@
<arg>org.apache.activemq:artemis-amqp-protocol:1.5.5</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:1.5.5</arg>
<arg>org.codehaus.groovy:groovy-all:${groovy.version}</arg>
+ <arg>org.jboss.marshalling:jboss-marshalling-river:2.0.2.Final</arg>
</libListWithDeps>
<libList>
<arg>org.apache.activemq.tests:compatibility-tests:${project.version}</arg>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ef662b/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 6fd38f7..c66a518 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
@@ -98,6 +98,13 @@ public class GroovyRun {
}
}
+
+ public static void assertFalse(boolean value) {
+ if (value) {
+ throw new RuntimeException("Expected false");
+ }
+ }
+
public static void assertEquals(Object value1, Object value2) {
if (!value1.equals(value2)) {
throw new RuntimeException(value1 + "!=" + value2);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ef662b/tests/compatibility-tests/src/main/resources/serial/jbmserial.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/serial/jbmserial.groovy b/tests/compatibility-tests/src/main/resources/serial/jbmserial.groovy
new file mode 100644
index 0000000..159cce9
--- /dev/null
+++ b/tests/compatibility-tests/src/main/resources/serial/jbmserial.groovy
@@ -0,0 +1,99 @@
+package clients
+/*
+ * 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.
+ */
+
+// Create a client connection factory
+
+import org.apache.activemq.artemis.tests.compatibility.GroovyRun
+import org.jboss.marshalling.Marshaller
+import org.jboss.marshalling.MarshallerFactory
+import org.jboss.marshalling.Marshalling
+import org.jboss.marshalling.MarshallingConfiguration
+import org.jboss.marshalling.Unmarshaller
+
+import javax.jms.*;
+import org.apache.activemq.artemis.jms.client.*
+
+
+file = arg[0]
+method = arg[1]
+System.out.println("File::" + file);
+
+
+
+// Get the factory for the "river" marshalling protocol
+final MarshallerFactory factory = Marshalling.getProvidedMarshallerFactory("river");
+
+// Create a configuration
+final MarshallingConfiguration configuration = new MarshallingConfiguration();
+// Use version 3
+configuration.setVersion(3);
+
+if (method.equals("write")) {
+ cf = new ActiveMQConnectionFactory("tcp://localhost:61616?confirmationWindowSize=1048576&blockOnDurableSend=false");
+ queue = new ActiveMQQueue("queue");
+ topic = new ActiveMQTopic("topic")
+ temporary = ActiveMQDestination.createTemporaryQueue("whatever")
+ temporaryTopic = ActiveMQDestination.createTemporaryTopic("whatever")
+
+ Marshaller marshaller = factory.createMarshaller(configuration)
+ FileOutputStream fileOutputStream = new FileOutputStream(file)
+ marshaller.start(Marshalling.createByteOutput(fileOutputStream));
+ marshaller.writeObject(cf);
+ marshaller.writeObject(queue)
+ marshaller.writeObject(topic)
+ marshaller.writeObject(temporary)
+ marshaller.writeObject(temporaryTopic)
+ marshaller.finish()
+ fileOutputStream.close();
+} else {
+ Unmarshaller unmarshaller = factory.createUnmarshaller(configuration)
+ FileInputStream inputfile = new FileInputStream(file)
+ unmarshaller.start(Marshalling.createByteInput(inputfile))
+ cf = unmarshaller.readObject();
+ queue = unmarshaller.readObject()
+ topic = unmarshaller.readObject()
+ temporary = unmarshaller.readObject()
+ temporaryTopic = unmarshaller.readObject()
+}
+
+GroovyRun.assertTrue(!cf.getServerLocator().isBlockOnDurableSend());
+GroovyRun.assertEquals(1048576, cf.getServerLocator().getConfirmationWindowSize());
+
+Connection connection = cf.createConnection();
+Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ActiveMQDestination queueDest = (ActiveMQDestination)queue;
+GroovyRun.assertTrue(queueDest.isQueue())
+GroovyRun.assertFalse(queueDest.isTemporary())
+
+ActiveMQDestination topicDest = (ActiveMQDestination)topic
+GroovyRun.assertFalse(topicDest.isQueue())
+GroovyRun.assertFalse(queueDest.isTemporary())
+
+ActiveMQDestination temporaryDest = (ActiveMQDestination)temporary
+GroovyRun.assertTrue(temporaryDest.isQueue())
+GroovyRun.assertTrue(temporaryDest.isTemporary())
+
+temporaryDest = (ActiveMQDestination)temporaryTopic
+GroovyRun.assertFalse(temporaryDest.isQueue())
+GroovyRun.assertTrue(temporaryDest.isTemporary())
+
+MessageConsumer consumer = session.createConsumer(queue);
+MessageProducer topicProducer = session.createProducer(topic)
+connection.close();
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ef662b/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 6108cec..9310782 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
@@ -22,11 +22,15 @@ 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.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.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
/**
@@ -43,7 +47,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 ServerBaseTest {
+public class SerializationTest 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"
@@ -60,7 +64,7 @@ public class SerializationTest extends ServerBaseTest {
// combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, ONE_FIVE});
// combinations.add(new Object[]{ONE_FIVE, ONE_FIVE, ONE_FIVE});
- combinations.addAll(combinatory(new Object[]{SNAPSHOT}, new Object[]{ONE_FIVE, SNAPSHOT}, new Object[]{ONE_FIVE, SNAPSHOT}));
+ combinations.addAll(combinatory(new Object[]{null}, new Object[]{ONE_FIVE, SNAPSHOT}, new Object[]{ONE_FIVE, SNAPSHOT}));
return combinations;
}
@@ -68,12 +72,35 @@ public class SerializationTest extends ServerBaseTest {
super(server, sender, receiver);
}
+ @Before
+ public void beforeTest() throws Throwable {
+ FileUtil.deleteDirectory(serverFolder.getRoot());
+ serverFolder.getRoot().mkdirs();
+ setVariable(senderClassloader, "persistent", false);
+ startServer(serverFolder.getRoot(), senderClassloader, "1");
+ }
+
+ @After
+ public void afterTest() {
+ try {
+ stopServer(senderClassloader);
+ } catch (Throwable ignored) {
+ ignored.printStackTrace();
+ }
+ }
+
@Test
public void testSerializeFactory() throws Throwable {
File file = serverFolder.newFile("objects.ser");
- file.mkdirs();
- callScript(senderClassloader, "serial/serial.groovy", file.getAbsolutePath(), "write");
- callScript(receiverClassloader, "serial/serial.groovy", file.getAbsolutePath(), "read");
+ callScript(senderClassloader, "serial/serial.groovy", file.getAbsolutePath(), "write");
+ callScript(receiverClassloader, "serial/serial.groovy", file.getAbsolutePath(), "read");
+ }
+
+ @Test
+ public void testJBMSerializeFactory() throws Throwable {
+ File file = serverFolder.newFile("objectsjbm.ser");
+ callScript(senderClassloader, "serial/jbmserial.groovy", file.getAbsolutePath(), "write");
+ callScript(receiverClassloader, "serial/jbmserial.groovy", file.getAbsolutePath(), "read");
}
}
[2/2] activemq-artemis git commit: This closes #1764
Posted by mi...@apache.org.
This closes #1764
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/9e68d846
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/9e68d846
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/9e68d846
Branch: refs/heads/master
Commit: 9e68d846456cbddb8f0051f07616a4e9918b8018
Parents: 247ed59 12ef662
Author: Michael Pearce <mi...@me.com>
Authored: Wed Jan 10 16:19:55 2018 +0000
Committer: Michael André Pearce <mi...@me.com>
Committed: Wed Jan 10 16:21:56 2018 +0000
----------------------------------------------------------------------
.../jms/client/ActiveMQConnectionFactory.java | 4 +-
.../artemis/jms/client/ActiveMQDestination.java | 39 ++++++--
.../maven/ArtemisDependencyScanPlugin.java | 2 +-
tests/compatibility-tests/pom.xml | 6 ++
.../artemis/tests/compatibility/GroovyRun.java | 7 ++
.../src/main/resources/serial/jbmserial.groovy | 99 ++++++++++++++++++++
.../tests/compatibility/SerializationTest.java | 36 ++++++-
7 files changed, 180 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e68d846/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/SerializationTest.java
----------------------------------------------------------------------