You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/03/04 13:15:28 UTC
[02/16] activemq-artemis git commit: ARTEMIS-1009 Pure Message
Encoding.
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
index d9a817e..c0487d0 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
@@ -16,40 +16,43 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.bridge;
-import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.core.server.ServerMessage;
+
+import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.core.server.cluster.Transformer;
public class SimpleTransformer implements Transformer {
@Override
- public ServerMessage transform(final ServerMessage message) {
- SimpleString oldProp = (SimpleString) message.getObjectProperty(new SimpleString("wibble"));
-
- if (!oldProp.equals(new SimpleString("bing"))) {
- throw new IllegalStateException("Wrong property value!!");
- }
-
- // Change a property
- message.putStringProperty(new SimpleString("wibble"), new SimpleString("bong"));
-
- // Change the body
- ActiveMQBuffer buffer = message.getBodyBuffer();
-
- buffer.readerIndex(0);
-
- String str = buffer.readString();
-
- if (!str.equals("doo be doo be doo be doo")) {
- throw new IllegalStateException("Wrong body!!");
- }
-
- buffer.clear();
-
- buffer.writeString("dee be dee be dee be dee");
-
- return message;
+ public Message transform(final Message message) {
+
+ // TODO-now: fix this test!!!
+
+ throw new RuntimeException(("Fix me"));
+// SimpleString oldProp = (SimpleString) message.getObjectProperty(new SimpleString("wibble"));
+//
+// if (!oldProp.equals(new SimpleString("bing"))) {
+// throw new IllegalStateException("Wrong property value!!");
+// }
+//
+// // Change a property
+// message.putStringProperty(new SimpleString("wibble"), new SimpleString("bong"));
+//
+// // Change the body
+// ActiveMQBuffer buffer = message.getBodyBuffer();
+//
+// buffer.readerIndex(0);
+//
+// String str = buffer.readString();
+//
+// if (!str.equals("doo be doo be doo be doo")) {
+// throw new IllegalStateException("Wrong body!!");
+// }
+//
+// buffer.clear();
+//
+// buffer.writeString("dee be dee be dee be dee");
+//
+// return message;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
index 26bcb43..8766057 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
@@ -16,12 +16,13 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
+import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
-import org.apache.activemq.artemis.core.message.impl.MessageImpl;
+
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import org.junit.Before;
import org.junit.Test;
@@ -83,7 +84,7 @@ public class ClusterHeadersRemovedTest extends ClusterTestBase {
assertNotNull(message);
- assertFalse(message.containsProperty(MessageImpl.HDR_ROUTE_TO_IDS));
+ assertFalse(message.containsProperty(Message.HDR_ROUTE_TO_IDS));
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
index de5fe33..0b0fa00 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
@@ -28,7 +28,7 @@ import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
-import org.apache.activemq.artemis.core.message.impl.MessageImpl;
+
import org.apache.activemq.artemis.core.server.Bindable;
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import org.apache.activemq.artemis.core.server.cluster.impl.Redistributor;
@@ -474,7 +474,7 @@ public class MessageRedistributionTest extends ClusterTestBase {
bb.putLong(i);
- msg.putBytesProperty(MessageImpl.HDR_BRIDGE_DUPLICATE_ID, bytes);
+ msg.putBytesProperty(Message.HDR_BRIDGE_DUPLICATE_ID, bytes);
prod0.send(msg);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
index 510fa68..69a360e 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
@@ -20,6 +20,7 @@ import java.util.Collection;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.Message;
+
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
@@ -35,7 +36,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.api.core.RoutingType;
-import org.apache.activemq.artemis.core.server.ServerMessage;
+
import org.apache.activemq.artemis.core.server.cluster.Transformer;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl;
@@ -1301,7 +1302,7 @@ public class DivertTest extends ActiveMQTestBase {
ServiceRegistryImpl serviceRegistry = new ServiceRegistryImpl();
Transformer transformer = new Transformer() {
@Override
- public ServerMessage transform(ServerMessage message) {
+ public Message transform(Message message) {
return null;
}
};
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
index 43a4ad9..eff1615 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
@@ -50,7 +50,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionRec
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendMessage;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.api.core.RoutingType;
-import org.apache.activemq.artemis.core.server.ServerMessage;
+
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
@@ -88,7 +88,7 @@ public class InterceptorTest extends ActiveMQTestBase {
if (packet.getType() == PacketImpl.SESS_SEND) {
SessionSendMessage p = (SessionSendMessage) packet;
- ServerMessage sm = (ServerMessage) p.getMessage();
+ Message sm = p.getMessage();
sm.putStringProperty(InterceptorTest.key, "orange");
}
@@ -165,7 +165,7 @@ public class InterceptorTest extends ActiveMQTestBase {
if (packet.getType() == PacketImpl.SESS_RECEIVE_MSG) {
SessionReceiveMessage p = (SessionReceiveMessage) packet;
- ServerMessage sm = (ServerMessage) p.getMessage();
+ Message sm = p.getMessage();
sm.putStringProperty(InterceptorTest.key, "orange");
}
@@ -319,7 +319,7 @@ public class InterceptorTest extends ActiveMQTestBase {
if (packet.getType() == PacketImpl.SESS_SEND) {
SessionSendMessage p = (SessionSendMessage) packet;
- ServerMessage sm = (ServerMessage) p.getMessage();
+ Message sm = p.getMessage();
sm.putIntProperty(key, num);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/MessageJournalTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/MessageJournalTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/MessageJournalTest.java
new file mode 100644
index 0000000..85ed04f
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/MessageJournalTest.java
@@ -0,0 +1,130 @@
+/**
+ * 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.integration.journal;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo;
+import org.apache.activemq.artemis.core.journal.RecordInfo;
+import org.apache.activemq.artemis.core.journal.TransactionFailureCallback;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
+import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
+import org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage;
+import org.apache.activemq.artemis.protocol.amqp.broker.ProtonProtocolManagerFactory;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.qpid.proton.message.Message;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class MessageJournalTest extends ActiveMQTestBase {
+
+ @Test
+ public void testStoreCore() throws Throwable {
+ ActiveMQServer server = createServer(true);
+
+ server.start();
+
+ CoreMessage message = new CoreMessage().initBuffer(10 * 1024).setDurable(true);
+
+ message.setMessageID(333);
+
+ CoreProtocolManagerFactory factory = (CoreProtocolManagerFactory) server.getRemotingService().getProtocolFactoryMap().get("CORE");
+
+ Assert.assertNotNull(factory);
+
+ message.getBodyBuffer().writeByte((byte)'Z');
+
+ server.getStorageManager().storeMessage(message);
+
+ server.getStorageManager().stop();
+
+ JournalStorageManager journalStorageManager = (JournalStorageManager) server.getStorageManager();
+
+ List<RecordInfo> committedRecords = new LinkedList<>();
+
+ List<PreparedTransactionInfo> preparedTransactions = new LinkedList<>();
+
+ TransactionFailureCallback transactionFailure = new TransactionFailureCallback() {
+ @Override
+ public void failedTransaction(long transactionID, List<RecordInfo> records, List<RecordInfo> recordsToDelete) {
+
+ }
+ };
+
+ try {
+ journalStorageManager.getMessageJournal().start();
+
+ journalStorageManager.getMessageJournal().load(committedRecords, preparedTransactions, transactionFailure);
+
+ Assert.assertEquals(1, committedRecords.size());
+ } finally {
+ journalStorageManager.getMessageJournal().stop();
+ }
+
+ }
+
+
+ @Test
+ public void testStoreAMQP() throws Throwable {
+ ActiveMQServer server = createServer(true);
+
+ server.start();
+
+ ProtonProtocolManagerFactory factory = (ProtonProtocolManagerFactory) server.getRemotingService().getProtocolFactoryMap().get("AMQP");
+
+ Message protonJMessage = Message.Factory.create();
+
+ AMQPMessage message = new AMQPMessage(protonJMessage);
+
+ message.setMessageID(333);
+
+ Assert.assertNotNull(factory);
+
+ server.getStorageManager().storeMessage(message);
+
+ server.getStorageManager().stop();
+
+ JournalStorageManager journalStorageManager = (JournalStorageManager) server.getStorageManager();
+
+ List<RecordInfo> committedRecords = new LinkedList<>();
+
+ List<PreparedTransactionInfo> preparedTransactions = new LinkedList<>();
+
+ TransactionFailureCallback transactionFailure = new TransactionFailureCallback() {
+ @Override
+ public void failedTransaction(long transactionID, List<RecordInfo> records, List<RecordInfo> recordsToDelete) {
+
+ }
+ };
+
+ try {
+ journalStorageManager.getMessageJournal().start();
+
+ journalStorageManager.getMessageJournal().load(committedRecords, preparedTransactions, transactionFailure);
+
+ Assert.assertEquals(1, committedRecords.size());
+ } finally {
+ journalStorageManager.getMessageJournal().stop();
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java
index 38cc126..a0f23d0 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java
@@ -43,9 +43,9 @@ import org.apache.activemq.artemis.core.journal.impl.JournalCompactor;
import org.apache.activemq.artemis.core.journal.impl.JournalFile;
import org.apache.activemq.artemis.core.journal.impl.JournalFileImpl;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
import org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl;
-import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
import org.apache.activemq.artemis.tests.unit.core.journal.impl.JournalImplTestBase;
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
@@ -1656,13 +1656,13 @@ public class NIOJournalCompactTest extends JournalImplTestBase {
long id = seqGenerator.incrementAndGet();
values[i] = id;
- ServerMessageImpl message = new ServerMessageImpl(id, 100);
+ CoreMessage message = new CoreMessage(id, 100);
message.getBodyBuffer().writeBytes(new byte[1024]);
storage.storeMessageTransactional(tx, message);
}
- ServerMessageImpl message = new ServerMessageImpl(seqGenerator.incrementAndGet(), 100);
+ CoreMessage message = new CoreMessage(seqGenerator.incrementAndGet(), 100);
survivingMsgs.add(message.getMessageID());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/ContainerBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/ContainerBaseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/ContainerBaseTest.java
new file mode 100644
index 0000000..f055531
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/ContainerBaseTest.java
@@ -0,0 +1,64 @@
+/**
+ * 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.integration.karaf;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.ops4j.pax.exam.ExamSystem;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.TestAddress;
+import org.ops4j.pax.exam.TestContainer;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.TestProbeProvider;
+import org.ops4j.pax.exam.spi.PaxExamRuntime;
+
+/**
+ * This is useful for when you want to automate remote tests.
+ */
+public abstract class ContainerBaseTest extends KarafBaseTest {
+ protected ExamSystem system;
+ protected TestProbeBuilder builder;
+ protected TestAddress testToBeCalled;
+ protected TestProbeProvider probe;
+ protected TestContainer container;
+
+ protected void setupContainer(Class testToCall, String methodToCall, Option[] options) throws IOException {
+ system = PaxExamRuntime.createTestSystem(options);
+ builder = system.createProbe();
+ testToBeCalled = builder.addTest(testToCall, methodToCall);
+ probe = builder.build();
+ container = PaxExamRuntime.createContainer(system);
+ container.start();
+ container.install(probe.getStream());
+ }
+
+ @After
+ public void shutdownContainer() {
+ if (container != null) {
+ container.stop();
+ }
+ }
+
+
+ protected void executeRemoteTest() {
+ container.call(testToBeCalled);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/KarafBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/KarafBaseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/KarafBaseTest.java
new file mode 100644
index 0000000..22f1efc
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/KarafBaseTest.java
@@ -0,0 +1,212 @@
+/**
+ * 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.integration.karaf;
+
+import javax.inject.Inject;
+import javax.security.auth.Subject;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.PrintStream;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.karaf.jaas.boot.principal.RolePrincipal;
+import org.apache.karaf.jaas.boot.principal.UserPrincipal;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.api.console.SessionFactory;
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
+import org.ops4j.pax.exam.options.UrlReference;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.util.tracker.ServiceTracker;
+
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+public class KarafBaseTest extends Assert {
+
+ private static Logger LOG = Logger.getLogger(KarafBaseTest.class.getName());
+
+ public static final long ASSERTION_TIMEOUT = 30000L;
+ public static final long COMMAND_TIMEOUT = 30000L;
+ public static final String USER = "karaf";
+ public static final String PASSWORD = "karaf";
+
+ /**
+ * plug to add more options on sub tests
+ */
+ protected void testOptions(List<Option> options) throws Exception {
+ }
+
+ public Option[] configureArtemisFeatures(boolean debug, String version, String... features) throws Exception {
+
+ ArrayList<String> featureArray = new ArrayList<>();
+ featureArray.addAll(Arrays.asList(features));
+
+ List<Option> optionList = new LinkedList<>();
+
+ optionList.add(karafDistributionConfiguration().
+ frameworkUrl(maven().groupId("org.apache.karaf").
+ artifactId("apache-karaf").type("tar.gz").
+ versionAsInProject()).unpackDirectory(new File("target/containertest/unpack/")));
+ optionList.add(KarafDistributionOption.keepRuntimeFolder());
+ optionList.add(logLevel(LogLevelOption.LogLevel.INFO));
+ optionList.add(editConfigurationFilePut("etc/config.properties", "karaf.startlevel.bundle", "50"));
+
+ if (debug) {
+ // uncomment this to debug it.
+ optionList.add(debugConfiguration("5005", true));
+ }
+
+ optionList.add(features(getArtemisMQKarafFeatureUrl(version), featureArray.toArray(new String[featureArray.size()])));
+
+ testOptions(optionList);
+
+ return optionList.toArray(new Option[optionList.size()]);
+ }
+
+ public UrlReference getArtemisMQKarafFeatureUrl(String version) {
+ String type = "xml/features";
+ UrlReference urlReference;
+
+ if (version == null) {
+ urlReference = mavenBundle().groupId("org.apache.activemq").
+ artifactId("artemis-features").versionAsInProject().type(type);
+ } else {
+ urlReference = mavenBundle().groupId("org.apache.activemq").
+ artifactId("artemis-features").version(version).type(type);
+ }
+ LOG.info("FeatureURL: " + urlReference.getURL());
+ return urlReference;
+ }
+
+ ExecutorService executor = Executors.newCachedThreadPool();
+
+ @Inject
+ BundleContext bundleContext;
+
+ @Inject
+ SessionFactory sessionFactory;
+
+ protected String executeCommand(final String command, final Long timeout, final Boolean silent) {
+ String response;
+ final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ final PrintStream printStream = new PrintStream(byteArrayOutputStream);
+ final Session commandSession = sessionFactory.create(System.in, printStream, printStream);
+ commandSession.put("APPLICATION", System.getProperty("karaf.name", "root"));
+ commandSession.put("USER", USER);
+ FutureTask<String> commandFuture = new FutureTask<>(new Callable<String>() {
+ @Override
+ public String call() {
+
+ Subject subject = new Subject();
+ subject.getPrincipals().add(new UserPrincipal("admin"));
+ subject.getPrincipals().add(new RolePrincipal("admin"));
+ subject.getPrincipals().add(new RolePrincipal("manager"));
+ subject.getPrincipals().add(new RolePrincipal("viewer"));
+ return Subject.doAs(subject, new PrivilegedAction<String>() {
+ @Override
+ public String run() {
+ try {
+ if (!silent) {
+ System.out.println(command);
+ System.out.flush();
+ }
+ commandSession.execute(command);
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+ printStream.flush();
+ return byteArrayOutputStream.toString();
+ }
+ });
+ }
+ });
+
+ try {
+ executor.submit(commandFuture);
+ response = commandFuture.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ response = "SHELL COMMAND TIMED OUT: ";
+ }
+ LOG.info("Execute: " + command + " - Response:" + response);
+ return response;
+ }
+
+ protected String executeCommand(final String command) {
+ return executeCommand(command, COMMAND_TIMEOUT, false);
+ }
+
+ protected boolean withinReason(Callable<Boolean> callable) throws Throwable {
+ long max = System.currentTimeMillis() + ASSERTION_TIMEOUT;
+ while (true) {
+ try {
+ return callable.call();
+ } catch (Throwable t) {
+ if (System.currentTimeMillis() < max) {
+ TimeUnit.SECONDS.sleep(1);
+ continue;
+ } else {
+ throw t;
+ }
+ }
+ }
+ }
+
+ public boolean verifyBundleInstalled(final String bundleName) throws Exception {
+ boolean found = false;
+ for (Bundle bundle : bundleContext.getBundles()) {
+ LOG.debug("Checking: " + bundle.getSymbolicName());
+ if (bundle.getSymbolicName().contains(bundleName)) {
+ found = true;
+ break;
+ }
+ }
+ return found;
+ }
+
+ protected Object waitForService(String filter, long timeout) throws InvalidSyntaxException, InterruptedException {
+ ServiceTracker<Object, Object> st = new ServiceTracker<>(bundleContext, bundleContext.createFilter(filter), null);
+ try {
+ st.open();
+ return st.waitForService(timeout);
+ } finally {
+ st.close();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/ArtemisFeatureTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/ArtemisFeatureTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/ArtemisFeatureTest.java
new file mode 100644
index 0000000..b47a6e0
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/ArtemisFeatureTest.java
@@ -0,0 +1,101 @@
+/**
+ * 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.integration.karaf.distribution;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import java.util.concurrent.Callable;
+
+import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
+import org.apache.activemq.artemis.tests.integration.karaf.KarafBaseTest;
+import org.apache.log4j.Logger;
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.Constants;
+
+/**
+ * Useful docs about this test: https://ops4j1.jira.com/wiki/display/paxexam/FAQ
+ */
+@RunWith(PaxExam.class)
+public class ArtemisFeatureTest extends KarafBaseTest {
+
+ private static Logger LOG = Logger.getLogger(ArtemisFeatureTest.class.getName());
+
+ @ProbeBuilder
+ public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+ probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.ops4j.pax.exam.options.*,org.apache.felix.service.*;status=provisional");
+ return probe;
+ }
+
+ @Configuration
+ public Option[] configure() throws Exception {
+ return configureArtemisFeatures(false, null, "artemis");
+ }
+ @Test
+ public void testSample() throws Throwable {
+ System.out.println("Hello!!!");
+ ClientMessageImpl message = new ClientMessageImpl();
+ }
+
+ @Test(timeout = 5 * 60 * 1000)
+ public void test() throws Throwable {
+ executeCommand("bundle:list");
+
+ withinReason(new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ assertTrue("artemis bundle installed", verifyBundleInstalled("artemis-server-osgi"));
+ return true;
+ }
+ });
+
+ Object service = waitForService("(objectClass=org.apache.activemq.artemis.core.server.ActiveMQServer)", 30000);
+ assertNotNull(service);
+ LOG.info("have service " + service);
+
+ executeCommand("service:list -n");
+
+ Connection connection = null;
+ try {
+ JmsConnectionFactory factory = new JmsConnectionFactory("amqp://localhost:5672");
+ connection = factory.createConnection(USER, PASSWORD);
+ connection.start();
+
+ javax.jms.Session sess = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
+ Queue queue = sess.createQueue("exampleQueue");
+ MessageProducer producer = sess.createProducer(queue);
+ producer.send(sess.createTextMessage("TEST"));
+
+ MessageConsumer consumer = sess.createConsumer(queue);
+ Message msg = consumer.receive(5000);
+ assertNotNull(msg);
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/package-info.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/package-info.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/package-info.java
new file mode 100644
index 0000000..5af5077
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/distribution/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * This contains tests that will validate the Artemis distribution
+ */
+package org.apache.activemq.artemis.tests.integration.karaf.distribution;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/ProbeRemoteServer.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/ProbeRemoteServer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/ProbeRemoteServer.java
new file mode 100644
index 0000000..7b4eea0
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/ProbeRemoteServer.java
@@ -0,0 +1,51 @@
+/**
+ * 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.integration.karaf.version;
+
+import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
+import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.ActiveMQServers;
+import org.apache.activemq.artemis.core.server.JournalType;
+import org.junit.Ignore;
+import org.junit.Test;
+
+// Ignored as this is executed by PaxExam on RemoteTest
+@Ignore
+public class ProbeRemoteServer {
+
+ ActiveMQServer server;
+
+ @Test
+ public void probe1() throws Exception {
+ System.out.println("probe1 with ");
+ ClientMessageImpl message = new ClientMessageImpl();
+
+ ConfigurationImpl config = new ConfigurationImpl().setSecurityEnabled(false).setJournalMinFiles(2).
+ setJournalFileSize(100 * 1024).setJournalType(JournalType.NIO).
+ setJournalDirectory("./data/journal").
+ setBindingsDirectory("./data/binding").
+ setPagingDirectory("./data/paging").
+ setLargeMessagesDirectory("./data/lm").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword("mycluster").setJournalDatasync(false).setSecurityEnabled(false);
+ config.addAcceptorConfiguration("netty", "tcp://localhost:61616");
+
+ server = ActiveMQServers.newActiveMQServer(config, false);
+
+ server.start();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/RemoteTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/RemoteTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/RemoteTest.java
new file mode 100644
index 0000000..10e97b3
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/RemoteTest.java
@@ -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.
+ */
+
+package org.apache.activemq.artemis.tests.integration.karaf.version;
+
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.tests.integration.karaf.ContainerBaseTest;
+import org.junit.Test;
+
+public class RemoteTest extends ContainerBaseTest {
+
+ @Test
+ public void testValidateRemote() throws Exception {
+ setupContainer(ProbeRemoteServer.class, "probe1", configureArtemisFeatures(false, "1.5.1", "artemis-core"));
+
+ executeRemoteTest();
+
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
+ factory.createConnection().close();
+
+ container.stop();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/VersionWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/VersionWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/VersionWireTest.java
new file mode 100644
index 0000000..be2fac5
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/VersionWireTest.java
@@ -0,0 +1,104 @@
+/**
+ * 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.integration.karaf.version;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.List;
+
+import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.tests.integration.karaf.KarafBaseTest;
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+
+import static org.ops4j.pax.exam.CoreOptions.vmOptions;
+
+// uncomment this to be able to debug it
+// import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration;
+
+/**
+ * Useful docs about this test: https://ops4j1.jira.com/wiki/display/paxexam/FAQ
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class VersionWireTest extends KarafBaseTest {
+
+ File file = new File(System.getProperty("./target/generated.bin", System.getProperty("testFile", "./target/generated.bin")));
+
+
+ private static Logger LOG = Logger.getLogger(VersionWireTest.class.getName());
+
+ /**
+ * plug to add more options on sub tests
+ */
+ @Override
+ protected void testOptions(List<Option> options) throws Exception {
+ options.add(vmOptions("-DtestFile=" + file.getCanonicalPath()));
+ }
+
+ @ProbeBuilder
+ public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) throws Exception {
+
+ file.deleteOnExit();
+ System.out.println("Path::" + file.getCanonicalPath());
+ PrintStream out = new PrintStream(new FileOutputStream(file));
+ out.println("hello");
+ out.close();
+ System.out.println("probing!!!");
+ Message message = new ClientMessageImpl();
+ System.out.println("probed!!!");
+ return probe;
+ }
+
+
+ @Configuration
+ public Option[] configure1_5() throws Exception {
+
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
+ factory.setBlockOnDurableSend(false);
+
+ return configureArtemisFeatures(false, "1.5.0", "artemis-core");
+
+ }
+
+ @Configuration
+ public Option[] configure13() throws Exception {
+ return configureArtemisFeatures(false, null, "artemis-core");
+ }
+
+
+ @Test
+ public void testSample() throws Throwable {
+ System.out.println("Path::" + file.getCanonicalPath());
+
+ Assert.assertTrue(file.getCanonicalPath() + " don't exist", file.exists());
+ System.out.println("Hello!!!");
+ ClientMessageImpl message = new ClientMessageImpl();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/package-info.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/package-info.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/package-info.java
new file mode 100644
index 0000000..459e912
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/version/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check wire compatibility.
+ */
+package org.apache.activemq.artemis.tests.integration.karaf.version;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java
index 0719b38..3151408 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java
@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.management.ManagementHelper;
import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
@@ -48,7 +48,7 @@ public class ManagementHelperTest extends Assert {
String operationName = RandomUtil.randomString();
String param = RandomUtil.randomString();
String[] params = new String[]{RandomUtil.randomString(), RandomUtil.randomString(), RandomUtil.randomString()};
- Message msg = new ClientMessageImpl((byte) 0, false, 0, 0, (byte) 4, 1000);
+ ClientMessage msg = new ClientMessageImpl((byte) 0, false, 0, 0, (byte) 4, 1000);
ManagementHelper.putOperationInvocation(msg, resource, operationName, param, params);
Object[] parameters = ManagementHelper.retrieveOperationParameters(msg);
@@ -135,7 +135,7 @@ public class ManagementHelperTest extends Assert {
Object[] params = new Object[]{i, s, d, b, l, map, strArray, maps};
- Message msg = new ClientMessageImpl((byte) 0, false, 0, 0, (byte) 4, 1000);
+ ClientMessageImpl msg = new ClientMessageImpl((byte) 0, false, 0, 0, (byte) 4, 1000);
ManagementHelper.putOperationInvocation(msg, resource, operationName, params);
Object[] parameters = ManagementHelper.retrieveOperationParameters(msg);
@@ -201,7 +201,7 @@ public class ManagementHelperTest extends Assert {
Object[] params = new Object[]{"hello", map};
- Message msg = new ClientMessageImpl((byte) 0, false, 0, 0, (byte) 4, 1000);
+ ClientMessageImpl msg = new ClientMessageImpl((byte) 0, false, 0, 0, (byte) 4, 1000);
ManagementHelper.putOperationInvocation(msg, resource, operationName, params);
Object[] parameters = ManagementHelper.retrieveOperationParameters(msg);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
index 1afc732..151341f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
@@ -16,19 +16,20 @@
*/
package org.apache.activemq.artemis.tests.integration.management;
+import org.apache.activemq.artemis.api.core.ICoreMessage;
+import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.management.AddressControl;
import org.apache.activemq.artemis.api.core.management.ManagementHelper;
import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
import org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
-import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
import org.apache.activemq.artemis.core.server.management.impl.ManagementServiceImpl;
import org.apache.activemq.artemis.tests.integration.server.FakeStorageManager;
import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue;
@@ -50,10 +51,10 @@ public class ManagementServiceImplTest extends ActiveMQTestBase {
server.start();
// invoke attribute and operation on the server
- ServerMessage message = new ServerMessageImpl(1, 100);
+ CoreMessage message = new CoreMessage(1, 100);
ManagementHelper.putOperationInvocation(message, ResourceNames.BROKER, "createQueue", queue, address);
- ServerMessage reply = server.getManagementService().handleMessage(message);
+ Message reply = server.getManagementService().handleMessage(message);
Assert.assertTrue(ManagementHelper.hasOperationSucceeded(reply));
}
@@ -66,10 +67,10 @@ public class ManagementServiceImplTest extends ActiveMQTestBase {
server.start();
// invoke attribute and operation on the server
- ServerMessage message = new ServerMessageImpl(1, 100);
+ CoreMessage message = new CoreMessage(1, 100);
ManagementHelper.putOperationInvocation(message, ResourceNames.BROKER, "thereIsNoSuchOperation");
- ServerMessage reply = server.getManagementService().handleMessage(message);
+ ICoreMessage reply = server.getManagementService().handleMessage(message);
Assert.assertFalse(ManagementHelper.hasOperationSucceeded(reply));
Assert.assertNotNull(ManagementHelper.getResult(reply));
@@ -83,10 +84,10 @@ public class ManagementServiceImplTest extends ActiveMQTestBase {
server.start();
// invoke attribute and operation on the server
- ServerMessage message = new ServerMessageImpl(1, 100);
+ ICoreMessage message = new CoreMessage(1, 100);
ManagementHelper.putOperationInvocation(message, "Resouce.Does.Not.Exist", "toString");
- ServerMessage reply = server.getManagementService().handleMessage(message);
+ ICoreMessage reply = server.getManagementService().handleMessage(message);
Assert.assertFalse(ManagementHelper.hasOperationSucceeded(reply));
Assert.assertNotNull(ManagementHelper.getResult(reply));
@@ -100,11 +101,11 @@ public class ManagementServiceImplTest extends ActiveMQTestBase {
server.start();
// invoke attribute and operation on the server
- ServerMessage message = new ServerMessageImpl(1, 100);
+ ICoreMessage message = new CoreMessage(1, 100);
ManagementHelper.putAttribute(message, ResourceNames.BROKER, "started");
- ServerMessage reply = server.getManagementService().handleMessage(message);
+ ICoreMessage reply = server.getManagementService().handleMessage(message);
Assert.assertTrue(ManagementHelper.hasOperationSucceeded(reply));
Assert.assertTrue((Boolean) ManagementHelper.getResult(reply));
@@ -118,11 +119,11 @@ public class ManagementServiceImplTest extends ActiveMQTestBase {
server.start();
// invoke attribute and operation on the server
- ServerMessage message = new ServerMessageImpl(1, 100);
+ ICoreMessage message = new CoreMessage(1, 100);
ManagementHelper.putAttribute(message, ResourceNames.BROKER, "attribute.Does.Not.Exist");
- ServerMessage reply = server.getManagementService().handleMessage(message);
+ ICoreMessage reply = server.getManagementService().handleMessage(message);
Assert.assertFalse(ManagementHelper.hasOperationSucceeded(reply));
Assert.assertNotNull(ManagementHelper.getResult(reply));
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
index 1f0d7e0..3675416 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
@@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQException;
-import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
@@ -289,7 +288,7 @@ public class PagingSendTest extends ActiveMQTestBase {
List<String> messageIds = new ArrayList<>();
ClientProducer producer = session.createProducer(queueAddr);
for (int i = 0; i < batchSize; i++) {
- Message message = session.createMessage(true);
+ ClientMessage message = session.createMessage(true);
message.getBodyBuffer().writeBytes(new byte[1024]);
String id = UUID.randomUUID().toString();
message.putStringProperty("id", id);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
index 1714947..48127d2 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
@@ -42,6 +42,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.Pair;
+import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
@@ -75,7 +76,6 @@ import org.apache.activemq.artemis.core.persistence.impl.journal.OperationContex
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
@@ -5536,7 +5536,7 @@ public class PagingTest extends ActiveMQTestBase {
for (int i = 0; i < 100; i++) {
Message msg = session.createMessage(true);
- msg.getBodyBuffer().writeBytes(new byte[1024]);
+ msg.toCore().getBodyBuffer().writeBytes(new byte[1024]);
prod.send(msg);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java
index 90f7c5f..615a924 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java
@@ -21,17 +21,17 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
+import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.StoreConfiguration;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
import org.apache.activemq.artemis.core.persistence.AddressBindingInfo;
import org.apache.activemq.artemis.core.persistence.GroupingInfo;
import org.apache.activemq.artemis.core.persistence.QueueBindingInfo;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.core.server.impl.PostOfficeJournalLoader;
-import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue;
import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice;
import org.junit.Assert;
@@ -40,8 +40,6 @@ import org.junit.runners.Parameterized;
public class DeleteMessagesOnStartupTest extends StorageManagerTestBase {
- volatile boolean deleteMessages = false;
-
ArrayList<Long> deletedMessage = new ArrayList<>();
public DeleteMessagesOnStartupTest(StoreConfiguration.StoreType storeType) {
@@ -63,12 +61,12 @@ public class DeleteMessagesOnStartupTest extends StorageManagerTestBase {
HashMap<Long, Queue> queues = new HashMap<>();
queues.put(100L, theQueue);
- ServerMessage msg = new ServerMessageImpl(1, 100);
+ Message msg = new CoreMessage(1, 100);
journal.storeMessage(msg);
for (int i = 2; i < 100; i++) {
- journal.storeMessage(new ServerMessageImpl(i, 100));
+ journal.storeMessage(new CoreMessage(i, 100));
}
journal.storeReference(100, 1, true);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java
index 8833b92..16cedd2 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java
@@ -47,27 +47,27 @@ public class ExportFormatTest extends ActiveMQTestBase {
// Case the format was changed, and the change was agreed, use _testCreateFormat to recreate this field
String journalFile = "#File,JournalFileImpl: (activemq-data-1.amq id = 1, recordID = 1)\n" +
- "operation@AddRecordTX,txID@0,id@5,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAABQEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZufQEAQAAAAEAAAAGawBlAHkABgAAAAA=\n" +
- "operation@UpdateTX,txID@0,id@5,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecordTX,txID@0,id@6,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAABgEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZufcEAQAAAAEAAAAGawBlAHkABgAAAAE=\n" +
- "operation@UpdateTX,txID@0,id@6,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecordTX,txID@0,id@7,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAABwEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZufcEAQAAAAEAAAAGawBlAHkABgAAAAI=\n" +
+ "operation@AddRecordTX,txID@0,id@7,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAAHAQAAAARBADEAAAAAPQAAAA0AAAAAAAAABwEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WFoEAQAAAAEAAAAGawBlAHkABgAAAAA=\n" +
"operation@UpdateTX,txID@0,id@7,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecordTX,txID@0,id@8,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAACAEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZufgEAQAAAAEAAAAGawBlAHkABgAAAAM=\n" +
+ "operation@AddRecordTX,txID@0,id@8,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAAIAQAAAARBADEAAAAAPQAAAA0AAAAAAAAACAEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WF4EAQAAAAEAAAAGawBlAHkABgAAAAE=\n" +
"operation@UpdateTX,txID@0,id@8,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecordTX,txID@0,id@9,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAACQEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZufgEAQAAAAEAAAAGawBlAHkABgAAAAQ=\n" +
+ "operation@AddRecordTX,txID@0,id@9,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAAJAQAAAARBADEAAAAAPQAAAA0AAAAAAAAACQEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WF4EAQAAAAEAAAAGawBlAHkABgAAAAI=\n" +
"operation@UpdateTX,txID@0,id@9,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
+ "operation@AddRecordTX,txID@0,id@10,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAAKAQAAAARBADEAAAAAPQAAAA0AAAAAAAAACgEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WF8EAQAAAAEAAAAGawBlAHkABgAAAAM=\n" +
+ "operation@UpdateTX,txID@0,id@10,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
+ "operation@AddRecordTX,txID@0,id@11,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAALAQAAAARBADEAAAAAPQAAAA0AAAAAAAAACwEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WF8EAQAAAAEAAAAGawBlAHkABgAAAAQ=\n" +
+ "operation@UpdateTX,txID@0,id@11,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
"operation@Commit,txID@0,numberOfRecords@10\n" +
- "operation@AddRecord,id@13,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAADQEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZuhQEAQAAAAEAAAAGawBlAHkABgAAAAU=\n" +
- "operation@Update,id@13,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecord,id@14,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAADgEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZuhcEAQAAAAEAAAAGawBlAHkABgAAAAY=\n" +
- "operation@Update,id@14,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecord,id@15,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAADwEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZuhsEAQAAAAEAAAAGawBlAHkABgAAAAc=\n" +
+ "operation@AddRecord,id@15,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAAPAQAAAARBADEAAAAAPQAAAA0AAAAAAAAADwEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WLAEAQAAAAEAAAAGawBlAHkABgAAAAU=\n" +
"operation@Update,id@15,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecord,id@16,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAAEAEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2Zuh4EAQAAAAEAAAAGawBlAHkABgAAAAg=\n" +
+ "operation@AddRecord,id@16,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAAQAQAAAARBADEAAAAAPQAAAA0AAAAAAAAAEAEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WLIEAQAAAAEAAAAGawBlAHkABgAAAAY=\n" +
"operation@Update,id@16,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
- "operation@AddRecord,id@17,userRecordType@31,length@65,isUpdate@false,compactCount@0,data@AAAAEQAAAE4AAAAAAAAAEQEAAAAEQQAxAAAA_wAAAAAAAAAAAAABTh2ZuiIEAQAAAAEAAAAGawBlAHkABgAAAAk=\n" +
+ "operation@AddRecord,id@17,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAARAQAAAARBADEAAAAAPQAAAA0AAAAAAAAAEQEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WLgEAQAAAAEAAAAGawBlAHkABgAAAAc=\n" +
"operation@Update,id@17,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
+ "operation@AddRecord,id@18,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAASAQAAAARBADEAAAAAPQAAAA0AAAAAAAAAEgEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WLwEAQAAAAEAAAAGawBlAHkABgAAAAg=\n" +
+ "operation@Update,id@18,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
+ "operation@AddRecord,id@19,userRecordType@45,length@83,isUpdate@false,compactCount@0,data@AQAAAAAAAAATAQAAAARBADEAAAAAPQAAAA0AAAAAAAAAEwEAAAAEQQAxAAAAAQAAAAAAAAAAAAABWpf6WL4EAQAAAAEAAAAGawBlAHkABgAAAAk=\n" +
+ "operation@Update,id@19,userRecordType@32,length@8,isUpdate@true,compactCount@0,data@AAAAAAAAAAM=\n" +
"#File,JournalFileImpl: (activemq-data-2.amq id = 2, recordID = 2)";
@Test
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java
index 1ae9527..ab32517 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java
@@ -58,6 +58,7 @@ import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo;
import org.apache.activemq.artemis.core.journal.RecordInfo;
import org.apache.activemq.artemis.core.journal.TransactionFailureCallback;
import org.apache.activemq.artemis.core.journal.impl.JournalFile;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
import org.apache.activemq.artemis.core.paging.PagedMessage;
import org.apache.activemq.artemis.core.paging.PagingManager;
import org.apache.activemq.artemis.core.paging.PagingStore;
@@ -65,6 +66,7 @@ import org.apache.activemq.artemis.core.paging.impl.PagedMessageImpl;
import org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl;
import org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryNIO;
import org.apache.activemq.artemis.core.persistence.OperationContext;
+import org.apache.activemq.artemis.core.persistence.Persister;
import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
import org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl;
@@ -74,10 +76,8 @@ import org.apache.activemq.artemis.core.replication.ReplicatedJournal;
import org.apache.activemq.artemis.core.replication.ReplicationManager;
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.core.server.cluster.ClusterController;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
-import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
@@ -228,7 +228,7 @@ public final class ReplicationTest extends ActiveMQTestBase {
Assert.assertTrue("Expecting no active tokens:" + manager.getActiveTokens(), manager.getActiveTokens().isEmpty());
- ServerMessage msg = new ServerMessageImpl(1, 1024);
+ CoreMessage msg = new CoreMessage().initBuffer(1024).setMessageID(1);
SimpleString dummy = new SimpleString("dummy");
msg.setAddress(dummy);
@@ -259,12 +259,12 @@ public final class ReplicationTest extends ActiveMQTestBase {
blockOnReplication(storage, manager);
- ServerMessageImpl serverMsg = new ServerMessageImpl();
+ CoreMessage serverMsg = new CoreMessage();
serverMsg.setMessageID(500);
serverMsg.setAddress(new SimpleString("tttt"));
ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(100);
- serverMsg.encodeHeadersAndProperties(buffer);
+ serverMsg.encodeHeadersAndProperties(buffer.byteBuf());
manager.largeMessageBegin(500);
@@ -619,6 +619,62 @@ public final class ReplicationTest extends ActiveMQTestBase {
static final class FakeJournal implements Journal {
@Override
+ public void appendAddRecord(long id,
+ byte recordType,
+ Persister persister,
+ Object record,
+ boolean sync) throws Exception {
+
+ }
+
+ @Override
+ public void appendAddRecord(long id,
+ byte recordType,
+ Persister persister,
+ Object record,
+ boolean sync,
+ IOCompletion completionCallback) throws Exception {
+
+ }
+
+ @Override
+ public void appendUpdateRecord(long id,
+ byte recordType,
+ Persister persister,
+ Object record,
+ boolean sync) throws Exception {
+
+ }
+
+ @Override
+ public void appendUpdateRecord(long id,
+ byte recordType,
+ Persister persister,
+ Object record,
+ boolean sync,
+ IOCompletion callback) throws Exception {
+
+ }
+
+ @Override
+ public void appendAddRecordTransactional(long txID,
+ long id,
+ byte recordType,
+ Persister persister,
+ Object record) throws Exception {
+
+ }
+
+ @Override
+ public void appendUpdateRecordTransactional(long txID,
+ long id,
+ byte recordType,
+ Persister persister,
+ Object record) throws Exception {
+
+ }
+
+ @Override
public void appendAddRecord(final long id,
final byte recordType,
final byte[] record,
@@ -756,11 +812,6 @@ public final class ReplicationTest extends ActiveMQTestBase {
}
@Override
- public void perfBlast(final int pages) {
-
- }
-
- @Override
public boolean isStarted() {
return false;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java
index c3670c5..67cfe18 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java
@@ -19,8 +19,8 @@ package org.apache.activemq.artemis.tests.integration.server;
import java.util.ArrayList;
import java.util.List;
+import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager;
-import org.apache.activemq.artemis.core.server.ServerMessage;
public class FakeStorageManager extends NullStorageManager {
@@ -29,12 +29,12 @@ public class FakeStorageManager extends NullStorageManager {
List<Long> ackIds = new ArrayList<>();
@Override
- public void storeMessage(final ServerMessage message) throws Exception {
+ public void storeMessage(final Message message) throws Exception {
messageIds.add(message.getMessageID());
}
@Override
- public void storeMessageTransactional(final long txID, final ServerMessage message) throws Exception {
+ public void storeMessageTransactional(final long txID, final Message message) throws Exception {
messageIds.add(message.getMessageID());
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java
index cba3008..ec49ece 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java
@@ -425,7 +425,7 @@ public class ScaleDownTest extends ClusterTestBase {
while (!servers[0].getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) {
for (int i = 0; i < CHUNK_SIZE; i++) {
- Message message = session.createMessage(true);
+ ClientMessage message = session.createMessage(true);
message.getBodyBuffer().writeBytes(new byte[1024]);
producer.send(message);
messageCount++;
@@ -463,7 +463,7 @@ public class ScaleDownTest extends ClusterTestBase {
while (!servers[0].getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) {
for (int i = 0; i < CHUNK_SIZE; i++) {
- Message message = session.createMessage(true);
+ ClientMessage message = session.createMessage(true);
message.getBodyBuffer().writeBytes(new byte[1024]);
message.putIntProperty("order", i);
producer.send(message);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
index 89f7a60..141a6b8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
@@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
@@ -41,7 +42,6 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.remoting.impl.ssl.SSLSupport;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.RandomUtil;
@@ -127,7 +127,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase {
ClientConsumer consumer = addClientConsumer(session.createConsumer(CoreClientOverOneWaySSLTest.QUEUE));
session.start();
- Message m = consumer.receive(1000);
+ ClientMessage m = consumer.receive(1000);
Assert.assertNotNull(m);
Assert.assertEquals(text, m.getBodyBuffer().readString());
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
index 772e44d..11b3b0b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
@@ -26,7 +26,6 @@ import io.netty.handler.ssl.SslHandler;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.api.core.Interceptor;
-import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
@@ -151,7 +150,7 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase {
ClientConsumer consumer = session.createConsumer(CoreClientOverTwoWaySSLTest.QUEUE);
session.start();
- Message m = consumer.receive(1000);
+ ClientMessage m = consumer.receive(1000);
Assert.assertNotNull(m);
Assert.assertEquals(text, m.getBodyBuffer().readString());
}
@@ -189,7 +188,7 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase {
ClientConsumer consumer = session.createConsumer(CoreClientOverTwoWaySSLTest.QUEUE);
session.start();
- Message m = consumer.receive(1000);
+ ClientMessage m = consumer.receive(1000);
Assert.assertNotNull(m);
Assert.assertEquals(text, m.getBodyBuffer().readString());
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3384260e/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
----------------------------------------------------------------------
diff --git a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
index 0ee92e9..0c4dbf5 100644
--- a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
+++ b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/PersistMultiThreadTest.java
@@ -26,7 +26,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
+import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
import org.apache.activemq.artemis.core.paging.PagingManager;
import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.paging.cursor.PageCursorProvider;
@@ -37,8 +39,6 @@ import org.apache.activemq.artemis.core.replication.ReplicationManager;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.server.RouteContextList;
-import org.apache.activemq.artemis.core.server.ServerMessage;
-import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.Transaction;
@@ -188,8 +188,9 @@ public class PersistMultiThreadTest extends ActiveMQTestBase {
}
private void storeMessage(long txID, long id) throws Exception {
- ServerMessage message = new ServerMessageImpl(id, 10 * 1024);
- message.setPagingStore(fakePagingStore);
+ Message message = new CoreMessage(id, 10 * 1024);
+ // TODO-now: fix this
+ message.setContext(fakePagingStore);
message.getBodyBuffer().writeBytes(new byte[104]);
message.putStringProperty("hello", "" + id);
@@ -248,6 +249,26 @@ public class PersistMultiThreadTest extends ActiveMQTestBase {
class FakePagingStore implements PagingStore {
@Override
+ public void durableDown(Message message, int durableCount) {
+
+ }
+
+ @Override
+ public void durableUp(Message message, int durableCount) {
+
+ }
+
+ @Override
+ public void nonDurableUp(Message message, int nonDurableCoun) {
+
+ }
+
+ @Override
+ public void nonDurableDown(Message message, int nonDurableCoun) {
+
+ }
+
+ @Override
public SimpleString getAddress() {
return null;
}
@@ -328,7 +349,7 @@ public class PersistMultiThreadTest extends ActiveMQTestBase {
}
@Override
- public boolean page(ServerMessage message,
+ public boolean page(Message message,
Transaction tx,
RouteContextList listCtx,
ReentrantReadWriteLock.ReadLock readLock) throws Exception {