*/
@Test
public void testActiveE2ECloseSimple() throws InterruptedException,
IOException, FlumeSpecException {
final String lnode = "e2eSimple";
final FlumeMaster master = new FlumeMaster(cfg);
MasterRPC rpc = new DirectMasterRPC(master);
final FlumeNode node = new FlumeNode(rpc, false, false);
// should have nothing.
assertEquals(0, node.getLogicalNodeManager().getNodes().size());
LivenessManager liveMan = node.getLivenessManager();
// update config node to something that will be interrupted.
LOG.info("setting to invalid e2e host");
master.getSpecMan().setConfig(lnode, "flow", "asciisynth(0)",
"agentE2ESink(\"localhost\", 12347)");
master.getSpecMan().addLogicalNode(NetUtils.localhost(), lnode);
liveMan.heartbeatChecks();
// TODO It we only wait for opening state, this test can hang
LogicalNode n = node.getLogicalNodeManager().get(lnode);
Driver d = n.getDriver();
assertTrue("Attempting to start driver timed out",
d.waitForAtLeastState(DriverState.ACTIVE, 10000));
// update config node to something that will be interrupted.
LOG.info("!!! decommissioning node on master");
master.getSpecMan().removeLogicalNode(lnode);
liveMan.heartbeatChecks();
assertTrue("Attempting to stop driver timed out",
d.waitForAtLeastState(DriverState.ERROR, 15000));
}