SLIDER-151 renaming PingResource PingInformation, as it is the payload, not the 
actual URL


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

Branch: refs/heads/develop
Commit: 07909f8297f10f66a02cdda6f99047e3d61511da
Parents: 500aa3d
Author: Steve Loughran <[email protected]>
Authored: Tue Feb 3 21:12:58 2015 +0000
Committer: Steve Loughran <[email protected]>
Committed: Tue Feb 3 21:13:40 2015 +0000

----------------------------------------------------------------------
 .../slider/api/types/PingInformation.java       | 47 ++++++++++++++++++++
 .../apache/slider/api/types/PingResource.java   | 47 --------------------
 .../client/rest/SliderApplicationApi.java       |  4 +-
 .../client/rest/SliderApplicationApiClient.java | 12 ++---
 .../rest/application/ApplicationResource.java   | 10 ++---
 .../application/actions/RestActionPing.java     | 18 ++++----
 .../agent/rest/JerseyTestDelegates.groovy       | 14 +++---
 .../agent/rest/LowLevelRestTestDelegates.groovy |  8 ++--
 8 files changed, 80 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java 
b/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
new file mode 100644
index 0000000..223edca
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
@@ -0,0 +1,47 @@
+/*
+ * 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.slider.api.types;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * Serialized information to/from Ping operations
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PingInformation {
+  public long time;
+  public String text;
+  public String verb;
+  public String body;
+
+  @Override
+  public String toString() {
+    
+    final StringBuilder sb =
+        new StringBuilder("PingResource{");
+    sb.append("time=").append(time);
+    sb.append(", verb=").append(verb);
+    sb.append(", text='").append(text).append('\'');
+    sb.append(", body='").append(body).append('\'');
+    sb.append('}');
+    return sb.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/main/java/org/apache/slider/api/types/PingResource.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/api/types/PingResource.java 
b/slider-core/src/main/java/org/apache/slider/api/types/PingResource.java
deleted file mode 100644
index 2a57ae0..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/PingResource.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serialized information to/from Ping operations
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PingResource {
-  public long time;
-  public String text;
-  public String verb;
-  public String body;
-
-  @Override
-  public String toString() {
-    
-    final StringBuilder sb =
-        new StringBuilder("PingResource{");
-    sb.append("time=").append(time);
-    sb.append(", verb=").append(verb);
-    sb.append(", text='").append(text).append('\'');
-    sb.append(", body='").append(body).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
 
b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
index eec201b..f284075 100644
--- 
a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
+++ 
b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
@@ -21,7 +21,7 @@ package org.apache.slider.client.rest;
 import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.PingResource;
+import org.apache.slider.api.types.PingInformation;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTreeOperations;
 
@@ -127,7 +127,7 @@ public interface SliderApplicationApi {
    * @return the response
    * @throws IOException on any failure
    */
-  PingResource ping(String text) throws IOException;
+  PingInformation ping(String text) throws IOException;
 
   /**
    * Stop the AM (async operation)

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
 
b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
index 810c9a9..8c920d5 100644
--- 
a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
+++ 
b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
@@ -31,7 +31,7 @@ import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.conf.ConfTreeOperations;
 import org.apache.slider.core.restclient.HttpVerb;
-import org.apache.slider.api.types.PingResource;
+import org.apache.slider.api.types.PingInformation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -211,7 +211,7 @@ public class SliderApplicationApiClient extends 
BaseRestClient
   }
 
   @Override
-  public PingResource ping(String text) throws IOException {
+  public PingInformation ping(String text) throws IOException {
     return pingPost(text);
   }
   
@@ -221,10 +221,10 @@ public class SliderApplicationApiClient extends 
BaseRestClient
    * @return the response
    * @throws IOException on any failure
    */
