You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2022/04/18 16:24:27 UTC
[GitHub] [activemq-artemis] iliya-gr commented on a diff in pull request #4030: ARTEMIS-3751 Do not override large message size
iliya-gr commented on code in PR #4030:
URL: https://github.com/apache/activemq-artemis/pull/4030#discussion_r852235977
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSLargeMessageTest.java:
##########
@@ -0,0 +1,192 @@
+/*
+ * 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.amqp;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Random;
+import java.util.zip.Deflater;
+
+import org.junit.Test;
+
+public class JMSLargeMessageTest extends JMSClientTestSupport {
+
+ // https://issues.apache.org/jira/projects/ARTEMIS/issues/ARTEMIS-3751
+ @Test
+ public void testSendLargeMessageWithCompressionWhenCompressedSizeIsLowerThanLargeMessageSize() throws Exception {
+ Connection connection = createCoreConnection();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Destination queue = session.createQueue("testQueue");
+
+ MessageProducer producer = session.createProducer(queue);
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ connection.start();
+
+ // What we want is to get a message witch size is larger than client's minLargeMessageSize (200 kibs here) while compressed the size must be lower than that
+ // and at same time it must be greater than server minLargeMessageSize (which is 100 kibs by default)
+ byte[] data = new byte[1024 * 300];
+
+ // We don't want the data to be too random, 42 seems to be a good random seed
+ new DeflateGenerator(new Random(42), 2.0, 2.0).generate(data, 2);
Review Comment:
It's only for generating random data. Assert is to ensure that it matches criteria: `server large message size < compressed size < client large message size`
--
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.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org