@Test
public void testProcess() throws InterruptedException, LifecycleException,
EventDeliveryException, IOException {
Channel channel = new MemoryChannel();
Context context = new Context();
context.put("command", "cat /etc/passwd");
context.put("keep-alive", "1");
context.put("capacity", "1000");
context.put("transactionCapacity", "1000");
Configurables.configure(source, context);
Configurables.configure(channel, context);
ChannelSelector rcs = new ReplicatingChannelSelector();
rcs.setChannels(Lists.newArrayList(channel));
source.setChannelProcessor(new ChannelProcessor(rcs));
source.start();
Transaction transaction = channel.getTransaction();
transaction.begin();
Event event;
FileOutputStream outputStream = new FileOutputStream(
"/tmp/flume-execsource." + Thread.currentThread().getId());
while ((event = channel.take()) != null) {
outputStream.write(event.getBody());
outputStream.write('\n');
}
outputStream.close();