brusdev commented on a change in pull request #2694: ARTEMIS-2371 Message with 
huge header shuts broker down
URL: https://github.com/apache/activemq-artemis/pull/2694#discussion_r292061972
 
 

 ##########
 File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpLargeMessageTest.java
 ##########
 @@ -265,6 +266,51 @@ public void testSendAMQPReceiveAMQPViaJMSBytes() throws 
Exception {
       return payload;
    }
 
+   @Test(timeout = 60000)
+   public void testSendHugeHeader() throws Exception {
+      doTestSendHugeHeader(PAYLOAD);
+   }
+
+   @Test(timeout = 60000)
+   public void testSendLargeMessageWithHugeHeader() throws Exception {
+      doTestSendHugeHeader(1024 * 1024);
+   }
+
+   public void doTestSendHugeHeader(int expectedSize) throws Exception {
+      server.getAddressSettingsRepository().addMatch("#", new 
AddressSettings().setDefaultAddressRoutingType(RoutingType.ANYCAST));
+
+      AmqpClient client = createAmqpClient();
+      AmqpConnection connection = addConnection(client.connect());
+      try {
+
+         connection.connect();
+
+         final int strLength = 1024 * 1024;
+         AmqpSession session = connection.createSession();
+         AmqpSender sender = session.createSender(testQueueName);
+
+         AmqpMessage message = createAmqpMessage((byte) 'A', expectedSize);
+         StringBuffer buffer = new StringBuffer();
+         for (int i = 0; i < strLength; i++) {
+            buffer.append(" ");
+         }
+         message.setApplicationProperty("str", buffer.toString());
+         message.setDurable(true);
+
+         try {
+            sender.send(message);
+            fail();
+         } catch (IOException e) {
+            Assert.assertTrue(e.getCause() instanceof JMSException);
+            Assert.assertTrue(e.getMessage().contains("larger than the store 
maxRecordSize"));
 
 Review comment:
   I changed the check to test Exception Code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to