You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2015/10/16 12:07:35 UTC
svn commit: r1708942 - in /qpid/java/trunk:
client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
systests/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
Author: lquack
Date: Fri Oct 16 10:07:34 2015
New Revision: 1708942
URL: http://svn.apache.org/viewvc?rev=1708942&view=rev
Log:
QPID-6786: [Java Broker] Fix AMQConnection.getMaximumFrameSize() for AMQP 0-10
Address review comments from Keith Wall.
Work around QPID-6793 in the tests for now.
Modified:
qpid/java/trunk/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java?rev=1708942&r1=1708941&r2=1708942&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java Fri Oct 16 10:07:34 2015
@@ -55,12 +55,13 @@ import org.apache.qpid.transport.Connect
import org.apache.qpid.transport.ConnectionException;
import org.apache.qpid.transport.ConnectionListener;
import org.apache.qpid.transport.ConnectionSettings;
+import org.apache.qpid.transport.FrameSizeObserver;
import org.apache.qpid.transport.ProtocolVersionException;
import org.apache.qpid.transport.SessionDetachCode;
import org.apache.qpid.transport.SessionException;
import org.apache.qpid.transport.TransportException;
-public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, ConnectionListener
+public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, ConnectionListener, FrameSizeObserver
{
private static final int DEFAULT_PORT = 5672;
@@ -86,6 +87,7 @@ public class AMQConnectionDelegate_0_10
_conn = conn;
_qpidConnection = new Connection();
_qpidConnection.addConnectionListener(this);
+ _qpidConnection.addFrameSizeObserver(this);
}
/**
@@ -612,6 +614,12 @@ public class AMQConnectionDelegate_0_10
return _qpidConnection.isVirtualHostPropertiesSupported();
}
+ @Override
+ public void setMaxFrameSize(final int frameSize)
+ {
+ _conn.setMaximumFrameSize(frameSize);
+ }
+
private class RedirectConnectionException extends ConnectionException
{
private final String _host;
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java?rev=1708942&r1=1708941&r2=1708942&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java Fri Oct 16 10:07:34 2015
@@ -39,6 +39,7 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
+import javax.naming.InitialContext;
import com.google.common.base.Strings;
import org.junit.Assert;
@@ -164,17 +165,70 @@ public class PropertyValueTest extends Q
runBatch(50);
}
+
+ /**
+ * This fails because of QPID-6793
+ */
/*
- QPID-6786
- */
- public void testLargeHeader_010_HeadersFillContentHeaderFrame() throws Exception
+ public void testLargeHeader_010_HeaderLargerThan16Bit() throws Exception
{
_connection = (AMQConnection) getConnection();
int maximumFrameSize = (int) _connection.getMaximumFrameSize();
String propertyName = "string";
- String propertyValue = generateLongString((int) maximumFrameSize *2);
+ String propertyValue = generateLongString(1<<16);
sendReceiveMessageWithHeader(_connection, propertyName, propertyValue);
}
+ */
+
+ /**
+ * Test QPID-6786
+ */
+ public void testLargeHeader_010_HeadersFillContentHeaderFrame() throws Exception
+ {
+ _connection = (AMQConnection) getConnection();
+ int maximumFrameSize = (int) _connection.getMaximumFrameSize();
+ Map<String, String> headerProperties = new HashMap<>();
+ int headerPropertySize = ((1<<16) - 1);
+ int i = 0;
+ do
+ {
+ String propertyName = "string_" + i;
+ String propertyValue = generateLongString((1<<16) - 1);
+ headerProperties.put(propertyName, propertyValue);
+ ++i;
+ }
+ while (headerProperties.size() * headerPropertySize < 2 * maximumFrameSize);
+
+ _connection.start();
+ Session session = _connection.createSession(true, Session.SESSION_TRANSACTED);
+
+ Destination destination = session.createQueue(getTestQueueName());
+
+ Message message = session.createMessage();
+ for (Map.Entry<String, String> propertyEntry : headerProperties.entrySet())
+ {
+ message.setStringProperty(propertyEntry.getKey(), propertyEntry.getValue());
+ }
+
+ MessageConsumer consumer = session.createConsumer(destination);
+
+ MessageProducer producer = session.createProducer(destination);
+ producer.setDisableMessageID(true);
+ producer.setDisableMessageTimestamp(true);
+ producer.send(message);
+ session.commit();
+
+ Message receivedMessage = consumer.receive(1000);
+ assertNotNull("Message not received", receivedMessage);
+ for (Map.Entry<String, String> propertyEntry : headerProperties.entrySet())
+ {
+ assertEquals("Message has unexpected property value",
+ propertyEntry.getValue(),
+ receivedMessage.getStringProperty(propertyEntry.getKey()));
+ }
+ session.commit();
+
+ }
public void testLargeHeader_08091_HeadersFillContentHeaderFrame() throws Exception
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org