[hornetq-commits] JBoss hornetq SVN: r9086 - in trunk: tests/jms-tests/src/org/hornetq/jms/tests/message and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Apr 9 12:31:01 EDT 2010
Author: timfox
Date: 2010-04-09 12:31:00 -0400 (Fri, 09 Apr 2010)
New Revision: 9086
Modified:
trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/message/MessageTestBase.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-304
Modified: trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java 2010-04-09 14:36:35 UTC (rev 9085)
+++ trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java 2010-04-09 16:31:00 UTC (rev 9086)
@@ -52,6 +52,8 @@
private TypedProperties map = new TypedProperties();
+ private boolean invalid = true;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -107,60 +109,70 @@
{
checkName(name);
map.putBooleanProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setByte(final String name, final byte value) throws JMSException
{
checkName(name);
map.putByteProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setShort(final String name, final short value) throws JMSException
{
checkName(name);
map.putShortProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setChar(final String name, final char value) throws JMSException
{
checkName(name);
map.putCharProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setInt(final String name, final int value) throws JMSException
{
checkName(name);
map.putIntProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setLong(final String name, final long value) throws JMSException
{
checkName(name);
map.putLongProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setFloat(final String name, final float value) throws JMSException
{
checkName(name);
map.putFloatProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setDouble(final String name, final double value) throws JMSException
{
checkName(name);
map.putDoubleProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setString(final String name, final String value) throws JMSException
{
checkName(name);
map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value));
+ invalid = true;
}
public void setBytes(final String name, final byte[] value) throws JMSException
{
checkName(name);
map.putBytesProperty(new SimpleString(name), value);
+ invalid = true;
}
public void setBytes(final String name, final byte[] value, final int offset, final int length) throws JMSException
@@ -173,6 +185,7 @@
byte[] newBytes = new byte[length];
System.arraycopy(value, offset, newBytes, 0, length);
map.putBytesProperty(new SimpleString(name), newBytes);
+ invalid = true;
}
public void setObject(final String name, final Object value) throws JMSException
@@ -223,6 +236,7 @@
{
throw new MessageFormatException("Invalid object type.");
}
+ invalid = true;
}
public boolean getBoolean(final String name) throws JMSException
@@ -390,12 +404,19 @@
super.clearBody();
map.clear();
+
+ invalid = true;
}
@Override
public void doBeforeSend() throws Exception
{
- map.encode(message.getBodyBuffer());
+ if (invalid)
+ {
+ message.getBodyBuffer().resetWriterIndex();
+
+ map.encode(message.getBodyBuffer());
+ }
super.doBeforeSend();
}
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/message/MessageTestBase.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/message/MessageTestBase.java 2010-04-09 14:36:35 UTC (rev 9085)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/message/MessageTestBase.java 2010-04-09 16:31:00 UTC (rev 9086)
@@ -140,7 +140,40 @@
ProxyAssertSupport.assertNull(queueCons.receive(100));
}
+
+ public void testSendMoreThanOnce() throws Exception
+ {
+ prepareMessage(message);
+ session.close();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ queueProd = session.createProducer(HornetQServerTestCase.queue1);
+ queueProd.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+ queueCons = session.createConsumer(HornetQServerTestCase.queue1);
+
+ queueProd.send(message);
+ queueProd.send(message);
+ queueProd.send(message);
+
+ Message r = queueCons.receive(500);
+
+ assertEquivalent(r, DeliveryMode.NON_PERSISTENT);
+
+ r = queueCons.receive(500);
+
+ assertEquivalent(r, DeliveryMode.NON_PERSISTENT);
+
+ r = queueCons.receive(500);
+
+ assertEquivalent(r, DeliveryMode.NON_PERSISTENT);
+
+ queueCons.close();
+ session.close();
+
+
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
More information about the hornetq-commits
mailing list