Java Code Examples for org.apache.qpid.proton.amqp.UnsignedLong#valueOf()
The following examples show how to use
org.apache.qpid.proton.amqp.UnsignedLong#valueOf() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsInboundMessageDispatchTest.java From qpid-jms with Apache License 2.0 | 6 votes |
@Test public void testEqualAndHashCodeWithSameSequenceSameConsumerIdDifferentMessageIdTypes() { JmsSessionId sessionId = new JmsSessionId("con", 1); JmsConsumerId consumerId = new JmsConsumerId(sessionId, 1); Object messageId1 = new Binary(new byte[] { (byte) 1, (byte) 0 }); Object messageId2 = UnsignedLong.valueOf(2); long sequence = 1; JmsInboundMessageDispatch envelope1 = new JmsInboundMessageDispatch(sequence); envelope1.setConsumerId(consumerId); envelope1.setMessageId(messageId1); JmsInboundMessageDispatch envelope2 = new JmsInboundMessageDispatch(sequence); envelope2.setConsumerId(consumerId); envelope2.setMessageId(messageId2); assertFalse("objects should not be equal", envelope1.equals(envelope2)); assertFalse("objects should still not be equal", envelope2.equals(envelope1)); // Not strictly a requirement, but expected in this case assertNotEquals("hashCodes should not be the same", envelope1.hashCode(), envelope2.hashCode()); }
Example 2
Source File: SaslChallengeMatcher.java From qpid-jms with Apache License 2.0 | 5 votes |
public SaslChallengeMatcher() { super(FrameType.SASL, ANY_CHANNEL, UnsignedLong.valueOf(0x0000000000000042L), Symbol.valueOf("amqp:sasl-challenge:list")); }
Example 3
Source File: SaslMechanismsMatcher.java From qpid-jms with Apache License 2.0 | 5 votes |
public SaslMechanismsMatcher() { super(FrameType.SASL, ANY_CHANNEL, UnsignedLong.valueOf(0x0000000000000040L), Symbol.valueOf("amqp:sasl-mechanisms:list")); }
Example 4
Source File: AmqpJmsMessageFacadeTest.java From qpid-jms with Apache License 2.0 | 5 votes |
/** * 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()); }
Example 5
Source File: SaslOutcomeMatcher.java From qpid-jms with Apache License 2.0 | 5 votes |
public SaslOutcomeMatcher() { super(FrameType.SASL, ANY_CHANNEL, UnsignedLong.valueOf(0x0000000000000044L), Symbol.valueOf("amqp:sasl-outcome:list")); }
Example 6
Source File: MessageIntegrationTest.java From qpid-jms with Apache License 2.0 | 5 votes |
/** * Tests that receiving a message with a UUID typed correlation-id results in returning the * expected value for JMSCorrelationID where the JMS "ID:" prefix has been added to the UUID.tostring() * * @throws Exception if an error occurs during the test. */ @Test(timeout = 20000) public void testReceivedMessageWithLongCorrelationIdReturnsExpectedJMSCorrelationID() throws Exception { UnsignedLong underlyingCorrelationId = UnsignedLong.valueOf(123456789L); String expected = "ID:AMQP_ULONG:" + underlyingCorrelationId.toString(); receivedMessageWithCorrelationIdTestImpl(underlyingCorrelationId, expected); }
Example 7
Source File: OpenMatcher.java From qpid-jms with Apache License 2.0 | 5 votes |
public OpenMatcher() { super(FrameType.AMQP, ANY_CHANNEL, UnsignedLong.valueOf(0x0000000000000010L), Symbol.valueOf("amqp:open:list")); }
Example 8
Source File: AMQPMessageIdHelperTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * 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); }
Example 9
Source File: AMQPMessageIdHelperTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * 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); }
Example 10
Source File: AMQPMessageIdHelper.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * 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 ActiveMQAMQPIllegalStateException * 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()); } }
Example 11
Source File: CloseMatcher.java From qpid-jms with Apache License 2.0 | 5 votes |
public CloseMatcher() { super(FrameType.AMQP, ANY_CHANNEL, UnsignedLong.valueOf(0x0000000000000018L), Symbol.valueOf("amqp:close:list")); }
Example 12
Source File: TransferMatcher.java From qpid-jms with Apache License 2.0 | 5 votes |
/** * @param frameSize the size to check, or 0 if not to check the size. */ public TransferMatcher(int frameSize) { super(FrameType.AMQP, ANY_CHANNEL, frameSize, UnsignedLong.valueOf(0x0000000000000014L), Symbol.valueOf("amqp:transfer:list")); }
Example 13
Source File: AmqpMessageIdHelperTest.java From qpid-jms with Apache License 2.0 | 5 votes |
/** * 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); }
Example 14
Source File: DeleteOnNoMessagesMatcher.java From qpid-jms with Apache License 2.0 | 4 votes |
public DeleteOnNoMessagesMatcherCore() { super(UnsignedLong.valueOf(0x000000000000002dL), Symbol.valueOf("amqp:delete-on-no-messages:list")); }
Example 15
Source File: TargetMatcher.java From qpid-jms with Apache License 2.0 | 4 votes |
public TargetMatcherCore() { super(UnsignedLong.valueOf(0x0000000000000029L), Symbol.valueOf("amqp:target:list")); }
Example 16
Source File: TransactionalStateMatcher.java From qpid-jms with Apache License 2.0 | 4 votes |
public TransactionalStateMatcherCore() { super(UnsignedLong.valueOf(0x0000000000000034L), Symbol.valueOf("amqp:transactional-state:list")); }
Example 17
Source File: AmqpJmsNoLocalType.java From qpid-jms with Apache License 2.0 | 4 votes |
@Override public Object getDescriptor() { return UnsignedLong.valueOf(0x0000468C00000003L); }
Example 18
Source File: DeleteOnNoLinksOrMessagesMatcher.java From qpid-jms with Apache License 2.0 | 4 votes |
public DeleteOnNoLinksOrMessagesMatcherCore() { super(UnsignedLong.valueOf(0x000000000000002eL), Symbol.valueOf("amqp:delete-on-no-links-or-messages:list")); }
Example 19
Source File: AcceptedMatcher.java From qpid-jms with Apache License 2.0 | 4 votes |
public AcceptedMatcherCore() { super(UnsignedLong.valueOf(0x0000000000000024L), Symbol.valueOf("amqp:accepted:list")); }
Example 20
Source File: MessageIntegrationTest.java From qpid-jms with Apache License 2.0 | 3 votes |
/** * Tests that sending a message with a ulong typed correlation-id value which is a * message-id results in an AMQP message with the expected encoding of the correlation-id, * where the type is ulong, the "ID:" prefix of the JMSCorrelationID value is (obviously) not present. * * @throws Exception if an error occurs during the test. */ @Test(timeout = 20000) public void testSentMessageWithUlongCorrelationId() throws Exception { UnsignedLong ulong = UnsignedLong.valueOf(Long.MAX_VALUE); String stringCorrelationId = AmqpMessageIdHelper.JMS_ID_PREFIX + AmqpMessageIdHelper.AMQP_ULONG_PREFIX + ulong.toString(); sentMessageWithCorrelationIdTestImpl(stringCorrelationId, ulong); }