浏览代码

svn merge -c 1326668 from trunk. FIXES: HADOOP-8283. Allow tests to control token service value (Daryn Sharp via bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1326671 13f79535-47bb-0310-9956-ffa450edef68
Robert Joseph Evans 13 年之前
父节点
当前提交
15827811ac

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -30,6 +30,9 @@ Release 0.23.3 - UNRELEASED
     HADOOP-7510. Tokens should use original hostname provided instead of ip 
     HADOOP-7510. Tokens should use original hostname provided instead of ip 
     (Daryn Sharp via bobby)
     (Daryn Sharp via bobby)
 
 
+    HADOOP-8283. Allow tests to control token service value (Daryn Sharp via
+    bobby)
+
 Release 0.23.2 - UNRELEASED 
 Release 0.23.2 - UNRELEASED 
 
 
   NEW FEATURES
   NEW FEATURES

+ 30 - 0
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/SecurityUtilTestHelper.java

@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.hadoop.security;
+
+/** helper utils for tests */
+public class SecurityUtilTestHelper {
+  
+  /**
+   * Allow tests to change the resolver used for tokens
+   * @param flag boolean for whether token services use ips or hosts
+   */
+  public static void setTokenServiceUseIp(boolean flag) {
+    SecurityUtil.setTokenServiceUseIp(flag);
+  }
+}