@Test
public void testRestart() throws InterruptedException, LifecycleException,
EventDeliveryException, IOException {
Channel channel = new MemoryChannel();
Context context = new Context();
context.put(ExecSourceConfigurationConstants.CONFIG_RESTART_THROTTLE, "10");
context.put(ExecSourceConfigurationConstants.CONFIG_RESTART, "true");
context.put("command", "echo flume");
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();
long start = System.currentTimeMillis();
for(int i = 0; i < 5; i++) {
Event event = channel.take();
assertNotNull(event);
assertNotNull(event.getBody());
assertEquals("flume", new String(event.getBody(), Charsets.UTF_8));
}