use of org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolPB in project ozone by apache.
the class TestOMFailovers method testAccessContorlExceptionFailovers.
@Test
public void testAccessContorlExceptionFailovers() throws Exception {
testException = new AccessControlException();
GenericTestUtils.setLogLevel(OMFailoverProxyProvider.LOG, Level.DEBUG);
GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.captureLogs(OMFailoverProxyProvider.LOG);
MockFailoverProxyProvider failoverProxyProvider = new MockFailoverProxyProvider(conf);
OzoneManagerProtocolPB proxy = (OzoneManagerProtocolPB) RetryProxy.create(OzoneManagerProtocolPB.class, failoverProxyProvider, failoverProxyProvider.getRetryPolicy(OzoneConfigKeys.OZONE_CLIENT_FAILOVER_MAX_ATTEMPTS_DEFAULT));
try {
proxy.submitRequest(null, null);
Assert.fail("Request should fail with AccessControlException");
} catch (Exception ex) {
Assert.assertTrue(ex instanceof ServiceException);
// Request should try all OMs one be one and fail when the last OM also
// throws AccessControlException.
GenericTestUtils.assertExceptionContains("ServiceException of " + "type class org.apache.hadoop.security.AccessControlException for " + "om3", ex);
Assert.assertTrue(ex.getCause() instanceof AccessControlException);
Assert.assertTrue(logCapturer.getOutput().contains(getRetryProxyDebugMsg("om1")));
Assert.assertTrue(logCapturer.getOutput().contains(getRetryProxyDebugMsg("om2")));
Assert.assertTrue(logCapturer.getOutput().contains(getRetryProxyDebugMsg("om3")));
}
}
Aggregations