Forráskód Böngészése

YARN-11337. Upgrade Junit 4 to 5 in hadoop-yarn-applications-mawo (#4993)

Co-authored-by: Ashutosh Gupta <ashugpt@amazon.com>
Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
Ashutosh Gupta 2 éve
szülő
commit
2aae7ffe08

+ 20 - 10
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-mawo/hadoop-yarn-applications-mawo-core/pom.xml

@@ -31,23 +31,33 @@
   </properties>
 
   <dependencies>
+
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-common</artifactId>
     </dependency>
 
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-common</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.platform</groupId>
+      <artifactId>junit-platform-launcher</artifactId>
+      <scope>test</scope>
     </dependency>
-
-      <dependency>
-          <groupId>org.apache.hadoop</groupId>
-          <artifactId>hadoop-common</artifactId>
-          <type>test-jar</type>
-          <scope>test</scope>
-      </dependency>
 
     <dependency>
       <groupId>com.google.inject</groupId>

+ 14 - 12
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-mawo/hadoop-yarn-applications-mawo-core/src/test/java/org/apache/hadoop/applications/mawo/server/common/TestMaWoConfiguration.java

@@ -19,8 +19,10 @@
 package org.apache.hadoop.applications.mawo.server.common;
 
 
-import org.junit.Assert;
-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.assertTrue;
 
 /**
  * Test MaWo configuration.
@@ -31,29 +33,29 @@ public class TestMaWoConfiguration {
    * Validate default MaWo Configurations.
    */
   @Test
-  public void testMaWoConfiguration() {
+  void testMaWoConfiguration() {
 
     MawoConfiguration mawoConf = new MawoConfiguration();
 
     // validate Rpc server port
-    Assert.assertEquals(mawoConf.getRpcServerPort(), 5120);
+    assertEquals(5120, mawoConf.getRpcServerPort());
 
     // validate Rpc hostname
-    Assert.assertTrue("localhost".equals(mawoConf.getRpcHostName()));
+    assertEquals("localhost", mawoConf.getRpcHostName());
 
     // validate job queue storage conf
     boolean jobQueueStorage = mawoConf.getJobQueueStorageEnabled();
-    Assert.assertTrue(jobQueueStorage);
+    assertTrue(jobQueueStorage);
 
     // validate default teardownWorkerValidity Interval
-    Assert.assertEquals(mawoConf.getTeardownWorkerValidityInterval(), 120000);
+    assertEquals(120000, mawoConf.getTeardownWorkerValidityInterval());
 
     // validate Zk related configs
-    Assert.assertTrue("/tmp/mawoRoot".equals(mawoConf.getZKParentPath()));
-    Assert.assertTrue("localhost:2181".equals(mawoConf.getZKAddress()));
-    Assert.assertEquals(1000, mawoConf.getZKRetryIntervalMS());
-    Assert.assertEquals(10000, mawoConf.getZKSessionTimeoutMS());
-    Assert.assertEquals(1000, mawoConf.getZKRetriesNum());
+    assertEquals("/tmp/mawoRoot", mawoConf.getZKParentPath());
+    assertEquals("localhost:2181", mawoConf.getZKAddress());
+    assertEquals(1000, mawoConf.getZKRetryIntervalMS());
+    assertEquals(10000, mawoConf.getZKSessionTimeoutMS());
+    assertEquals(1000, mawoConf.getZKRetriesNum());
   }