You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by jm...@apache.org on 2014/06/11 00:34:14 UTC
git commit: SLIDER-88 Add class path reporting REST resource
Repository: incubator-slider
Updated Branches:
refs/heads/develop 8c3dddb3a -> 71aef45ba
SLIDER-88 Add class path reporting REST resource
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/71aef45b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/71aef45b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/71aef45b
Branch: refs/heads/develop
Commit: 71aef45ba81065269355d38a60c0e9465ee5867a
Parents: 8c3dddb
Author: Jon Maron <jm...@hortonworks.com>
Authored: Tue Jun 10 15:33:31 2014 -0700
Committer: Jon Maron <jm...@hortonworks.com>
Committed: Tue Jun 10 15:33:31 2014 -0700
----------------------------------------------------------------------
.../slider/server/appmaster/web/rest/RestPaths.java | 2 ++
.../web/rest/publisher/PublisherResource.java | 14 ++++++++++++++
.../rest/publisher/TestPublisherRestResources.groovy | 12 ++++++++++++
3 files changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/71aef45b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java
index fed8afe..d55635f 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java
@@ -56,4 +56,6 @@ public class RestPaths {
= "[a-z0-9][a-z0-9_.\\+-]*";
public static final String SLIDER_CONFIGSET = "slider";
+
+ public static final String SLIDER_CLASSPATH = "classpath";
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/71aef45b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
index e6b2664..a439d9b 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
@@ -38,8 +38,14 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Set;
import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
@@ -100,6 +106,14 @@ public class PublisherResource {
}
@GET
+ @Path("/classpath")
+ @Produces({MediaType.APPLICATION_JSON})
+ public Set<URL> getAMClassPath() {
+ URL[] urls = ((URLClassLoader) getClass().getClassLoader()).getURLs();
+ return new LinkedHashSet<>(Arrays.asList(urls));
+ }
+
+ @GET
@Path("/"+ SET_NAME)
@Produces({MediaType.APPLICATION_JSON})
public PublishedConfigSet getPublishedConfiguration(
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/71aef45b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy
index bc7c79a..1309e57 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy
@@ -130,6 +130,18 @@ class TestPublisherRestResources extends AgentTestBase {
response = webResource.type(MediaType.TEXT_PLAIN).get(ClientResponse.class);
assert 404 == response.status
+ String classpathUri = publisher_url +"/"+ RestPaths.SLIDER_CLASSPATH
+ webResource = client.resource(classpathUri)
+ Set uris = webResource.type(MediaType.APPLICATION_JSON)
+ .get(Set.class)
+ assert uris.size() > 0
+ log.info("Classpath URIs: {}", uris)
+ // check for some expected classpath elements
+ assert uris.any {it =~ /curator-x-discovery/}
+ assert uris.any {it =~ /hadoop-yarn-api/}
+ assert uris.any {it =~ /hadoop-hdfs/}
+ // and a negative test...
+ assert !uris.any {it =~ /foo-bar/}
}
}