Search in sources :

Example 1 with OMProxyInfo

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);
    }
}
Also used : OMFailoverProxyProvider(org.apache.hadoop.ozone.om.ha.OMFailoverProxyProvider) OMProxyInfo(org.apache.hadoop.ozone.om.ha.OMProxyInfo) InetSocketAddress(java.net.InetSocketAddress) OzoneClient(org.apache.hadoop.ozone.client.OzoneClient) Test(org.junit.Test)

Example 2 with OMProxyInfo

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()));
}
Also used : OMFailoverProxyProvider(org.apache.hadoop.ozone.om.ha.OMFailoverProxyProvider) OMProxyInfo(org.apache.hadoop.ozone.om.ha.OMProxyInfo) Test(org.junit.Test)

Aggregations

OMFailoverProxyProvider (org.apache.hadoop.ozone.om.ha.OMFailoverProxyProvider)2 OMProxyInfo (org.apache.hadoop.ozone.om.ha.OMProxyInfo)2 Test (org.junit.Test)2 InetSocketAddress (java.net.InetSocketAddress)1 OzoneClient (org.apache.hadoop.ozone.client.OzoneClient)1