use of com.adaptris.core.stubs.StubMessageFactory in project interlok by adaptris.
the class LineCountSplitterTest method testSetMessageFactory.
@Override
public void testSetMessageFactory() throws Exception {
MessageSplitterImp splitter = createSplitterForTests();
assertNull(splitter.getMessageFactory());
assertEquals(DefaultMessageFactory.class, splitter.selectFactory(new DefaultMessageFactory().newMessage()).getClass());
splitter.setMessageFactory(new StubMessageFactory());
assertEquals(StubMessageFactory.class, splitter.getMessageFactory().getClass());
assertEquals(StubMessageFactory.class, splitter.selectFactory(new DefaultMessageFactory().newMessage()).getClass());
splitter.setMessageFactory(null);
assertEquals(DefaultMessageFactory.class, splitter.selectFactory(new DefaultMessageFactory().newMessage()).getClass());
assertEquals(StubMessageFactory.class, splitter.selectFactory(new StubMessageFactory().newMessage()).getClass());
}
use of com.adaptris.core.stubs.StubMessageFactory in project interlok by adaptris.
the class SplitterCase method testSetMessageFactory.
@Test
public void testSetMessageFactory() throws Exception {
MessageSplitterImp splitter = createSplitterForTests();
assertNull(splitter.getMessageFactory());
assertEquals(DefaultMessageFactory.class, splitter.selectFactory(new DefaultMessageFactory().newMessage()).getClass());
assertEquals(StubMessageFactory.class, splitter.selectFactory(new StubMessageFactory().newMessage()).getClass());
splitter.setMessageFactory(new StubMessageFactory());
assertEquals(StubMessageFactory.class, splitter.getMessageFactory().getClass());
assertEquals(StubMessageFactory.class, splitter.selectFactory(new DefaultMessageFactory().newMessage()).getClass());
splitter.setMessageFactory(new DefaultMessageFactory());
assertEquals(DefaultMessageFactory.class, splitter.selectFactory(new StubMessageFactory().newMessage()).getClass());
splitter.setMessageFactory(null);
assertEquals(DefaultMessageFactory.class, splitter.selectFactory(new DefaultMessageFactory().newMessage()).getClass());
assertEquals(StubMessageFactory.class, splitter.selectFactory(new StubMessageFactory().newMessage()).getClass());
}
use of com.adaptris.core.stubs.StubMessageFactory in project interlok by adaptris.
the class HttpConsumerTest method testBasicConsumeWithCustomMessageImpl.
@Test
public void testBasicConsumeWithCustomMessageImpl() throws Exception {
HttpConnection connection = createConnection(null);
MockMessageProducer mockProducer = new MockMessageProducer();
JettyMessageConsumer consumer = JettyHelper.createConsumer(URL_TO_POST_TO);
Channel adapter = JettyHelper.createChannel(connection, consumer, mockProducer);
try {
consumer.setMessageFactory(new StubMessageFactory());
adapter.requestStart();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_PAYLOAD);
msg.addMetadata(CONTENT_TYPE_METADATA_KEY, "text/xml");
httpProducer.setUrl(createProduceDestinationUrl(connection.getPort()));
start(httpProducer);
AdaptrisMessage reply = httpProducer.request(msg);
assertEquals("Reply Payloads", XML_PAYLOAD, reply.getContent());
doAssertions(mockProducer);
assertEquals("Consumed Message Java Class", AdaptrisMessageStub.class, mockProducer.getMessages().get(0).getClass());
} finally {
stop(httpProducer);
adapter.requestClose();
PortManager.release(connection.getPort());
}
}
Aggregations