}
}
@Test
public void slave_success_replication() throws Exception {
Props props = new Props(new Properties());
props.set(ProcessConstants.SEARCH_PORT, String.valueOf(port));
props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
props.set(ProcessConstants.CLUSTER_MASTER, "true");
props.set(ProcessConstants.CLUSTER_NODE_NAME, "MASTER");
props.set(ProcessConstants.CLUSTER_NAME, CLUSTER_NAME);
props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());
searchServer = new SearchServer(props);
assertThat(searchServer).isNotNull();
searchServer.start();
assertThat(searchServer.isReady()).isTrue();
client = getSearchClient();
client.admin().indices().prepareCreate("test").get();
// start a slave
props = new Props(new Properties());
props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
props.set(ProcessConstants.CLUSTER_MASTER_HOST, "localhost:" + port);
props.set(ProcessConstants.CLUSTER_NAME, CLUSTER_NAME);
props.set(ProcessConstants.CLUSTER_NODE_NAME, "SLAVE");
props.set(ProcessConstants.SEARCH_PORT, String.valueOf(NetworkUtils.freePort()));
props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());
SearchServer slaveServer = new SearchServer(props);
assertThat(slaveServer).isNotNull();
slaveServer.start();
assertThat(slaveServer.isReady()).isTrue();