You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2015/05/29 12:42:40 UTC

[1/4] incubator-slider git commit: SLIDER-878 move AMWebClient to using BaseRestClient for its REST operations. This drops the http/https logic

Repository: incubator-slider
Updated Branches:
  refs/heads/develop ed7b52eab -> 92b299a6d


SLIDER-878 move AMWebClient to using BaseRestClient for its REST operations. This drops the http/https logic


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/e95d516a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/e95d516a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/e95d516a

Branch: refs/heads/develop
Commit: e95d516a336ad1a09418559733cd6d8ee8f16a2e
Parents: 6263573
Author: Steve Loughran <st...@apache.org>
Authored: Thu May 21 21:57:33 2015 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Thu May 21 21:57:33 2015 +0100

----------------------------------------------------------------------
 .../funtest/accumulo/AccumuloBasicIT.groovy     |  4 +-
 .../org/apache/slider/client/SliderClient.java  |  8 ++--
 .../slider/client/rest/BaseRestClient.java      | 19 ++-------
 .../core/registry/retrieve/AMWebClient.java     | 27 ++++++++-----
 .../registry/retrieve/RegistryRetriever.java    | 14 +++----
 .../core/restclient/UgiJerseyBinding.java       | 42 ++++++++++++++++----
 .../TestStandaloneYarnRegistryAM.groovy         |  2 +-
 7 files changed, 67 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e95d516a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
index f0504e4..56014d7 100644
--- a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
+++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
@@ -174,7 +174,9 @@ class AccumuloBasicIT extends AccumuloAgentCommandTestBase {
       SliderKeys.APP_TYPE,
       clusterName);
     ServiceRecord instance = sliderClient.resolve(path)
-    RegistryRetriever retriever = new RegistryRetriever(instance)
+    RegistryRetriever retriever = new RegistryRetriever(
+        sliderClient.config,
+        instance)
     PublishedConfiguration configuration = retriever.retrieveConfiguration(
       retriever.getConfigurations(true), exportName, true)
     return configuration

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e95d516a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 98f1344..4380173 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -3937,7 +3937,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
 
     ServiceRecord instance = lookupServiceRecord(registryArgs);
 
-    RegistryRetriever retriever = new RegistryRetriever(instance);
+    RegistryRetriever retriever = new RegistryRetriever(getConfig(), instance);
     PublishedConfigSet configurations =
         retriever.getConfigurations(!registryArgs.internal);
     PrintStream out = null;
