use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.
the class JMSMappingOutboundTransformerTest method testConvertObjectMessageToAmqpMessageUnknownEncodingGetsDataSection.
@Test
public void testConvertObjectMessageToAmqpMessageUnknownEncodingGetsDataSection() throws Exception {
ServerJMSObjectMessage outbound = createObjectMessage(TEST_OBJECT_VALUE);
outbound.encode();
Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
assertNotNull(amqp.getBody());
assertTrue(amqp.getBody() instanceof Data);
assertFalse(0 == ((Data) amqp.getBody()).getValue().getLength());
Object value = deserialize(((Data) amqp.getBody()).getValue().getArray());
assertNotNull(value);
assertTrue(value instanceof UUID);
}
use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.
the class AMQPMessageSupport method createObjectMessage.
public static ServerJMSMessage createObjectMessage(long id, byte[] array, int offset, int length, CoreMessageObjectPools coreMessageObjectPools) throws JMSException {
ServerJMSObjectMessage message = createObjectMessage(id, coreMessageObjectPools);
message.setSerializedForm(new Binary(array, offset, length));
return message;
}
use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.
the class JMSMappingOutboundTransformerTest method testConvertEmptyObjectMessageToAmqpMessageWithDataBody.
// ----- ObjectMessage type tests -----------------------------------------//
@Test
public void testConvertEmptyObjectMessageToAmqpMessageWithDataBody() throws Exception {
ServerJMSObjectMessage outbound = createObjectMessage();
outbound.encode();
Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
assertNotNull(amqp.getBody());
assertTrue(amqp.getBody() instanceof Data);
assertEquals(5, ((Data) amqp.getBody()).getValue().getLength());
}
use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.
the class JMSMappingOutboundTransformerTest method createObjectMessage.
private ServerJMSObjectMessage createObjectMessage(Serializable payload, boolean compression) {
ServerJMSObjectMessage result = AMQPMessageSupport.createObjectMessage(0, null);
if (compression) {
// TODO
}
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos)) {
oos.writeObject(payload);
byte[] data = baos.toByteArray();
result.setSerializedForm(new Binary(data));
} catch (Exception ex) {
throw new AssertionError("Should not fail to setObject in this test");
}
return result;
}
use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.
the class AMQPMessageSupport method createObjectMessage.
public static ServerJMSMessage createObjectMessage(long id, Binary serializedForm, CoreMessageObjectPools coreMessageObjectPools) throws JMSException {
ServerJMSObjectMessage message = createObjectMessage(id, coreMessageObjectPools);
message.setSerializedForm(serializedForm);
return message;
}
Aggregations