diff --git a/hadoop-ozone/client/pom.xml b/hadoop-ozone/client/pom.xml index e3e4a0655be..fc130a4f8a5 100644 --- a/hadoop-ozone/client/pom.xml +++ b/hadoop-ozone/client/pom.xml @@ -27,6 +27,9 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> Apache Ozone Client Apache Ozone Client jar + + false + @@ -57,6 +60,10 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> junit test + + org.junit.jupiter + junit-jupiter-params + ch.qos.reload4j reload4j diff --git a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java index f7010eaef11..0f4c4769a79 100644 --- a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java +++ b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java @@ -22,22 +22,19 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.ozone.OzoneManagerVersion; import org.apache.hadoop.ozone.om.helpers.ServiceInfo; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; import java.util.LinkedList; import java.util.List; import static org.apache.hadoop.ozone.client.rpc.RpcClient.validateOmVersion; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; /** * Run RPC Client tests. */ -@RunWith(Parameterized.class) public class TestRpcClient { private enum ValidateOmVersionTestCases { NULL_EXPECTED_NO_OM( @@ -62,10 +59,10 @@ private enum ValidateOmVersionTestCases { true ), NULL_EXPECTED_ONE_CURRENT_ONE_FUTURE_OM( - null, - OzoneManagerVersion.CURRENT, - OzoneManagerVersion.FUTURE_VERSION, - true + null, + OzoneManagerVersion.CURRENT, + OzoneManagerVersion.FUTURE_VERSION, + true ), NULL_EXPECTED_TWO_FUTURE_OM( null, @@ -193,19 +190,9 @@ private enum ValidateOmVersionTestCases { } } - @Parameterized.Parameters(name = "{0}") - public static Iterable parameters() { - return Arrays.asList(ValidateOmVersionTestCases.values()); - } - - private ValidateOmVersionTestCases testCase; - - public TestRpcClient(ValidateOmVersionTestCases testCase) { - this.testCase = testCase; - } - - @Test - public void testValidateOmVersion() { + @ParameterizedTest + @EnumSource(ValidateOmVersionTestCases.class) + public void testValidateOmVersion(ValidateOmVersionTestCases testCase) { List serviceInfoList = new LinkedList<>(); ServiceInfo.Builder b1 = new ServiceInfo.Builder(); ServiceInfo.Builder b2 = new ServiceInfo.Builder(); @@ -219,8 +206,9 @@ public void testValidateOmVersion() { b2.setOmVersion(testCase.om2Version); serviceInfoList.add(b2.build()); } - Assert.assertEquals("Running test " + testCase, testCase.validation, - validateOmVersion(testCase.expectedVersion, serviceInfoList)); + Assertions.assertEquals(testCase.validation, + validateOmVersion(testCase.expectedVersion, serviceInfoList), + "Running test " + testCase); } @Test