@@ -3977,7 +3977,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       throws YarnException, IOException {
     ServiceRecord instance = lookupServiceRecord(registryArgs);
 
-    RegistryRetriever retriever = new RegistryRetriever(instance);
+    RegistryRetriever retriever = new RegistryRetriever(getConfig(), instance);
     PublishedExportsSet exports =
         retriever.getExports(!registryArgs.internal);
     PrintStream out = null;
@@ -4025,7 +4025,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       throws YarnException, IOException {
     ServiceRecord instance = lookupServiceRecord(registryArgs);
 
-    RegistryRetriever retriever = new RegistryRetriever(instance);
+    RegistryRetriever retriever = new RegistryRetriever(getConfig(), instance);
     boolean external = !registryArgs.internal;
     PublishedConfigSet configurations =
         retriever.getConfigurations(external);
@@ -4050,7 +4050,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       throws YarnException, IOException {
     ServiceRecord instance = lookupServiceRecord(registryArgs);
 
-    RegistryRetriever retriever = new RegistryRetriever(instance);
+    RegistryRetriever retriever = new RegistryRetriever(getConfig(), instance);
     boolean external = !registryArgs.internal;
     PublishedExportsSet exports =
         retriever.getExports(external);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e95d516a/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
index b0e64ac..856fe4e 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
@@ -119,7 +119,7 @@ public class BaseRestClient  {
    * @param u the URI of the resource.
    * @return the Web resource.
    */
-  protected WebResource resource(URI u) {
+  public WebResource resource(URI u) {
     return client.resource(u);
   }
 
@@ -130,21 +130,8 @@ public class BaseRestClient  {
    * @return the Web resource.
    */
 
-  protected WebResource resource(String url) {
-    WebResource resource = client.resource(url);
-    return resource;
+  public WebResource resource(String url) {
+    return client.resource(url);
   }
 
-  protected WebResource jsonResource(String url) {
-    WebResource resource = resource(url);
-    resource.type(MediaType.APPLICATION_JSON);
-    return resource;
-  }
-
-
-  protected WebResource jsonResource(URI u) {
-    WebResource resource = resource(u);
-    resource.type(MediaType.APPLICATION_JSON);
-    return resource;
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e95d516a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
index dd9af16..c6f0fe0 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
@@ -27,6 +27,8 @@ import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory;
 import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.ssl.SSLFactory;
+import org.apache.slider.client.rest.BaseRestClient;
+import org.apache.slider.core.restclient.UgiJerseyBinding;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,10 +47,14 @@ import java.net.URL;
  * the redirection and security logic properly
  */
 public class AMWebClient {
-  private static final Client client;
+
+
+  private Client client;
+  private BaseRestClient restClient;
   private static final Logger
       log = LoggerFactory.getLogger(AMWebClient.class);
 
+/*
 
   static {
     ClientConfig clientConfig = new DefaultClientConfig();
@@ -62,15 +68,17 @@ public class AMWebClient {
     client = new Client(handler, clientConfig);
     client.setFollowRedirects(true);
   }
+*/
+
+  public AMWebClient(Configuration conf) {
+    UgiJerseyBinding binding = new UgiJerseyBinding(conf);
+    client = binding.createJerseyClient();
+
+    restClient = new BaseRestClient(client);
 
-  /**
-   * Get the Jersey Client
-   * @return the client
-   */
-  public static Client getClient() {
-    return client;
   }
 
+
   private static URLConnectionClientHandler getUrlConnectionClientHandler() {
     return new URLConnectionClientHandler(new HttpURLConnectionFactory() {
       @Override
@@ -107,7 +115,7 @@ public class AMWebClient {
             c.setHostnameVerifier(hv);
           } catch (Exception e) {
             log.info("Unable to configure HTTPS connection from "
-                     + "configuration.  Leveraging JDK properties.");
+                     + "configuration.  Using JDK properties.");
           }
 
         }
@@ -117,8 +125,7 @@ public class AMWebClient {
   }
 
   public WebResource resource(String url) {
-    WebResource resource = client.resource(url);
-    return resource;
+    return restClient.resource(url);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e95d516a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
index 6c665a2..03564fa 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
@@ -21,6 +21,7 @@ package org.apache.slider.core.registry.retrieve;
 import com.beust.jcommander.Strings;
 import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.client.WebResource;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.registry.client.exceptions.RegistryIOException;
 import org.apache.hadoop.registry.client.types.ServiceRecord;
 import static org.apache.slider.client.ClientRegistryBinder.*;
@@ -50,23 +51,18 @@ public class RegistryRetriever extends AMWebClient {
   private final String externalExportsURL;
   private final String internalExportsURL;
 
-  public RegistryRetriever(String externalConfigurationURL, String internalConfigurationURL,
-                           String externalExportsURL, String internalExportsURL) {
-    this.externalConfigurationURL = externalConfigurationURL;
-    this.internalConfigurationURL = internalConfigurationURL;
-    this.externalExportsURL = externalExportsURL;
-    this.internalExportsURL = internalExportsURL;
-  }
-
   /**
    * Retrieve from a service by locating the
    * exported {@link CustomRegistryConstants#PUBLISHER_CONFIGURATIONS_API}
    * and working off it.
+   *
+   * @param conf
    * @param record service record
    * @throws RegistryIOException the address type of the endpoint does
    * not match that expected (i.e. not a list of URLs), missing endpoint...
    */
-  public RegistryRetriever(ServiceRecord record) throws RegistryIOException {
+  public RegistryRetriever(Configuration conf, ServiceRecord record) throws RegistryIOException {
+    super(new Configuration());
     externalConfigurationURL = lookupRestAPI(record,
         PUBLISHER_CONFIGURATIONS_API, true);
     internalConfigurationURL = lookupRestAPI(record,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e95d516a/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java b/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
index d19c621..bf71861 100644
--- a/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
+++ b/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
@@ -19,23 +19,19 @@
 package org.apache.slider.core.restclient;
 
 import com.google.common.base.Preconditions;
-import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.Client;
 import com.sun.jersey.api.client.UniformInterfaceException;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.json.JSONConfiguration;
 import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory;
 import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.PathAccessDeniedException;
-import org.apache.hadoop.fs.PathIOException;
-import org.apache.hadoop.fs.PathNotFoundException;
 import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.hadoop.yarn.webapp.ForbiddenException;
-import org.apache.hadoop.yarn.webapp.NotFoundException;
 import org.apache.slider.core.exceptions.ExceptionConverter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.URL;
@@ -123,6 +119,36 @@ public class UgiJerseyBinding implements
     return ExceptionConverter.convertJerseyException(verb.getVerb(),
         url, ex);
   }
+
+  /**
+   * Create the standard Jersey client Config
+   * @return the recommended Jersey Client config
+   */
+  public ClientConfig createJerseyClientConfig() {
+    ClientConfig clientConfig = new DefaultClientConfig();
+    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
+    return clientConfig;
+  }
+
+  /**
+   * Create a jersey client bonded to this handler, using the
+   * supplied client config
+   * @param clientConfig client configuratin
+   * @return a new client instance to use
+   */
+  public Client createJerseyClient(ClientConfig clientConfig) {
+    return new Client(getHandler(), clientConfig);
+  }
+
+  /**
+   * Create a jersey client bonded to this handler, using the
+   * client config created with {@link #createJerseyClientConfig()}
+   * @return a new client instance to use
+   */
+  public Client createJerseyClient() {
+    return createJerseyClient(createJerseyClientConfig());
+  }
+
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e95d516a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
index 62a8c40..139860a 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
@@ -357,7 +357,7 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase {
     describe "Registry Retrieval Class"
     // retrieval
 
-    RegistryRetriever retriever = new RegistryRetriever(serviceRecord)
+    RegistryRetriever retriever = new RegistryRetriever(launcher.configuration, serviceRecord)
     log.info retriever.toString()
     
     assert retriever.hasConfigurations(true)


[2/4] incubator-slider git commit: SLIDER-878 complete move to BaseRestClient; add shortcut for the get operation there

Posted by st...@apache.org.
SLIDER-878 complete move to BaseRestClient; add shortcut for the get operation there


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/8ceddfd7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/8ceddfd7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/8ceddfd7

Branch: refs/heads/develop
Commit: 8ceddfd7e8e2392cd121adc5dd8aab4993166e4a
Parents: e95d516
Author: Steve Loughran <st...@apache.org>
Authored: Thu May 21 22:12:18 2015 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Thu May 21 22:12:18 2015 +0100

----------------------------------------------------------------------
 .../slider/client/rest/BaseRestClient.java      | 15 +++++
 .../core/registry/retrieve/AMWebClient.java     | 65 ++++++++++++++------
 .../registry/retrieve/RegistryRetriever.java    | 45 +++-----------
 3 files changed, 71 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8ceddfd7/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
index 856fe4e..d936a22 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
@@ -75,6 +75,7 @@ public class BaseRestClient  {
       throws IOException {
     try {
       Preconditions.checkArgument(c != null);
+      log.debug("{}} {}", method, resource.getURI());
       return resource.accept(MediaType.APPLICATION_JSON_TYPE)
               .method(method.getVerb(), c);
     } catch (ClientHandlerException ex) {
@@ -101,6 +102,7 @@ public class BaseRestClient  {
       throws IOException {
     try {
       Preconditions.checkArgument(t != null);
+      log.debug("{}} {}", method, resource.getURI());
       resource.accept(MediaType.APPLICATION_JSON_TYPE);
       return resource.method(method.getVerb(), t);
     } catch (ClientHandlerException ex) {
@@ -113,6 +115,19 @@ public class BaseRestClient  {
     }
   }
 
+
+  /**
+   * Execute the  GET operation. Failures are raised as IOException subclasses
+   * @param resource resource to work against
+   * @param c class to build
+   * @param <T> type expected
+   * @return an instance of the type T
+   * @throws IOException on any failure
+   */
+  public <T> T get(WebResource resource, Class<T> c) throws IOException {
+    return exec(HttpVerb.GET, resource, c);
+  }
+
   /**
    * Create a Web resource from the client.
    *

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8ceddfd7/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
index c6f0fe0..40fa217 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
@@ -19,6 +19,7 @@
 package org.apache.slider.core.registry.retrieve;
 
 import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.GenericType;
 import com.sun.jersey.api.client.WebResource;
 import com.sun.jersey.api.client.config.ClientConfig;
 import com.sun.jersey.api.client.config.DefaultClientConfig;
@@ -28,6 +29,7 @@ import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.ssl.SSLFactory;
 import org.apache.slider.client.rest.BaseRestClient;
+import org.apache.slider.core.restclient.HttpVerb;
 import org.apache.slider.core.restclient.UgiJerseyBinding;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,32 +51,15 @@ import java.net.URL;
 public class AMWebClient {
 
 
-  private Client client;
-  private BaseRestClient restClient;
+  private final BaseRestClient restClient;
   private static final Logger
       log = LoggerFactory.getLogger(AMWebClient.class);
 
-/*
-
-  static {
-    ClientConfig clientConfig = new DefaultClientConfig();
-    clientConfig.getFeatures().put(
-        JSONConfiguration.FEATURE_POJO_MAPPING,
-        Boolean.TRUE);
-    clientConfig.getProperties().put(
-        URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND,
-        true);
-    URLConnectionClientHandler handler = getUrlConnectionClientHandler();
-    client = new Client(handler, clientConfig);
-    client.setFollowRedirects(true);
-  }
-*/
 
   public AMWebClient(Configuration conf) {
     UgiJerseyBinding binding = new UgiJerseyBinding(conf);
-    client = binding.createJerseyClient();
 
-    restClient = new BaseRestClient(client);
+    restClient = new BaseRestClient(binding.createJerseyClient());
 
   }
 
@@ -128,4 +113,46 @@ public class AMWebClient {
     return restClient.resource(url);
   }
 
+  public BaseRestClient getRestClient() {
+    return restClient;
+  }
+
+  /**
+   * Execute the operation. Failures are raised as IOException subclasses
+   * @param method method to execute
+   * @param resource resource to work against
+   * @param c class to build
+   * @param <T> type expected
+   * @return an instance of the type T
+   * @throws IOException on any failure
+   */
+  public <T> T exec(HttpVerb method, WebResource resource, Class<T> c) throws IOException {
+    return restClient.exec(method, resource, c);
+  }
+
+  /**
+   * Execute the operation. Failures are raised as IOException subclasses
+   * @param method method to execute
+   * @param resource resource to work against
+   * @param t type to work with
+   * @param <T> type expected
+   * @return an instance of the type T
+   * @throws IOException on any failure
+   */
+  public <T> T exec(HttpVerb method, WebResource resource, GenericType<T> t)
+      throws IOException {
+    return restClient.exec(method, resource, t);
+  }
+
+  /**
+   * Execute the  GET operation. Failures are raised as IOException subclasses
+   * @param resource resource to work against
+   * @param c class to build
+   * @param <T> type expected
+   * @return an instance of the type T
+   * @throws IOException on any failure
+   */
+  public <T> T get(WebResource resource, Class<T> c) throws IOException {
+    return restClient.get(resource, c);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8ceddfd7/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
index 03564fa..b0eddb8 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
@@ -53,16 +53,16 @@ public class RegistryRetriever extends AMWebClient {
 
   /**
    * Retrieve from a service by locating the
-   * exported {@link CustomRegistryConstants#PUBLISHER_CONFIGURATIONS_API}
+   * exported {@link CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API}
    * and working off it.
    *
-   * @param conf
+   * @param conf configuration to work from
    * @param record service record
    * @throws RegistryIOException the address type of the endpoint does
    * not match that expected (i.e. not a list of URLs), missing endpoint...
    */
   public RegistryRetriever(Configuration conf, ServiceRecord record) throws RegistryIOException {
-    super(new Configuration());
+    super(conf);
     externalConfigurationURL = lookupRestAPI(record,
         PUBLISHER_CONFIGURATIONS_API, true);
     internalConfigurationURL = lookupRestAPI(record,
@@ -92,14 +92,8 @@ public class RegistryRetriever extends AMWebClient {
       FileNotFoundException, IOException {
 
     String confURL = getConfigurationURL(external);
-    try {
       WebResource webResource = resource(confURL);
-      log.debug("GET {}", confURL);
-      PublishedConfigSet configSet = webResource.get(PublishedConfigSet.class);
-      return configSet;
-    } catch (UniformInterfaceException e) {
-      throw ExceptionConverter.convertJerseyException("GET", confURL, e);
-    }
+    return get(webResource, PublishedConfigSet.class);
   }
 
   protected String getConfigurationURL(boolean external) throws FileNotFoundException {
@@ -127,14 +121,8 @@ public class RegistryRetriever extends AMWebClient {
       FileNotFoundException, IOException {
 
     String exportsUrl = getExportURL(external);
-    try {
-      WebResource webResource = resource(exportsUrl);
-      log.debug("GET {}", exportsUrl);
-      PublishedExportsSet exportSet = webResource.get(PublishedExportsSet.class);
-      return exportSet;
-    } catch (UniformInterfaceException e) {
-      throw ExceptionConverter.convertJerseyException("GET", exportsUrl, e);
-    }
+    WebResource webResource = resource(exportsUrl);
+    return get(webResource, PublishedExportsSet.class);
   }
 
 
@@ -154,14 +142,8 @@ public class RegistryRetriever extends AMWebClient {
       throw new FileNotFoundException("Unknown configuration " + name);
     }
     confURL = SliderUtils.appendToURL(confURL, name);
-    try {
-      WebResource webResource = resource(confURL);
-      PublishedConfiguration publishedConf =
-          webResource.get(PublishedConfiguration.class);
-      return publishedConf;
-    } catch (UniformInterfaceException e) {
-      throw ExceptionConverter.convertJerseyException("GET", confURL, e);
-    }
+    WebResource webResource = resource(confURL);
+    return get(webResource, PublishedConfiguration.class);
   }
 
   /**
@@ -180,15 +162,8 @@ public class RegistryRetriever extends AMWebClient {
     }
     String exportsURL = getExportURL(external);
     exportsURL = SliderUtils.appendToURL(exportsURL, name);
-    try {
-      WebResource webResource = resource(exportsURL);
-      PublishedExports publishedExports =
-          webResource.get(PublishedExports.class);
-      return publishedExports;
-    } catch (UniformInterfaceException e) {
-      throw ExceptionConverter.convertJerseyException("GET", exportsURL, e);
-    }
-  }
+    return get(resource(exportsURL), PublishedExports.class);
+ }
 
   @Override
   public String toString() {


[3/4] incubator-slider git commit: SLIDER-886 TestZKIntegration.testListUserClustersWithTwoCluster failing

Posted by st...@apache.org.
SLIDER-886 TestZKIntegration.testListUserClustersWithTwoCluster failing


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/2263663e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/2263663e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/2263663e

Branch: refs/heads/develop
Commit: 2263663e20eb97e85cb31e9c1d57c57b5cc006bb
Parents: 8ceddfd
Author: Steve Loughran <st...@apache.org>
Authored: Fri May 29 11:41:54 2015 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Fri May 29 11:41:54 2015 +0100

----------------------------------------------------------------------
 .../groovy/org/apache/slider/common/tools/TestZKIntegration.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2263663e/slider-core/src/test/groovy/org/apache/slider/common/tools/TestZKIntegration.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/common/tools/TestZKIntegration.groovy b/slider-core/src/test/groovy/org/apache/slider/common/tools/TestZKIntegration.groovy
index 431c49f..d8dbfcd 100644
--- a/slider-core/src/test/groovy/org/apache/slider/common/tools/TestZKIntegration.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/common/tools/TestZKIntegration.groovy
@@ -99,7 +99,7 @@ class TestZKIntegration extends YarnZKMiniClusterTestBase implements KeysForTest
     log.info("Ephemeral path $c2")
     List<String> clusters = zki.clusters
     assert clusters.size() == 2
-    assert (c1.endsWith(clusters[0]) && c1.endsWith(clusters[1])) ||
+    assert (c1.endsWith(clusters[0]) && c2.endsWith(clusters[1])) ||
            (c1.endsWith(clusters[1]) && c2.endsWith(clusters[0]))
   }
 


[4/4] incubator-slider git commit: Merge branch 'feature/SLIDER-878-jersey-jdk8' into develop

Posted by st...@apache.org.
Merge branch 'feature/SLIDER-878-jersey-jdk8' into develop


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/92b299a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/92b299a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/92b299a6

Branch: refs/heads/develop
Commit: 92b299a6da699fa8cbaf60c5f74d7c9d42bd4ec3
Parents: ed7b52e 2263663
Author: Steve Loughran <st...@apache.org>
Authored: Fri May 29 11:42:26 2015 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Fri May 29 11:42:26 2015 +0100

----------------------------------------------------------------------
 .../funtest/accumulo/AccumuloBasicIT.groovy     |  4 +-
 .../org/apache/slider/client/SliderClient.java  |  8 +-
 .../slider/client/rest/BaseRestClient.java      | 34 +++++----
 .../core/registry/retrieve/AMWebClient.java     | 78 ++++++++++++++------
 .../registry/retrieve/RegistryRetriever.java    | 55 ++++----------
 .../core/restclient/UgiJerseyBinding.java       | 42 +++++++++--
 .../TestStandaloneYarnRegistryAM.groovy         |  2 +-
 .../common/tools/TestZKIntegration.groovy       |  2 +-
 8 files changed, 130 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/92b299a6/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------