use of org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY in project ozone by apache.
the class TestOmUtils method testGetOmHAAddressesById.
@Test
public void testGetOmHAAddressesById() {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set(OZONE_OM_SERVICE_IDS_KEY, "ozone1");
conf.set("ozone.om.nodes.ozone1", "node1,node2,node3");
conf.set("ozone.om.address.ozone1.node1", "1.1.1.1");
conf.set("ozone.om.address.ozone1.node2", "1.1.1.2");
conf.set("ozone.om.address.ozone1.node3", "1.1.1.3");
Map<String, List<InetSocketAddress>> addresses = OmUtils.getOmHAAddressesById(conf);
assertFalse(addresses.isEmpty());
List<InetSocketAddress> rpcAddrs = addresses.get("ozone1");
assertFalse(rpcAddrs.isEmpty());
assertTrue(rpcAddrs.stream().anyMatch(a -> a.getAddress().getHostAddress().equals("1.1.1.1")));
assertTrue(rpcAddrs.stream().anyMatch(a -> a.getAddress().getHostAddress().equals("1.1.1.2")));
assertTrue(rpcAddrs.stream().anyMatch(a -> a.getAddress().getHostAddress().equals("1.1.1.3")));
}
Aggregations