SLIDER-713: PUT operation now working, but I'm still at the "superstition" vs "understanding" level
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/2dc7b33e Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/2dc7b33e Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/2dc7b33e Branch: refs/heads/develop Commit: 2dc7b33ed4fd0761bb91228daf0b5315143e976a Parents: a06f53a Author: Steve Loughran <[email protected]> Authored: Tue Feb 17 18:31:23 2015 +0000 Committer: Steve Loughran <[email protected]> Committed: Tue Feb 17 18:31:23 2015 +0000 ---------------------------------------------------------------------- .../slider/client/rest/SliderApplicationApiRestClient.java | 9 +++++++-- .../appmaster/web/rest/application/ApplicationResource.java | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2dc7b33e/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java index a6eb5e3..4d09d95 100644 --- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java +++ b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java @@ -171,9 +171,14 @@ public class SliderApplicationApiRestClient extends BaseRestClient public void putDesiredResources(ConfTree updated) throws IOException { WebResource resource = applicationResource(MODEL_DESIRED_RESOURCES); try { + // entity to put resource.entity(updated, MediaType.APPLICATION_JSON_TYPE); -// resource.put(ConfTree.class, updated); - resource.put(ClientResponse.class, updated); + + // put operation. The result is discarded; it does help validate + // that the operation returned a JSON data structure as well as a 200 + // response. + //resource.put(ConfTree.class); + resource.put(ClientResponse.class); } catch (ClientHandlerException ex) { throw ExceptionConverter.convertJerseyException("PUT", resource.getURI().toString(), http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2dc7b33e/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 9eea539..da790b0 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 @@ -154,15 +154,15 @@ public class ApplicationResource extends AbstractSliderResource { markGet(SLIDER_SUBPATH_APPLICATION, MODEL_DESIRED_RESOURCES); return lookupConfTree(MODEL_DESIRED_RESOURCES); } - + @PUT @Path(MODEL_DESIRED_RESOURCES) - @Produces({APPLICATION_JSON}) @Consumes({APPLICATION_JSON}) + @Produces({APPLICATION_JSON}) public ConfTree putModelDesiredResources( ConfTree updated) { markPut(SLIDER_SUBPATH_APPLICATION, MODEL_DESIRED_RESOURCES); - log.info("PUT {}:\n{}", MODEL_DESIRED_RESOURCES, + log.info("PUT {}:\n{}", MODEL_DESIRED_RESOURCES, updated); queue(new ActionFlexCluster("flex", 1, TimeUnit.MILLISECONDS, @@ -171,7 +171,7 @@ public class ApplicationResource extends AbstractSliderResource { // been executed return updated; } - + @GET @Path(MODEL_RESOLVED) @Produces({APPLICATION_JSON})
