activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [06/21] activemq-artemis git commit: ARTEMIS-1009 Pure Message Encoding.
Date Mon, 06 Mar 2017 03:58:24 GMT
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java
index 923e719..4ddde1c 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java
@@ -33,10 +33,13 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.io.SequentialFile;
 import org.apache.activemq.artemis.core.io.SequentialFileFactory;
 import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
+import org.apache.activemq.artemis.core.message.impl.CoreMessagePersister;
 import org.apache.activemq.artemis.core.paging.PageTransactionInfo;
 import org.apache.activemq.artemis.core.paging.PagedMessage;
 import org.apache.activemq.artemis.core.paging.PagingManager;
@@ -49,13 +52,15 @@ import org.apache.activemq.artemis.core.paging.impl.PageTransactionInfoImpl;
 import org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl;
 import org.apache.activemq.artemis.core.persistence.StorageManager;
 import org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager;
-import org.apache.activemq.artemis.core.server.ServerMessage;
+import org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory;
 import org.apache.activemq.artemis.core.server.files.FileStoreMonitor;
 import org.apache.activemq.artemis.core.server.impl.RoutingContextImpl;
-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.AddressFullMessagePolicy;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessagePersister;
+import org.apache.activemq.artemis.protocol.amqp.broker.ProtonProtocolManagerFactory;
+import org.apache.activemq.artemis.spi.core.protocol.MessagePersister;
 import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory;
 import org.apache.activemq.artemis.tests.unit.util.FakePagingManager;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
