use of com.adaptris.core.services.aggregator.ReplaceWithFirstMessage in project interlok by adaptris.
the class AggregatingFsConsumeServiceTest method testServiceNonDeleting.
@Test
public void testServiceNonDeleting() throws Exception {
Object o = new Object();
File tempFile = TempFileUtils.createTrackedFile(o);
String url = "file://localhost/" + tempFile.getCanonicalPath().replaceAll("\\\\", "/");
AggregatingFsConsumer afc = createConsumer(url, null, new ReplaceWithFirstMessage());
afc.setDeleteAggregatedFiles(false);
AggregatingFsConsumeService service = createAggregatingService(afc);
File wipFile = new File(tempFile.getParent(), tempFile.getName() + afc.wipSuffix());
try {
writeDataMessage(tempFile);
start(service);
AdaptrisMessage msg = new DefaultMessageFactory().newMessage(INITIAL_PAYLOAD);
service.doService(msg);
assertNotSame(INITIAL_PAYLOAD, msg.getContent());
assertEquals(DATA_PAYLOAD, msg.getContent());
assertTrue(tempFile.exists());
assertFalse(wipFile.exists());
} finally {
stop(service);
}
}
use of com.adaptris.core.services.aggregator.ReplaceWithFirstMessage in project interlok by adaptris.
the class AggregatingJmsConsumeServiceTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
AggregatingJmsConsumeService service = null;
service = new AggregatingJmsConsumeService();
JmsConnection jmsConnection = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616"));
jmsConnection.setConnectionAttempts(2);
jmsConnection.setConnectionRetryInterval(new TimeInterval(3L, "SECONDS"));
service.setConnection(jmsConnection);
AggregatingQueueConsumer consumer = new AggregatingQueueConsumer();
consumer.setEndpoint("Sample.Q1");
consumer.setFilterExpression("%message{filterSelectorKey}");
consumer.setMessageAggregator(new ReplaceWithFirstMessage());
consumer.setMessageTranslator(new TextMessageTranslator());
service.setJmsConsumer(consumer);
return service;
}
use of com.adaptris.core.services.aggregator.ReplaceWithFirstMessage in project interlok by adaptris.
the class AggregatingJmsConsumeServiceTest method createService.
private AggregatingJmsConsumeService createService(EmbeddedActiveMq broker) {
AggregatingQueueConsumer consumer = new AggregatingQueueConsumer();
consumer.setMessageAggregator(new ReplaceWithFirstMessage());
return createService(broker, consumer);
}
Aggregations