From fa75b5e6ee9e22fa77f96a788e2629aaf08e725c Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 12 Sep 2016 16:40:06 +0100 Subject: [PATCH] YARN-2517 patch 015: remove a test which was obsolete, but which didn't show as it was broken. Fix up more javadocs --- .../client/api/RegistryOperationsFactory.java | 2 +- .../client/binding/RegistryTypeUtils.java | 34 +++++++++---------- .../client/impl/zk/RegistrySecurity.java | 4 +-- .../impl/zk/ZookeeperConfigOptions.java | 2 +- .../registry/client/types/Endpoint.java | 2 +- .../registry/client/types/ProtocolTypes.java | 2 +- .../registry/client/types/package-info.java | 2 +- .../services/AddingCompositeService.java | 2 +- .../hadoop/registry/RegistryTestHelper.java | 8 ++--- .../secure/TestRegistrySecurityHelper.java | 19 ----------- 10 files changed, 29 insertions(+), 48 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/api/RegistryOperationsFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/api/RegistryOperationsFactory.java index 443654df37eb9..bd7756a5f679b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/api/RegistryOperationsFactory.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/api/RegistryOperationsFactory.java @@ -32,7 +32,7 @@ * Each created instance will be returned initialized. *

* That is, the service will have had Service.init(conf) applied - * to it —possibly after the configuration has been modified to + * to it, possibly after the configuration has been modified to * support the specific binding/security mechanism used */ public final class RegistryOperationsFactory { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java index ec59d5985a044..2bf4adcdecddc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java @@ -37,7 +37,7 @@ import java.util.Map; /** - * Static methods to work with registry types —primarily endpoints and the + * Static methods to work with registry types, primarily endpoints and the * list representation of addresses. */ @InterfaceAudience.Public @@ -45,7 +45,7 @@ public class RegistryTypeUtils { /** - * Create a URL endpoint from a list of URIs + * Create a URL endpoint from a list of URIs. * @param api implemented API * @param protocolType protocol type * @param uris URIs @@ -58,7 +58,7 @@ public static Endpoint urlEndpoint(String api, } /** - * Create a REST endpoint from a list of URIs + * Create a REST endpoint from a list of URIs. * @param api implemented API * @param uris URIs * @return a new endpoint @@ -69,7 +69,7 @@ public static Endpoint restEndpoint(String api, } /** - * Create a Web UI endpoint from a list of URIs + * Create a Web UI endpoint from a list of URIs. * @param api implemented API * @param uris URIs * @return a new endpoint @@ -80,7 +80,7 @@ public static Endpoint webEndpoint(String api, } /** - * Create an internet address endpoint from a list of URIs + * Create an internet address endpoint from a list of URIs. * @param api implemented API * @param protocolType protocol type * @param hostname hostname/FQDN @@ -102,7 +102,7 @@ public static Endpoint inetAddrEndpoint(String api, } /** - * Create an IPC endpoint + * Create an IPC endpoint. * @param api API * @param address the address as a tuple of (hostname, port) * @return the new endpoint @@ -115,19 +115,19 @@ public static Endpoint ipcEndpoint(String api, InetSocketAddress address) { } /** - * Create a single entry map + * Create a single entry map. * @param key map entry key * @param val map entry value * @return a 1 entry map. */ public static Map map(String key, String val) { - Map map = new HashMap(1); + Map map = new HashMap<>(1); map.put(key, val); return map; } /** - * Create a URI + * Create a URI. * @param uri value * @return a 1 entry map. */ @@ -136,7 +136,7 @@ public static Map uri(String uri) { } /** - * Create a (hostname, port) address pair + * Create a (hostname, port) address pair. * @param hostname hostname * @param port port * @return a 1 entry map. @@ -149,7 +149,7 @@ public static Map hostnamePortPair(String hostname, int port) { } /** - * Create a (hostname, port) address pair + * Create a (hostname, port) address pair. * @param address socket address whose hostname and port are used for the * generated address. * @return a 1 entry map. @@ -159,7 +159,7 @@ public static Map hostnamePortPair(InetSocketAddress address) { } /** - * Require a specific address type on an endpoint + * Require a specific address type on an endpoint. * @param required required type * @param epr endpoint * @throws InvalidRecordException if the type is wrong @@ -176,7 +176,7 @@ public static void requireAddressType(String required, Endpoint epr) throws } /** - * Get a single URI endpoint + * Get a single URI endpoint. * @param epr endpoint * @return the uri of the first entry in the address list. Null if the endpoint * itself is null @@ -203,7 +203,7 @@ public static List retrieveAddressesUriType(Endpoint epr) /** * Get a specific field from an address -raising an exception if - * the field is not present + * the field is not present. * @param address address to query * @param field field to resolve * @return the resolved value. Guaranteed to be non-null. @@ -219,7 +219,7 @@ public static String getAddressField(Map address, } /** - * Get the address URLs. Guranteed to return at least one address. + * Get the address URLs. Guaranteed to return at least one address. * @param epr endpoint * @return the address as a URL * @throws InvalidRecordException if the type is wrong, there are no addresses @@ -241,7 +241,7 @@ public static List retrieveAddressURLs(Endpoint epr) /** * Validate the record by checking for null fields and other invalid - * conditions + * conditions. * @param path path for exceptions * @param record record to validate. May be null * @throws InvalidRecordException on invalid entries @@ -270,7 +270,7 @@ public static void validateServiceRecord(String path, ServiceRecord record) /** * Validate the endpoint by checking for null fields and other invalid - * conditions + * conditions. * @param path path for exceptions * @param endpoint endpoint to validate. May be null * @throws InvalidRecordException on invalid entries diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java index 362350e9f7268..2aea43bb5ec99 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java @@ -156,7 +156,7 @@ private enum AccessPolicy { /** * A list of digest ACLs which can be added to permissions - * —and cleared later. + * and cleared later. */ private final List digestACLs = new ArrayList<>(); @@ -251,7 +251,7 @@ private void initSecurity() throws IOException { } } - // here check for UGI having secure on or digest + ID + // configure security access based on settings. switch (access) { case sasl: // secure + SASL => has to be authenticated diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/ZookeeperConfigOptions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/ZookeeperConfigOptions.java index acdf0aae8319d..7c5092af2188c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/ZookeeperConfigOptions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/ZookeeperConfigOptions.java @@ -29,7 +29,7 @@ * Methods/classes being invoked. This implies that: *

    *
  1. There can only be one instance of a ZK client or service class - * in a single JVM —else their configuration options will conflict.
  2. + * in a single JVM -else their configuration options will conflict. *
  3. It is safest to set these properties immediately before * invoking ZK operations.
  4. *
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/Endpoint.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/Endpoint.java index 9d9413c056a1a..f981d773c3c9a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/Endpoint.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/Endpoint.java @@ -140,7 +140,7 @@ public Endpoint(String api, * @param api API name * @param addressType address type * @param protocolType protocol type - * @param addr address. May be null —in which case it is not added + * @param addr address. May be null -in which case it is not added */ public Endpoint(String api, String addressType, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/ProtocolTypes.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/ProtocolTypes.java index b836b0003c7dc..98675262e2e3a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/ProtocolTypes.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/ProtocolTypes.java @@ -74,7 +74,7 @@ public interface ProtocolTypes { String PROTOCOL_UDP = "udp"; /** - * Default value —the protocol is unknown : "{@value}" + * Default value -the protocol is unknown : "{@value}" */ String PROTOCOL_UNKNOWN = ""; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/package-info.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/package-info.java index 1c926be00b6be..9838756d6bbfe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/package-info.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/package-info.java @@ -32,7 +32,7 @@ * * * The {@link org.apache.hadoop.registry.client.types.RegistryPathStatus} - * class is not saved to the registry —it is the status of a registry + * class is not saved to the registry -it is the status of a registry * entry that can be retrieved from the API call. It is still * designed to be marshalled to and from JSON, as it can be served up * from REST front ends to the registry. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/AddingCompositeService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/AddingCompositeService.java index 9faede49dc565..2c9045e34ba44 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/AddingCompositeService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/AddingCompositeService.java @@ -31,7 +31,7 @@ *

* It is essential that any service added is in a state where it can be moved * on with that of the parent services. Specifically, do not add an uninited - * service to a parent that is already inited —as the start + * service to a parent that is already inited -as the start * operation will then fail * */ diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/RegistryTestHelper.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/RegistryTestHelper.java index 35767a20aca32..1bac93267cd02 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/RegistryTestHelper.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/RegistryTestHelper.java @@ -49,7 +49,7 @@ /** * This is a set of static methods to aid testing the registry operations. - * The methods can be imported statically —or the class used as a base + * The methods can be imported statically, or the class used as a base * class for tests. */ public class RegistryTestHelper extends Assert { @@ -207,7 +207,7 @@ public static void assertMatches(ServiceRecord source, ServiceRecord resolved) { } /** - * Find an endpoint in a record or fail, + * Find an endpoint in a record or fail. * @param record record * @param api API * @param external external? @@ -237,7 +237,7 @@ public static Endpoint findEndpoint(ServiceRecord record, } /** - * Log a record + * Log a record. * @param name record name * @param record details * @throws IOException only if something bizarre goes wrong marshalling @@ -324,7 +324,7 @@ public static LoginContext logout(LoginContext login) { * @param user username * @param keytab keytab to list * @return the UGI - * @throws IOException + * @throws IOException login failure. */ public static UserGroupInformation loginUGI(String user, File keytab) throws IOException { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestRegistrySecurityHelper.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestRegistrySecurityHelper.java index 06e1df71ddded..0c21ea0cfc329 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestRegistrySecurityHelper.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestRegistrySecurityHelper.java @@ -190,23 +190,4 @@ public void testUGIProperties() throws Throwable { LOG.info("User {} has ACL {}", user, acl); } - - @Test - public void testSecurityImpliesKerberos() throws Throwable { - Configuration conf = new Configuration(); - conf.setBoolean("hadoop.security.authentication", true); - conf.setBoolean(KEY_REGISTRY_SECURE, true); - conf.set(KEY_REGISTRY_KERBEROS_REALM, "KERBEROS"); - ; - try(RegistrySecurity security = new RegistrySecurity("registry security")) { - security.init(conf); - fail("Expected an initialization failure in " + security); - } catch (Exception e) { - assertTrue( - "did not find "+ RegistrySecurity.E_NO_KERBEROS + " in " + e, - e.toString().contains(RegistrySecurity.E_NO_KERBEROS)); - } - } - - }