Skip to content

Commit

Permalink
YARN-2517 patch 015: remove a test which was obsolete, but which didn…
Browse files Browse the repository at this point in the history
…'t show as it was broken. Fix up more javadocs
  • Loading branch information
steveloughran committed Nov 22, 2016
1 parent 5b1caa1 commit fa75b5e
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* <i>Each created instance will be returned initialized.</i>
* <p>
* That is, the service will have had <code>Service.init(conf)</code> applied
* to itpossibly 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
import java.util.Map;

/**
* Static methods to work with registry typesprimarily endpoints and the
* Static methods to work with registry types, primarily endpoints and the
* list representation of addresses.
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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<String, String> map(String key, String val) {
Map<String, String> map = new HashMap<String, String>(1);
Map<String, String> map = new HashMap<>(1);
map.put(key, val);
return map;
}

/**
* Create a URI
* Create a URI.
* @param uri value
* @return a 1 entry map.
*/
Expand All @@ -136,7 +136,7 @@ public static Map<String, String> 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.
Expand All @@ -149,7 +149,7 @@ public static Map<String, String> 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.
Expand All @@ -159,7 +159,7 @@ public static Map<String, String> 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
Expand All @@ -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
Expand All @@ -203,7 +203,7 @@ public static List<String> 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.
Expand All @@ -219,7 +219,7 @@ public static String getAddressField(Map<String, String> 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
Expand All @@ -241,7 +241,7 @@ public static List<URL> 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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ACL> digestACLs = new ArrayList<>();

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Methods/classes being invoked. This implies that:
* <ol>
* <li>There can only be one instance of a ZK client or service class
* in a single JVM else their configuration options will conflict.</li>
* in a single JVM -else their configuration options will conflict.</li>
* <li>It is safest to set these properties immediately before
* invoking ZK operations.</li>
* </ol>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* </ul>
*
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* <p>
* 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 <code>start</code>
* service to a parent that is already inited -as the <code>start</code>
* operation will then fail
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/**
* This is a set of static methods to aid testing the registry operations.
* The methods can be imported staticallyor 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 {
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}


}

0 comments on commit fa75b5e

Please sign in to comment.