|
@@ -19,7 +19,11 @@
|
|
package org.apache.hadoop.yarn.server;
|
|
package org.apache.hadoop.yarn.server;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.nio.ByteBuffer;
|
|
|
|
+import java.nio.channels.FileChannel;
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
import org.junit.AfterClass;
|
|
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.api.records.MasterKey;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
|
-import org.apache.kerby.util.IOUtil;
|
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
|
|
|
public class TestRMNMSecretKeys {
|
|
public class TestRMNMSecretKeys {
|
|
@@ -59,10 +62,20 @@ public class TestRMNMSecretKeys {
|
|
" kdc = localhost:88\n}\n" +
|
|
" kdc = localhost:88\n}\n" +
|
|
"[domain_realm]\n" +
|
|
"[domain_realm]\n" +
|
|
" localhost = APACHE.ORG";
|
|
" localhost = APACHE.ORG";
|
|
- IOUtil.writeFile(content, krb5ConfFile);
|
|
|
|
|
|
+ writeFile(content, krb5ConfFile);
|
|
System.setProperty(KRB5_CONF, krb5ConfFile.getAbsolutePath());
|
|
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
|
|
@AfterClass
|
|
public static void tearDown() throws IOException {
|
|
public static void tearDown() throws IOException {
|
|
KRB5_CONF_ROOT_DIR.delete();
|
|
KRB5_CONF_ROOT_DIR.delete();
|