@@ -69,6 +74,11 @@ import org.junit.Test;
 
 public class PagingStoreImplTest extends ActiveMQTestBase {
 
+   static {
+      MessagePersister.registerPersister(CoreProtocolManagerFactory.ID, CoreMessagePersister.getInstance());
+      MessagePersister.registerPersister(ProtonProtocolManagerFactory.ID, AMQPMessagePersister.getInstance());
+   }
+
    private static final SimpleString destinationTestName = new SimpleString("test");
    private final ReadLock lock = new ReentrantReadWriteLock().readLock();
 
@@ -152,7 +162,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
       buffers.add(buffer);
       SimpleString destination = new SimpleString("test");
 
-      ServerMessage msg = createMessage(1, storeImpl, destination, buffer);
+      Message msg = createMessage(1, storeImpl, destination, buffer);
 
       Assert.assertTrue(storeImpl.isPaging());
 
@@ -197,7 +207,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
 
          buffers.add(buffer);
 
-         ServerMessage msg = createMessage(i, storeImpl, destination, buffer);
+         Message msg = createMessage(i, storeImpl, destination, buffer);
          final RoutingContextImpl ctx = new RoutingContextImpl(null);
          Assert.assertTrue(storeImpl.page(msg, ctx.getTransaction(), ctx.getContextListing(storeImpl.getStoreName()),
lock));
 
@@ -224,7 +234,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
 
       for (int i = 0; i < numMessages; i++) {
          ActiveMQBuffer horn1 = buffers.get(i);
-         ActiveMQBuffer horn2 = msg.get(i).getMessage().getBodyBuffer();
+         ActiveMQBuffer horn2 = msg.get(i).getMessage().toCore().getBodyBuffer();
          horn1.resetReaderIndex();
          horn2.resetReaderIndex();
          for (int j = 0; j < horn1.writerIndex(); j++) {
@@ -263,7 +273,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
             store.forceAnotherPage();
          }
 
-         ServerMessage msg = createMessage(i, store, destination, buffer);
+         Message msg = createMessage(i, store, destination, buffer);
 
          final RoutingContextImpl ctx = new RoutingContextImpl(null);
          Assert.assertTrue(store.page(msg, ctx.getTransaction(), ctx.getContextListing(store.getStoreName()),
lock));
@@ -290,7 +300,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
 
          for (int i = 0; i < 5; i++) {
             Assert.assertEquals(sequence++, msg.get(i).getMessage().getMessageID());
-            ActiveMQTestBase.assertEqualsBuffers(18, buffers.get(pageNr * 5 + i), msg.get(i).getMessage().getBodyBuffer());
+            ActiveMQTestBase.assertEqualsBuffers(18, buffers.get(pageNr * 5 + i), msg.get(i).getMessage().toCore().getBodyBuffer());
          }
       }
 
@@ -298,7 +308,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
 
       Assert.assertTrue(store.isPaging());
 
-      ServerMessage msg = createMessage(1, store, destination, buffers.get(0));
+      Message msg = createMessage(1, store, destination, buffers.get(0));
 
       final RoutingContextImpl ctx = new RoutingContextImpl(null);
       Assert.assertTrue(store.page(msg, ctx.getTransaction(), ctx.getContextListing(store.getStoreName()),
lock));
@@ -341,7 +351,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
 
       Assert.assertEquals(1L, msgs.get(0).getMessage().getMessageID());
 
-      ActiveMQTestBase.assertEqualsBuffers(18, buffers.get(0), msgs.get(0).getMessage().getBodyBuffer());
+      ActiveMQTestBase.assertEqualsBuffers(18, buffers.get(0), msgs.get(0).getMessage().toCore().getBodyBuffer());
 
       Assert.assertEquals(1, store.getNumberOfPages());
 
@@ -374,7 +384,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
 
       final CountDownLatch latchStart = new CountDownLatch(numberOfThreads);
 
-      final ConcurrentHashMap<Long, ServerMessage> buffers = new ConcurrentHashMap<>();
+      final ConcurrentHashMap<Long, Message> buffers = new ConcurrentHashMap<>();
 
       final ArrayList<Page> readPages = new ArrayList<>();
 
@@ -408,7 +418,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
                   // Each thread will Keep paging until all the messages are depaged.
                   // This is possible because the depage thread is not actually reading the
pages.
                   // Just using the internal API to remove it from the page file system
-                  ServerMessage msg = createMessage(id, storeImpl, destination, createRandomBuffer(id,
5));
+                  Message msg = createMessage(id, storeImpl, destination, createRandomBuffer(id,
5));
                   final RoutingContextImpl ctx2 = new RoutingContextImpl(null);
                   if (storeImpl.page(msg, ctx2.getTransaction(), ctx2.getContextListing(storeImpl.getStoreName()),
lock)) {
                      buffers.put(id, msg);
@@ -477,7 +487,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
          throw consumer.e;
       }
 
-      final ConcurrentMap<Long, ServerMessage> buffers2 = new ConcurrentHashMap<>();
+      final ConcurrentMap<Long, Message> buffers2 = new ConcurrentHashMap<>();
 
       for (Page page : readPages) {
          page.open();
@@ -485,14 +495,14 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
          page.close();
 
          for (PagedMessage msg : msgs) {
-            long id = msg.getMessage().getBodyBuffer().readLong();
-            msg.getMessage().getBodyBuffer().resetReaderIndex();
+            long id = msg.getMessage().toCore().getBodyBuffer().readLong();
+            msg.getMessage().toCore().getBodyBuffer().resetReaderIndex();
 
-            ServerMessage msgWritten = buffers.remove(id);
+            Message msgWritten = buffers.remove(id);
             buffers2.put(id, msg.getMessage());
             Assert.assertNotNull(msgWritten);
             Assert.assertEquals(msg.getMessage().getAddress(), msgWritten.getAddress());
-            ActiveMQTestBase.assertEqualsBuffers(10, msgWritten.getBodyBuffer(), msg.getMessage().getBodyBuffer());
+            ActiveMQTestBase.assertEqualsBuffers(10, msgWritten.toCore().getBodyBuffer(),
msg.getMessage().toCore().getBodyBuffer());
          }
       }
 
@@ -522,7 +532,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
       Assert.assertEquals(numberOfPages, storeImpl2.getNumberOfPages());
 
       long lastMessageId = messageIdGenerator.incrementAndGet();
-      ServerMessage lastMsg = createMessage(lastMessageId, storeImpl, destination, createRandomBuffer(lastMessageId,
5));
+      Message lastMsg = createMessage(lastMessageId, storeImpl, destination, createRandomBuffer(lastMessageId,
5));
 
       storeImpl2.forceAnotherPage();
 
@@ -547,11 +557,11 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
 
          for (PagedMessage msg : msgs) {
 
-            long id = msg.getMessage().getBodyBuffer().readLong();
-            ServerMessage msgWritten = buffers2.remove(id);
+            long id = msg.getMessage().toCore().getBodyBuffer().readLong();
+            Message msgWritten = buffers2.remove(id);
             Assert.assertNotNull(msgWritten);
             Assert.assertEquals(msg.getMessage().getAddress(), msgWritten.getAddress());
-            ActiveMQTestBase.assertEqualsByteArrays(msgWritten.getBodyBuffer().writerIndex(),
msgWritten.getBodyBuffer().toByteBuffer().array(), msg.getMessage().getBodyBuffer().toByteBuffer().array());
+            ActiveMQTestBase.assertEqualsByteArrays(msgWritten.toCore().getBodyBuffer().writerIndex(),
msgWritten.toCore().getBodyBuffer().toByteBuffer().array(), msg.getMessage().toCore().getBodyBuffer().toByteBuffer().array());
          }
       }
 
