}
@Test
public void testDomainSetup() throws Exception {
CLIWrapper cli = new CLIWrapper(false, DomainTestSupport.masterAddress);
// wait for cli welcome message
String line = cli.readLine(WAIT_TIMEOUT);
while(! line.contains("You are disconnected")) {
line = cli.readLine(WAIT_TIMEOUT);
}
cli.sendConnect(DomainTestSupport.masterAddress);
line = cli.readLine(WAIT_TIMEOUT);
assertTrue("Check we are disconnected:" + line, line.indexOf("disconnected") >= 0);
cli.sendLine("version", false);
line = cli.readLine(WAIT_TIMEOUT);
assertTrue("Connect failed:" + line, line.indexOf("[domain@") >= 0);
// check hosts
cli.sendLine(":read-children-names(child-type=host)");
CLIOpResult res = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
assertTrue(res.getResult() instanceof List);
List hosts = (List) res.getResult();
assertTrue(hosts.contains("master"));
assertTrue(hosts.contains("slave"));
// check servers
assertTrue(checkHostServers(cli, "master", new String[] {"main-one", "main-two", "other-one", "reload-one"}));
assertTrue(checkHostServers(cli, "slave", new String[] {"main-three", "main-four", "other-two", "reload-two"}));
cli.quit();
}