use of com.linkedin.databus.client.pub.ServerInfo.ServerInfoSetBuilder in project databus by linkedin.
the class TestServerInfo method testServerInfoSetBuilder.
@Test
public void testServerInfoSetBuilder() throws Exception {
ServerInfoBuilder sib = new ServerInfoBuilder();
String address1 = ServerInfoBuilder.generateAddress("SeRvEr1", "localhost", 98, "com.linkedin.events.source1", "com.linkedin.events.source3");
sib.setAddress(address1);
ServerInfo si1 = sib.build();
String address2 = ServerInfoBuilder.generateAddress("SeRvEr2", "localhost", 99, "com.linkedin.events.source1", "com.linkedin.events.source3");
sib.setAddress(address2);
ServerInfo si2 = sib.build();
String address3 = ServerInfoBuilder.generateAddress(null, "localhost", 100, "com.linkedin.events.source1", "com.linkedin.events.source2", "com.linkedin.events.source3");
sib.setAddress(address3);
ServerInfo si3 = sib.build();
ServerInfoSetBuilder builder = new ServerInfoSetBuilder();
builder.setServers(address1 + ServerInfoSetBuilder.SERVER_INFO_SEPARATOR + address2 + ServerInfoSetBuilder.SERVER_INFO_SEPARATOR + address3);
List<ServerInfo> res = builder.build();
assertEquals(3, res.size());
assertEquals(true, res.contains(si1));
assertEquals(true, res.contains(si2));
assertEquals(true, res.contains(si3));
}
Aggregations