Browse Source

Addendum for YARN-5648.

Varun Saxena 8 years ago
parent
commit
cb5d601b2e

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineV2ClientImpl.java

@@ -203,8 +203,8 @@ public class TimelineV2ClientImpl extends TimelineV2Client {
         .put(ClientResponse.class, obj);
   }
 
-  protected void putObjects(URI base, String path,
-      MultivaluedMap<String, String> params, Object obj)
+  protected void putObjects(final URI base, final String path,
+      final MultivaluedMap<String, String> params, final Object obj)
       throws IOException, YarnException {
     ClientResponse resp = null;
     try {

+ 15 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestRMNMSecretKeys.java

@@ -19,7 +19,11 @@
 package org.apache.hadoop.yarn.server;
 
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
 import java.util.UUID;
 
 import org.junit.AfterClass;
@@ -35,7 +39,6 @@ import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerResp
 import org.apache.hadoop.yarn.server.api.records.MasterKey;
 import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.kerby.util.IOUtil;
 import org.junit.Test;
 
 public class TestRMNMSecretKeys {
@@ -59,10 +62,20 @@ public class TestRMNMSecretKeys {
         "        kdc = localhost:88\n}\n" +
         "[domain_realm]\n" +
         "    localhost = APACHE.ORG";
-    IOUtil.writeFile(content, krb5ConfFile);
+    writeFile(content, krb5ConfFile);
     System.setProperty(KRB5_CONF, krb5ConfFile.getAbsolutePath());
   }
 
+  private static void writeFile(String content, File file) throws IOException {
+      FileOutputStream outputStream = new FileOutputStream(file);
+      FileChannel fc = outputStream.getChannel();
+
+      ByteBuffer buffer =
+          ByteBuffer.wrap(content.getBytes(StandardCharsets.UTF_8));
+      fc.write(buffer);
+      outputStream.close();
+  }
+
   @AfterClass
   public static void tearDown() throws IOException {
     KRB5_CONF_ROOT_DIR.delete();

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/security/TestTimelineAuthFilterForV2.java

@@ -243,10 +243,10 @@ public class TestTimelineAuthFilterForV2 {
 
   @Test
   public void testPutTimelineEntities() throws Exception {
-    ApplicationId appId = ApplicationId.newInstance(0, 1);
+    final ApplicationId appId = ApplicationId.newInstance(0, 1);
     auxService.addApplication(appId);
     final String entityType = "dummy_type";
-    File entityTypeDir = new File(TEST_ROOT_DIR.getAbsolutePath() +
+    final File entityTypeDir = new File(TEST_ROOT_DIR.getAbsolutePath() +
         File.separator + "entities" + File.separator +
         YarnConfiguration.DEFAULT_RM_CLUSTER_ID + File.separator + "test_user" +
         File.separator + "test_flow_name" + File.separator +