use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class StandardResponseProducerTest method testResponse_MetadataContentType.
@Test
public void testResponse_MetadataContentType() throws Exception {
StandardResponseProducer responder = new StandardResponseProducer(HttpStatus.OK_200);
responder.setContentTypeProvider(new MetadataContentTypeProvider("MyContentType"));
AddMetadataService addMetadata = new AddMetadataService(Arrays.asList(new MetadataElement[] { new MetadataElement("MyContentType", "text/xml") }));
HttpConnection httpConnection = createConnection();
Channel c = createChannel(httpConnection, createWorkflow(createConsumer(URL_TO_POST_TO), new MockMessageProducer(), new ServiceList(new Service[] { addMetadata, new StandaloneProducer(responder) })));
StandaloneRequestor requestor = createRequestor(httpConnection.getPort());
AdaptrisMessage msg = createMessage();
try {
c.requestStart();
start(requestor);
requestor.doService(msg);
assertEquals(TEXT, msg.getContent());
assertTrue(msg.containsKey("Content-Type"));
assertTrue(msg.getMetadataValue("Content-Type").startsWith("text/xml"));
} finally {
c.requestClose();
stop(requestor);
PortManager.release(httpConnection.getPort());
}
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class MessageMetricsStatisticsByMetadataTest method createMessageForInjection.
@Override
protected SerializableAdaptrisMessage createMessageForInjection(String payload) {
SerializableAdaptrisMessage msg = null;
if (!isEmpty(payload)) {
msg = new SerializableAdaptrisMessage(GUID.getUUID(), payload);
} else {
msg = new SerializableAdaptrisMessage(GUID.getUUID());
}
msg.addMetadata(new MetadataElement("messageType", "Order"));
return msg;
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class MetadataTotalsMBeanTest method createMessageForInjection.
@Override
protected SerializableAdaptrisMessage createMessageForInjection(String payload) {
SerializableAdaptrisMessage msg = null;
if (!isEmpty(payload)) {
msg = new SerializableAdaptrisMessage(GUID.getUUID(), payload);
} else {
msg = new SerializableAdaptrisMessage(GUID.getUUID());
}
msg.addMetadata(new MetadataElement(METADATA_KEY1, STATS_KEY));
return msg;
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class MetadataCountMBeanTest method createMessageForInjection.
@Override
protected SerializableAdaptrisMessage createMessageForInjection(String payload) {
SerializableAdaptrisMessage msg = null;
if (!isEmpty(payload)) {
msg = new SerializableAdaptrisMessage(GUID.getUUID(), payload);
} else {
msg = new SerializableAdaptrisMessage(GUID.getUUID());
}
msg.addMetadata(new MetadataElement(COUNTER_1, "10"));
msg.addMetadata(new MetadataElement(COUNTER_2, "10"));
return msg;
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class MetadataConverterCase method testSetProperty.
@Test
public void testSetProperty() throws Exception {
MetadataConverter mc = createConverter();
Session session = activeMqBroker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
MetadataCollection metadataCollection = new MetadataCollection();
metadataCollection.add(new MetadataElement(HEADER, getStringValue()));
Message jmsMsg = session.createMessage();
mc.moveMetadata(metadataCollection, jmsMsg);
assertEquals(getStringValue(), jmsMsg.getStringProperty(HEADER));
assertValue(jmsMsg);
}
Aggregations