@@ -560,8 +570,8 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
       lastPage.close();
       Assert.assertEquals(1, lastMessages.size());
 
-      lastMessages.get(0).getMessage().getBodyBuffer().resetReaderIndex();
-      Assert.assertEquals(lastMessages.get(0).getMessage().getBodyBuffer().readLong(), lastMessageId);
+      lastMessages.get(0).getMessage().toCore().getBodyBuffer().resetReaderIndex();
+      Assert.assertEquals(lastMessages.get(0).getMessage().toCore().getBodyBuffer().readLong(),
lastMessageId);
 
       Assert.assertEquals(0, buffers2.size());
 
@@ -643,7 +653,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
                   // Each thread will Keep paging until all the messages are depaged.
                   // This is possible because the depage thread is not actually reading the
pages.
                   // Just using the internal API to remove it from the page file system
-                  ServerMessage msg = createMessage(i, store, destination, createRandomBuffer(i,
1024));
+                  Message msg = createMessage(i, store, destination, createRandomBuffer(i,
1024));
                   msg.putLongProperty("count", i);
 
                   final RoutingContextImpl ctx2 = new RoutingContextImpl(null);
@@ -681,7 +691,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
                      List<PagedMessage> messages = page.read(new NullStorageManager());
 
                      for (PagedMessage pgmsg : messages) {
-                        ServerMessage msg = pgmsg.getMessage();
+                        Message msg = pgmsg.getMessage();
 
                         Assert.assertEquals(msgsRead++, msg.getMessageID());
 
@@ -739,15 +749,15 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
       };
    }
 
