use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class StatelessServiceWrapperTest method testWrappingOfServiceListWrappedSettersAreCalled.
@Test
public void testWrappingOfServiceListWrappedSettersAreCalled() throws Exception {
ServiceList ws = new ServiceList();
ws.setUniqueId(ServiceList.class.getSimpleName());
StatelessServiceWrapper s = new StatelessServiceWrapper(ws);
s.setUniqueId(StatelessServiceWrapper.class.getSimpleName());
s.setContinueOnFail(true);
s.setIsTrackingEndpoint(true);
assertNotNull(ws.getIsTrackingEndpoint());
assertEquals(s.getIsTrackingEndpoint(), ws.getIsTrackingEndpoint());
assertEquals(ws.isTrackingEndpoint(), s.isTrackingEndpoint());
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class StatelessServiceWrapperTest method testWrappingOfServiceList.
@Test
public void testWrappingOfServiceList() throws Exception {
ServiceList ws = new ServiceList();
ws.setUniqueId(ServiceList.class.getSimpleName());
ws.setContinueOnFail(true);
ws.setIsTrackingEndpoint(true);
StatelessServiceWrapper s = new StatelessServiceWrapper(ws);
s.setUniqueId(StatelessServiceWrapper.class.getSimpleName());
assertNotNull(ws.getIsTrackingEndpoint());
assertEquals(ws.isTrackingEndpoint(), s.isTrackingEndpoint());
assertEquals(ws.isBranching(), s.isBranching());
assertEquals(ws.createName(), s.createName());
assertEquals(ws.createQualifier(), s.createQualifier());
assertNotSame(ws.getUniqueId(), s.getUniqueId());
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class HttpHelper method createAndStartChannel.
public static Channel createAndStartChannel(MockMessageProducer mock, HttpStatusProvider.HttpStatus status) throws Exception {
JettyMessageConsumer mc = createConsumer(URL_TO_POST_TO);
mc.setHeaderHandler(new MetadataHeaderHandler());
HttpConnection jc = createConnection();
Channel c = createChannel(jc, createWorkflow(mc, mock, new ServiceList(new Service[] { new StandaloneProducer(new StandardResponseProducer(status)) })));
start(c);
return c;
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class HttpRequestServiceTest method testRequest_EmptyReply.
@Test
public void testRequest_EmptyReply() throws Exception {
MockMessageProducer mock = new MockMessageProducer();
HttpConnection jc = HttpHelper.createConnection();
JettyMessageConsumer mc = createConsumer(HttpHelper.URL_TO_POST_TO);
StandardResponseProducer responder = new StandardResponseProducer(HttpStatus.OK_200);
responder.setSendPayload(false);
Channel c = createChannel(jc, createWorkflow(mc, mock, new ServiceList(new Service[] { new StandaloneProducer(responder) })));
HttpRequestService service = new HttpRequestService(HttpHelper.createProduceDestination(c)).withMethod("POST");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage(TEXT);
try {
start(c);
execute(service, msg);
waitForMessages(mock, 1);
} finally {
HttpHelper.stopChannelAndRelease(c);
}
assertEquals(1, mock.messageCount());
AdaptrisMessage m2 = mock.getMessages().get(0);
assertEquals("POST", m2.getMetadataValue(CoreConstants.HTTP_METHOD));
assertEquals(0, msg.getSize());
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class HttpRequestServiceTest method testRequest_PostMethod_ZeroBytes.
@Test
public void testRequest_PostMethod_ZeroBytes() throws Exception {
MockMessageProducer mock = new MockMessageProducer();
HttpConnection jc = HttpHelper.createConnection();
JettyMessageConsumer mc = createConsumer(HttpHelper.URL_TO_POST_TO);
Channel c = createChannel(jc, createWorkflow(mc, mock, new ServiceList(new Service[] { new PayloadFromTemplateService().withTemplate(TEXT), new StandaloneProducer(new StandardResponseProducer(HttpStatus.OK_200)) })));
HttpRequestService service = new HttpRequestService(HttpHelper.createProduceDestination(c)).withMethod("POST");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
try {
start(c);
execute(service, msg);
waitForMessages(mock, 1);
} finally {
HttpHelper.stopChannelAndRelease(c);
}
assertEquals(1, mock.messageCount());
AdaptrisMessage m2 = mock.getMessages().get(0);
assertEquals("POST", m2.getMetadataValue(CoreConstants.HTTP_METHOD));
assertEquals(TEXT, msg.getContent());
}
Aggregations