use of org.apache.hadoop.ozone.om.ha.OMProxyInfo in project ozone by apache.
the class TestOzoneManagerHAMetadataOnly method testOMProxyProviderInitialization.
/**
* Test that OMFailoverProxyProvider creates an OM proxy for each OM in the
* cluster.
*/
@Test
public void testOMProxyProviderInitialization() throws Exception {
OzoneClient rpcClient = getCluster().getRpcClient();
OMFailoverProxyProvider omFailoverProxyProvider = OmFailoverProxyUtil.getFailoverProxyProvider(rpcClient.getObjectStore().getClientProxy());
List<OMProxyInfo> omProxies = omFailoverProxyProvider.getOMProxyInfos();
Assert.assertEquals(getNumOfOMs(), omProxies.size());
for (int i = 0; i < getNumOfOMs(); i++) {
InetSocketAddress omRpcServerAddr = getCluster().getOzoneManager(i).getOmRpcServerAddr();
boolean omClientProxyExists = false;
for (OMProxyInfo omProxyInfo : omProxies) {
if (omProxyInfo.getAddress().equals(omRpcServerAddr)) {
omClientProxyExists = true;
break;
}
}
Assert.assertTrue("There is no OM Client Proxy corresponding to OM " + "node" + getCluster().getOzoneManager(i).getOMNodeId(), omClientProxyExists);
}
}
use of org.apache.hadoop.ozone.om.ha.OMProxyInfo in project ozone by apache.
the class TestOzoneRpcClientAbstract method testOMClientProxyProvider.
/**
* Test OM Proxy Provider.
*/
@Test
public void testOMClientProxyProvider() {
OMFailoverProxyProvider omFailoverProxyProvider = OmFailoverProxyUtil.getFailoverProxyProvider(store.getClientProxy());
List<OMProxyInfo> omProxies = omFailoverProxyProvider.getOMProxyInfos();
// For a non-HA OM service, there should be only one OM proxy.
Assert.assertEquals(1, omProxies.size());
// The address in OMProxyInfo object, which client will connect to,
// should match the OM's RPC address.
Assert.assertTrue(omProxies.get(0).getAddress().equals(ozoneManager.getOmRpcServerAddr()));
}
Aggregations