@Test
public void testPurge() throws InterruptedException, TTransportException,
IOException {
assertEquals(0, flumeMaster.getSpecMan().getAllConfigs().size());
FlumeShell sh = new FlumeShell();
sh
.executeLine("connect localhost:"
+ FlumeConfiguration.DEFAULT_ADMIN_PORT);
flumeMaster.getStatMan().updateHeartbeatStatus("foo", "foo", "foo",
NodeState.HELLO, 1);
assertNotNull(flumeMaster.getStatMan().getStatus("foo"));
// no exception when called with node that doesn't exist.
sh.executeLine("exec purge wackadoodle");
// successful case
sh.executeLine("exec purge foo");
Clock.sleep(250);
NodeStatus stat = flumeMaster.getStatMan().getStatus("foo");
assertNull(stat);
flumeMaster.getStatMan().updateHeartbeatStatus("foo", "foo", "foo",
NodeState.HELLO, 1);
flumeMaster.getStatMan().updateHeartbeatStatus("bar", "bar", "bar",
NodeState.HELLO, 1);
flumeMaster.getStatMan().updateHeartbeatStatus("baz", "baz", "baz",
NodeState.HELLO, 1);
assertNotNull(flumeMaster.getStatMan().getStatus("foo"));
assertNotNull(flumeMaster.getStatMan().getStatus("bar"));
assertNotNull(flumeMaster.getStatMan().getStatus("baz"));
sh.executeLine("exec purgeAll");
Clock.sleep(250);
assertNull(flumeMaster.getStatMan().getStatus("foo"));
assertNull(flumeMaster.getStatMan().getStatus("foo"));
assertNull(flumeMaster.getStatMan().getStatus("foo"));