Jelajahi Sumber

YARN-11265. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-sharedcachemanager (#4772)

Co-authored-by: Ashutosh Gupta <ashugpt@amazon.com>
Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
Ashutosh Gupta 2 tahun lalu
induk
melakukan
21bae31d58
9 mengubah file dengan 177 tambahan dan 154 penghapusan
  1. 15 5
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/pom.xml
  2. 15 14
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestCleanerTask.java
  3. 38 35
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestClientSCMProtocolService.java
  4. 11 10
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestRemoteAppChecker.java
  5. 25 24
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestSCMAdminProtocolService.java
  6. 28 24
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestSharedCacheUploaderService.java
  7. 15 14
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/metrics/TestCleanerMetrics.java
  8. 3 2
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/store/SCMStoreBaseTest.java
  9. 27 26
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/store/TestInMemorySCMStore.java

+ 15 - 5
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/pom.xml

@@ -49,11 +49,6 @@
       <groupId>org.apache.hadoop</groupId>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-yarn-client</artifactId>
       <artifactId>hadoop-yarn-client</artifactId>
     </dependency>
     </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
     <dependency>
       <groupId>org.mockito</groupId>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
       <artifactId>mockito-core</artifactId>
@@ -71,6 +66,21 @@
       <scope>test</scope>
       <scope>test</scope>
       <type>test-jar</type>
       <type>test-jar</type>
     </dependency>
     </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>
   </dependencies>
   </dependencies>
   
   
   <build>
   <build>

+ 15 - 14
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestCleanerTask.java

@@ -18,25 +18,26 @@
 
 
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 
 
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantLock;
 
 
+import org.junit.jupiter.api.Test;
+
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.server.sharedcachemanager.metrics.CleanerMetrics;
 import org.apache.hadoop.yarn.server.sharedcachemanager.metrics.CleanerMetrics;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
-import org.junit.Test;
+
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 
 public class TestCleanerTask {
 public class TestCleanerTask {
   private static final String ROOT =
   private static final String ROOT =
@@ -47,7 +48,7 @@ public class TestCleanerTask {
       YarnConfiguration.DEFAULT_SHARED_CACHE_NESTED_LEVEL;
       YarnConfiguration.DEFAULT_SHARED_CACHE_NESTED_LEVEL;
 
 
   @Test
   @Test
-  public void testNonExistentRoot() throws Exception {
+  void testNonExistentRoot() throws Exception {
     FileSystem fs = mock(FileSystem.class);
     FileSystem fs = mock(FileSystem.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     SCMStore store = mock(SCMStore.class);
     SCMStore store = mock(SCMStore.class);
@@ -64,7 +65,7 @@ public class TestCleanerTask {
   }
   }
 
 
   @Test
   @Test
-  public void testProcessFreshResource() throws Exception {
+  void testProcessFreshResource() throws Exception {
     FileSystem fs = mock(FileSystem.class);
     FileSystem fs = mock(FileSystem.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     SCMStore store = mock(SCMStore.class);
     SCMStore store = mock(SCMStore.class);
@@ -89,7 +90,7 @@ public class TestCleanerTask {
   }
   }
 
 
   @Test
   @Test
-  public void testProcessEvictableResource() throws Exception {
+  void testProcessEvictableResource() throws Exception {
     FileSystem fs = mock(FileSystem.class);
     FileSystem fs = mock(FileSystem.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     SCMStore store = mock(SCMStore.class);
     SCMStore store = mock(SCMStore.class);
@@ -125,7 +126,7 @@ public class TestCleanerTask {
   }
   }
 
 
   @Test
   @Test
-  public void testResourceIsInUseHasAnActiveApp() throws Exception {
+  void testResourceIsInUseHasAnActiveApp() throws Exception {
     FileSystem fs = mock(FileSystem.class);
     FileSystem fs = mock(FileSystem.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     CleanerMetrics metrics = mock(CleanerMetrics.class);
     SCMStore store = mock(SCMStore.class);
     SCMStore store = mock(SCMStore.class);

+ 38 - 35
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestClientSCMProtocolService.java

@@ -18,15 +18,16 @@
 
 
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.spy;
-
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.InetSocketAddress;
 
 
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -42,11 +43,11 @@ import org.apache.hadoop.yarn.server.sharedcachemanager.metrics.ClientSCMMetrics
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SharedCacheResourceReference;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SharedCacheResourceReference;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.mockito.Mockito.spy;
 
 
 
 
 /**
 /**
@@ -55,7 +56,7 @@ import org.junit.Test;
 public class TestClientSCMProtocolService {
 public class TestClientSCMProtocolService {
   private static File testDir = null;
   private static File testDir = null;
 
 
-  @BeforeClass
+  @BeforeAll
   public static void setupTestDirs() throws IOException {
   public static void setupTestDirs() throws IOException {
     testDir = new File("target",
     testDir = new File("target",
         TestSharedCacheUploaderService.class.getCanonicalName());
         TestSharedCacheUploaderService.class.getCanonicalName());
@@ -64,7 +65,7 @@ public class TestClientSCMProtocolService {
     testDir = testDir.getAbsoluteFile();
     testDir = testDir.getAbsoluteFile();
   }
   }
 
 
-  @AfterClass
+  @AfterAll
   public static void cleanupTestDirs() throws IOException {
   public static void cleanupTestDirs() throws IOException {
     if (testDir != null) {
     if (testDir != null) {
       testDir.delete();
       testDir.delete();
@@ -78,7 +79,7 @@ public class TestClientSCMProtocolService {
   private final RecordFactory recordFactory = RecordFactoryProvider
   private final RecordFactory recordFactory = RecordFactoryProvider
       .getRecordFactory(null);
       .getRecordFactory(null);
 
 
-  @Before
+  @BeforeEach
   public void startUp() {
   public void startUp() {
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     conf.set(YarnConfiguration.SCM_STORE_CLASS,
     conf.set(YarnConfiguration.SCM_STORE_CLASS,
@@ -105,7 +106,7 @@ public class TestClientSCMProtocolService {
             conf);
             conf);
   }
   }
 
 
-  @After
+  @AfterEach
   public void cleanUp() {
   public void cleanUp() {
     if (store != null) {
     if (store != null) {
       store.stop();
       store.stop();
@@ -124,19 +125,19 @@ public class TestClientSCMProtocolService {
   }
   }
 
 
   @Test
   @Test
-  public void testUse_MissingEntry() throws Exception {
+  void testUse_MissingEntry() throws Exception {
     long misses = ClientSCMMetrics.getInstance().getCacheMisses();
     long misses = ClientSCMMetrics.getInstance().getCacheMisses();
     UseSharedCacheResourceRequest request =
     UseSharedCacheResourceRequest request =
         recordFactory.newRecordInstance(UseSharedCacheResourceRequest.class);
         recordFactory.newRecordInstance(UseSharedCacheResourceRequest.class);
     request.setResourceKey("key1");
     request.setResourceKey("key1");
     request.setAppId(createAppId(1, 1L));
     request.setAppId(createAppId(1, 1L));
     assertNull(clientSCMProxy.use(request).getPath());
     assertNull(clientSCMProxy.use(request).getPath());
-    assertEquals("Client SCM metrics aren't updated.", 1, ClientSCMMetrics
-        .getInstance().getCacheMisses() - misses);
+    assertEquals(1, ClientSCMMetrics
+        .getInstance().getCacheMisses() - misses, "Client SCM metrics aren't updated.");
   }
   }
 
 
   @Test
   @Test
-  public void testUse_ExistingEntry_NoAppIds() throws Exception {
+  void testUse_ExistingEntry_NoAppIds() throws Exception {
     // Pre-populate the SCM with one cache entry
     // Pre-populate the SCM with one cache entry
     store.addResource("key1", "foo.jar");
     store.addResource("key1", "foo.jar");
 
 
@@ -150,13 +151,13 @@ public class TestClientSCMProtocolService {
     String expectedPath = testDir.getAbsolutePath() + "/k/e/y/key1/foo.jar";
     String expectedPath = testDir.getAbsolutePath() + "/k/e/y/key1/foo.jar";
     assertEquals(expectedPath, clientSCMProxy.use(request).getPath());
     assertEquals(expectedPath, clientSCMProxy.use(request).getPath());
     assertEquals(1, store.getResourceReferences("key1").size());
     assertEquals(1, store.getResourceReferences("key1").size());
-    assertEquals("Client SCM metrics aren't updated.", 1, ClientSCMMetrics
-        .getInstance().getCacheHits() - hits);
+    assertEquals(1, ClientSCMMetrics
+        .getInstance().getCacheHits() - hits, "Client SCM metrics aren't updated.");
 
 
   }
   }
 
 
   @Test
   @Test
-  public void testUse_ExistingEntry_OneId() throws Exception {
+  void testUse_ExistingEntry_OneId() throws Exception {
     // Pre-populate the SCM with one cache entry
     // Pre-populate the SCM with one cache entry
     store.addResource("key1", "foo.jar");
     store.addResource("key1", "foo.jar");
     store.addResourceReference("key1",
     store.addResourceReference("key1",
@@ -174,12 +175,12 @@ public class TestClientSCMProtocolService {
     String expectedPath = testDir.getAbsolutePath() + "/k/e/y/key1/foo.jar";
     String expectedPath = testDir.getAbsolutePath() + "/k/e/y/key1/foo.jar";
     assertEquals(expectedPath, clientSCMProxy.use(request).getPath());
     assertEquals(expectedPath, clientSCMProxy.use(request).getPath());
     assertEquals(2, store.getResourceReferences("key1").size());
     assertEquals(2, store.getResourceReferences("key1").size());
-    assertEquals("Client SCM metrics aren't updated.", 1, ClientSCMMetrics
-        .getInstance().getCacheHits() - hits);
+    assertEquals(1, ClientSCMMetrics
+        .getInstance().getCacheHits() - hits, "Client SCM metrics aren't updated.");
   }
   }
 
 
   @Test
   @Test
-  public void testUse_ExistingEntry_DupId() throws Exception {
+  void testUse_ExistingEntry_DupId() throws Exception {
     // Pre-populate the SCM with one cache entry
     // Pre-populate the SCM with one cache entry
     store.addResource("key1", "foo.jar");
     store.addResource("key1", "foo.jar");
     UserGroupInformation testUGI = UserGroupInformation.getCurrentUser();
     UserGroupInformation testUGI = UserGroupInformation.getCurrentUser();
@@ -201,12 +202,12 @@ public class TestClientSCMProtocolService {
     assertEquals(expectedPath, clientSCMProxy.use(request).getPath());
     assertEquals(expectedPath, clientSCMProxy.use(request).getPath());
     assertEquals(1, store.getResourceReferences("key1").size());
     assertEquals(1, store.getResourceReferences("key1").size());
 
 
-    assertEquals("Client SCM metrics aren't updated.", 1, ClientSCMMetrics
-        .getInstance().getCacheHits() - hits);
+    assertEquals(1, ClientSCMMetrics
+        .getInstance().getCacheHits() - hits, "Client SCM metrics aren't updated.");
   }
   }
 
 
   @Test
   @Test
-  public void testRelease_ExistingEntry_NonExistantAppId() throws Exception {
+  void testRelease_ExistingEntry_NonExistantAppId() throws Exception {
     // Pre-populate the SCM with one cache entry
     // Pre-populate the SCM with one cache entry
     store.addResource("key1", "foo.jar");
     store.addResource("key1", "foo.jar");
     store.addResourceReference("key1",
     store.addResourceReference("key1",
@@ -224,13 +225,14 @@ public class TestClientSCMProtocolService {
     assertEquals(1, store.getResourceReferences("key1").size());
     assertEquals(1, store.getResourceReferences("key1").size());
 
 
     assertEquals(
     assertEquals(
-        "Client SCM metrics were updated when a release did not happen", 0,
-        ClientSCMMetrics.getInstance().getCacheReleases() - releases);
+        0,
+        ClientSCMMetrics.getInstance().getCacheReleases() - releases,
+        "Client SCM metrics were updated when a release did not happen");
 
 
   }
   }
 
 
   @Test
   @Test
-  public void testRelease_ExistingEntry_WithAppId() throws Exception {
+  void testRelease_ExistingEntry_WithAppId() throws Exception {
     // Pre-populate the SCM with one cache entry
     // Pre-populate the SCM with one cache entry
     store.addResource("key1", "foo.jar");
     store.addResource("key1", "foo.jar");
     UserGroupInformation testUGI = UserGroupInformation.getCurrentUser();
     UserGroupInformation testUGI = UserGroupInformation.getCurrentUser();
@@ -249,13 +251,13 @@ public class TestClientSCMProtocolService {
     clientSCMProxy.release(request);
     clientSCMProxy.release(request);
     assertEquals(0, store.getResourceReferences("key1").size());
     assertEquals(0, store.getResourceReferences("key1").size());
 
 
-    assertEquals("Client SCM metrics aren't updated.", 1, ClientSCMMetrics
-        .getInstance().getCacheReleases() - releases);
+    assertEquals(1, ClientSCMMetrics
+        .getInstance().getCacheReleases() - releases, "Client SCM metrics aren't updated.");
 
 
   }
   }
 
 
   @Test
   @Test
-  public void testRelease_MissingEntry() throws Exception {
+  void testRelease_MissingEntry() throws Exception {
 
 
     long releases = ClientSCMMetrics.getInstance().getCacheReleases();
     long releases = ClientSCMMetrics.getInstance().getCacheReleases();
 
 
@@ -268,8 +270,9 @@ public class TestClientSCMProtocolService {
     assertNotNull(store.getResourceReferences("key2"));
     assertNotNull(store.getResourceReferences("key2"));
     assertEquals(0, store.getResourceReferences("key2").size());
     assertEquals(0, store.getResourceReferences("key2").size());
     assertEquals(
     assertEquals(
-        "Client SCM metrics were updated when a release did not happen.", 0,
-        ClientSCMMetrics.getInstance().getCacheReleases() - releases);
+        0,
+        ClientSCMMetrics.getInstance().getCacheReleases() - releases,
+        "Client SCM metrics were updated when a release did not happen.");
   }
   }
 
 
   private ApplicationId createAppId(int id, long timestamp) {
   private ApplicationId createAppId(int id, long timestamp) {

+ 11 - 10
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestRemoteAppChecker.java

@@ -18,11 +18,8 @@
 
 
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.spy;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -32,14 +29,18 @@ import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl;
 import org.apache.hadoop.yarn.client.api.YarnClient;
 import org.apache.hadoop.yarn.client.api.YarnClient;
 import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl;
 import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl;
 import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
 import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
-import org.junit.After;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.spy;
 
 
 public class TestRemoteAppChecker {
 public class TestRemoteAppChecker {
 
 
   private RemoteAppChecker checker;
   private RemoteAppChecker checker;
 
 
-  @After
+  @AfterEach
   public void cleanup() {
   public void cleanup() {
     if (checker != null) {
     if (checker != null) {
       checker.stop();
       checker.stop();
@@ -61,7 +62,7 @@ public class TestRemoteAppChecker {
   }
   }
 
 
   @Test
   @Test
-  public void testNonExistentApp() throws Exception {
+  void testNonExistentApp() throws Exception {
     YarnClient client = createCheckerWithMockedClient();
     YarnClient client = createCheckerWithMockedClient();
     ApplicationId id = ApplicationId.newInstance(1, 1);
     ApplicationId id = ApplicationId.newInstance(1, 1);
 
 
@@ -76,7 +77,7 @@ public class TestRemoteAppChecker {
   }
   }
 
 
   @Test
   @Test
-  public void testRunningApp() throws Exception {
+  void testRunningApp() throws Exception {
     YarnClient client = createCheckerWithMockedClient();
     YarnClient client = createCheckerWithMockedClient();
     ApplicationId id = ApplicationId.newInstance(1, 1);
     ApplicationId id = ApplicationId.newInstance(1, 1);
 
 

+ 25 - 24
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestSCMAdminProtocolService.java

@@ -18,36 +18,37 @@
 
 
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.when;
-
 import java.io.IOException;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.InetSocketAddress;
 
 
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RPC;
-import org.apache.hadoop.yarn.server.api.SCMAdminProtocol;
-import org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest;
-import org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse;
-import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.RunSharedCacheCleanerTaskResponsePBImpl;
 import org.apache.hadoop.yarn.client.SCMAdmin;
 import org.apache.hadoop.yarn.client.SCMAdmin;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.ipc.YarnRPC;
 import org.apache.hadoop.yarn.ipc.YarnRPC;
+import org.apache.hadoop.yarn.server.api.SCMAdminProtocol;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse;
+import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.RunSharedCacheCleanerTaskResponsePBImpl;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 
 /**
 /**
  * Basic unit tests for the SCM Admin Protocol Service and SCMAdmin.
  * Basic unit tests for the SCM Admin Protocol Service and SCMAdmin.
@@ -63,7 +64,7 @@ public class TestSCMAdminProtocolService {
   private final RecordFactory recordFactory = RecordFactoryProvider
   private final RecordFactory recordFactory = RecordFactoryProvider
       .getRecordFactory(null);
       .getRecordFactory(null);
 
 
-  @Before
+  @BeforeEach
   public void startUp() {
   public void startUp() {
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     conf.set(YarnConfiguration.SCM_STORE_CLASS,
     conf.set(YarnConfiguration.SCM_STORE_CLASS,
@@ -95,7 +96,7 @@ public class TestSCMAdminProtocolService {
     };
     };
   }
   }
 
 
-  @After
+  @AfterEach
   public void cleanUpTest() {
   public void cleanUpTest() {
     if (service != null) {
     if (service != null) {
       service.stop();
       service.stop();
@@ -107,18 +108,18 @@ public class TestSCMAdminProtocolService {
   }
   }
 
 
   @Test
   @Test
-  public void testRunCleanerTask() throws Exception {
+  void testRunCleanerTask() throws Exception {
     doNothing().when(cleaner).runCleanerTask();
     doNothing().when(cleaner).runCleanerTask();
     RunSharedCacheCleanerTaskRequest request =
     RunSharedCacheCleanerTaskRequest request =
         recordFactory.newRecordInstance(RunSharedCacheCleanerTaskRequest.class);
         recordFactory.newRecordInstance(RunSharedCacheCleanerTaskRequest.class);
     RunSharedCacheCleanerTaskResponse response = SCMAdminProxy.runCleanerTask(request);
     RunSharedCacheCleanerTaskResponse response = SCMAdminProxy.runCleanerTask(request);
-    Assert.assertTrue("cleaner task request isn't accepted", response.getAccepted());
+    assertTrue(response.getAccepted(), "cleaner task request isn't accepted");
     verify(service, times(1)).runCleanerTask(any(RunSharedCacheCleanerTaskRequest.class));
     verify(service, times(1)).runCleanerTask(any(RunSharedCacheCleanerTaskRequest.class));
   }
   }
 
 
   @Test
   @Test
-  public void testRunCleanerTaskCLI() throws Exception {
-    String[] args = { "-runCleanerTask" };
+  void testRunCleanerTaskCLI() throws Exception {
+    String[] args = {"-runCleanerTask"};
     RunSharedCacheCleanerTaskResponse rp =
     RunSharedCacheCleanerTaskResponse rp =
         new RunSharedCacheCleanerTaskResponsePBImpl();
         new RunSharedCacheCleanerTaskResponsePBImpl();
     rp.setAccepted(true);
     rp.setAccepted(true);

+ 28 - 24
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/TestSharedCacheUploaderService.java

@@ -18,17 +18,17 @@
 
 
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 package org.apache.hadoop.yarn.server.sharedcachemanager;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.spy;
-
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.InetSocketAddress;
 import java.util.Collection;
 import java.util.Collection;
 
 
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -41,11 +41,12 @@ import org.apache.hadoop.yarn.server.sharedcachemanager.metrics.SharedCacheUploa
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SharedCacheResourceReference;
 import org.apache.hadoop.yarn.server.sharedcachemanager.store.SharedCacheResourceReference;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.spy;
 
 
 
 
 /**
 /**
@@ -54,7 +55,7 @@ import org.junit.Test;
 public class TestSharedCacheUploaderService {
 public class TestSharedCacheUploaderService {
   private static File testDir = null;
   private static File testDir = null;
 
 
-  @BeforeClass
+  @BeforeAll
   public static void setupTestDirs() throws IOException {
   public static void setupTestDirs() throws IOException {
     testDir = new File("target",
     testDir = new File("target",
         TestSharedCacheUploaderService.class.getCanonicalName());
         TestSharedCacheUploaderService.class.getCanonicalName());
@@ -63,7 +64,7 @@ public class TestSharedCacheUploaderService {
     testDir = testDir.getAbsoluteFile();
     testDir = testDir.getAbsoluteFile();
   }
   }
 
 
-  @AfterClass
+  @AfterAll
   public static void cleanupTestDirs() throws IOException {
   public static void cleanupTestDirs() throws IOException {
     if (testDir != null) {
     if (testDir != null) {
       testDir.delete();
       testDir.delete();
@@ -76,7 +77,7 @@ public class TestSharedCacheUploaderService {
   private final RecordFactory recordFactory = RecordFactoryProvider
   private final RecordFactory recordFactory = RecordFactoryProvider
       .getRecordFactory(null);
       .getRecordFactory(null);
 
 
-  @Before
+  @BeforeEach
   public void startUp() {
   public void startUp() {
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     conf.set(YarnConfiguration.SCM_STORE_CLASS,
     conf.set(YarnConfiguration.SCM_STORE_CLASS,
@@ -103,7 +104,7 @@ public class TestSharedCacheUploaderService {
             SCMUploaderProtocol.class, scmAddress, conf);
             SCMUploaderProtocol.class, scmAddress, conf);
   }
   }
 
 
-  @After
+  @AfterEach
   public void cleanUp() {
   public void cleanUp() {
     if (store != null) {
     if (store != null) {
       store.stop();
       store.stop();
@@ -119,7 +120,7 @@ public class TestSharedCacheUploaderService {
   }
   }
 
 
   @Test
   @Test
-  public void testNotify_noEntry() throws Exception {
+  void testNotify_noEntry() throws Exception {
     long accepted =
     long accepted =
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads();
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads();
 
 
@@ -134,14 +135,15 @@ public class TestSharedCacheUploaderService {
     assertEquals(0, set.size());
     assertEquals(0, set.size());
 
 
     assertEquals(
     assertEquals(
-        "NM upload metrics aren't updated.", 1,
+        1,
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads() -
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads() -
-            accepted);
+            accepted,
+        "NM upload metrics aren't updated.");
 
 
   }
   }
 
 
   @Test
   @Test
-  public void testNotify_entryExists_differentName() throws Exception {
+  void testNotify_entryExists_differentName() throws Exception {
 
 
     long rejected =
     long rejected =
         SharedCacheUploaderMetrics.getInstance().getRejectUploads();
         SharedCacheUploaderMetrics.getInstance().getRejectUploads();
@@ -157,14 +159,15 @@ public class TestSharedCacheUploaderService {
     assertNotNull(set);
     assertNotNull(set);
     assertEquals(0, set.size());
     assertEquals(0, set.size());
     assertEquals(
     assertEquals(
-        "NM upload metrics aren't updated.", 1,
+        1,
         SharedCacheUploaderMetrics.getInstance().getRejectUploads() -
         SharedCacheUploaderMetrics.getInstance().getRejectUploads() -
-            rejected);
+            rejected,
+        "NM upload metrics aren't updated.");
 
 
   }
   }
 
 
   @Test
   @Test
-  public void testNotify_entryExists_sameName() throws Exception {
+  void testNotify_entryExists_sameName() throws Exception {
 
 
     long accepted =
     long accepted =
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads();
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads();
@@ -180,9 +183,10 @@ public class TestSharedCacheUploaderService {
     assertNotNull(set);
     assertNotNull(set);
     assertEquals(0, set.size());
     assertEquals(0, set.size());
     assertEquals(
     assertEquals(
-        "NM upload metrics aren't updated.", 1,
+        1,
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads() -
         SharedCacheUploaderMetrics.getInstance().getAcceptedUploads() -
-            accepted);
+            accepted,
+        "NM upload metrics aren't updated.");
 
 
   }
   }
 }
 }

+ 15 - 14
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/metrics/TestCleanerMetrics.java

@@ -17,24 +17,25 @@
  */
  */
 package org.apache.hadoop.yarn.server.sharedcachemanager.metrics;
 package org.apache.hadoop.yarn.server.sharedcachemanager.metrics;
 
 
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
-import org.junit.Before;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 
 public class TestCleanerMetrics {
 public class TestCleanerMetrics {
 
 
   Configuration conf = new Configuration();
   Configuration conf = new Configuration();
   CleanerMetrics cleanerMetrics;
   CleanerMetrics cleanerMetrics;
 
 
-  @Before
+  @BeforeEach
   public void init() {
   public void init() {
     cleanerMetrics = CleanerMetrics.getInstance();
     cleanerMetrics = CleanerMetrics.getInstance();
   }
   }
 
 
   @Test
   @Test
-  public void testMetricsOverMultiplePeriods() {
+  void testMetricsOverMultiplePeriods() {
     simulateACleanerRun();
     simulateACleanerRun();
     assertMetrics(4, 4, 1, 1);
     assertMetrics(4, 4, 1, 1);
     simulateACleanerRun();
     simulateACleanerRun();
@@ -51,14 +52,14 @@ public class TestCleanerMetrics {
 
 
   void assertMetrics(int proc, int totalProc, int del, int totalDel) {
   void assertMetrics(int proc, int totalProc, int del, int totalDel) {
     assertEquals(
     assertEquals(
-        "Processed files in the last period are not measured correctly", proc,
-        cleanerMetrics.getProcessedFiles());
-    assertEquals("Total processed files are not measured correctly",
-        totalProc, cleanerMetrics.getTotalProcessedFiles());
-    assertEquals(
-        "Deleted files in the last period are not measured correctly", del,
-        cleanerMetrics.getDeletedFiles());
-    assertEquals("Total deleted files are not measured correctly",
-        totalDel, cleanerMetrics.getTotalDeletedFiles());
+        proc,
+        cleanerMetrics.getProcessedFiles(),
+        "Processed files in the last period are not measured correctly");
+    assertEquals(totalProc, cleanerMetrics.getTotalProcessedFiles(),
+        "Total processed files are not measured correctly");
+    assertEquals(del, cleanerMetrics.getDeletedFiles(),
+        "Deleted files in the last period are not measured correctly");
+    assertEquals(totalDel, cleanerMetrics.getTotalDeletedFiles(),
+        "Total deleted files are not measured correctly");
   }
   }
 }
 }

+ 3 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/store/SCMStoreBaseTest.java

@@ -18,9 +18,10 @@
 
 
 package org.apache.hadoop.yarn.server.sharedcachemanager.store;
 package org.apache.hadoop.yarn.server.sharedcachemanager.store;
 
 
+import org.junit.jupiter.api.Test;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.hadoop.util.ReflectionUtils;
-import org.junit.Test;
 
 
 /**
 /**
  * All test classes that test an SCMStore implementation must extend this class.
  * All test classes that test an SCMStore implementation must extend this class.
@@ -33,7 +34,7 @@ public abstract class SCMStoreBaseTest {
   abstract Class<? extends SCMStore> getStoreClass();
   abstract Class<? extends SCMStore> getStoreClass();
 
 
   @Test
   @Test
-  public void TestZeroArgConstructor() throws Exception {
+  void TestZeroArgConstructor() throws Exception {
     // Test that the SCMStore implementation class is compatible with
     // Test that the SCMStore implementation class is compatible with
     // ReflectionUtils#newInstance
     // ReflectionUtils#newInstance
     ReflectionUtils.newInstance(getStoreClass(), new Configuration());
     ReflectionUtils.newInstance(getStoreClass(), new Configuration());

+ 27 - 26
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/test/java/org/apache/hadoop/yarn/server/sharedcachemanager/store/TestInMemorySCMStore.java

@@ -18,16 +18,6 @@
 
 
 package org.apache.hadoop.yarn.server.sharedcachemanager.store;
 package org.apache.hadoop.yarn.server.sharedcachemanager.store;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Collections;
@@ -41,6 +31,10 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.Future;
 
 
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FileSystem;
@@ -48,9 +42,16 @@ import org.apache.hadoop.util.concurrent.HadoopExecutors;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.server.sharedcachemanager.AppChecker;
 import org.apache.hadoop.yarn.server.sharedcachemanager.AppChecker;
 import org.apache.hadoop.yarn.server.sharedcachemanager.DummyAppChecker;
 import org.apache.hadoop.yarn.server.sharedcachemanager.DummyAppChecker;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
 
 
 public class TestInMemorySCMStore extends SCMStoreBaseTest {
 public class TestInMemorySCMStore extends SCMStoreBaseTest {
 
 
@@ -62,13 +63,13 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
     return InMemorySCMStore.class;
     return InMemorySCMStore.class;
   }
   }
 
 
-  @Before
+  @BeforeEach
   public void setup() {
   public void setup() {
     this.checker = spy(new DummyAppChecker());
     this.checker = spy(new DummyAppChecker());
     this.store = spy(new InMemorySCMStore(checker));
     this.store = spy(new InMemorySCMStore(checker));
   }
   }
 
 
-  @After
+  @AfterEach
   public void cleanup() {
   public void cleanup() {
     if (this.store != null) {
     if (this.store != null) {
       this.store.stop();
       this.store.stop();
@@ -117,7 +118,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testAddResourceConcurrency() throws Exception {
+  void testAddResourceConcurrency() throws Exception {
     startEmptyStore();
     startEmptyStore();
     final String key = "key1";
     final String key = "key1";
     int count = 5;
     int count = 5;
@@ -140,7 +141,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
     start.countDown();
     start.countDown();
     // check the result; they should all agree with the value
     // check the result; they should all agree with the value
     Set<String> results = new HashSet<String>();
     Set<String> results = new HashSet<String>();
-    for (Future<String> future: futures) {
+    for (Future<String> future : futures) {
       results.add(future.get());
       results.add(future.get());
     }
     }
     assertSame(1, results.size());
     assertSame(1, results.size());
@@ -148,7 +149,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testAddResourceRefNonExistentResource() throws Exception {
+  void testAddResourceRefNonExistentResource() throws Exception {
     startEmptyStore();
     startEmptyStore();
     String key = "key1";
     String key = "key1";
     ApplicationId id = createAppId(1, 1L);
     ApplicationId id = createAppId(1, 1L);
@@ -158,7 +159,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testRemoveResourceEmptyRefs() throws Exception {
+  void testRemoveResourceEmptyRefs() throws Exception {
     startEmptyStore();
     startEmptyStore();
     String key = "key1";
     String key = "key1";
     String fileName = "foo.jar";
     String fileName = "foo.jar";
@@ -169,7 +170,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testAddResourceRefRemoveResource() throws Exception {
+  void testAddResourceRefRemoveResource() throws Exception {
     startEmptyStore();
     startEmptyStore();
     String key = "key1";
     String key = "key1";
     ApplicationId id = createAppId(1, 1L);
     ApplicationId id = createAppId(1, 1L);
@@ -186,7 +187,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testAddResourceRefConcurrency() throws Exception {
+  void testAddResourceRefConcurrency() throws Exception {
     startEmptyStore();
     startEmptyStore();
     final String key = "key1";
     final String key = "key1";
     final String user = "user";
     final String user = "user";
@@ -215,7 +216,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
     start.countDown();
     start.countDown();
     // check the result
     // check the result
     Set<String> results = new HashSet<String>();
     Set<String> results = new HashSet<String>();
-    for (Future<String> future: futures) {
+    for (Future<String> future : futures) {
       results.add(future.get());
       results.add(future.get());
     }
     }
     // they should all have the same file name
     // they should all have the same file name
@@ -228,7 +229,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testAddResourceRefAddResourceConcurrency() throws Exception {
+  void testAddResourceRefAddResourceConcurrency() throws Exception {
     startEmptyStore();
     startEmptyStore();
     final String key = "key1";
     final String key = "key1";
     final String fileName = "foo.jar";
     final String fileName = "foo.jar";
@@ -265,7 +266,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testRemoveRef() throws Exception {
+  void testRemoveRef() throws Exception {
     startEmptyStore();
     startEmptyStore();
     String key = "key1";
     String key = "key1";
     String fileName = "foo.jar";
     String fileName = "foo.jar";
@@ -287,7 +288,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testBootstrapping() throws Exception {
+  void testBootstrapping() throws Exception {
     Map<String, String> initialCachedResources = startStoreWithResources();
     Map<String, String> initialCachedResources = startStoreWithResources();
     int count = initialCachedResources.size();
     int count = initialCachedResources.size();
     ApplicationId id = createAppId(1, 1L);
     ApplicationId id = createAppId(1, 1L);
@@ -306,7 +307,7 @@ public class TestInMemorySCMStore extends SCMStoreBaseTest {
   }
   }
 
 
   @Test
   @Test
-  public void testEvictableWithInitialApps() throws Exception {
+  void testEvictableWithInitialApps() throws Exception {
     startStoreWithApps();
     startStoreWithApps();
     assertFalse(store.isResourceEvictable("key", mock(FileStatus.class)));
     assertFalse(store.isResourceEvictable("key", mock(FileStatus.class)));
   }
   }