use of com.adaptris.core.AdaptrisMessage in project interlok by adaptris.
the class JettyWrapperTest method testUnwrap.
@Test
public void testUnwrap() {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
JettyWrapper wrapper = new JettyWrapper();
msg.addObjectHeader(JettyConstants.JETTY_WRAPPER, wrapper);
assertEquals(wrapper, JettyWrapper.unwrap(msg));
assertNotSame(wrapper, JettyWrapper.unwrap(AdaptrisMessageFactory.getDefaultInstance().newMessage()));
}
use of com.adaptris.core.AdaptrisMessage in project interlok by adaptris.
the class StandardResponseProducerTest method testResponse_NoOpResponseHeaders.
@Test
public void testResponse_NoOpResponseHeaders() throws Exception {
StandardResponseProducer responder = new StandardResponseProducer(HttpStatus.OK_200);
responder.setResponseHeaderProvider(new NoOpResponseHeaderProvider());
HttpConnection httpConnection = createConnection();
Channel c = createChannel(httpConnection, createWorkflow(createConsumer(URL_TO_POST_TO), new MockMessageProducer(), new ServiceList(new Service[] { new StandaloneProducer(responder) })));
StandaloneRequestor requestor = createRequestor(httpConnection.getPort());
AdaptrisMessage msg = createMessage();
try {
c.requestStart();
start(requestor);
requestor.doService(msg);
assertEquals(TEXT, msg.getContent());
} finally {
c.requestClose();
stop(requestor);
PortManager.release(httpConnection.getPort());
}
}
use of com.adaptris.core.AdaptrisMessage in project interlok by adaptris.
the class StandardResponseProducerTest method testNoObjectMetadata.
@Test
public void testNoObjectMetadata() throws Exception {
StandardResponseProducer responder = new StandardResponseProducer(HttpStatus.OK_200);
StandaloneProducer p = new StandaloneProducer(responder);
try {
// INTERLOK-3329 For coverage so the prepare() warning is executed 2x
LifecycleHelper.prepare(p);
start(p);
AdaptrisMessage msg = createMessage();
p.doService(msg);
} finally {
stop(p);
}
}
use of com.adaptris.core.AdaptrisMessage 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.AdaptrisMessage in project interlok by adaptris.
the class FilesystemRetryStoreTest method testWrite_Exception.
@Test(expected = InterlokException.class)
public void testWrite_Exception() throws Exception {
FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(INVALID_URL);
try {
LifecycleHelper.initAndStart(store);
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
store.write(msg);
} finally {
LifecycleHelper.stopAndClose(store);
}
}
Aggregations