本文整理汇总了Java中org.apache.qpid.proton.amqp.UnsignedLong.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java UnsignedLong.valueOf方法的具体用法?Java UnsignedLong.valueOf怎么用?Java UnsignedLong.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.qpid.proton.amqp.UnsignedLong
的用法示例。
在下文中一共展示了UnsignedLong.valueOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeIdFromJson
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
/**
* Decodes the given JsonObject to JSON representation.
* Supported types for AMQP 1.0 correlation/messageIds are String, UnsignedLong, UUID and Binary.
* @param json JSON representation of an ID
* @return an ID object of correct type
*/
public static Object decodeIdFromJson(final JsonObject json)
{
final String type = json.getString("type");
final String id = json.getString("id");
switch (type) {
case "string":
return id;
case "ulong":
return UnsignedLong.valueOf(id);
case "uuid":
return UUID.fromString(id);
case "binary":
return new Binary(Base64.getDecoder().decode(id));
default:
throw new IllegalArgumentException("type " + type + " is not supported");
}
}
示例2: toIdObject
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
/**
* Takes the provided id string and return the appropriate amqp messageId
* style object. Converts the type based on any relevant encoding information
* found as a prefix.
*
* @param origId
* the object to be converted
* @return the AMQP messageId style object
*
* @throws IllegalArgument
* if the provided baseId String indicates an encoded type but can't
* be converted to that type.
*/
public Object toIdObject(final String origId) throws ActiveMQAMQPIllegalStateException {
if (origId == null) {
return null;
}
if (!AMQPMessageIdHelper.INSTANCE.hasMessageIdPrefix(origId)) {
// We have a string without any "ID:" prefix, it is an
// application-specific String, use it as-is.
return origId;
}
try {
if (hasAmqpNoPrefix(origId, JMS_ID_PREFIX_LENGTH)) {
// Prefix telling us there was originally no "ID:" prefix,
// strip it and return the remainder
return origId.substring(JMS_ID_PREFIX_LENGTH + AMQP_NO_PREFIX_LENGTH);
} else if (hasAmqpUuidPrefix(origId, JMS_ID_PREFIX_LENGTH)) {
String uuidString = origId.substring(JMS_ID_PREFIX_LENGTH + AMQP_UUID_PREFIX_LENGTH);
return UUID.fromString(uuidString);
} else if (hasAmqpUlongPrefix(origId, JMS_ID_PREFIX_LENGTH)) {
String ulongString = origId.substring(JMS_ID_PREFIX_LENGTH + AMQP_ULONG_PREFIX_LENGTH);
return UnsignedLong.valueOf(ulongString);
} else if (hasAmqpStringPrefix(origId, JMS_ID_PREFIX_LENGTH)) {
return origId.substring(JMS_ID_PREFIX_LENGTH + AMQP_STRING_PREFIX_LENGTH);
} else if (hasAmqpBinaryPrefix(origId, JMS_ID_PREFIX_LENGTH)) {
String hexString = origId.substring(JMS_ID_PREFIX_LENGTH + AMQP_BINARY_PREFIX_LENGTH);
byte[] bytes = convertHexStringToBinary(hexString);
return new Binary(bytes);
} else {
// We have a string without any encoding prefix needing processed,
// so transmit it as-is, including the "ID:"
return origId;
}
} catch (IllegalArgumentException iae) {
throw new ActiveMQAMQPIllegalStateException(iae.getMessage());
}
}
示例3: testToMessageIdStringWithUnsignedLong
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
/**
* Test that {@link AMQPMessageIdHelper#toMessageIdString(Object)} returns a
* string indicating an AMQP encoded ulong when given a UnsignedLong object.
*/
@Test
public void testToMessageIdStringWithUnsignedLong() {
UnsignedLong uLongMessageId = UnsignedLong.valueOf(123456789L);
String expected = AMQPMessageIdHelper.JMS_ID_PREFIX + AMQPMessageIdHelper.AMQP_ULONG_PREFIX + uLongMessageId.toString();
doToMessageIdTestImpl(uLongMessageId, expected);
}
示例4: testToCorrelationIdStringWithUnsignedLong
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
/**
* Test that {@link AMQPMessageIdHelper#toCorrelationIdString(Object)}
* returns a string indicating an AMQP encoded ulong when given a
* UnsignedLong object.
*/
@Test
public void testToCorrelationIdStringWithUnsignedLong() {
UnsignedLong uLongCorrelationId = UnsignedLong.valueOf(123456789L);
String expected = AMQPMessageIdHelper.JMS_ID_PREFIX + AMQPMessageIdHelper.AMQP_ULONG_PREFIX + uLongCorrelationId.toString();
doToCorrelationIDTestImpl(uLongCorrelationId, expected);
}
示例5: testToIdObjectWithEncodedUlong
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
/**
* Test that {@link AMQPMessageIdHelper#toIdObject(String)} returns an
* UnsignedLong when given a string indicating an encoded AMQP ulong id.
*
* @throws Exception
* if an error occurs during the test.
*/
@Test
public void testToIdObjectWithEncodedUlong() throws Exception {
UnsignedLong longId = UnsignedLong.valueOf(123456789L);
String provided = AMQPMessageIdHelper.JMS_ID_PREFIX + AMQPMessageIdHelper.AMQP_ULONG_PREFIX + "123456789";
doToIdObjectTestImpl(provided, longId);
}
示例6: BeginMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public BeginMatcher()
{
super(FrameType.AMQP,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000011L),
Symbol.valueOf("amqp:begin:list"));
}
示例7: DispositionMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public DispositionMatcher()
{
super(FrameType.AMQP,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000015L),
Symbol.valueOf("amqp:disposition:list"));
}
示例8: DetachMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public DetachMatcher()
{
super(FrameType.AMQP,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000016L),
Symbol.valueOf("amqp:detach:list"));
}
示例9: testSetGetCorrelationIdOnNewMessageWithUnsignedLong
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
/**
* Test that setting then getting a ulong correlationId (using BigInteger) returns the expected value
* and sets the expected value on the underlying AMQP message
* @throws Exception if unexpected error
*/
@Test
public void testSetGetCorrelationIdOnNewMessageWithUnsignedLong() throws Exception {
Object testCorrelationId = UnsignedLong.valueOf(123456789L);
String converted = "ID:AMQP_ULONG:" + testCorrelationId;
AmqpJmsMessageFacade amqpMessageFacade = createNewMessageFacade();
amqpMessageFacade.setCorrelationId(converted);
assertEquals("Unexpected correlationId value on underlying AMQP message", testCorrelationId, amqpMessageFacade.getProperties().getCorrelationId());
assertEquals("Expected correlationId not returned", converted, amqpMessageFacade.getCorrelationId());
}
示例10: CloseMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public CloseMatcher()
{
super(FrameType.AMQP,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000018L),
Symbol.valueOf("amqp:close:list"));
}
示例11: EndMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public EndMatcher()
{
super(FrameType.AMQP,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000017L),
Symbol.valueOf("amqp:end:list"));
}
示例12: AttachMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public AttachMatcher()
{
super(FrameType.AMQP,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000012L),
Symbol.valueOf("amqp:attach:list"));
}
示例13: SaslChallengeMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public SaslChallengeMatcher()
{
super(FrameType.SASL,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000042L),
Symbol.valueOf("amqp:sasl-challenge:list"));
}
示例14: SaslOutcomeMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public SaslOutcomeMatcher()
{
super(FrameType.SASL,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000044L),
Symbol.valueOf("amqp:sasl-outcome:list"));
}
示例15: SaslMechanismsMatcher
import org.apache.qpid.proton.amqp.UnsignedLong; //导入方法依赖的package包/类
public SaslMechanismsMatcher()
{
super(FrameType.SASL,
ANY_CHANNEL,
UnsignedLong.valueOf(0x0000000000000040L),
Symbol.valueOf("amqp:sasl-mechanisms:list"));
}