-  public PingResource pingGet(String text) throws IOException {
+  public PingInformation pingGet(String text) throws IOException {
     WebResource pingResource = applicationResource(ACTION_PING);
     pingResource.getUriBuilder().queryParam("body", text);
-    return pingResource.get(PingResource.class);
+    return pingResource.get(PingInformation.class);
   }
   
   /**
@@ -233,12 +233,12 @@ public class SliderApplicationApiClient extends 
BaseRestClient
    * @return the response
    * @throws IOException on any failure
    */
-  public PingResource pingPost(String text) throws IOException {
+  public PingInformation pingPost(String text) throws IOException {
     WebResource pingResource = applicationResource(ACTION_PING);
     pingResource.type(MediaType.APPLICATION_JSON_TYPE);
     Form f = new Form();
     f.add("text", text);
-    return pingResource.post(PingResource.class, f);
+    return pingResource.post(PingInformation.class, f);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
index 6667548..9fd59c1 100644
--- 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
+++ 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
@@ -44,7 +44,7 @@ import 
org.apache.slider.server.appmaster.web.rest.application.resources.Content
 import 
org.apache.slider.server.appmaster.web.rest.application.resources.LiveComponentsRefresher;
 import 
org.apache.slider.server.appmaster.web.rest.application.resources.LiveResourcesRefresher;
 import 
org.apache.slider.server.appmaster.web.rest.application.actions.RestActionPing;
-import org.apache.slider.api.types.PingResource;
+import org.apache.slider.api.types.PingInformation;
 import 
org.apache.slider.server.appmaster.web.rest.application.resources.LiveStatisticsRefresher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -395,7 +395,7 @@ TODO: decide what structure to return here, then implement
   @GET
   @Path(ACTION_PING)
   @Produces({APPLICATION_JSON})
-  public PingResource actionPingGet(@Context HttpServletRequest request,
+  public PingInformation actionPingGet(@Context HttpServletRequest request,
       @Context UriInfo uriInfo) {
     markGet(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
     return new RestActionPing().ping(request, uriInfo, "");
@@ -404,7 +404,7 @@ TODO: decide what structure to return here, then implement
   @POST
   @Path(ACTION_PING)
   @Produces({APPLICATION_JSON})
-  public PingResource actionPingPost(@Context HttpServletRequest request,
+  public PingInformation actionPingPost(@Context HttpServletRequest request,
       @Context UriInfo uriInfo,
       String body) {
     markPost(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
@@ -415,7 +415,7 @@ TODO: decide what structure to return here, then implement
   @Path(ACTION_PING)
   @Consumes({TEXT_PLAIN})
   @Produces({APPLICATION_JSON})
-  public PingResource actionPingPut(@Context HttpServletRequest request,
+  public PingInformation actionPingPut(@Context HttpServletRequest request,
       @Context UriInfo uriInfo,
       String body) {
     markPut(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
@@ -426,7 +426,7 @@ TODO: decide what structure to return here, then implement
   @Path(ACTION_PING)
   @Consumes({APPLICATION_JSON})
   @Produces({APPLICATION_JSON})
-  public PingResource actionPingDelete(@Context HttpServletRequest request,
+  public PingInformation actionPingDelete(@Context HttpServletRequest request,
       @Context UriInfo uriInfo) {
     markDelete(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
     return new RestActionPing().ping(request, uriInfo, "");

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
index 80a0a1c..96b4f75 100644
--- 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
+++ 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
@@ -18,7 +18,7 @@
 
 package org.apache.slider.server.appmaster.web.rest.application.actions;
 
-import org.apache.slider.api.types.PingResource;
+import org.apache.slider.api.types.PingInformation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -33,18 +33,18 @@ public class RestActionPing {
   public RestActionPing() {
   }
   
-  public PingResource ping(HttpServletRequest request, UriInfo uriInfo, String 
body) {
+  public PingInformation ping(HttpServletRequest request, UriInfo uriInfo, 
String body) {
     String verb = request.getMethod();
     log.info("Ping {}", verb);
-    PingResource pingResource = new PingResource();
-    pingResource.time = System.currentTimeMillis();
-    pingResource.verb = verb;
-    pingResource.body = body;
+    PingInformation pingInformation = new PingInformation();
+    pingInformation.time = System.currentTimeMillis();
+    pingInformation.verb = verb;
+    pingInformation.body = body;
     String text = 
         String.format(Locale.ENGLISH,
             "Ping verb %s received at %tc",
-            verb, pingResource.time);
-    pingResource.text = text;
-    return pingResource;
+            verb, pingInformation.time);
+    pingInformation.text = text;
+    return pingInformation;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
----------------------------------------------------------------------
diff --git 
a/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
 
b/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
index 4a4fa7f..a7a5432 100644
--- 
a/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
+++ 
b/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
@@ -35,7 +35,7 @@ import org.apache.slider.core.conf.ConfTree
 import org.apache.slider.core.conf.ConfTreeOperations
 import org.apache.slider.core.restclient.HttpVerb
 import 
org.apache.slider.server.appmaster.web.rest.application.ApplicationResource
-import org.apache.slider.api.types.PingResource
+import org.apache.slider.api.types.PingInformation
 
 import javax.ws.rs.core.MediaType
 
@@ -370,13 +370,13 @@ class JerseyTestDelegates extends 
AbstractRestTestDelegate {
     // GET
     describe "pinging"
     
-    def pinged = jExec(HttpVerb.GET, ACTION_PING, PingResource)
+    def pinged = jExec(HttpVerb.GET, ACTION_PING, PingInformation)
     log.info "Ping GET: $pinged"
     // HEAD
 //    jExec(HttpVerb.HEAD, ACTION_PING, PingResource)
-    jExec(HttpVerb.PUT, ACTION_PING, PingResource)
-    jExec(HttpVerb.DELETE, ACTION_PING, PingResource)
-    jExec(HttpVerb.POST, ACTION_PING, PingResource)
+    jExec(HttpVerb.PUT, ACTION_PING, PingInformation)
+    jExec(HttpVerb.DELETE, ACTION_PING, PingInformation)
+    jExec(HttpVerb.POST, ACTION_PING, PingInformation)
     ping(HttpVerb.PUT, ACTION_PING, "ping-text")
     ping(HttpVerb.POST, ACTION_PING, "ping-text")
     ping(HttpVerb.DELETE, ACTION_PING, "ping-text")
@@ -390,11 +390,11 @@ class JerseyTestDelegates extends 
AbstractRestTestDelegate {
    * @param payload payload
    * @return the resource if the verb has a response
    */
-  private PingResource ping(HttpVerb method, String subpath, Object payload) {
+  private PingInformation ping(HttpVerb method, String subpath, Object 
payload) {
     def actionPing = applicationResource(ACTION_PING)
     def upload = method.hasUploadBody() ? payload : null
     if (method.hasResponseBody()) {
-      def pinged = actionPing.method(method.verb, PingResource, upload)
+      def pinged = actionPing.method(method.verb, PingInformation, upload)
       assert method.verb == pinged.verb
       return pinged
     } else {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/07909f82/slider-core/src/test/groovy/org/apache/slider/agent/rest/LowLevelRestTestDelegates.groovy
----------------------------------------------------------------------
diff --git 
a/slider-core/src/test/groovy/org/apache/slider/agent/rest/LowLevelRestTestDelegates.groovy
 
b/slider-core/src/test/groovy/org/apache/slider/agent/rest/LowLevelRestTestDelegates.groovy
index f499d63..117e294 100644
--- 
a/slider-core/src/test/groovy/org/apache/slider/agent/rest/LowLevelRestTestDelegates.groovy
+++ 
b/slider-core/src/test/groovy/org/apache/slider/agent/rest/LowLevelRestTestDelegates.groovy
@@ -31,7 +31,7 @@ import org.apache.slider.core.restclient.HttpOperationResponse
 import org.apache.slider.core.restclient.HttpVerb
 import org.apache.slider.core.restclient.UrlConnectionOperations
 import 
org.apache.slider.server.appmaster.web.rest.application.ApplicationResource
-import org.apache.slider.api.types.PingResource
+import org.apache.slider.api.types.PingInformation
 import org.apache.slider.test.Outcome
 
 import javax.ws.rs.core.MediaType
@@ -206,7 +206,7 @@ class LowLevelRestTestDelegates extends 
AbstractRestTestDelegate {
     // GET
     String ping = appendToURL(appmaster, SLIDER_PATH_APPLICATION, ACTION_PING)
     describe "ping to AM URL $appmaster, ping URL $ping"
-    def pinged = fetchType(PingResource, appmaster, ACTION_PING + 
"?body=hello")
+    def pinged = fetchType(PingInformation, appmaster, ACTION_PING + 
"?body=hello")
     log.info "Ping GET: $pinged"
 
     URL pingUrl = new URL(ping)
@@ -241,7 +241,7 @@ class LowLevelRestTestDelegates extends 
AbstractRestTestDelegate {
     byte[] bytes = outcome.data
     if (verb.hasResponseBody()) {
       assert bytes.length > 0, "0 bytes from ping $verb.verb"
-      pinged = deser(PingResource, bytes)
+      pinged = deser(PingInformation, bytes)
       log.info "Ping $verb.verb: $pinged"
       assert verb.verb == pinged.verb
     } else {
@@ -277,7 +277,7 @@ class LowLevelRestTestDelegates extends 
AbstractRestTestDelegate {
         true,
         "AM failed to shut down") {
       def pinged = fetchType(
-          PingResource,
+          PingInformation,
           appmaster,
           ACTION_PING + "?body=hello")
       fail("AM didn't shut down; Ping GET= $pinged")

Reply via email to