use of org.apache.kafka.trogdor.basic.BasicNode in project kafka by apache.
the class AgentTest method createBasicPlatform.
private static BasicPlatform createBasicPlatform(Scheduler scheduler) {
TreeMap<String, Node> nodes = new TreeMap<>();
HashMap<String, String> config = new HashMap<>();
config.put(Platform.Config.TROGDOR_AGENT_PORT, Integer.toString(Agent.DEFAULT_PORT));
nodes.put("node01", new BasicNode("node01", "localhost", config, Collections.emptySet()));
BasicTopology topology = new BasicTopology(nodes);
return new BasicPlatform("node01", topology, scheduler, new BasicPlatform.ShellCommandRunner());
}
use of org.apache.kafka.trogdor.basic.BasicNode in project apache-kafka-on-k8s by banzaicloud.
the class AgentTest method createBasicPlatform.
private static BasicPlatform createBasicPlatform(Scheduler scheduler) {
TreeMap<String, Node> nodes = new TreeMap<>();
HashMap<String, String> config = new HashMap<>();
nodes.put("node01", new BasicNode("node01", "localhost", config, Collections.<String>emptySet()));
BasicTopology topology = new BasicTopology(nodes);
return new BasicPlatform("node01", topology, scheduler, new BasicPlatform.ShellCommandRunner());
}
use of org.apache.kafka.trogdor.basic.BasicNode in project apache-kafka-on-k8s by banzaicloud.
the class TopologyTest method testAgentNodeNames.
@Test
public void testAgentNodeNames() throws Exception {
TreeMap<String, Node> nodes = new TreeMap<>();
final int numNodes = 5;
for (int i = 0; i < numNodes; i++) {
HashMap<String, String> conf = new HashMap<>();
if (i == 0) {
conf.put(Platform.Config.TROGDOR_COORDINATOR_PORT, String.valueOf(Coordinator.DEFAULT_PORT));
} else {
conf.put(Platform.Config.TROGDOR_AGENT_PORT, String.valueOf(Agent.DEFAULT_PORT));
}
BasicNode node = new BasicNode(String.format("node%02d", i), String.format("node%d.example.com", i), conf, new HashSet<String>());
nodes.put(node.name(), node);
}
Topology topology = new BasicTopology(nodes);
Set<String> names = Topology.Util.agentNodeNames(topology);
assertEquals(4, names.size());
for (int i = 1; i < numNodes - 1; i++) {
assertTrue(names.contains(String.format("node%02d", i)));
}
}
use of org.apache.kafka.trogdor.basic.BasicNode in project kafka by apache.
the class TopologyTest method testAgentNodeNames.
@Test
public void testAgentNodeNames() {
TreeMap<String, Node> nodes = new TreeMap<>();
final int numNodes = 5;
for (int i = 0; i < numNodes; i++) {
HashMap<String, String> conf = new HashMap<>();
if (i == 0) {
conf.put(Platform.Config.TROGDOR_COORDINATOR_PORT, String.valueOf(Coordinator.DEFAULT_PORT));
} else {
conf.put(Platform.Config.TROGDOR_AGENT_PORT, String.valueOf(Agent.DEFAULT_PORT));
}
BasicNode node = new BasicNode(String.format("node%02d", i), String.format("node%d.example.com", i), conf, new HashSet<>());
nodes.put(node.name(), node);
}
Topology topology = new BasicTopology(nodes);
Set<String> names = Topology.Util.agentNodeNames(topology);
assertEquals(4, names.size());
for (int i = 1; i < numNodes - 1; i++) {
assertTrue(names.contains(String.format("node%02d", i)));
}
}
Aggregations