public void testDuplicateSpawn() throws IOException, InterruptedException {
// use the simple command manger, non-gossip ackmanager
FlumeMaster master = new FlumeMaster(new CommandManager(),
new ConfigManager(), new StatusManager(), new MasterAckManager(), cfg);
MasterRPC rpc = new DirectMasterRPC(master);
FlumeNode node = new FlumeNode(rpc, false, false);
// should have nothing.
assertEquals(0, node.getLogicalNodeManager().getNodes().size());
String local = NetUtils.localhost();
// these are spawn commands
master.getSpecMan().addLogicalNode(local, node.getPhysicalNodeName());
master.getSpecMan().addLogicalNode(local, "bar");
master.getSpecMan().addLogicalNode(local, "baz");
// there should not be duplicates in the mapping table.
master.getSpecMan().addLogicalNode(local, node.getPhysicalNodeName());
master.getSpecMan().addLogicalNode(local, "bar");
master.getSpecMan().addLogicalNode(local, "baz");
Multimap<String, String> mapping = master.getSpecMan().getLogicalNodeMap();
assertEquals(3, mapping.size());
LivenessManager liveMan = node.getLivenessManager();
liveMan.checkLogicalNodes();
assertEquals(3, node.getLogicalNodeManager().getNodes().size());
}