-   private ServerMessage createMessage(final long id,
+   private CoreMessage createMessage(final long id,
                                        final PagingStore store,
                                        final SimpleString destination,
                                        final ActiveMQBuffer buffer) {
-      ServerMessage msg = new ServerMessageImpl(id, 50 + buffer.capacity());
+      CoreMessage msg = new CoreMessage(id, 50 + buffer.capacity());
 
       msg.setAddress(destination);
 
-      msg.setPagingStore(store);
+      msg.setContext(store);
 
       msg.getBodyBuffer().resetReaderIndex();
       msg.getBodyBuffer().resetWriterIndex();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java
index 8cc138d..830e61f 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java
@@ -22,8 +22,10 @@ import java.util.List;
 import java.util.Set;
 
 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.core.filter.Filter;
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
 import org.apache.activemq.artemis.core.postoffice.Binding;
 import org.apache.activemq.artemis.core.postoffice.BindingType;
 import org.apache.activemq.artemis.core.postoffice.Bindings;
@@ -31,10 +33,8 @@ import org.apache.activemq.artemis.core.postoffice.impl.BindingsImpl;
 import org.apache.activemq.artemis.core.server.Bindable;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
-import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.impl.RefsOperation;
 import org.apache.activemq.artemis.core.server.impl.RoutingContextImpl;
-import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
 import org.apache.activemq.artemis.core.transaction.Transaction;
 import org.apache.activemq.artemis.core.transaction.TransactionOperation;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
@@ -91,9 +91,9 @@ public class BindingsImplTest extends ActiveMQTestBase {
 
       for (int i = 0; i < 100; i++) {
          if (route) {
-            bind.route(new ServerMessageImpl(i, 100), new RoutingContextImpl(new FakeTransaction()));
+            bind.route(new CoreMessage(i, 100), new RoutingContextImpl(new FakeTransaction()));
          } else {
-            bind.redistribute(new ServerMessageImpl(i, 100), queue, new RoutingContextImpl(new
FakeTransaction()));
+            bind.redistribute(new CoreMessage(i, 100), queue, new RoutingContextImpl(new
FakeTransaction()));
          }
       }
    }
@@ -273,7 +273,7 @@ public class BindingsImplTest extends ActiveMQTestBase {
        * @see org.apache.activemq.artemis.core.filter.Filter#match(org.apache.activemq.artemis.core.server.ServerMessage)
        */
       @Override
-      public boolean match(final ServerMessage message) {
+      public boolean match(final Message message) {
          return false;
       }
 
@@ -372,12 +372,12 @@ public class BindingsImplTest extends ActiveMQTestBase {
       }
 
       @Override
-      public boolean isHighAcceptPriority(final ServerMessage message) {
+      public boolean isHighAcceptPriority(final Message message) {
          return false;
       }
 
       @Override
-      public void route(final ServerMessage message, final RoutingContext context) throws
Exception {
+      public void route(final Message message, final RoutingContext context) throws Exception
{
 
       }
 
@@ -395,7 +395,7 @@ public class BindingsImplTest extends ActiveMQTestBase {
       }
 
       @Override
-      public void routeWithAck(ServerMessage message, RoutingContext context) {
+      public void routeWithAck(Message message, RoutingContext context) {
 
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
index 8171e39..66bdddb 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
@@ -22,6 +22,8 @@ import java.util.Set;
 import java.util.concurrent.Executor;
 
 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.filter.Filter;
 import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
@@ -30,7 +32,6 @@ import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
 import org.apache.activemq.artemis.api.core.RoutingType;
-import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.impl.AckReason;
 import org.apache.activemq.artemis.core.transaction.Transaction;
 import org.apache.activemq.artemis.utils.LinkedListIterator;
@@ -539,18 +540,18 @@ public class FakeQueue implements Queue {
    }
 
    @Override
-   public void route(final ServerMessage message, final RoutingContext context) throws Exception
{
+   public void route(final Message message, final RoutingContext context) throws Exception
{
       // no-op
 
    }
 
    @Override
-   public void routeWithAck(ServerMessage message, RoutingContext context) {
+   public void routeWithAck(Message message, RoutingContext context) {
 
    }
 
    @Override
-   public boolean hasMatchingConsumer(final ServerMessage message) {
+   public boolean hasMatchingConsumer(final Message message) {
       // no-op
       return false;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
index 3718afb..b74a4c0 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.unit.core.postoffice.impl;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.filter.Filter;
 import org.apache.activemq.artemis.core.postoffice.Binding;
@@ -29,7 +30,6 @@ import org.apache.activemq.artemis.core.postoffice.impl.WildcardAddressManager;
 import org.apache.activemq.artemis.core.server.Bindable;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
-import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.Test;
@@ -132,7 +132,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
       }
 
       @Override
-      public boolean isHighAcceptPriority(ServerMessage message) {
+      public boolean isHighAcceptPriority(Message message) {
          return false;
       }
 
@@ -152,7 +152,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
       }
 
       @Override
-      public void route(ServerMessage message, RoutingContext context) throws Exception {
+      public void route(Message message, RoutingContext context) throws Exception {
       }
 
       @Override
@@ -170,7 +170,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
       }
 
       @Override
-      public void routeWithAck(ServerMessage message, RoutingContext context) {
+      public void routeWithAck(Message message, RoutingContext context) {
 
       }
    }
@@ -204,14 +204,14 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase
{
       }
 
       @Override
-      public boolean redistribute(ServerMessage message,
+      public boolean redistribute(Message message,
                                   Queue originatingQueue,
                                   RoutingContext context) throws Exception {
          return false;
       }
 
       @Override
-      public void route(ServerMessage message, RoutingContext context) throws Exception {
+      public void route(Message message, RoutingContext context) throws Exception {
          System.out.println("routing message: " + message);
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
index 804429f..78179a8 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
@@ -25,6 +25,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ClientProducer;
@@ -40,7 +41,6 @@ import org.apache.activemq.artemis.core.server.Consumer;
 import org.apache.activemq.artemis.core.server.HandleStatus;
 import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.impl.QueueImpl;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeConsumer;
@@ -157,7 +157,7 @@ public class QueueImplTest extends ActiveMQTestBase {
 
       Filter filter = new Filter() {
          @Override
-         public boolean match(final ServerMessage message) {
+         public boolean match(final Message message) {
             return false;
          }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java
index 9d7f0e1..8f394e2 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java
@@ -16,9 +16,10 @@
  */
 package org.apache.activemq.artemis.tests.unit.core.server.impl.fakes;
 
+
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.filter.Filter;
-import org.apache.activemq.artemis.core.server.ServerMessage;
 
 public class FakeFilter implements Filter {
 
@@ -36,9 +37,9 @@ public class FakeFilter implements Filter {
    }
 
    @Override
-   public boolean match(final ServerMessage message) {
+   public boolean match(final Message message) {
       if (headerName != null) {
-         Object value = message.getObjectProperty(new SimpleString(headerName));
+         Object value = message.getObjectProperty(headerName);
 
          if (value instanceof SimpleString) {
             value = ((SimpleString) value).toString();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java
index 547d669..a84d2d0 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java
@@ -20,6 +20,7 @@ import javax.transaction.xa.Xid;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.Pair;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.journal.Journal;
@@ -29,7 +30,6 @@ import org.apache.activemq.artemis.core.persistence.QueueBindingInfo;
 import org.apache.activemq.artemis.core.persistence.impl.PageCountPending;
 import org.apache.activemq.artemis.core.persistence.impl.journal.AddMessageRecord;
 import org.apache.activemq.artemis.core.server.MessageReference;
-import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.impl.JournalLoader;
 import org.apache.activemq.artemis.core.transaction.ResourceManager;
 import org.apache.activemq.artemis.core.transaction.Transaction;
@@ -37,7 +37,7 @@ import org.apache.activemq.artemis.core.transaction.Transaction;
 public class FakeJournalLoader implements JournalLoader {
 
    @Override
-   public void handleNoMessageReferences(Map<Long, ServerMessage> messages) {
+   public void handleNoMessageReferences(Map<Long, Message> messages) {
    }
 
    @Override
@@ -69,7 +69,7 @@ public class FakeJournalLoader implements JournalLoader {
    }
 
    @Override
-   public void handlePreparedSendMessage(ServerMessage message, Transaction tx, long queueID)
{
+   public void handlePreparedSendMessage(Message message, Transaction tx, long queueID) {
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
index 6602df5..109a336 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
@@ -21,6 +21,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.Pair;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager;
@@ -35,7 +36,6 @@ import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
 import org.apache.activemq.artemis.api.core.RoutingType;
-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.MessageReferenceImpl;
 import org.apache.activemq.artemis.core.transaction.Transaction;
@@ -173,14 +173,14 @@ public class FakePostOffice implements PostOffice {
    }
 
    @Override
-   public Pair<RoutingContext, ServerMessage> redistribute(final ServerMessage message,
-                                                           final Queue originatingQueue,
-                                                           final Transaction tx) throws Exception
{
+   public Pair<RoutingContext, Message> redistribute(final Message message,
+                                                     final Queue originatingQueue,
+                                                     final Transaction tx) throws Exception
{
       return null;
    }
 
    @Override
-   public MessageReference reroute(final ServerMessage message,
+   public MessageReference reroute(final Message message,
                                    final Queue queue,
                                    final Transaction tx) throws Exception {
       message.incrementRefCount();
@@ -188,14 +188,14 @@ public class FakePostOffice implements PostOffice {
    }
 
    @Override
-   public RoutingStatus route(ServerMessage message,
+   public RoutingStatus route(Message message,
                               Transaction tx,
                               boolean direct) throws Exception {
       return RoutingStatus.OK;
    }
 
    @Override
-   public RoutingStatus route(ServerMessage message,
+   public RoutingStatus route(Message message,
                               Transaction tx,
                               boolean direct,
                               boolean rejectDuplicates) throws Exception {
@@ -203,12 +203,12 @@ public class FakePostOffice implements PostOffice {
    }
 
    @Override
-   public RoutingStatus route(ServerMessage message, RoutingContext context, boolean direct)
throws Exception {
+   public RoutingStatus route(Message message, RoutingContext context, boolean direct) throws
Exception {
       return null;
    }
 
    @Override
-   public RoutingStatus route(ServerMessage message,
+   public RoutingStatus route(Message message,
                               RoutingContext context,
                               boolean direct,
                               boolean rejectDuplicates) throws Exception {
@@ -216,11 +216,11 @@ public class FakePostOffice implements PostOffice {
    }
 
    @Override
-   public void processRoute(ServerMessage message, RoutingContext context, boolean direct)
throws Exception {
+   public void processRoute(Message message, RoutingContext context, boolean direct) throws
Exception {
    }
 
    @Override
-   public RoutingStatus route(ServerMessage message, boolean direct) throws Exception {
+   public RoutingStatus route(Message message, boolean direct) throws Exception {
       return RoutingStatus.OK;
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/FakePagingManager.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/FakePagingManager.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/FakePagingManager.java
index 500a81f..d1012a6 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/FakePagingManager.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/FakePagingManager.java
@@ -19,11 +19,12 @@ package org.apache.activemq.artemis.tests.unit.util;
 import java.util.Collection;
 import java.util.Map;
 
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.paging.PageTransactionInfo;
 import org.apache.activemq.artemis.core.paging.PagingManager;
 import org.apache.activemq.artemis.core.paging.PagingStore;
-import org.apache.activemq.artemis.core.server.ServerMessage;
+
 import org.apache.activemq.artemis.core.server.files.FileStoreMonitor;
 
 public final class FakePagingManager implements PagingManager {
@@ -64,11 +65,11 @@ public final class FakePagingManager implements PagingManager {
       return false;
    }
 
-   public boolean page(final ServerMessage message, final boolean duplicateDetection) throws
Exception {
+   public boolean page(final Message message, final boolean duplicateDetection) throws Exception
{
       return false;
    }
 
-   public boolean page(final ServerMessage message,
+   public boolean page(final Message message,
                        final long transactionId,
                        final boolean duplicateDetection) throws Exception {
       return false;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java
index 3fa2df8..2b5205e 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java
@@ -16,8 +16,8 @@
  */
 package org.apache.activemq.artemis.tests.unit.util;
 
+import org.apache.activemq.artemis.core.message.impl.CoreMessage;
 import org.apache.activemq.artemis.core.server.impl.MessageReferenceImpl;
-import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
 import org.apache.activemq.artemis.tests.unit.UnitTestLogger;
 import org.apache.activemq.artemis.utils.MemorySize;
 import org.junit.Assert;
@@ -30,7 +30,7 @@ public class MemorySizeTest extends Assert {
       UnitTestLogger.LOGGER.info("Server message size is " + MemorySize.calculateSize(new
MemorySize.ObjectFactory() {
          @Override
          public Object createObject() {
-            return new ServerMessageImpl(1, 1000);
+            return new CoreMessage(1, 1000);
          }
       }));
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/669e7cf2/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UTF8Test.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UTF8Test.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UTF8Test.java
index b07f5bf..570c791 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UTF8Test.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UTF8Test.java
@@ -44,7 +44,7 @@ public class UTF8Test extends ActiveMQTestBase {
 
       String str = new String(bytes);
 
-      UTF8Util.saveUTF(buffer, str);
+      UTF8Util.saveUTF(buffer.byteBuf(), str);
 
       String newStr = UTF8Util.readUTF(buffer);
 
@@ -72,7 +72,7 @@ public class UTF8Test extends ActiveMQTestBase {
    }
 
    private void testValidateUTFOnDataInputStream(final String str, final ActiveMQBuffer wrap)
throws Exception {
-      UTF8Util.saveUTF(wrap, str);
+      UTF8Util.saveUTF(wrap.byteBuf(), str);
 
       DataInputStream data = new DataInputStream(new ByteArrayInputStream(wrap.toByteBuffer().array()));
 
@@ -106,7 +106,7 @@ public class UTF8Test extends ActiveMQTestBase {
       ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(0xffff + 4);
 
       try {
-         UTF8Util.saveUTF(buffer, str);
+         UTF8Util.saveUTF(buffer.byteBuf(), str);
          Assert.fail("String is too big, supposed to throw an exception");
       } catch (Exception ignored) {
       }
@@ -122,7 +122,7 @@ public class UTF8Test extends ActiveMQTestBase {
       str = new String(chars);
 
       try {
-         UTF8Util.saveUTF(buffer, str);
+         UTF8Util.saveUTF(buffer.byteBuf(), str);
          Assert.fail("Encoded String is too big, supposed to throw an exception");
       } catch (Exception ignored) {
       }
@@ -138,7 +138,7 @@ public class UTF8Test extends ActiveMQTestBase {
 
       str = new String(chars);
 
-      UTF8Util.saveUTF(buffer, str);
+      UTF8Util.saveUTF(buffer.byteBuf(), str);
 
       Assert.assertEquals(0xffff + DataConstants.SIZE_SHORT, buffer.writerIndex());
 


Mime
View raw message