You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2014/02/07 17:47:53 UTC
svn commit: r1565719 - in /qpid/jms/trunk/src:
main/java/org/apache/qpid/jms/impl/MessageIdHelper.java
test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java
Author: robbie
Date: Fri Feb 7 16:47:53 2014
New Revision: 1565719
URL: http://svn.apache.org/r1565719
Log:
QPIDJMS-9: fix constants and method names relating to the ulong id conversion
Modified:
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageIdHelper.java
qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java
Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageIdHelper.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageIdHelper.java?rev=1565719&r1=1565718&r2=1565719&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageIdHelper.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageIdHelper.java Fri Feb 7 16:47:53 2014
@@ -47,7 +47,7 @@ import java.util.UUID;
* <p>When setting a JMSCorrelationID using setJMSCorrelationID(String id), any value which begins with the "ID:" prefix of a
* JMSMessageID that attempts to identify itself as an encoded binary, uuid, or ulong but cant be converted into the indicated
* format will cause an exception to be thrown. Any JMSCorrelationID String being set which does not begin with the "ID:"
- * prefix of a JMSMessageID will beencoded as a String in the AMQP message, regardless whether it includes the above encoding
+ * prefix of a JMSMessageID will be encoded as a String in the AMQP message, regardless whether it includes the above encoding
* prefixes.
*
*/
@@ -55,13 +55,13 @@ public class MessageIdHelper
{
public static final String AMQP_STRING_PREFIX = "AMQP_STRING:";
public static final String AMQP_UUID_PREFIX = "AMQP_UUID:";
- public static final String AMQP_LONG_PREFIX = "AMQP_LONG:";
+ public static final String AMQP_ULONG_PREFIX = "AMQP_ULONG:";
public static final String AMQP_BINARY_PREFIX = "AMQP_BINARY:";
public static final String JMS_ID_PREFIX = "ID:";
private static final int JMS_ID_PREFIX_LENGTH = JMS_ID_PREFIX.length();
private static final int AMQP_UUID_PREFIX_LENGTH = AMQP_UUID_PREFIX.length();
- private static final int AMQP_LONG_PREFIX_LENGTH = AMQP_LONG_PREFIX.length();
+ private static final int AMQP_ULONG_PREFIX_LENGTH = AMQP_ULONG_PREFIX.length();
private static final int AMQP_STRING_PREFIX_LENGTH = AMQP_STRING_PREFIX.length();
private static final int AMQP_BINARY_PREFIX_LENGTH = AMQP_BINARY_PREFIX.length();
@@ -140,7 +140,7 @@ public class MessageIdHelper
}
else if(messageId instanceof BigInteger || messageId instanceof Long)
{
- return AMQP_LONG_PREFIX + messageId.toString();
+ return AMQP_ULONG_PREFIX + messageId.toString();
}
else if(messageId instanceof ByteBuffer)
{
@@ -157,7 +157,7 @@ public class MessageIdHelper
{
return hasAmqpBinaryPrefix(stringId) ||
hasAmqpUuidPrefix(stringId) ||
- hasAmqpLongPrefix(stringId) ||
+ hasAmqpUlongPrefix(stringId) ||
hasAmqpStringPrefix(stringId);
}
@@ -166,9 +166,9 @@ public class MessageIdHelper
return stringId.startsWith(AMQP_STRING_PREFIX);
}
- private boolean hasAmqpLongPrefix(String stringId)
+ private boolean hasAmqpUlongPrefix(String stringId)
{
- return stringId.startsWith(AMQP_LONG_PREFIX);
+ return stringId.startsWith(AMQP_ULONG_PREFIX);
}
private boolean hasAmqpUuidPrefix(String stringId)
@@ -219,9 +219,9 @@ public class MessageIdHelper
String uuidString = strip(baseId, AMQP_UUID_PREFIX_LENGTH);
return UUID.fromString(uuidString);
}
- else if(hasAmqpLongPrefix(baseId))
+ else if(hasAmqpUlongPrefix(baseId))
{
- String longString = strip(baseId, AMQP_LONG_PREFIX_LENGTH);
+ String longString = strip(baseId, AMQP_ULONG_PREFIX_LENGTH);
return new BigInteger(longString);
}
else if(hasAmqpStringPrefix(baseId))
Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java?rev=1565719&r1=1565718&r2=1565719&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java Fri Feb 7 16:47:53 2014
@@ -215,12 +215,12 @@ public class MessageIdHelperTest extends
/**
* Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
* indicating an AMQP encoded string, when the given string happens to already begin with
- * the {@link MessageIdHelper#AMQP_LONG_PREFIX}.
+ * the {@link MessageIdHelper#AMQP_ULONG_PREFIX}.
*/
@Test
public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForLong()
{
- String longStringMessageId = MessageIdHelper.AMQP_LONG_PREFIX + Long.valueOf(123456789L);
+ String longStringMessageId = MessageIdHelper.AMQP_ULONG_PREFIX + Long.valueOf(123456789L);
String expected = MessageIdHelper.AMQP_STRING_PREFIX + longStringMessageId;
String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(longStringMessageId);
@@ -264,10 +264,10 @@ public class MessageIdHelperTest extends
* indicating an AMQP encoded Long when given a Long object.
*/
@Test
- public void testToBaseMessageIdStringWithLong()
+ public void testToBaseMessageIdStringWithUlong()
{
Long longMessageId = Long.valueOf(123456789L);
- String expected = MessageIdHelper.AMQP_LONG_PREFIX + longMessageId.toString();
+ String expected = MessageIdHelper.AMQP_ULONG_PREFIX + longMessageId.toString();
String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(longMessageId);
assertNotNull("null string should not have been returned", baseMessageIdString);
@@ -282,7 +282,7 @@ public class MessageIdHelperTest extends
public void testToBaseMessageIdStringWithBigInteger()
{
BigInteger bigIntMessageId = BigInteger.valueOf(123456789L);
- String expected = MessageIdHelper.AMQP_LONG_PREFIX + bigIntMessageId.toString();
+ String expected = MessageIdHelper.AMQP_ULONG_PREFIX + bigIntMessageId.toString();
String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(bigIntMessageId);
assertNotNull("null string should not have been returned", baseMessageIdString);
@@ -296,10 +296,10 @@ public class MessageIdHelperTest extends
* encoded AMQP ulong id.
*/
@Test
- public void testToIdObjectWithEncodedLong()
+ public void testToIdObjectWithEncodedUlong()
{
BigInteger longId = BigInteger.valueOf(123456789L);
- String provided = MessageIdHelper.AMQP_LONG_PREFIX + "123456789";
+ String provided = MessageIdHelper.AMQP_ULONG_PREFIX + "123456789";
Object idObject = _messageIdHelper.toIdObject(provided);
assertNotNull("null object should not have been returned", idObject);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org