Search in sources :

Example 1 with OmUtils

use of org.apache.hadoop.ozone.OmUtils in project ozone by apache.

the class TestOzoneManagerRatisServer method testIsReadOnlyCapturesAllCmdTypeEnums.

/**
 * Test that all of {@link OzoneManagerProtocolProtos.Type} enum values are
 * categorized in {@link OmUtils#isReadOnly(OMRequest)}.
 */
@Test
public void testIsReadOnlyCapturesAllCmdTypeEnums() throws Exception {
    GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.captureLogs(LoggerFactory.getLogger(OmUtils.class));
    OzoneManagerProtocolProtos.Type[] cmdTypes = OzoneManagerProtocolProtos.Type.values();
    for (OzoneManagerProtocolProtos.Type cmdtype : cmdTypes) {
        OMRequest request = OMRequest.newBuilder().setCmdType(cmdtype).setClientId(clientId).build();
        OmUtils.isReadOnly(request);
        assertFalse(cmdtype + " is not categorized in " + "OmUtils#isReadyOnly", logCapturer.getOutput().contains("CmdType " + cmdtype + " is not " + "categorized as readOnly or not."));
        logCapturer.clearOutput();
    }
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OmUtils(org.apache.hadoop.ozone.OmUtils) OzoneManagerProtocolProtos(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos) GenericTestUtils(org.apache.ozone.test.GenericTestUtils) Test(org.junit.Test)

Aggregations

OmUtils (org.apache.hadoop.ozone.OmUtils)1 OzoneManagerProtocolProtos (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1 GenericTestUtils (org.apache.ozone.test.GenericTestUtils)1 Test (org.junit.Test)1