QPID-8083 [System Tests] [REST/HTTP] Refactor MessageContentCompressionRestTest


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/b603e03f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/b603e03f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/b603e03f

Branch: refs/heads/master
Commit: b603e03ff34a2477cbad30cb76a8271395624fd7
Parents: 6402bfa
Author: Keith Wall <kw...@apache.org>
Authored: Tue Feb 13 16:46:31 2018 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Tue Feb 13 16:46:31 2018 +0000

----------------------------------------------------------------------
 .../message/CompressedMessageContentTest.java   | 262 ++++++++++++++
 .../rest/MessageContentCompressionRestTest.java | 338 -------------------
 test-profiles/CPPExcludes                       |   3 -
 test-profiles/Java10Excludes                    |   3 -
 4 files changed, 262 insertions(+), 344 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b603e03f/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/endtoend/message/CompressedMessageContentTest.java
----------------------------------------------------------------------
diff --git 
a/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/endtoend/message/CompressedMessageContentTest.java
 
b/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/endtoend/message/CompressedMessageContentTest.java
new file mode 100644
index 0000000..62a85c6
--- /dev/null
+++ 
b/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/endtoend/message/CompressedMessageContentTest.java
@@ -0,0 +1,262 @@
+/*
+ * 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.qpid.tests.http.endtoend.message;
+
+import static 
org.apache.qpid.server.model.Broker.BROKER_MESSAGE_COMPRESSION_ENABLED;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assume.assumeThat;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.GZIPInputStream;
+
+import javax.jms.Connection;
+import javax.jms.MapMessage;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.tests.http.HttpRequestConfig;
+import org.apache.qpid.tests.http.HttpTestBase;
+import org.apache.qpid.tests.utils.ConfigItem;
+
+@HttpRequestConfig
+@ConfigItem(name = BROKER_MESSAGE_COMPRESSION_ENABLED, value = "true")
+public class CompressedMessageContentTest extends HttpTestBase
+{
+    private static final String TEST_QUEUE = "testQueue";
+
+    @Before
+    public void setUp() throws Exception
+    {
+        assumeThat(getProtocol(), is(not(equalTo(Protocol.AMQP_1_0))));
+        getHelper().setTls(true);
+        getBrokerAdmin().createQueue(TEST_QUEUE);
+    }
+
+    @Test
+    public void getCompressedMessageContent_noCompressionSupported() throws 
Exception
+    {
+        final String messageText = sendCompressibleTextMessage();
+
+        String queueRelativePath = String.format("queue/%s", TEST_QUEUE);
+
+        List<Map<String, Object>> messages = 
getHelper().getJsonAsList(queueRelativePath + "/getMessageInfo");
+        assertThat(messages.size(), is(equalTo(1)));
+        final Map<String, Object> message = messages.get(0);
+        assertThat(message.get("encoding"), is(equalTo("gzip")));
+        long id = ((Number) message.get("id")).longValue();
+
+        byte[] messageBytes = getHelper().getBytes(queueRelativePath + 
"/getMessageContent?messageId=" + id);
+        String content = new String(messageBytes, StandardCharsets.UTF_8);
+        assertThat("Unexpected message content", content, 
is(equalTo(messageText)));
+
+        messageBytes = getHelper().getBytes(queueRelativePath + 
"/getMessageContent?limit=1024&decompressBeforeLimiting=true&messageId=" + id);
+        content = new String(messageBytes, StandardCharsets.UTF_8);
+        assertThat("Unexpected limited message content", content, 
is(equalTo(messageText.substring(0, 1024))));
+    }
+
+    @Test
+    public void getCompressedMessageContent_compressionSupported() throws 
Exception
+    {
+        final String messageText = sendCompressibleTextMessage();
+
+        String queueRelativePath = String.format("queue/%s", TEST_QUEUE);
+
+        List<Map<String, Object>> messages = 
getHelper().getJsonAsList(queueRelativePath + "/getMessageInfo");
+        assertThat(messages.size(), is(equalTo(1)));
+
+        final Map<String, Object> message = messages.get(0);
+        assertThat(message.get("encoding"), is(equalTo("gzip")));
+        long id = ((Number) message.get("id")).longValue();
+
+        getHelper().setAcceptEncoding("gzip, deflate, br");
+        String content = getDecompressedContent(queueRelativePath + 
"/getMessageContent?messageId=" + id);
+        assertThat("Unexpected message content", content, 
is(equalTo(messageText)));
+
+        content = getDecompressedContent(queueRelativePath + 
"/getMessageContent?limit=1024&decompressBeforeLimiting=true&messageId=" + id);
+        assertThat("Unexpected limited message content", content, 
is(equalTo(messageText.substring(0, 1024))));
+    }
+
+    @Test
+    public void getCompressedMapMessage_noCompressionSupported() throws 
Exception
+    {
+        final Map<String, Object> mapToSend = sendCompressibleMapMessage();
+
+        String queueRelativePath = String.format("queue/%s", TEST_QUEUE);
+
+        List<Map<String, Object>> messages = 
getHelper().getJsonAsList(queueRelativePath + "/getMessageInfo");
+        assertThat(messages.size(), is(equalTo(1)));
+
+        final Map<String, Object> message = messages.get(0);
+        assertThat(message.get("encoding"), is(equalTo("gzip")));
+        long id = ((Number) message.get("id")).longValue();
+
+
+        Map<String, Object> content = 
getHelper().getJsonAsMap(queueRelativePath + 
"/getMessageContent?returnJson=true&messageId=" + id);
+        assertThat("Unexpected message content: difference ", new 
HashMap<>(content), is(equalTo(new HashMap<>(mapToSend))));
+    }
+
+    @Test
+    public void getCompressedMapMessage_compressionSupported() throws Exception
+    {
+        final Map<String, Object> mapToSend = sendCompressibleMapMessage();
+
+        String queueRelativePath = String.format("queue/%s", TEST_QUEUE);
+
+        List<Map<String, Object>> messages = 
getHelper().getJsonAsList(queueRelativePath + "/getMessageInfo");
+        assertThat(messages.size(), is(equalTo(1)));
+
+        final Map<String, Object> message = messages.get(0);
+        assertThat(message.get("encoding"), is(equalTo("gzip")));
+        long id = ((Number) message.get("id")).longValue();
+
+        getHelper().setAcceptEncoding("gzip, deflate, br");
+        HttpURLConnection connection =
+                getHelper().openManagementConnection(queueRelativePath
+                                                     + 
"/getMessageContent?returnJson=true&messageId="
+                                                     + id,
+                                                     "GET");
+        connection.connect();
+
+        String content = decompressInputStream(connection);
+        Map<String, Object> mapContent = new ObjectMapper().readValue(content, 
new TypeReference<Map<String, Object>>() {});
+
+        assertThat("Unexpected message content ", new HashMap<>(mapContent), 
is(equalTo(new HashMap<>(mapToSend))));
+    }
+
+    private String getDecompressedContent(final String url) throws IOException
+    {
+        HttpURLConnection connection = 
getHelper().openManagementConnection(url, "GET");
+        connection.connect();
+        return decompressInputStream(connection);
+    }
+
+    private String decompressInputStream(final HttpURLConnection connection) 
throws IOException
+    {
+        try (InputStream is = new GZIPInputStream(connection.getInputStream());
+             ByteArrayOutputStream baos = new ByteArrayOutputStream())
+        {
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = is.read(buffer)) != -1)
+            {
+                baos.write(buffer, 0, len);
+            }
+            return new String(baos.toByteArray(), StandardCharsets.UTF_8);
+        }
+    }
+
+    private String sendCompressibleTextMessage() throws Exception
+    {
+        final String messageText = createCompressibleMessageText();
+        Connection connection = getConnection(true);
+        try
+        {
+            Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+            MessageProducer producer = 
session.createProducer(session.createQueue(TEST_QUEUE));
+            TextMessage sentMessage = session.createTextMessage(messageText);
+            producer.send(sentMessage);
+        }
+        finally
+        {
+            connection.close();
+        }
+        return messageText;
+    }
+
+    private Map<String, Object> sendCompressibleMapMessage() throws Exception
+    {
+        final Map<String, Object> mapToSend = createCompressibleMapMessage();
+
+        Connection senderConnection = getConnection(true);
+        try
+        {
+            Session session = senderConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+            MessageProducer producer = 
session.createProducer(session.createQueue(TEST_QUEUE));
+            MapMessage sentMessage = session.createMapMessage();
+            for(Map.Entry<String,Object> entry: mapToSend.entrySet())
+            {
+                String key =  entry.getKey();
+                Object value =  entry.getValue();
+                sentMessage.setObject(key, value);
+            }
+
+            producer.send(sentMessage);
+        }
+        finally
+        {
+            senderConnection.close();
+        }
+        return mapToSend;
+    }
+
+    private Map<String, Object> createCompressibleMapMessage()
+    {
+        Map<String, Object> mapToSend = new HashMap<>();
+
+        String message = "This is a sample message";
+        int i = 0, l = message.length();
+        do
+        {
+            mapToSend.put("text" + i, message);
+            i++;
+        }
+        while (i * l < 2048 * 1024);
+
+        mapToSend.put("int", 1);
+        return mapToSend;
+    }
+
+    private String createCompressibleMessageText()
+    {
+        StringBuilder stringBuilder = new StringBuilder();
+        while(stringBuilder.length() < 2048*1024)
+        {
+            stringBuilder.append("This should compress easily. ");
+        }
+        return stringBuilder.toString();
+    }
+
+    private Connection getConnection(final boolean compress) throws Exception
+    {
+        Map<String, String> options = 
Collections.singletonMap("compressMessages", String.valueOf(compress));
+        return getConnectionBuilder().setOptions(options).build();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b603e03f/systests/src/test/java/org/apache/qpid/systest/rest/MessageContentCompressionRestTest.java
----------------------------------------------------------------------
diff --git 
a/systests/src/test/java/org/apache/qpid/systest/rest/MessageContentCompressionRestTest.java
 
b/systests/src/test/java/org/apache/qpid/systest/rest/MessageContentCompressionRestTest.java
deleted file mode 100644
index 6f5621b..0000000
--- 
a/systests/src/test/java/org/apache/qpid/systest/rest/MessageContentCompressionRestTest.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- *
- * 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.qpid.systest.rest;
-
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.GZIPInputStream;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Maps;
-
-import org.apache.qpid.jms.ConnectionURL;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.Port;
-import org.apache.qpid.systest.rest.RestTestHelper;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import org.apache.qpid.test.utils.TestBrokerConfiguration;
-
-public class MessageContentCompressionRestTest extends QpidBrokerTestCase
-{
-    private static String VIRTUAL_HOST = "test";
-    private RestTestHelper _restTestHelper;
-
-    @Override
-    public void startDefaultBroker()
-    {
-        // tests are starting the broker
-    }
-
-    public void doActualSetUp() throws Exception
-    {
-        TestBrokerConfiguration config = getDefaultBrokerConfiguration();
-        config.addHttpManagementConfiguration();
-        config.setObjectAttribute(Port.class, 
TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT,
-                                  
Port.ALLOW_CONFIDENTIAL_OPERATIONS_ON_INSECURE_CHANNELS,
-                                  true);
-        super.startDefaultBroker();
-
-        _restTestHelper = new RestTestHelper(getDefaultBroker().getHttpPort());
-    }
-
-    @Override
-    protected void tearDown() throws Exception
-    {
-        try
-        {
-            super.tearDown();
-        }
-        finally
-        {
-            _restTestHelper.tearDown();
-        }
-    }
-
-    public void 
testGetContentViaRestForCompressedMessageWithAgentNotSupportingCompression() 
throws Exception
-    {
-        setTestSystemProperty(Broker.BROKER_MESSAGE_COMPRESSION_ENABLED, 
String.valueOf(true));
-
-        doActualSetUp();
-
-        String messageText = createMessageText();
-        Connection senderConnection = getConnection(true);
-        Session session = senderConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-        Queue testQueue = createTestQueue(session);
-
-        publishMessage(senderConnection, messageText, testQueue);
-
-        String queueRelativePath =  "queue/" + VIRTUAL_HOST  + "/" + 
VIRTUAL_HOST + "/" + testQueue.getQueueName();
-
-        List<Map<String, Object>> messages = 
_restTestHelper.getJsonAsList(queueRelativePath + "/getMessageInfo");
-        assertEquals("Unexpected number of messages", 1, messages.size());
-        long id = ((Number) messages.get(0).get("id")).longValue();
-
-        byte[] messageBytes = _restTestHelper.getBytes(queueRelativePath + 
"/getMessageContent?messageId=" + id);
-        String content = new String(messageBytes, StandardCharsets.UTF_8);
-        assertEquals("Unexpected message content :" + content, messageText, 
content);
-
-        messageBytes = _restTestHelper.getBytes(queueRelativePath + 
"/getMessageContent?limit=1024&decompressBeforeLimiting=true&messageId=" + id);
-        content = new String(messageBytes, StandardCharsets.UTF_8);
-        assertEquals("Unexpected message content :" + content, 
messageText.substring(0, 1024), content);
-    }
-
-    public void 
testGetContentViaRestForCompressedMessageWithAgentSupportingCompression() 
throws Exception
-    {
-        setTestSystemProperty(Broker.BROKER_MESSAGE_COMPRESSION_ENABLED, 
String.valueOf(true));
-
-        doActualSetUp();
-
-        String messageText = createMessageText();
-        Connection senderConnection = getConnection(true);
-        Session session = senderConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-        Queue testQueue = createTestQueue(session);
-
-        publishMessage(senderConnection, messageText, testQueue);
-
-        String queueRelativePath =  "queue/" + VIRTUAL_HOST  + "/" + 
VIRTUAL_HOST + "/" + testQueue.getQueueName();
-
-        List<Map<String, Object>> messages = 
_restTestHelper.getJsonAsList(queueRelativePath + "/getMessageInfo");
-        assertEquals("Unexpected number of messages", 1, messages.size());
-        long id = ((Number) messages.get(0).get("id")).longValue();
-
-        _restTestHelper.setAcceptEncoding("gzip, deflate, br");
-        String content = getDecompressedContent(queueRelativePath + 
"/getMessageContent?messageId=" + id);
-        assertEquals("Unexpected message content :" + content, messageText, 
content);
-
-        content = getDecompressedContent(queueRelativePath + 
"/getMessageContent?limit=1024&decompressBeforeLimiting=true&messageId=" + id);
-        assertEquals("Unexpected message content :" + content, 
messageText.substring(0, 1024), content);
-    }
-
-    public void testGetTruncatedContentViaRestForCompressedMessage() throws 
Exception
-    {
-        setTestSystemProperty(Broker.BROKER_MESSAGE_COMPRESSION_ENABLED, 
String.valueOf(true));
-
-        doActualSetUp();
-
-        String messageText = createMessageText();
-        Connection senderConnection = getConnection(true);
-        Session session = senderConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-        Queue testQueue = createTestQueue(session);
-
-        publishMessage(senderConnection, messageText, testQueue);
-
-        String queueRelativePath = "queue/" + VIRTUAL_HOST  + "/" + 
VIRTUAL_HOST + "/" + testQueue.getQueueName();
-
-        List<Map<String, Object>> messages = 
_restTestHelper.getJsonAsList(queueRelativePath + "/getMessageInfo");
-        assertEquals("Unexpected number of messages", 1, messages.size());
-        long id = ((Number) messages.get(0).get("id")).longValue();
-
-        _restTestHelper.setAcceptEncoding("gzip");
-        try
-        {
-            getDecompressedContent(queueRelativePath + 
"/getMessageContent?limit=1024&messageId=" + id);
-            fail("Should not be able to decompress truncated gzip");
-        }
-        catch (EOFException e)
-        {
-            // pass
-        }
-    }
-
-    private String getDecompressedContent(final String url) throws IOException
-    {
-        HttpURLConnection connection = 
_restTestHelper.openManagementConnection(url, "GET");
-        connection.connect();
-        return decompressInputStream(connection);
-    }
-
-    public void 
testGetContentViaRestForCompressedMapMessageWithAgentNotSupportingCompression() 
throws Exception
-    {
-        setTestSystemProperty(Broker.BROKER_MESSAGE_COMPRESSION_ENABLED, 
String.valueOf(true));
-
-        doActualSetUp();
-
-        Connection senderConnection = getConnection(true);
-        Session session = senderConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-        Queue testQueue = createTestQueue(session);
-
-        Map<String, Object> mapToSend = createMapToSend();
-        publishMapMessage(senderConnection, mapToSend, testQueue);
-
-        String queueRelativePath =  "queue/" + VIRTUAL_HOST  + "/" + 
VIRTUAL_HOST + "/" + testQueue.getQueueName();
-
-        List<Map<String, Object>> messages = 
_restTestHelper.getJsonAsList(queueRelativePath + "/getMessageInfo");
-        assertEquals("Unexpected number of messages", 1, messages.size());
-        long id = ((Number) messages.get(0).get("id")).longValue();
-
-        Map<String, Object> content =
-                _restTestHelper.getJsonAsMap(queueRelativePath + 
"/getMessageContent?returnJson=true&messageId=" + id);
-        assertEquals("Unexpected message content: difference " + 
Maps.difference(mapToSend, content),
-                     new HashMap<>(mapToSend),
-                     new HashMap<>(content));
-    }
-
-    public void 
testGetContentViaRestForCompressedMapMessageWithAgentSupportingCompression() 
throws Exception
-    {
-        setTestSystemProperty(Broker.BROKER_MESSAGE_COMPRESSION_ENABLED, 
String.valueOf(true));
-
-        doActualSetUp();
-
-        Connection senderConnection = getConnection(true);
-        Session session = senderConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-        Queue testQueue = createTestQueue(session);
-
-        Map<String, Object> mapToSend = createMapToSend();
-        publishMapMessage(senderConnection, mapToSend, testQueue);
-
-
-        String queueRelativePath =  "queue/" + VIRTUAL_HOST  + "/" + 
VIRTUAL_HOST + "/" + testQueue.getQueueName();
-
-        List<Map<String, Object>> messages = 
_restTestHelper.getJsonAsList(queueRelativePath + "/getMessageInfo");
-        assertEquals("Unexpected number of messages", 1, messages.size());
-        long id = ((Number) messages.get(0).get("id")).longValue();
-
-        _restTestHelper.setAcceptEncoding("gzip, deflate, br");
-        HttpURLConnection connection =
-                _restTestHelper.openManagementConnection(queueRelativePath
-                                                         + 
"/getMessageContent?returnJson=true&messageId="
-                                                         + id,
-                                                         "GET");
-        connection.connect();
-
-        String content = decompressInputStream(connection);
-        Map<String, Object> mapContent = new ObjectMapper().readValue(content, 
Map.class);
-        assertEquals("Unexpected message content: difference " + 
Maps.difference(mapToSend, mapContent),
-                     new HashMap<>(mapToSend),
-                     new HashMap<>(mapContent));
-    }
-
-    private Map<String, Object> createMapToSend()
-    {
-        Map<String, Object> mapToSend = new HashMap<>();
-
-        String message = "This is a sample message";
-        int i = 0, l = message.length();
-        do
-        {
-            mapToSend.put("text" + i, message);
-            i++;
-        }
-        while (i * l < 2048 * 1024);
-
-        mapToSend.put("int", 1);
-        return mapToSend;
-    }
-
-    private String decompressInputStream(final HttpURLConnection connection) 
throws IOException
-    {
-        String content;
-        try (InputStream is = new GZIPInputStream(connection.getInputStream());
-             ByteArrayOutputStream baos = new ByteArrayOutputStream())
-        {
-            byte[] buffer = new byte[1024];
-            int len;
-            while ((len = is.read(buffer)) != -1)
-            {
-                baos.write(buffer, 0, len);
-            }
-            content = new String(baos.toByteArray(), StandardCharsets.UTF_8);
-        }
-        return content;
-    }
-
-    private void publishMapMessage(final Connection senderConnection,
-                                   final Map<String, Object> mapData,
-                                   final Queue testQueue)
-            throws JMSException, org.apache.qpid.QpidException
-    {
-        Session session = senderConnection.createSession(true, 
Session.SESSION_TRANSACTED);
-
-        MessageProducer producer = session.createProducer(testQueue);
-        MapMessage sentMessage = session.createMapMessage();
-        sentMessage.setStringProperty("bar", "foo");
-        for(Map.Entry<String,Object> entry: mapData.entrySet())
-        {
-            String key =  entry.getKey();
-            Object value =  entry.getValue();
-            if (value instanceof String)
-            {
-                sentMessage.setString(key, (String) value);
-            }
-            else if (value instanceof Integer)
-            {
-                sentMessage.setInt(key, (Integer) value);
-            }
-            else
-            {
-                throw new RuntimeException("Setting value of type " + 
value.getClass() + " is not implemented yet");
-            }
-        }
-
-        producer.send(sentMessage);
-        session.commit();
-    }
-
-    private void publishMessage(final Connection senderConnection, final 
String messageText, final Queue testQueue)
-            throws JMSException, org.apache.qpid.QpidException
-    {
-        Session session = senderConnection.createSession(true, 
Session.SESSION_TRANSACTED);
-
-        MessageProducer producer = session.createProducer(testQueue);
-        TextMessage sentMessage = session.createTextMessage(messageText);
-        sentMessage.setStringProperty("bar", "foo");
-
-        producer.send(sentMessage);
-        session.commit();
-    }
-
-    private String createMessageText()
-    {
-        StringBuilder stringBuilder = new StringBuilder();
-        while(stringBuilder.length() < 2048*1024)
-        {
-            stringBuilder.append("This should compress easily. ");
-        }
-        return stringBuilder.toString();
-    }
-
-    private Connection getConnection(final boolean compress) throws Exception
-    {
-        Map<String, String> options = new HashMap<>();
-        
options.put(ConnectionURL.OPTIONS_COMPRESS_MESSAGES,String.valueOf(compress));
-        return getConnectionWithOptions(options);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b603e03f/test-profiles/CPPExcludes
----------------------------------------------------------------------
diff --git a/test-profiles/CPPExcludes b/test-profiles/CPPExcludes
index 2d24142..d8ae4d7 100755
--- a/test-profiles/CPPExcludes
+++ b/test-profiles/CPPExcludes
@@ -81,9 +81,6 @@ org.apache.qpid.systest.rest.*
 org.apache.qpid.systest.rest.acl.*
 
 
-// QPID-6000 : Tests Qpid Broker-J specific message compression functionality, 
and uses the REST API to test it
-org.apache.qpid.systest.rest.MessageContentCompressionRestTest#*
-
 
 
org.apache.qpid.test.unit.client.AMQSessionTest#testQueueDepthForQueueThatDoesNotExistLegacyBehaviour_08_091
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b603e03f/test-profiles/Java10Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/Java10Excludes b/test-profiles/Java10Excludes
index 3128524..611c6b9 100644
--- a/test-profiles/Java10Excludes
+++ b/test-profiles/Java10Excludes
@@ -33,9 +33,6 @@ 
org.apache.qpid.server.logging.ChannelLoggingTest#testChannelClosedOnExclusiveQu
 // This test is checking features of the 0-x client specific implementation of 
Session
 org.apache.qpid.test.unit.client.AMQSessionTest#*
 
-// Message compression not currently supported by the 1.0 client
-org.apache.qpid.systest.rest.MessageContentCompressionRestTest#*
-
 // Tests the interaction between the Broker's supported protocols and what the 
0-x client agrees to
 org.apache.qpid.server.SupportedProtocolVersionsTest#*
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to