diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml
index 61d7c9baaa8..121b3ab98e6 100755
--- a/hadoop-project/pom.xml
+++ b/hadoop-project/pom.xml
@@ -90,6 +90,7 @@
3.0.0
3.1.0-RC1
+ 5.0.0-RC2
11.0.2
4.0
2.9.4
@@ -854,6 +855,16 @@
4.11
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit5.version}
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ ${junit5.version}
+
+
commons-lang
commons-lang
2.6
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
index f17cf8c500b..08c7e6c30db 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
@@ -129,8 +129,13 @@
protobuf-java
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
test
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java
index 82170b31342..aacc2642900 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java
@@ -22,12 +22,15 @@
import com.google.common.collect.Sets;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.junit.Assert;
import java.lang.reflect.*;
import java.nio.ByteBuffer;
import java.util.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
+
/**
* Generic helper class to validate protocol records.
*/
@@ -191,7 +194,7 @@ public String toString() {
p.getMethod = m;
ret.put(propertyName, p);
} else {
- Assert.fail("Multiple get method with same name: " + recordClass
+ fail("Multiple get method with same name: " + recordClass
+ p.propertyName);
}
}
@@ -247,18 +250,18 @@ public String toString() {
gsp.setMethod.invoke(origRecord, gsp.testValue);
}
Object ret = getProto.invoke(origRecord);
- Assert.assertNotNull(recordClass.getName() + "#getProto returns null", ret);
+ assertNotNull(ret, recordClass.getName() + "#getProto returns null");
if (!(protoClass.isAssignableFrom(ret.getClass()))) {
- Assert.fail("Illegal getProto method return type: " + ret.getClass());
+ fail("Illegal getProto method return type: " + ret.getClass());
}
R deserRecord = pbConstructor.newInstance(ret);
- Assert.assertEquals("whole " + recordClass + " records should be equal",
- origRecord, deserRecord);
+ assertEquals(origRecord, deserRecord,
+ "whole " + recordClass + " records should be equal");
for (GetSetPair gsp : getSetPairs.values()) {
Object origValue = gsp.getMethod.invoke(origRecord);
Object deserValue = gsp.getMethod.invoke(deserRecord);
- Assert.assertEquals("property " + recordClass.getName() + "#"
- + gsp.propertyName + " should be equal", origValue, deserValue);
+ assertEquals(origValue, deserValue, "property " + recordClass.getName()
+ + "#" + gsp.propertyName + " should be equal");
}
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java
index f54ed78ac1e..97a91348e90 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java
@@ -19,41 +19,43 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
-
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class TestApplicationAttemptId {
+class TestApplicationAttemptId {
@Test
- public void testApplicationAttemptId() {
+ void testApplicationAttemptId() {
ApplicationAttemptId a1 = createAppAttemptId(10l, 1, 1);
ApplicationAttemptId a2 = createAppAttemptId(10l, 1, 2);
ApplicationAttemptId a3 = createAppAttemptId(10l, 2, 1);
ApplicationAttemptId a4 = createAppAttemptId(8l, 1, 4);
ApplicationAttemptId a5 = createAppAttemptId(10l, 1, 1);
- Assert.assertTrue(a1.equals(a5));
- Assert.assertFalse(a1.equals(a2));
- Assert.assertFalse(a1.equals(a3));
- Assert.assertFalse(a1.equals(a4));
+ assertTrue(a1.equals(a5));
+ assertFalse(a1.equals(a2));
+ assertFalse(a1.equals(a3));
+ assertFalse(a1.equals(a4));
- Assert.assertTrue(a1.compareTo(a5) == 0);
- Assert.assertTrue(a1.compareTo(a2) < 0);
- Assert.assertTrue(a1.compareTo(a3) < 0);
- Assert.assertTrue(a1.compareTo(a4) > 0);
+ assertTrue(a1.compareTo(a5) == 0);
+ assertTrue(a1.compareTo(a2) < 0);
+ assertTrue(a1.compareTo(a3) < 0);
+ assertTrue(a1.compareTo(a4) > 0);
- Assert.assertTrue(a1.hashCode() == a5.hashCode());
- Assert.assertFalse(a1.hashCode() == a2.hashCode());
- Assert.assertFalse(a1.hashCode() == a3.hashCode());
- Assert.assertFalse(a1.hashCode() == a4.hashCode());
+ assertTrue(a1.hashCode() == a5.hashCode());
+ assertFalse(a1.hashCode() == a2.hashCode());
+ assertFalse(a1.hashCode() == a3.hashCode());
+ assertFalse(a1.hashCode() == a4.hashCode());
long ts = System.currentTimeMillis();
ApplicationAttemptId a6 = createAppAttemptId(ts, 543627, 33492611);
- Assert.assertEquals("appattempt_10_0001_000001", a1.toString());
- Assert.assertEquals("appattempt_" + ts + "_543627_33492611", a6.toString());
+ assertEquals("appattempt_10_0001_000001", a1.toString());
+ assertEquals("appattempt_" + ts + "_543627_33492611", a6.toString());
}
private ApplicationAttemptId createAppAttemptId(
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java
index ea25a64c95d..3cdf31c0aac 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java
@@ -18,36 +18,38 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
-
import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class TestApplicationId {
+class TestApplicationId {
@Test
- public void testApplicationId() {
+ void testApplicationId() {
ApplicationId a1 = ApplicationId.newInstance(10l, 1);
ApplicationId a2 = ApplicationId.newInstance(10l, 2);
ApplicationId a3 = ApplicationId.newInstance(10l, 1);
ApplicationId a4 = ApplicationId.newInstance(8l, 3);
- Assert.assertFalse(a1.equals(a2));
- Assert.assertFalse(a1.equals(a4));
- Assert.assertTrue(a1.equals(a3));
+ assertFalse(a1.equals(a2));
+ assertFalse(a1.equals(a4));
+ assertTrue(a1.equals(a3));
- Assert.assertTrue(a1.compareTo(a2) < 0);
- Assert.assertTrue(a1.compareTo(a3) == 0);
- Assert.assertTrue(a1.compareTo(a4) > 0);
+ assertTrue(a1.compareTo(a2) < 0);
+ assertTrue(a1.compareTo(a3) == 0);
+ assertTrue(a1.compareTo(a4) > 0);
- Assert.assertTrue(a1.hashCode() == a3.hashCode());
- Assert.assertFalse(a1.hashCode() == a2.hashCode());
- Assert.assertFalse(a2.hashCode() == a4.hashCode());
+ assertTrue(a1.hashCode() == a3.hashCode());
+ assertFalse(a1.hashCode() == a2.hashCode());
+ assertFalse(a2.hashCode() == a4.hashCode());
long ts = System.currentTimeMillis();
ApplicationId a5 = ApplicationId.newInstance(ts, 45436343);
- Assert.assertEquals("application_10_0001", a1.toString());
- Assert.assertEquals("application_" + ts + "_45436343", a5.toString());
+ assertEquals("application_10_0001", a1.toString());
+ assertEquals("application_" + ts + "_45436343", a5.toString());
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java
index 46fc4d58d92..db1f23ff533 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java
@@ -25,13 +25,16 @@
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestApplicatonReport {
+import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+
+class TestApplicatonReport {
@Test
- public void testApplicationReport() {
+ void testApplicationReport() {
long timestamp = System.currentTimeMillis();
ApplicationReport appReport1 =
createApplicationReport(1, 1, timestamp);
@@ -39,15 +42,15 @@ public void testApplicationReport() {
createApplicationReport(1, 1, timestamp);
ApplicationReport appReport3 =
createApplicationReport(1, 1, timestamp);
- Assert.assertEquals(appReport1, appReport2);
- Assert.assertEquals(appReport2, appReport3);
+ assertEquals(appReport1, appReport2);
+ assertEquals(appReport2, appReport3);
appReport1.setApplicationId(null);
- Assert.assertNull(appReport1.getApplicationId());
- Assert.assertNotSame(appReport1, appReport2);
+ assertNull(appReport1.getApplicationId());
+ assertNotSame(appReport1, appReport2);
appReport2.setCurrentApplicationAttemptId(null);
- Assert.assertNull(appReport2.getCurrentApplicationAttemptId());
- Assert.assertNotSame(appReport2, appReport3);
- Assert.assertNull(appReport1.getAMRMToken());
+ assertNull(appReport2.getCurrentApplicationAttemptId());
+ assertNotSame(appReport2, appReport3);
+ assertNull(appReport1.getAMRMToken());
}
protected static ApplicationReport createApplicationReport(
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
index 1643301072b..c16e8276e09 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
@@ -19,57 +19,59 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
-
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestContainerId {
@Test
- public void testContainerId() {
+ void testContainerId() {
ContainerId c1 = newContainerId(1, 1, 10l, 1);
ContainerId c2 = newContainerId(1, 1, 10l, 2);
ContainerId c3 = newContainerId(1, 1, 10l, 1);
ContainerId c4 = newContainerId(1, 3, 10l, 1);
ContainerId c5 = newContainerId(1, 3, 8l, 1);
- Assert.assertTrue(c1.equals(c3));
- Assert.assertFalse(c1.equals(c2));
- Assert.assertFalse(c1.equals(c4));
- Assert.assertFalse(c1.equals(c5));
+ assertTrue(c1.equals(c3));
+ assertFalse(c1.equals(c2));
+ assertFalse(c1.equals(c4));
+ assertFalse(c1.equals(c5));
- Assert.assertTrue(c1.compareTo(c3) == 0);
- Assert.assertTrue(c1.compareTo(c2) < 0);
- Assert.assertTrue(c1.compareTo(c4) < 0);
- Assert.assertTrue(c1.compareTo(c5) > 0);
+ assertTrue(c1.compareTo(c3) == 0);
+ assertTrue(c1.compareTo(c2) < 0);
+ assertTrue(c1.compareTo(c4) < 0);
+ assertTrue(c1.compareTo(c5) > 0);
- Assert.assertTrue(c1.hashCode() == c3.hashCode());
- Assert.assertFalse(c1.hashCode() == c2.hashCode());
- Assert.assertFalse(c1.hashCode() == c4.hashCode());
- Assert.assertFalse(c1.hashCode() == c5.hashCode());
+ assertTrue(c1.hashCode() == c3.hashCode());
+ assertFalse(c1.hashCode() == c2.hashCode());
+ assertFalse(c1.hashCode() == c4.hashCode());
+ assertFalse(c1.hashCode() == c5.hashCode());
long ts = System.currentTimeMillis();
ContainerId c6 = newContainerId(36473, 4365472, ts, 25645811);
- Assert.assertEquals("container_10_0001_01_000001", c1.toString());
- Assert.assertEquals(25645811, 0xffffffffffL & c6.getContainerId());
- Assert.assertEquals(0, c6.getContainerId() >> 40);
- Assert.assertEquals("container_" + ts + "_36473_4365472_25645811",
+ assertEquals("container_10_0001_01_000001", c1.toString());
+ assertEquals(25645811, 0xffffffffffL & c6.getContainerId());
+ assertEquals(0, c6.getContainerId() >> 40);
+ assertEquals("container_" + ts + "_36473_4365472_25645811",
c6.toString());
ContainerId c7 = newContainerId(36473, 4365472, ts, 4298334883325L);
- Assert.assertEquals(999799999997L, 0xffffffffffL & c7.getContainerId());
- Assert.assertEquals(3, c7.getContainerId() >> 40);
- Assert.assertEquals(
+ assertEquals(999799999997L, 0xffffffffffL & c7.getContainerId());
+ assertEquals(3, c7.getContainerId() >> 40);
+ assertEquals(
"container_e03_" + ts + "_36473_4365472_999799999997",
c7.toString());
ContainerId c8 = newContainerId(36473, 4365472, ts, 844424930131965L);
- Assert.assertEquals(1099511627773L, 0xffffffffffL & c8.getContainerId());
- Assert.assertEquals(767, c8.getContainerId() >> 40);
- Assert.assertEquals(
+ assertEquals(1099511627773L, 0xffffffffffL & c8.getContainerId());
+ assertEquals(767, c8.getContainerId() >> 40);
+ assertEquals(
"container_e767_" + ts + "_36473_4365472_1099511627773",
c8.toString());
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java
index 3d95a0fb573..7544ad53c9c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java
@@ -26,13 +26,14 @@
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetApplicationsRequestPBImpl;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestGetApplicationsRequest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class TestGetApplicationsRequest {
@Test
- public void testGetApplicationsRequest(){
+ void testGetApplicationsRequest(){
GetApplicationsRequest request = GetApplicationsRequest.newInstance();
EnumSet appStates =
@@ -73,40 +74,34 @@ public void testGetApplicationsRequest(){
((GetApplicationsRequestPBImpl)request).getProto());
// verify the whole record equals with original record
- Assert.assertEquals(requestFromProto, request);
+ assertEquals(requestFromProto, request);
// verify all properties are the same as original request
- Assert.assertEquals(
- "ApplicationStates from proto is not the same with original request",
- requestFromProto.getApplicationStates(), appStates);
+ assertEquals(requestFromProto.getApplicationStates(), appStates,
+ "ApplicationStates from proto is not the same with original request");
- Assert.assertEquals(
- "ApplicationTags from proto is not the same with original request",
- requestFromProto.getApplicationTags(), tags);
+ assertEquals(requestFromProto.getApplicationTags(), tags,
+ "ApplicationTags from proto is not the same with original request");
- Assert.assertEquals(
- "ApplicationTypes from proto is not the same with original request",
- requestFromProto.getApplicationTypes(), types);
+ assertEquals(requestFromProto.getApplicationTypes(), types,
+ "ApplicationTypes from proto is not the same with original request");
- Assert.assertEquals(
- "StartRange from proto is not the same with original request",
- requestFromProto.getStartRange(), new LongRange(startBegin, startEnd));
+ assertEquals(requestFromProto.getStartRange(),
+ new LongRange(startBegin, startEnd),
+ "StartRange from proto is not the same with original request");
- Assert.assertEquals(
- "FinishRange from proto is not the same with original request",
- requestFromProto.getFinishRange(), new LongRange(finishBegin, finishEnd));
+ assertEquals(requestFromProto.getFinishRange(),
+ new LongRange(finishBegin, finishEnd),
+ "FinishRange from proto is not the same with original request");
- Assert.assertEquals(
- "Limit from proto is not the same with original request",
- requestFromProto.getLimit(), limit);
+ assertEquals(requestFromProto.getLimit(), limit,
+ "Limit from proto is not the same with original request");
- Assert.assertEquals(
- "Queues from proto is not the same with original request",
- requestFromProto.getQueues(), queues);
+ assertEquals(requestFromProto.getQueues(), queues,
+ "Queues from proto is not the same with original request");
- Assert.assertEquals(
- "Users from proto is not the same with original request",
- requestFromProto.getUsers(), users);
+ assertEquals(requestFromProto.getUsers(), users,
+ "Users from proto is not the same with original request");
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java
index 32d31a30b02..30457b8f80c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java
@@ -18,32 +18,34 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
-
import org.apache.hadoop.yarn.api.records.NodeId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class TestNodeId {
+class TestNodeId {
@Test
- public void testNodeId() {
+ void testNodeId() {
NodeId nodeId1 = NodeId.newInstance("10.18.52.124", 8041);
NodeId nodeId2 = NodeId.newInstance("10.18.52.125", 8038);
NodeId nodeId3 = NodeId.newInstance("10.18.52.124", 8041);
NodeId nodeId4 = NodeId.newInstance("10.18.52.124", 8039);
- Assert.assertTrue(nodeId1.equals(nodeId3));
- Assert.assertFalse(nodeId1.equals(nodeId2));
- Assert.assertFalse(nodeId3.equals(nodeId4));
+ assertTrue(nodeId1.equals(nodeId3));
+ assertFalse(nodeId1.equals(nodeId2));
+ assertFalse(nodeId3.equals(nodeId4));
- Assert.assertTrue(nodeId1.compareTo(nodeId3) == 0);
- Assert.assertTrue(nodeId1.compareTo(nodeId2) < 0);
- Assert.assertTrue(nodeId3.compareTo(nodeId4) > 0);
+ assertTrue(nodeId1.compareTo(nodeId3) == 0);
+ assertTrue(nodeId1.compareTo(nodeId2) < 0);
+ assertTrue(nodeId3.compareTo(nodeId4) > 0);
- Assert.assertTrue(nodeId1.hashCode() == nodeId3.hashCode());
- Assert.assertFalse(nodeId1.hashCode() == nodeId2.hashCode());
- Assert.assertFalse(nodeId3.hashCode() == nodeId4.hashCode());
+ assertTrue(nodeId1.hashCode() == nodeId3.hashCode());
+ assertFalse(nodeId1.hashCode() == nodeId2.hashCode());
+ assertFalse(nodeId3.hashCode() == nodeId4.hashCode());
- Assert.assertEquals("10.18.52.124:8041", nodeId1.toString());
+ assertEquals("10.18.52.124:8041", nodeId1.toString());
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java
index bb688c93a9f..6fc1eecd5e7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java
@@ -325,20 +325,18 @@
import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.UpdateNodeResourceRequestPBImpl;
import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.UpdateNodeResourceResponsePBImpl;
import org.apache.hadoop.yarn.util.resource.Resources;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
import com.google.common.collect.ImmutableSet;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/**
* Test class for YARN API protocol records.
*/
-public class TestPBImplRecords extends BasePBImplRecordsTest {
+class TestPBImplRecords extends BasePBImplRecordsTest {
- @BeforeClass
- public static void setup() throws Exception {
+ @BeforeAll
+ static void setup() throws Exception {
typeValueCache.put(LongRange.class, new LongRange(1000, 2000));
typeValueCache.put(URL.class, URL.newInstance(
"http", "localhost", 8080, "file0"));
@@ -409,293 +407,293 @@ public static void setup() throws Exception {
}
@Test
- public void testAllocateRequestPBImpl() throws Exception {
+ void testAllocateRequestPBImpl() throws Exception {
validatePBImplRecord(AllocateRequestPBImpl.class, AllocateRequestProto.class);
}
@Test
- public void testAllocateResponsePBImpl() throws Exception {
+ void testAllocateResponsePBImpl() throws Exception {
validatePBImplRecord(AllocateResponsePBImpl.class, AllocateResponseProto.class);
}
@Test
- public void testCancelDelegationTokenRequestPBImpl() throws Exception {
+ void testCancelDelegationTokenRequestPBImpl() throws Exception {
validatePBImplRecord(CancelDelegationTokenRequestPBImpl.class,
CancelDelegationTokenRequestProto.class);
}
@Test
- public void testCancelDelegationTokenResponsePBImpl() throws Exception {
+ void testCancelDelegationTokenResponsePBImpl() throws Exception {
validatePBImplRecord(CancelDelegationTokenResponsePBImpl.class,
CancelDelegationTokenResponseProto.class);
}
@Test
- public void testFinishApplicationMasterRequestPBImpl() throws Exception {
+ void testFinishApplicationMasterRequestPBImpl() throws Exception {
validatePBImplRecord(FinishApplicationMasterRequestPBImpl.class,
FinishApplicationMasterRequestProto.class);
}
@Test
- public void testFinishApplicationMasterResponsePBImpl() throws Exception {
+ void testFinishApplicationMasterResponsePBImpl() throws Exception {
validatePBImplRecord(FinishApplicationMasterResponsePBImpl.class,
FinishApplicationMasterResponseProto.class);
}
@Test
- public void testGetApplicationAttemptReportRequestPBImpl() throws Exception {
+ void testGetApplicationAttemptReportRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptReportRequestPBImpl.class,
GetApplicationAttemptReportRequestProto.class);
}
@Test
- public void testGetApplicationAttemptReportResponsePBImpl() throws Exception {
+ void testGetApplicationAttemptReportResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptReportResponsePBImpl.class,
GetApplicationAttemptReportResponseProto.class);
}
@Test
- public void testGetApplicationAttemptsRequestPBImpl() throws Exception {
+ void testGetApplicationAttemptsRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptsRequestPBImpl.class,
GetApplicationAttemptsRequestProto.class);
}
@Test
- public void testGetApplicationAttemptsResponsePBImpl() throws Exception {
+ void testGetApplicationAttemptsResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptsResponsePBImpl.class,
GetApplicationAttemptsResponseProto.class);
}
@Test
- public void testGetApplicationReportRequestPBImpl() throws Exception {
+ void testGetApplicationReportRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationReportRequestPBImpl.class,
GetApplicationReportRequestProto.class);
}
@Test
- public void testGetApplicationReportResponsePBImpl() throws Exception {
+ void testGetApplicationReportResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationReportResponsePBImpl.class,
GetApplicationReportResponseProto.class);
}
@Test
- public void testGetApplicationsRequestPBImpl() throws Exception {
+ void testGetApplicationsRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationsRequestPBImpl.class,
GetApplicationsRequestProto.class);
}
@Test
- public void testGetApplicationsResponsePBImpl() throws Exception {
+ void testGetApplicationsResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationsResponsePBImpl.class,
GetApplicationsResponseProto.class);
}
@Test
- public void testGetClusterMetricsRequestPBImpl() throws Exception {
+ void testGetClusterMetricsRequestPBImpl() throws Exception {
validatePBImplRecord(GetClusterMetricsRequestPBImpl.class,
GetClusterMetricsRequestProto.class);
}
@Test
- public void testGetClusterMetricsResponsePBImpl() throws Exception {
+ void testGetClusterMetricsResponsePBImpl() throws Exception {
validatePBImplRecord(GetClusterMetricsResponsePBImpl.class,
GetClusterMetricsResponseProto.class);
}
@Test
- public void testGetClusterNodesRequestPBImpl() throws Exception {
+ void testGetClusterNodesRequestPBImpl() throws Exception {
validatePBImplRecord(GetClusterNodesRequestPBImpl.class,
GetClusterNodesRequestProto.class);
}
@Test
- public void testGetClusterNodesResponsePBImpl() throws Exception {
+ void testGetClusterNodesResponsePBImpl() throws Exception {
validatePBImplRecord(GetClusterNodesResponsePBImpl.class,
GetClusterNodesResponseProto.class);
}
@Test
- public void testGetContainerReportRequestPBImpl() throws Exception {
+ void testGetContainerReportRequestPBImpl() throws Exception {
validatePBImplRecord(GetContainerReportRequestPBImpl.class,
GetContainerReportRequestProto.class);
}
@Test
- public void testGetContainerReportResponsePBImpl() throws Exception {
+ void testGetContainerReportResponsePBImpl() throws Exception {
validatePBImplRecord(GetContainerReportResponsePBImpl.class,
GetContainerReportResponseProto.class);
}
@Test
- public void testGetContainersRequestPBImpl() throws Exception {
+ void testGetContainersRequestPBImpl() throws Exception {
validatePBImplRecord(GetContainersRequestPBImpl.class,
GetContainersRequestProto.class);
}
@Test
- public void testGetContainersResponsePBImpl() throws Exception {
+ void testGetContainersResponsePBImpl() throws Exception {
validatePBImplRecord(GetContainersResponsePBImpl.class,
GetContainersResponseProto.class);
}
@Test
- public void testGetContainerStatusesRequestPBImpl() throws Exception {
+ void testGetContainerStatusesRequestPBImpl() throws Exception {
validatePBImplRecord(GetContainerStatusesRequestPBImpl.class,
GetContainerStatusesRequestProto.class);
}
@Test
- public void testGetContainerStatusesResponsePBImpl() throws Exception {
+ void testGetContainerStatusesResponsePBImpl() throws Exception {
validatePBImplRecord(GetContainerStatusesResponsePBImpl.class,
GetContainerStatusesResponseProto.class);
}
@Test
- public void testGetDelegationTokenRequestPBImpl() throws Exception {
+ void testGetDelegationTokenRequestPBImpl() throws Exception {
validatePBImplRecord(GetDelegationTokenRequestPBImpl.class,
GetDelegationTokenRequestProto.class);
}
@Test
- public void testGetDelegationTokenResponsePBImpl() throws Exception {
+ void testGetDelegationTokenResponsePBImpl() throws Exception {
validatePBImplRecord(GetDelegationTokenResponsePBImpl.class,
GetDelegationTokenResponseProto.class);
}
@Test
- public void testGetNewApplicationRequestPBImpl() throws Exception {
+ void testGetNewApplicationRequestPBImpl() throws Exception {
validatePBImplRecord(GetNewApplicationRequestPBImpl.class,
GetNewApplicationRequestProto.class);
}
@Test
- public void testGetNewApplicationResponsePBImpl() throws Exception {
+ void testGetNewApplicationResponsePBImpl() throws Exception {
validatePBImplRecord(GetNewApplicationResponsePBImpl.class,
GetNewApplicationResponseProto.class);
}
@Test
- public void testGetQueueInfoRequestPBImpl() throws Exception {
+ void testGetQueueInfoRequestPBImpl() throws Exception {
validatePBImplRecord(GetQueueInfoRequestPBImpl.class,
GetQueueInfoRequestProto.class);
}
@Test
- public void testGetQueueInfoResponsePBImpl() throws Exception {
+ void testGetQueueInfoResponsePBImpl() throws Exception {
validatePBImplRecord(GetQueueInfoResponsePBImpl.class,
GetQueueInfoResponseProto.class);
}
@Test
- public void testGetQueueUserAclsInfoRequestPBImpl() throws Exception {
+ void testGetQueueUserAclsInfoRequestPBImpl() throws Exception {
validatePBImplRecord(GetQueueUserAclsInfoRequestPBImpl.class,
GetQueueUserAclsInfoRequestProto.class);
}
@Test
- public void testGetQueueUserAclsInfoResponsePBImpl() throws Exception {
+ void testGetQueueUserAclsInfoResponsePBImpl() throws Exception {
validatePBImplRecord(GetQueueUserAclsInfoResponsePBImpl.class,
GetQueueUserAclsInfoResponseProto.class);
}
@Test
- public void testKillApplicationRequestPBImpl() throws Exception {
+ void testKillApplicationRequestPBImpl() throws Exception {
validatePBImplRecord(KillApplicationRequestPBImpl.class,
KillApplicationRequestProto.class);
}
@Test
- public void testKillApplicationResponsePBImpl() throws Exception {
+ void testKillApplicationResponsePBImpl() throws Exception {
validatePBImplRecord(KillApplicationResponsePBImpl.class,
KillApplicationResponseProto.class);
}
@Test
- public void testMoveApplicationAcrossQueuesRequestPBImpl() throws Exception {
+ void testMoveApplicationAcrossQueuesRequestPBImpl() throws Exception {
validatePBImplRecord(MoveApplicationAcrossQueuesRequestPBImpl.class,
MoveApplicationAcrossQueuesRequestProto.class);
}
@Test
- public void testMoveApplicationAcrossQueuesResponsePBImpl() throws Exception {
+ void testMoveApplicationAcrossQueuesResponsePBImpl() throws Exception {
validatePBImplRecord(MoveApplicationAcrossQueuesResponsePBImpl.class,
MoveApplicationAcrossQueuesResponseProto.class);
}
@Test
- public void testRegisterApplicationMasterRequestPBImpl() throws Exception {
+ void testRegisterApplicationMasterRequestPBImpl() throws Exception {
validatePBImplRecord(RegisterApplicationMasterRequestPBImpl.class,
RegisterApplicationMasterRequestProto.class);
}
@Test
- public void testRegisterApplicationMasterResponsePBImpl() throws Exception {
+ void testRegisterApplicationMasterResponsePBImpl() throws Exception {
validatePBImplRecord(RegisterApplicationMasterResponsePBImpl.class,
RegisterApplicationMasterResponseProto.class);
}
@Test
- public void testRenewDelegationTokenRequestPBImpl() throws Exception {
+ void testRenewDelegationTokenRequestPBImpl() throws Exception {
validatePBImplRecord(RenewDelegationTokenRequestPBImpl.class,
RenewDelegationTokenRequestProto.class);
}
@Test
- public void testRenewDelegationTokenResponsePBImpl() throws Exception {
+ void testRenewDelegationTokenResponsePBImpl() throws Exception {
validatePBImplRecord(RenewDelegationTokenResponsePBImpl.class,
RenewDelegationTokenResponseProto.class);
}
@Test
- public void testStartContainerRequestPBImpl() throws Exception {
+ void testStartContainerRequestPBImpl() throws Exception {
validatePBImplRecord(StartContainerRequestPBImpl.class,
StartContainerRequestProto.class);
}
@Test
- public void testStartContainersRequestPBImpl() throws Exception {
+ void testStartContainersRequestPBImpl() throws Exception {
validatePBImplRecord(StartContainersRequestPBImpl.class,
StartContainersRequestProto.class);
}
@Test
- public void testStartContainersResponsePBImpl() throws Exception {
+ void testStartContainersResponsePBImpl() throws Exception {
validatePBImplRecord(StartContainersResponsePBImpl.class,
StartContainersResponseProto.class);
}
@Test
- public void testStopContainersRequestPBImpl() throws Exception {
+ void testStopContainersRequestPBImpl() throws Exception {
validatePBImplRecord(StopContainersRequestPBImpl.class,
StopContainersRequestProto.class);
}
@Test
- public void testStopContainersResponsePBImpl() throws Exception {
+ void testStopContainersResponsePBImpl() throws Exception {
validatePBImplRecord(StopContainersResponsePBImpl.class,
StopContainersResponseProto.class);
}
@Test
- public void testIncreaseContainersResourceRequestPBImpl() throws Exception {
+ void testIncreaseContainersResourceRequestPBImpl() throws Exception {
validatePBImplRecord(IncreaseContainersResourceRequestPBImpl.class,
IncreaseContainersResourceRequestProto.class);
}
@Test
- public void testIncreaseContainersResourceResponsePBImpl() throws Exception {
+ void testIncreaseContainersResourceResponsePBImpl() throws Exception {
validatePBImplRecord(IncreaseContainersResourceResponsePBImpl.class,
IncreaseContainersResourceResponseProto.class);
}
@Test
- public void testSubmitApplicationRequestPBImpl() throws Exception {
+ void testSubmitApplicationRequestPBImpl() throws Exception {
validatePBImplRecord(SubmitApplicationRequestPBImpl.class,
SubmitApplicationRequestProto.class);
}
@Test
- public void testSubmitApplicationResponsePBImpl() throws Exception {
+ void testSubmitApplicationResponsePBImpl() throws Exception {
validatePBImplRecord(SubmitApplicationResponsePBImpl.class,
SubmitApplicationResponseProto.class);
}
@@ -703,13 +701,13 @@ public void testSubmitApplicationResponsePBImpl() throws Exception {
@Test
@Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testApplicationAttemptIdPBImpl() throws Exception {
+ void testApplicationAttemptIdPBImpl() throws Exception {
validatePBImplRecord(ApplicationAttemptIdPBImpl.class,
ApplicationAttemptIdProto.class);
}
@Test
- public void testApplicationAttemptReportPBImpl() throws Exception {
+ void testApplicationAttemptReportPBImpl() throws Exception {
validatePBImplRecord(ApplicationAttemptReportPBImpl.class,
ApplicationAttemptReportProto.class);
}
@@ -717,24 +715,24 @@ public void testApplicationAttemptReportPBImpl() throws Exception {
@Test
@Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testApplicationIdPBImpl() throws Exception {
+ void testApplicationIdPBImpl() throws Exception {
validatePBImplRecord(ApplicationIdPBImpl.class, ApplicationIdProto.class);
}
@Test
- public void testApplicationReportPBImpl() throws Exception {
+ void testApplicationReportPBImpl() throws Exception {
validatePBImplRecord(ApplicationReportPBImpl.class,
ApplicationReportProto.class);
}
@Test
- public void testApplicationResourceUsageReportPBImpl() throws Exception {
+ void testApplicationResourceUsageReportPBImpl() throws Exception {
validatePBImplRecord(ApplicationResourceUsageReportPBImpl.class,
ApplicationResourceUsageReportProto.class);
}
@Test
- public void testApplicationSubmissionContextPBImpl() throws Exception {
+ void testApplicationSubmissionContextPBImpl() throws Exception {
validatePBImplRecord(ApplicationSubmissionContextPBImpl.class,
ApplicationSubmissionContextProto.class);
@@ -748,119 +746,119 @@ public void testApplicationSubmissionContextPBImpl() throws Exception {
@Test
@Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testContainerIdPBImpl() throws Exception {
+ void testContainerIdPBImpl() throws Exception {
validatePBImplRecord(ContainerIdPBImpl.class, ContainerIdProto.class);
}
@Test
- public void testContainerRetryPBImpl() throws Exception {
+ void testContainerRetryPBImpl() throws Exception {
validatePBImplRecord(ContainerRetryContextPBImpl.class,
ContainerRetryContextProto.class);
}
@Test
- public void testContainerLaunchContextPBImpl() throws Exception {
+ void testContainerLaunchContextPBImpl() throws Exception {
validatePBImplRecord(ContainerLaunchContextPBImpl.class,
ContainerLaunchContextProto.class);
}
@Test
- public void testResourceLocalizationRequest() throws Exception {
+ void testResourceLocalizationRequest() throws Exception {
validatePBImplRecord(ResourceLocalizationRequestPBImpl.class,
YarnServiceProtos.ResourceLocalizationRequestProto.class);
}
@Test
- public void testResourceLocalizationResponse() throws Exception {
+ void testResourceLocalizationResponse() throws Exception {
validatePBImplRecord(ResourceLocalizationResponsePBImpl.class,
YarnServiceProtos.ResourceLocalizationResponseProto.class);
}
@Test
- public void testContainerPBImpl() throws Exception {
+ void testContainerPBImpl() throws Exception {
validatePBImplRecord(ContainerPBImpl.class, ContainerProto.class);
}
@Test
- public void testContainerReportPBImpl() throws Exception {
+ void testContainerReportPBImpl() throws Exception {
validatePBImplRecord(ContainerReportPBImpl.class, ContainerReportProto.class);
}
@Test
- public void testUpdateContainerRequestPBImpl() throws Exception {
+ void testUpdateContainerRequestPBImpl() throws Exception {
validatePBImplRecord(UpdateContainerRequestPBImpl.class,
YarnServiceProtos.UpdateContainerRequestProto.class);
}
@Test
- public void testContainerStatusPBImpl() throws Exception {
+ void testContainerStatusPBImpl() throws Exception {
validatePBImplRecord(ContainerStatusPBImpl.class, ContainerStatusProto.class);
}
@Test
- public void testLocalResourcePBImpl() throws Exception {
+ void testLocalResourcePBImpl() throws Exception {
validatePBImplRecord(LocalResourcePBImpl.class, LocalResourceProto.class);
}
@Test
- public void testNMTokenPBImpl() throws Exception {
+ void testNMTokenPBImpl() throws Exception {
validatePBImplRecord(NMTokenPBImpl.class, NMTokenProto.class);
}
@Test
@Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testNodeIdPBImpl() throws Exception {
+ void testNodeIdPBImpl() throws Exception {
validatePBImplRecord(NodeIdPBImpl.class, NodeIdProto.class);
}
@Test
- public void testNodeReportPBImpl() throws Exception {
+ void testNodeReportPBImpl() throws Exception {
validatePBImplRecord(NodeReportPBImpl.class, NodeReportProto.class);
}
@Test
- public void testPreemptionContainerPBImpl() throws Exception {
+ void testPreemptionContainerPBImpl() throws Exception {
validatePBImplRecord(PreemptionContainerPBImpl.class,
PreemptionContainerProto.class);
}
@Test
- public void testPreemptionContractPBImpl() throws Exception {
+ void testPreemptionContractPBImpl() throws Exception {
validatePBImplRecord(PreemptionContractPBImpl.class,
PreemptionContractProto.class);
}
@Test
- public void testPreemptionMessagePBImpl() throws Exception {
+ void testPreemptionMessagePBImpl() throws Exception {
validatePBImplRecord(PreemptionMessagePBImpl.class,
PreemptionMessageProto.class);
}
@Test
- public void testPreemptionResourceRequestPBImpl() throws Exception {
+ void testPreemptionResourceRequestPBImpl() throws Exception {
validatePBImplRecord(PreemptionResourceRequestPBImpl.class,
PreemptionResourceRequestProto.class);
}
@Test
- public void testPriorityPBImpl() throws Exception {
+ void testPriorityPBImpl() throws Exception {
validatePBImplRecord(PriorityPBImpl.class, PriorityProto.class);
}
@Test
- public void testQueueInfoPBImpl() throws Exception {
+ void testQueueInfoPBImpl() throws Exception {
validatePBImplRecord(QueueInfoPBImpl.class, QueueInfoProto.class);
}
@Test
- public void testQueueUserACLInfoPBImpl() throws Exception {
+ void testQueueUserACLInfoPBImpl() throws Exception {
validatePBImplRecord(QueueUserACLInfoPBImpl.class,
QueueUserACLInfoProto.class);
}
@Test
- public void testResourceBlacklistRequestPBImpl() throws Exception {
+ void testResourceBlacklistRequestPBImpl() throws Exception {
validatePBImplRecord(ResourceBlacklistRequestPBImpl.class,
ResourceBlacklistRequestProto.class);
}
@@ -868,286 +866,286 @@ public void testResourceBlacklistRequestPBImpl() throws Exception {
@Test
@Ignore
// ignore as ResourceOptionPBImpl is immutable
- public void testResourceOptionPBImpl() throws Exception {
+ void testResourceOptionPBImpl() throws Exception {
validatePBImplRecord(ResourceOptionPBImpl.class, ResourceOptionProto.class);
}
@Test
- public void testResourcePBImpl() throws Exception {
+ void testResourcePBImpl() throws Exception {
validatePBImplRecord(ResourcePBImpl.class, ResourceProto.class);
}
@Test
- public void testResourceRequestPBImpl() throws Exception {
+ void testResourceRequestPBImpl() throws Exception {
validatePBImplRecord(ResourceRequestPBImpl.class, ResourceRequestProto.class);
}
@Test
- public void testSerializedExceptionPBImpl() throws Exception {
+ void testSerializedExceptionPBImpl() throws Exception {
validatePBImplRecord(SerializedExceptionPBImpl.class,
SerializedExceptionProto.class);
}
@Test
- public void testStrictPreemptionContractPBImpl() throws Exception {
+ void testStrictPreemptionContractPBImpl() throws Exception {
validatePBImplRecord(StrictPreemptionContractPBImpl.class,
StrictPreemptionContractProto.class);
}
@Test
- public void testTokenPBImpl() throws Exception {
+ void testTokenPBImpl() throws Exception {
validatePBImplRecord(TokenPBImpl.class, TokenProto.class);
}
@Test
- public void testURLPBImpl() throws Exception {
+ void testURLPBImpl() throws Exception {
validatePBImplRecord(URLPBImpl.class, URLProto.class);
}
@Test
- public void testYarnClusterMetricsPBImpl() throws Exception {
+ void testYarnClusterMetricsPBImpl() throws Exception {
validatePBImplRecord(YarnClusterMetricsPBImpl.class,
YarnClusterMetricsProto.class);
}
@Test
- public void testRefreshAdminAclsRequestPBImpl() throws Exception {
+ void testRefreshAdminAclsRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshAdminAclsRequestPBImpl.class,
RefreshAdminAclsRequestProto.class);
}
@Test
- public void testRefreshAdminAclsResponsePBImpl() throws Exception {
+ void testRefreshAdminAclsResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshAdminAclsResponsePBImpl.class,
RefreshAdminAclsResponseProto.class);
}
@Test
- public void testRefreshNodesRequestPBImpl() throws Exception {
+ void testRefreshNodesRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshNodesRequestPBImpl.class,
RefreshNodesRequestProto.class);
}
@Test
- public void testRefreshNodesResponsePBImpl() throws Exception {
+ void testRefreshNodesResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshNodesResponsePBImpl.class,
RefreshNodesResponseProto.class);
}
@Test
- public void testRefreshQueuesRequestPBImpl() throws Exception {
+ void testRefreshQueuesRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshQueuesRequestPBImpl.class,
RefreshQueuesRequestProto.class);
}
@Test
- public void testRefreshQueuesResponsePBImpl() throws Exception {
+ void testRefreshQueuesResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshQueuesResponsePBImpl.class,
RefreshQueuesResponseProto.class);
}
@Test
- public void testRefreshNodesResourcesRequestPBImpl() throws Exception {
+ void testRefreshNodesResourcesRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshNodesResourcesRequestPBImpl.class,
RefreshNodesResourcesRequestProto.class);
}
@Test
- public void testRefreshNodesResourcesResponsePBImpl() throws Exception {
+ void testRefreshNodesResourcesResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshNodesResourcesResponsePBImpl.class,
RefreshNodesResourcesResponseProto.class);
}
@Test
- public void testRefreshServiceAclsRequestPBImpl() throws Exception {
+ void testRefreshServiceAclsRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshServiceAclsRequestPBImpl.class,
RefreshServiceAclsRequestProto.class);
}
@Test
- public void testRefreshServiceAclsResponsePBImpl() throws Exception {
+ void testRefreshServiceAclsResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshServiceAclsResponsePBImpl.class,
RefreshServiceAclsResponseProto.class);
}
@Test
- public void testRefreshSuperUserGroupsConfigurationRequestPBImpl()
+ void testRefreshSuperUserGroupsConfigurationRequestPBImpl()
throws Exception {
validatePBImplRecord(RefreshSuperUserGroupsConfigurationRequestPBImpl.class,
RefreshSuperUserGroupsConfigurationRequestProto.class);
}
@Test
- public void testRefreshSuperUserGroupsConfigurationResponsePBImpl()
+ void testRefreshSuperUserGroupsConfigurationResponsePBImpl()
throws Exception {
validatePBImplRecord(RefreshSuperUserGroupsConfigurationResponsePBImpl.class,
RefreshSuperUserGroupsConfigurationResponseProto.class);
}
@Test
- public void testRefreshUserToGroupsMappingsRequestPBImpl() throws Exception {
+ void testRefreshUserToGroupsMappingsRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshUserToGroupsMappingsRequestPBImpl.class,
RefreshUserToGroupsMappingsRequestProto.class);
}
@Test
- public void testRefreshUserToGroupsMappingsResponsePBImpl() throws Exception {
+ void testRefreshUserToGroupsMappingsResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshUserToGroupsMappingsResponsePBImpl.class,
RefreshUserToGroupsMappingsResponseProto.class);
}
@Test
- public void testUpdateNodeResourceRequestPBImpl() throws Exception {
+ void testUpdateNodeResourceRequestPBImpl() throws Exception {
validatePBImplRecord(UpdateNodeResourceRequestPBImpl.class,
UpdateNodeResourceRequestProto.class);
}
@Test
- public void testUpdateNodeResourceResponsePBImpl() throws Exception {
+ void testUpdateNodeResourceResponsePBImpl() throws Exception {
validatePBImplRecord(UpdateNodeResourceResponsePBImpl.class,
UpdateNodeResourceResponseProto.class);
}
@Test
- public void testReservationSubmissionRequestPBImpl() throws Exception {
+ void testReservationSubmissionRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationSubmissionRequestPBImpl.class,
ReservationSubmissionRequestProto.class);
}
@Test
- public void testReservationSubmissionResponsePBImpl() throws Exception {
+ void testReservationSubmissionResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationSubmissionResponsePBImpl.class,
ReservationSubmissionResponseProto.class);
}
@Test
- public void testReservationUpdateRequestPBImpl() throws Exception {
+ void testReservationUpdateRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationUpdateRequestPBImpl.class,
ReservationUpdateRequestProto.class);
}
@Test
- public void testReservationUpdateResponsePBImpl() throws Exception {
+ void testReservationUpdateResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationUpdateResponsePBImpl.class,
ReservationUpdateResponseProto.class);
}
@Test
- public void testReservationDeleteRequestPBImpl() throws Exception {
+ void testReservationDeleteRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationDeleteRequestPBImpl.class,
ReservationDeleteRequestProto.class);
}
@Test
- public void testReservationDeleteResponsePBImpl() throws Exception {
+ void testReservationDeleteResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationDeleteResponsePBImpl.class,
ReservationDeleteResponseProto.class);
}
@Test
- public void testReservationListRequestPBImpl() throws Exception {
+ void testReservationListRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationListRequestPBImpl.class,
ReservationListRequestProto.class);
}
@Test
- public void testReservationListResponsePBImpl() throws Exception {
+ void testReservationListResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationListResponsePBImpl.class,
ReservationListResponseProto.class);
}
@Test
- public void testAddToClusterNodeLabelsRequestPBImpl() throws Exception {
+ void testAddToClusterNodeLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(AddToClusterNodeLabelsRequestPBImpl.class,
AddToClusterNodeLabelsRequestProto.class);
}
@Test
- public void testAddToClusterNodeLabelsResponsePBImpl() throws Exception {
+ void testAddToClusterNodeLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(AddToClusterNodeLabelsResponsePBImpl.class,
AddToClusterNodeLabelsResponseProto.class);
}
@Test
- public void testRemoveFromClusterNodeLabelsRequestPBImpl() throws Exception {
+ void testRemoveFromClusterNodeLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(RemoveFromClusterNodeLabelsRequestPBImpl.class,
RemoveFromClusterNodeLabelsRequestProto.class);
}
@Test
- public void testRemoveFromClusterNodeLabelsResponsePBImpl() throws Exception {
+ void testRemoveFromClusterNodeLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(RemoveFromClusterNodeLabelsResponsePBImpl.class,
RemoveFromClusterNodeLabelsResponseProto.class);
}
@Test
- public void testGetClusterNodeLabelsRequestPBImpl() throws Exception {
+ void testGetClusterNodeLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(GetClusterNodeLabelsRequestPBImpl.class,
GetClusterNodeLabelsRequestProto.class);
}
@Test
- public void testGetClusterNodeLabelsResponsePBImpl() throws Exception {
+ void testGetClusterNodeLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(GetClusterNodeLabelsResponsePBImpl.class,
GetClusterNodeLabelsResponseProto.class);
}
@Test
- public void testReplaceLabelsOnNodeRequestPBImpl() throws Exception {
+ void testReplaceLabelsOnNodeRequestPBImpl() throws Exception {
validatePBImplRecord(ReplaceLabelsOnNodeRequestPBImpl.class,
ReplaceLabelsOnNodeRequestProto.class);
}
@Test
- public void testReplaceLabelsOnNodeResponsePBImpl() throws Exception {
+ void testReplaceLabelsOnNodeResponsePBImpl() throws Exception {
validatePBImplRecord(ReplaceLabelsOnNodeResponsePBImpl.class,
ReplaceLabelsOnNodeResponseProto.class);
}
@Test
- public void testGetNodeToLabelsRequestPBImpl() throws Exception {
+ void testGetNodeToLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(GetNodesToLabelsRequestPBImpl.class,
GetNodesToLabelsRequestProto.class);
}
@Test
- public void testGetNodeToLabelsResponsePBImpl() throws Exception {
+ void testGetNodeToLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(GetNodesToLabelsResponsePBImpl.class,
GetNodesToLabelsResponseProto.class);
}
@Test
- public void testGetLabelsToNodesRequestPBImpl() throws Exception {
+ void testGetLabelsToNodesRequestPBImpl() throws Exception {
validatePBImplRecord(GetLabelsToNodesRequestPBImpl.class,
GetLabelsToNodesRequestProto.class);
}
@Test
- public void testGetLabelsToNodesResponsePBImpl() throws Exception {
+ void testGetLabelsToNodesResponsePBImpl() throws Exception {
validatePBImplRecord(GetLabelsToNodesResponsePBImpl.class,
GetLabelsToNodesResponseProto.class);
}
@Test
- public void testNodeLabelAttributesPBImpl() throws Exception {
+ void testNodeLabelAttributesPBImpl() throws Exception {
validatePBImplRecord(NodeLabelPBImpl.class,
NodeLabelProto.class);
}
@Test
- public void testCheckForDecommissioningNodesRequestPBImpl() throws Exception {
+ void testCheckForDecommissioningNodesRequestPBImpl() throws Exception {
validatePBImplRecord(CheckForDecommissioningNodesRequestPBImpl.class,
CheckForDecommissioningNodesRequestProto.class);
}
@Test
- public void testCheckForDecommissioningNodesResponsePBImpl() throws Exception {
+ void testCheckForDecommissioningNodesResponsePBImpl() throws Exception {
validatePBImplRecord(CheckForDecommissioningNodesResponsePBImpl.class,
CheckForDecommissioningNodesResponseProto.class);
}
@Test
- public void testExecutionTypeRequestPBImpl() throws Exception {
+ void testExecutionTypeRequestPBImpl() throws Exception {
validatePBImplRecord(ExecutionTypeRequestPBImpl.class,
ExecutionTypeRequestProto.class);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java
index 55b149640d3..372b7668778 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java
@@ -20,13 +20,16 @@
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestTimelineEntityGroupId {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TestTimelineEntityGroupId {
@Test
- public void testTimelineEntityGroupId() {
+ void testTimelineEntityGroupId() {
ApplicationId appId1 = ApplicationId.newInstance(1234, 1);
ApplicationId appId2 = ApplicationId.newInstance(1234, 2);
TimelineEntityGroupId group1 = TimelineEntityGroupId.newInstance(appId1, "1");
@@ -34,19 +37,19 @@ public void testTimelineEntityGroupId() {
TimelineEntityGroupId group3 = TimelineEntityGroupId.newInstance(appId2, "1");
TimelineEntityGroupId group4 = TimelineEntityGroupId.newInstance(appId1, "1");
- Assert.assertTrue(group1.equals(group4));
- Assert.assertFalse(group1.equals(group2));
- Assert.assertFalse(group1.equals(group3));
+ assertTrue(group1.equals(group4));
+ assertFalse(group1.equals(group2));
+ assertFalse(group1.equals(group3));
- Assert.assertTrue(group1.compareTo(group4) == 0);
- Assert.assertTrue(group1.compareTo(group2) < 0);
- Assert.assertTrue(group1.compareTo(group3) < 0);
+ assertTrue(group1.compareTo(group4) == 0);
+ assertTrue(group1.compareTo(group2) < 0);
+ assertTrue(group1.compareTo(group3) < 0);
- Assert.assertTrue(group1.hashCode() == group4.hashCode());
- Assert.assertFalse(group1.hashCode() == group2.hashCode());
- Assert.assertFalse(group1.hashCode() == group3.hashCode());
+ assertTrue(group1.hashCode() == group4.hashCode());
+ assertFalse(group1.hashCode() == group2.hashCode());
+ assertFalse(group1.hashCode() == group3.hashCode());
- Assert.assertEquals("timelineEntityGroupId_1234_1_1", group1.toString());
- Assert.assertEquals(TimelineEntityGroupId.fromString("timelineEntityGroupId_1234_1_1"), group1);
+ assertEquals("timelineEntityGroupId_1234_1_1", group1.toString());
+ assertEquals(TimelineEntityGroupId.fromString("timelineEntityGroupId_1234_1_1"), group1);
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/TestResourceUtilization.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/TestResourceUtilization.java
index 5934846e2f3..d07ad050d7e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/TestResourceUtilization.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/TestResourceUtilization.java
@@ -18,46 +18,50 @@
package org.apache.hadoop.yarn.api.records;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestResourceUtilization {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TestResourceUtilization {
@Test
- public void testResourceUtilization() {
+ void testResourceUtilization() {
ResourceUtilization u1 = ResourceUtilization.newInstance(10, 20, 0.5f);
ResourceUtilization u2 = ResourceUtilization.newInstance(u1);
ResourceUtilization u3 = ResourceUtilization.newInstance(10, 20, 0.5f);
ResourceUtilization u4 = ResourceUtilization.newInstance(20, 20, 0.5f);
ResourceUtilization u5 = ResourceUtilization.newInstance(30, 40, 0.8f);
- Assert.assertEquals(u1, u2);
- Assert.assertEquals(u1, u3);
- Assert.assertNotEquals(u1, u4);
- Assert.assertNotEquals(u2, u5);
- Assert.assertNotEquals(u4, u5);
+ assertEquals(u1, u2);
+ assertEquals(u1, u3);
+ assertNotEquals(u1, u4);
+ assertNotEquals(u2, u5);
+ assertNotEquals(u4, u5);
- Assert.assertTrue(u1.hashCode() == u2.hashCode());
- Assert.assertTrue(u1.hashCode() == u3.hashCode());
- Assert.assertFalse(u1.hashCode() == u4.hashCode());
- Assert.assertFalse(u2.hashCode() == u5.hashCode());
- Assert.assertFalse(u4.hashCode() == u5.hashCode());
+ assertTrue(u1.hashCode() == u2.hashCode());
+ assertTrue(u1.hashCode() == u3.hashCode());
+ assertFalse(u1.hashCode() == u4.hashCode());
+ assertFalse(u2.hashCode() == u5.hashCode());
+ assertFalse(u4.hashCode() == u5.hashCode());
- Assert.assertTrue(u1.getPhysicalMemory() == 10);
- Assert.assertFalse(u1.getVirtualMemory() == 10);
- Assert.assertTrue(u1.getCPU() == 0.5f);
+ assertTrue(u1.getPhysicalMemory() == 10);
+ assertFalse(u1.getVirtualMemory() == 10);
+ assertTrue(u1.getCPU() == 0.5f);
- Assert.assertEquals("", u1.toString());
u1.addTo(10, 0, 0.0f);
- Assert.assertNotEquals(u1, u2);
- Assert.assertEquals(u1, u4);
+ assertNotEquals(u1, u2);
+ assertEquals(u1, u4);
u1.addTo(10, 20, 0.3f);
- Assert.assertEquals(u1, u5);
+ assertEquals(u1, u5);
u1.subtractFrom(10, 20, 0.3f);
- Assert.assertEquals(u1, u4);
+ assertEquals(u1, u4);
u1.subtractFrom(10, 0, 0.0f);
- Assert.assertEquals(u1, u3);
+ assertEquals(u1, u3);
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestApplicationClientProtocolRecords.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestApplicationClientProtocolRecords.java
index 6c51516434e..a3955b21a06 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestApplicationClientProtocolRecords.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestApplicationClientProtocolRecords.java
@@ -36,10 +36,13 @@
import org.apache.hadoop.yarn.api.records.URL;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestApplicationClientProtocolRecords {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+class TestApplicationClientProtocolRecords {
/*
* This test validates the scenario in which the client sets a null value for a
@@ -47,7 +50,7 @@
*
*/
@Test
- public void testCLCPBImplNullEnv() throws IOException {
+ void testCLCPBImplNullEnv() throws IOException {
Map localResources = Collections.emptyMap();
Map environment = new HashMap();
List commands = Collections.emptyList();
@@ -68,7 +71,7 @@ public void testCLCPBImplNullEnv() throws IOException {
ContainerLaunchContext clcProto = new ContainerLaunchContextPBImpl(
((ContainerLaunchContextPBImpl) clc).getProto());
- Assert.assertEquals("",
+ assertEquals("",
clcProto.getEnvironment().get("testCLCPBImplNullEnv"));
}
@@ -78,7 +81,7 @@ public void testCLCPBImplNullEnv() throws IOException {
* local resource URL.
*/
@Test
- public void testCLCPBImplNullResourceURL() throws IOException {
+ void testCLCPBImplNullResourceURL() throws IOException {
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
try {
LocalResource rsrc_alpha = recordFactory.newRecordInstance(LocalResource.class);
@@ -92,9 +95,9 @@ public void testCLCPBImplNullResourceURL() throws IOException {
localResources.put("null_url_resource", rsrc_alpha);
ContainerLaunchContext containerLaunchContext = recordFactory.newRecordInstance(ContainerLaunchContext.class);
containerLaunchContext.setLocalResources(localResources);
- Assert.fail("Setting an invalid local resource should be an error!");
+ fail("Setting an invalid local resource should be an error!");
} catch (NullPointerException e) {
- Assert.assertTrue(e.getMessage().contains("Null resource URL for local resource"));
+ assertTrue(e.getMessage().contains("Null resource URL for local resource"));
}
}
@@ -103,7 +106,7 @@ public void testCLCPBImplNullResourceURL() throws IOException {
* local resource type.
*/
@Test
- public void testCLCPBImplNullResourceType() throws IOException {
+ void testCLCPBImplNullResourceType() throws IOException {
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
try {
LocalResource resource = recordFactory.newRecordInstance(LocalResource.class);
@@ -117,9 +120,9 @@ public void testCLCPBImplNullResourceType() throws IOException {
localResources.put("null_type_resource", resource);
ContainerLaunchContext containerLaunchContext = recordFactory.newRecordInstance(ContainerLaunchContext.class);
containerLaunchContext.setLocalResources(localResources);
- Assert.fail("Setting an invalid local resource should be an error!");
+ fail("Setting an invalid local resource should be an error!");
} catch (NullPointerException e) {
- Assert.assertTrue(e.getMessage().contains("Null resource type for local resource"));
+ assertTrue(e.getMessage().contains("Null resource type for local resource"));
}
}
@@ -128,7 +131,7 @@ public void testCLCPBImplNullResourceType() throws IOException {
* local resource type.
*/
@Test
- public void testCLCPBImplNullResourceVisibility() throws IOException {
+ void testCLCPBImplNullResourceVisibility() throws IOException {
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
try {
LocalResource resource = recordFactory.newRecordInstance(LocalResource.class);
@@ -142,9 +145,9 @@ public void testCLCPBImplNullResourceVisibility() throws IOException {
localResources.put("null_visibility_resource", resource);
ContainerLaunchContext containerLaunchContext = recordFactory.newRecordInstance(ContainerLaunchContext.class);
containerLaunchContext.setLocalResources(localResources);
- Assert.fail("Setting an invalid local resource should be an error!");
+ fail("Setting an invalid local resource should be an error!");
} catch (NullPointerException e) {
- Assert.assertTrue(e.getMessage().contains("Null resource visibility for local resource"));
+ assertTrue(e.getMessage().contains("Null resource visibility for local resource"));
}
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestSerializedExceptionPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestSerializedExceptionPBImpl.java
index ecfa63e0329..36564660aef 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestSerializedExceptionPBImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/impl/pb/TestSerializedExceptionPBImpl.java
@@ -22,69 +22,71 @@
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProto;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestSerializedExceptionPBImpl {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
+
+class TestSerializedExceptionPBImpl {
@Test
- public void testSerializedException() throws Exception {
+ void testSerializedException() throws Exception {
SerializedExceptionPBImpl orig = new SerializedExceptionPBImpl();
orig.init(new Exception("test exception"));
SerializedExceptionProto proto = orig.getProto();
SerializedExceptionPBImpl deser = new SerializedExceptionPBImpl(proto);
- Assert.assertEquals(orig, deser);
- Assert.assertEquals(orig.getMessage(), deser.getMessage());
- Assert.assertEquals(orig.getRemoteTrace(), deser.getRemoteTrace());
- Assert.assertEquals(orig.getCause(), deser.getCause());
+ assertEquals(orig, deser);
+ assertEquals(orig.getMessage(), deser.getMessage());
+ assertEquals(orig.getRemoteTrace(), deser.getRemoteTrace());
+ assertEquals(orig.getCause(), deser.getCause());
}
@Test
- public void testDeserialize() throws Exception {
+ void testDeserialize() throws Exception {
Exception ex = new Exception("test exception");
SerializedExceptionPBImpl pb = new SerializedExceptionPBImpl();
try {
pb.deSerialize();
- Assert.fail("deSerialze should throw YarnRuntimeException");
+ fail("deSerialze should throw YarnRuntimeException");
} catch (YarnRuntimeException e) {
- Assert.assertEquals(ClassNotFoundException.class,
- e.getCause().getClass());
+ assertEquals(ClassNotFoundException.class, e.getCause().getClass());
}
pb.init(ex);
- Assert.assertEquals(ex.toString(), pb.deSerialize().toString());
+ assertEquals(ex.toString(), pb.deSerialize().toString());
}
@Test
- public void testDeserializeWithDefaultConstructor() {
+ void testDeserializeWithDefaultConstructor() {
// Init SerializedException with an Exception with default constructor.
ClosedChannelException ex = new ClosedChannelException();
SerializedExceptionPBImpl pb = new SerializedExceptionPBImpl();
pb.init(ex);
- Assert.assertEquals(ex.getClass(), pb.deSerialize().getClass());
+ assertEquals(ex.getClass(), pb.deSerialize().getClass());
}
@Test
- public void testBeforeInit() throws Exception {
+ void testBeforeInit() throws Exception {
SerializedExceptionProto defaultProto =
SerializedExceptionProto.newBuilder().build();
SerializedExceptionPBImpl pb1 = new SerializedExceptionPBImpl();
- Assert.assertNull(pb1.getCause());
+ assertNull(pb1.getCause());
SerializedExceptionPBImpl pb2 = new SerializedExceptionPBImpl();
- Assert.assertEquals(defaultProto, pb2.getProto());
+ assertEquals(defaultProto, pb2.getProto());
SerializedExceptionPBImpl pb3 = new SerializedExceptionPBImpl();
- Assert.assertEquals(defaultProto.getTrace(), pb3.getRemoteTrace());
+ assertEquals(defaultProto.getTrace(), pb3.getRemoteTrace());
}
@Test
- public void testThrowableDeserialization() {
+ void testThrowableDeserialization() {
// java.lang.Error should also be serializable
Error ex = new Error();
SerializedExceptionPBImpl pb = new SerializedExceptionPBImpl();
pb.init(ex);
- Assert.assertEquals(ex.getClass(), pb.deSerialize().getClass());
+ assertEquals(ex.getClass(), pb.deSerialize().getClass());
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/timeline/TestTimelineRecords.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/timeline/TestTimelineRecords.java
index 9d16edb7163..473d5abb393 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/timeline/TestTimelineRecords.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/timeline/TestTimelineRecords.java
@@ -31,16 +31,19 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse.TimelinePutError;
import org.apache.hadoop.yarn.util.timeline.TimelineUtils;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestTimelineRecords {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TestTimelineRecords {
private static final Log LOG =
LogFactory.getLog(TestTimelineRecords.class);
@Test
- public void testEntities() throws Exception {
+ void testEntities() throws Exception {
TimelineEntities entities = new TimelineEntities();
for (int j = 0; j < 2; ++j) {
TimelineEntity entity = new TimelineEntity();
@@ -67,27 +70,27 @@ public void testEntities() throws Exception {
LOG.info("Entities in JSON:");
LOG.info(TimelineUtils.dumpTimelineRecordtoJSON(entities, true));
- Assert.assertEquals(2, entities.getEntities().size());
+ assertEquals(2, entities.getEntities().size());
TimelineEntity entity1 = entities.getEntities().get(0);
- Assert.assertEquals("entity id 0", entity1.getEntityId());
- Assert.assertEquals("entity type 0", entity1.getEntityType());
- Assert.assertEquals(2, entity1.getRelatedEntities().size());
- Assert.assertEquals(2, entity1.getEvents().size());
- Assert.assertEquals(2, entity1.getPrimaryFilters().size());
- Assert.assertEquals(2, entity1.getOtherInfo().size());
- Assert.assertEquals("domain id 0", entity1.getDomainId());
+ assertEquals("entity id 0", entity1.getEntityId());
+ assertEquals("entity type 0", entity1.getEntityType());
+ assertEquals(2, entity1.getRelatedEntities().size());
+ assertEquals(2, entity1.getEvents().size());
+ assertEquals(2, entity1.getPrimaryFilters().size());
+ assertEquals(2, entity1.getOtherInfo().size());
+ assertEquals("domain id 0", entity1.getDomainId());
TimelineEntity entity2 = entities.getEntities().get(1);
- Assert.assertEquals("entity id 1", entity2.getEntityId());
- Assert.assertEquals("entity type 1", entity2.getEntityType());
- Assert.assertEquals(2, entity2.getRelatedEntities().size());
- Assert.assertEquals(2, entity2.getEvents().size());
- Assert.assertEquals(2, entity2.getPrimaryFilters().size());
- Assert.assertEquals(2, entity2.getOtherInfo().size());
- Assert.assertEquals("domain id 1", entity2.getDomainId());
+ assertEquals("entity id 1", entity2.getEntityId());
+ assertEquals("entity type 1", entity2.getEntityType());
+ assertEquals(2, entity2.getRelatedEntities().size());
+ assertEquals(2, entity2.getEvents().size());
+ assertEquals(2, entity2.getPrimaryFilters().size());
+ assertEquals(2, entity2.getOtherInfo().size());
+ assertEquals("domain id 1", entity2.getDomainId());
}
@Test
- public void testEvents() throws Exception {
+ void testEvents() throws Exception {
TimelineEvents events = new TimelineEvents();
for (int j = 0; j < 2; ++j) {
TimelineEvents.EventsOfOneEntity partEvents =
@@ -107,31 +110,31 @@ public void testEvents() throws Exception {
LOG.info("Events in JSON:");
LOG.info(TimelineUtils.dumpTimelineRecordtoJSON(events, true));
- Assert.assertEquals(2, events.getAllEvents().size());
+ assertEquals(2, events.getAllEvents().size());
TimelineEvents.EventsOfOneEntity partEvents1 = events.getAllEvents().get(0);
- Assert.assertEquals("entity id 0", partEvents1.getEntityId());
- Assert.assertEquals("entity type 0", partEvents1.getEntityType());
- Assert.assertEquals(2, partEvents1.getEvents().size());
+ assertEquals("entity id 0", partEvents1.getEntityId());
+ assertEquals("entity type 0", partEvents1.getEntityType());
+ assertEquals(2, partEvents1.getEvents().size());
TimelineEvent event11 = partEvents1.getEvents().get(0);
- Assert.assertEquals("event type 0", event11.getEventType());
- Assert.assertEquals(2, event11.getEventInfo().size());
+ assertEquals("event type 0", event11.getEventType());
+ assertEquals(2, event11.getEventInfo().size());
TimelineEvent event12 = partEvents1.getEvents().get(1);
- Assert.assertEquals("event type 1", event12.getEventType());
- Assert.assertEquals(2, event12.getEventInfo().size());
+ assertEquals("event type 1", event12.getEventType());
+ assertEquals(2, event12.getEventInfo().size());
TimelineEvents.EventsOfOneEntity partEvents2 = events.getAllEvents().get(1);
- Assert.assertEquals("entity id 1", partEvents2.getEntityId());
- Assert.assertEquals("entity type 1", partEvents2.getEntityType());
- Assert.assertEquals(2, partEvents2.getEvents().size());
+ assertEquals("entity id 1", partEvents2.getEntityId());
+ assertEquals("entity type 1", partEvents2.getEntityType());
+ assertEquals(2, partEvents2.getEvents().size());
TimelineEvent event21 = partEvents2.getEvents().get(0);
- Assert.assertEquals("event type 0", event21.getEventType());
- Assert.assertEquals(2, event21.getEventInfo().size());
+ assertEquals("event type 0", event21.getEventType());
+ assertEquals(2, event21.getEventInfo().size());
TimelineEvent event22 = partEvents2.getEvents().get(1);
- Assert.assertEquals("event type 1", event22.getEventType());
- Assert.assertEquals(2, event22.getEventInfo().size());
+ assertEquals("event type 1", event22.getEventType());
+ assertEquals(2, event22.getEventInfo().size());
}
@Test
- public void testTimelinePutErrors() throws Exception {
+ void testTimelinePutErrors() throws Exception {
TimelinePutResponse TimelinePutErrors = new TimelinePutResponse();
TimelinePutError error1 = new TimelinePutError();
error1.setEntityId("entity id 1");
@@ -149,23 +152,23 @@ public void testTimelinePutErrors() throws Exception {
LOG.info("Errors in JSON:");
LOG.info(TimelineUtils.dumpTimelineRecordtoJSON(TimelinePutErrors, true));
- Assert.assertEquals(3, TimelinePutErrors.getErrors().size());
+ assertEquals(3, TimelinePutErrors.getErrors().size());
TimelinePutError e = TimelinePutErrors.getErrors().get(0);
- Assert.assertEquals(error1.getEntityId(), e.getEntityId());
- Assert.assertEquals(error1.getEntityType(), e.getEntityType());
- Assert.assertEquals(error1.getErrorCode(), e.getErrorCode());
+ assertEquals(error1.getEntityId(), e.getEntityId());
+ assertEquals(error1.getEntityType(), e.getEntityType());
+ assertEquals(error1.getErrorCode(), e.getErrorCode());
e = TimelinePutErrors.getErrors().get(1);
- Assert.assertEquals(error1.getEntityId(), e.getEntityId());
- Assert.assertEquals(error1.getEntityType(), e.getEntityType());
- Assert.assertEquals(error1.getErrorCode(), e.getErrorCode());
+ assertEquals(error1.getEntityId(), e.getEntityId());
+ assertEquals(error1.getEntityType(), e.getEntityType());
+ assertEquals(error1.getErrorCode(), e.getErrorCode());
e = TimelinePutErrors.getErrors().get(2);
- Assert.assertEquals(error2.getEntityId(), e.getEntityId());
- Assert.assertEquals(error2.getEntityType(), e.getEntityType());
- Assert.assertEquals(error2.getErrorCode(), e.getErrorCode());
+ assertEquals(error2.getEntityId(), e.getEntityId());
+ assertEquals(error2.getEntityType(), e.getEntityType());
+ assertEquals(error2.getErrorCode(), e.getErrorCode());
}
@Test
- public void testTimelineDomain() throws Exception {
+ void testTimelineDomain() throws Exception {
TimelineDomains domains = new TimelineDomains();
TimelineDomain domain = null;
@@ -185,25 +188,25 @@ public void testTimelineDomain() throws Exception {
LOG.info("Domain in JSON:");
LOG.info(TimelineUtils.dumpTimelineRecordtoJSON(domains, true));
- Assert.assertEquals(2, domains.getDomains().size());
+ assertEquals(2, domains.getDomains().size());
for (int i = 0; i < domains.getDomains().size(); ++i) {
domain = domains.getDomains().get(i);
- Assert.assertEquals("test id " + (i + 1), domain.getId());
- Assert.assertEquals("test description " + (i + 1),
+ assertEquals("test id " + (i + 1), domain.getId());
+ assertEquals("test description " + (i + 1),
domain.getDescription());
- Assert.assertEquals("test owner " + (i + 1), domain.getOwner());
- Assert.assertEquals("test_reader_user_" + (i + 1) +
+ assertEquals("test owner " + (i + 1), domain.getOwner());
+ assertEquals("test_reader_user_" + (i + 1) +
" test_reader_group+" + (i + 1), domain.getReaders());
- Assert.assertEquals("test_writer_user_" + (i + 1) +
+ assertEquals("test_writer_user_" + (i + 1) +
" test_writer_group+" + (i + 1), domain.getWriters());
- Assert.assertEquals(new Long(0L), domain.getCreatedTime());
- Assert.assertEquals(new Long(1L), domain.getModifiedTime());
+ assertEquals(new Long(0L), domain.getCreatedTime());
+ assertEquals(new Long(1L), domain.getModifiedTime());
}
}
@Test
- public void testMapInterfaceOrTimelineRecords() throws Exception {
+ void testMapInterfaceOrTimelineRecords() throws Exception {
TimelineEntity entity = new TimelineEntity();
List
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
org.mockito
mockito-all
test
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/records/TestFederationProtocolRecords.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/records/TestFederationProtocolRecords.java
index cf8cf719d01..4f1d1465fc5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/records/TestFederationProtocolRecords.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/records/TestFederationProtocolRecords.java
@@ -76,16 +76,16 @@
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.UpdateApplicationHomeSubClusterRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.UpdateApplicationHomeSubClusterResponsePBImpl;
import org.apache.hadoop.yarn.server.records.Version;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/**
* Test class for federation protocol records.
*/
-public class TestFederationProtocolRecords extends BasePBImplRecordsTest {
+class TestFederationProtocolRecords extends BasePBImplRecordsTest {
- @BeforeClass
- public static void setup() throws Exception {
+ @BeforeAll
+ static void setup() throws Exception {
generateByNewInstance(ApplicationId.class);
generateByNewInstance(Version.class);
generateByNewInstance(SubClusterId.class);
@@ -95,168 +95,168 @@ public static void setup() throws Exception {
}
@Test
- public void testSubClusterId() throws Exception {
+ void testSubClusterId() throws Exception {
validatePBImplRecord(SubClusterIdPBImpl.class, SubClusterIdProto.class);
}
@Test
- public void testSubClusterInfo() throws Exception {
+ void testSubClusterInfo() throws Exception {
validatePBImplRecord(SubClusterInfoPBImpl.class, SubClusterInfoProto.class);
}
@Test
- public void testSubClusterRegisterRequest() throws Exception {
+ void testSubClusterRegisterRequest() throws Exception {
validatePBImplRecord(SubClusterRegisterRequestPBImpl.class,
SubClusterRegisterRequestProto.class);
}
@Test
- public void testSubClusterRegisterResponse() throws Exception {
+ void testSubClusterRegisterResponse() throws Exception {
validatePBImplRecord(SubClusterRegisterResponsePBImpl.class,
SubClusterRegisterResponseProto.class);
}
@Test
- public void testSubClusterDeregisterRequest() throws Exception {
+ void testSubClusterDeregisterRequest() throws Exception {
validatePBImplRecord(SubClusterDeregisterRequestPBImpl.class,
SubClusterDeregisterRequestProto.class);
}
@Test
- public void testSubClusterDeregisterResponse() throws Exception {
+ void testSubClusterDeregisterResponse() throws Exception {
validatePBImplRecord(SubClusterDeregisterResponsePBImpl.class,
SubClusterDeregisterResponseProto.class);
}
@Test
- public void testSubClusterHeartbeatRequest() throws Exception {
+ void testSubClusterHeartbeatRequest() throws Exception {
validatePBImplRecord(SubClusterHeartbeatRequestPBImpl.class,
SubClusterHeartbeatRequestProto.class);
}
@Test
- public void testSubClusterHeartbeatResponse() throws Exception {
+ void testSubClusterHeartbeatResponse() throws Exception {
validatePBImplRecord(SubClusterHeartbeatResponsePBImpl.class,
SubClusterHeartbeatResponseProto.class);
}
@Test
- public void testGetSubClusterRequest() throws Exception {
+ void testGetSubClusterRequest() throws Exception {
validatePBImplRecord(GetSubClusterInfoRequestPBImpl.class,
GetSubClusterInfoRequestProto.class);
}
@Test
- public void testGetSubClusterResponse() throws Exception {
+ void testGetSubClusterResponse() throws Exception {
validatePBImplRecord(GetSubClusterInfoResponsePBImpl.class,
GetSubClusterInfoResponseProto.class);
}
@Test
- public void testGetSubClustersInfoRequest() throws Exception {
+ void testGetSubClustersInfoRequest() throws Exception {
validatePBImplRecord(GetSubClustersInfoRequestPBImpl.class,
GetSubClustersInfoRequestProto.class);
}
@Test
- public void testGetSubClustersInfoResponse() throws Exception {
+ void testGetSubClustersInfoResponse() throws Exception {
validatePBImplRecord(GetSubClustersInfoResponsePBImpl.class,
GetSubClustersInfoResponseProto.class);
}
@Test
- public void testAddApplicationHomeSubClusterRequest() throws Exception {
+ void testAddApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(AddApplicationHomeSubClusterRequestPBImpl.class,
AddApplicationHomeSubClusterRequestProto.class);
}
@Test
- public void testAddApplicationHomeSubClusterResponse() throws Exception {
+ void testAddApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(AddApplicationHomeSubClusterResponsePBImpl.class,
AddApplicationHomeSubClusterResponseProto.class);
}
@Test
- public void testUpdateApplicationHomeSubClusterRequest() throws Exception {
+ void testUpdateApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(UpdateApplicationHomeSubClusterRequestPBImpl.class,
UpdateApplicationHomeSubClusterRequestProto.class);
}
@Test
- public void testUpdateApplicationHomeSubClusterResponse() throws Exception {
+ void testUpdateApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(UpdateApplicationHomeSubClusterResponsePBImpl.class,
UpdateApplicationHomeSubClusterResponseProto.class);
}
@Test
- public void testGetApplicationHomeSubClusterRequest() throws Exception {
+ void testGetApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(GetApplicationHomeSubClusterRequestPBImpl.class,
GetApplicationHomeSubClusterRequestProto.class);
}
@Test
- public void testGetApplicationHomeSubClusterResponse() throws Exception {
+ void testGetApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(GetApplicationHomeSubClusterResponsePBImpl.class,
GetApplicationHomeSubClusterResponseProto.class);
}
@Test
- public void testGetApplicationsHomeSubClusterRequest() throws Exception {
+ void testGetApplicationsHomeSubClusterRequest() throws Exception {
validatePBImplRecord(GetApplicationsHomeSubClusterRequestPBImpl.class,
GetApplicationsHomeSubClusterRequestProto.class);
}
@Test
- public void testGetApplicationsHomeSubClusterResponse() throws Exception {
+ void testGetApplicationsHomeSubClusterResponse() throws Exception {
validatePBImplRecord(GetApplicationsHomeSubClusterResponsePBImpl.class,
GetApplicationsHomeSubClusterResponseProto.class);
}
@Test
- public void testDeleteApplicationHomeSubClusterRequest() throws Exception {
+ void testDeleteApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(DeleteApplicationHomeSubClusterRequestPBImpl.class,
DeleteApplicationHomeSubClusterRequestProto.class);
}
@Test
- public void testDeleteApplicationHomeSubClusterResponse() throws Exception {
+ void testDeleteApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(DeleteApplicationHomeSubClusterResponsePBImpl.class,
DeleteApplicationHomeSubClusterResponseProto.class);
}
@Test
- public void testGetSubClusterPolicyConfigurationRequest() throws Exception {
+ void testGetSubClusterPolicyConfigurationRequest() throws Exception {
validatePBImplRecord(GetSubClusterPolicyConfigurationRequestPBImpl.class,
GetSubClusterPolicyConfigurationRequestProto.class);
}
@Test
- public void testGetSubClusterPolicyConfigurationResponse() throws Exception {
+ void testGetSubClusterPolicyConfigurationResponse() throws Exception {
validatePBImplRecord(GetSubClusterPolicyConfigurationResponsePBImpl.class,
GetSubClusterPolicyConfigurationResponseProto.class);
}
@Test
- public void testSetSubClusterPolicyConfigurationRequest() throws Exception {
+ void testSetSubClusterPolicyConfigurationRequest() throws Exception {
validatePBImplRecord(SetSubClusterPolicyConfigurationRequestPBImpl.class,
SetSubClusterPolicyConfigurationRequestProto.class);
}
@Test
- public void testSetSubClusterPolicyConfigurationResponse() throws Exception {
+ void testSetSubClusterPolicyConfigurationResponse() throws Exception {
validatePBImplRecord(SetSubClusterPolicyConfigurationResponsePBImpl.class,
SetSubClusterPolicyConfigurationResponseProto.class);
}
@Test
- public void testGetSubClusterPoliciesConfigurationsRequest()
+ void testGetSubClusterPoliciesConfigurationsRequest()
throws Exception {
validatePBImplRecord(GetSubClusterPoliciesConfigurationsRequestPBImpl.class,
GetSubClusterPoliciesConfigurationsRequestProto.class);
}
@Test
- public void testGetSubClusterPoliciesConfigurationsResponse()
+ void testGetSubClusterPoliciesConfigurationsResponse()
throws Exception {
validatePBImplRecord(
GetSubClusterPoliciesConfigurationsResponsePBImpl.class,