activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] 01/03: ARTEMIS-2274 Test showing issue with Message overflowing buffer when sizes are too close to TimedBuffer size
Date Wed, 13 Mar 2019 19:04:03 GMT
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit b672cc3ad97da7ae0ffcff8dbf24c2aad5c3f174
Author: yb <17061955@cn.suning.com>
AuthorDate: Wed Mar 13 10:43:44 2019 +0800

    ARTEMIS-2274 Test showing issue with Message overflowing buffer when sizes are too close
to TimedBuffer size
---
 .../unit/core/message/impl/MessageImplTest.java    | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java
index e88097a..9fd4469 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java
@@ -24,9 +24,18 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 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.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.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
+import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
 import org.apache.activemq.artemis.core.message.impl.CoreMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.junit.Wait;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.utils.RandomUtil;
 import org.junit.Assert;
@@ -336,6 +345,56 @@ public class MessageImplTest extends ActiveMQTestBase {
       buf.writeBytes(new byte[1024]);
    }
 
+   @Test
+   public void testCloseCallBuffer() throws Exception {
+
+      SimpleString ADDRESS = new SimpleString("SimpleAddress");
+
+      final int messageSize = 1024 * 1024 - 64;
+
+      final int journalsize = 10 * 1024 * 1024;
+
+      ServerLocator locator = createInVMNonHALocator();
+
+      locator.setMinLargeMessageSize(1024 * 1024);
+
+      ClientSession session = null;
+
+      ConfigurationImpl config = (ConfigurationImpl)createDefaultConfig(false);
+      config.setJournalFileSize(journalsize).setJournalBufferSize_AIO(1024 * 1024).setJournalBufferSize_NIO(1024
* 1024);
+
+      ActiveMQServer server = createServer(true, config);
+
+      server.start();
+
+      ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
+
+      session = addClientSession(sf.createSession(false, false, 0));
+
+      session.createQueue(ADDRESS, ADDRESS, true);
+
+      ClientProducer producer = session.createProducer(ADDRESS);
+
+      ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+      ClientMessage clientFile = session.createMessage(true);
+      for (int i = 0; i < messageSize; i++) {
+         clientFile.getBodyBuffer().writeByte(getSamplebyte(i));
+      }
+
+      producer.send(clientFile);
+
+      session.commit();
+
+      session.start();
+
+      ClientMessage msg1 = consumer.receive(1000);
+
+      Wait.assertTrue(server::isActive);
+
+      assertNotNull(msg1);
+   }
+
    // Protected -------------------------------------------------------------------------------
    // Private ----------------------------------------------------------------------------------
 


Mime
View raw message