Closes #637 Remove deprecated REST API endpoints
This removes the deprecated REST API endpoints from Brooklyn 0.7.0. It also fixes the launcher configuration (as the `VersionApi` has been entirely removed) and unit tests. Please note that I didn't touch the `LocationApi` for a very specific reason: currently, this is the only of getting the locations defined within `brooklyn.properties`/`brooklyn.cfg` files. We need to figure out first how to handle those locations before removing the endpoints. As you can see, this is not in the scope of this PR. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f3d2eed5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f3d2eed5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f3d2eed5 Branch: refs/heads/master Commit: f3d2eed5652cba650fbdab607d1b2a81d6e0310e Parents: 26e5fe2 e36ef90 Author: Geoff Macartney <[email protected]> Authored: Tue Apr 18 14:32:35 2017 +0100 Committer: Geoff Macartney <[email protected]> Committed: Tue Apr 18 14:32:35 2017 +0100 ---------------------------------------------------------------------- .../brooklyn/rest/api/ApplicationApi.java | 16 --- .../apache/brooklyn/rest/api/CatalogApi.java | 93 ---------------- .../org/apache/brooklyn/rest/api/EntityApi.java | 7 -- .../brooklyn/rest/api/PolicyConfigApi.java | 20 +--- .../org/apache/brooklyn/rest/api/ServerApi.java | 15 --- .../apache/brooklyn/rest/api/VersionApi.java | 43 -------- .../apache/brooklyn/rest/BrooklynRestApi.java | 2 - .../rest/resources/ApplicationResource.java | 5 - .../rest/resources/CatalogResource.java | 107 ------------------- .../brooklyn/rest/resources/EntityResource.java | 6 -- .../rest/resources/PolicyConfigResource.java | 6 -- .../brooklyn/rest/resources/ServerResource.java | 13 --- .../rest/resources/VersionResource.java | 32 ------ .../resources/OSGI-INF/blueprint/service.xml | 2 - .../rest/resources/CatalogResourceTest.java | 34 ------ .../rest/resources/ErrorResponseTest.java | 23 +--- .../rest/resources/PolicyResourceTest.java | 5 +- .../rest/resources/ServerResourceTest.java | 7 +- .../rest/resources/VersionResourceTest.java | 46 -------- .../rest-server/src/main/webapp/WEB-INF/web.xml | 1 - .../brooklyn/rest/CorsFilterLauncherTest.java | 20 ++-- .../rest/CsrfTokenFilterLauncherTest.java | 14 +-- 22 files changed, 27 insertions(+), 490 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f3d2eed5/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java ---------------------------------------------------------------------- diff --cc rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java index dd50bed,323cdb2..12a6e93 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java @@@ -139,25 -139,9 +139,13 @@@ public interface CatalogApi @QueryParam("ignoreErrors") @DefaultValue("false") boolean ignoreErrors); - /** @deprecated since 0.7.0 use {@link #deleteEntity(String, String)} */ - @Deprecated - @DELETE - @Path("/entities/{entityId}") - @ApiOperation(value = "Deletes a specific version of an entity's definition from the catalog") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Entity not found") - }) - public void deleteEntity_0_7_0( - @ApiParam(name = "entityId", value = "The ID of the entity or template to delete", required = true) - @PathParam("entityId") String entityId) throws Exception; - @DELETE @Path("/applications/{symbolicName}/{version}") - @ApiOperation(value = "Deletes a specific version of an application's definition from the catalog") + @ApiOperation( + value = "Deletes a specific version of an application's definition from the catalog", + notes = "Version must exists, otherwise the API will return a 404. Alternatively, passing 'latest' will" + + "pick up the latest version for the given 'symbolicName'" + ) @ApiResponses(value = { @ApiResponse(code = 404, message = "Entity not found") }) @@@ -244,26 -217,9 +232,12 @@@ @ApiParam(name = "allVersions", value = "Include all versions (defaults false, only returning the best version)") @QueryParam("allVersions") @DefaultValue("false") boolean includeAllVersions); - /** @deprecated since 0.7.0 use {@link #getEntity(String, String)} */ - @Deprecated - @GET - @Path("/entities/{entityId}") - @ApiOperation(value = "Fetch an entity's definition from the catalog", - response = CatalogEntitySummary.class, - responseContainer = "List") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Entity not found") - }) - public CatalogEntitySummary getEntity_0_7_0( - @ApiParam(name = "entityId", value = "The ID of the entity or template to retrieve", required = true) - @PathParam("entityId") String entityId) throws Exception; - @GET @Path("/entities/{symbolicName}/{version}") - @ApiOperation(value = "Fetch a specific version of an entity's definition from the catalog", + @ApiOperation( + value = "Fetch a specific version of an entity's definition from the catalog", + notes = "Version must exists, otherwise the API will return a 404. Alternatively, passing 'latest' will" + + "pick up the latest version for the given 'symbolicName'", response = CatalogEntitySummary.class, responseContainer = "List") @ApiResponses(value = { @@@ -276,26 -232,9 +250,12 @@@ @ApiParam(name = "version", value = "The version identifier of the entity or template to retrieve", required = true) @PathParam("version") String version) throws Exception; - /** @deprecated since 0.7.0 use {@link #getEntity(String, String)} */ - @Deprecated - @GET - @Path("/applications/{applicationId}") - @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", - response = CatalogEntitySummary.class, - responseContainer = "List") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Entity not found") - }) - public CatalogEntitySummary getApplication_0_7_0( - @ApiParam(name = "applicationId", value = "The ID of the application to retrieve", required = true) - @PathParam("applicationId") String applicationId) throws Exception; - @GET @Path("/applications/{symbolicName}/{version}") - @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", + @ApiOperation( + value = "Fetch a specific version of an application's definition from the catalog", + notes = "Version must exists, otherwise the API will return a 404. Alternatively, passing 'latest' will" + + "pick up the latest version for the given 'symbolicName'", response = CatalogEntitySummary.class, responseContainer = "List") @ApiResponses(value = { @@@ -321,26 -260,9 +281,12 @@@ @ApiParam(name = "allVersions", value = "Include all versions (defaults false, only returning the best version)") @QueryParam("allVersions") @DefaultValue("false") boolean includeAllVersions); - /** @deprecated since 0.7.0 use {@link #getPolicy(String, String)} */ - @Deprecated - @GET - @Path("/policies/{policyId}") - @ApiOperation(value = "Fetch a policy's definition from the catalog", - response = CatalogItemSummary.class, - responseContainer = "List") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Entity not found") - }) - public CatalogItemSummary getPolicy_0_7_0( - @ApiParam(name = "policyId", value = "The ID of the policy to retrieve", required = true) - @PathParam("policyId") String policyId) throws Exception; - @GET @Path("/policies/{policyId}/{version}") - @ApiOperation(value = "Fetch a policy's definition from the catalog", + @ApiOperation( + value = "Fetch a policy's definition from the catalog", + notes = "Version must exists, otherwise the API will return a 404. Alternatively, passing 'latest' will" + + "pick up the latest version for the given 'policyId'", response = CatalogItemSummary.class, responseContainer = "List") @ApiResponses(value = { @@@ -365,26 -287,9 +311,12 @@@ @ApiParam(name = "allVersions", value = "Include all versions (defaults false, only returning the best version)") @QueryParam("allVersions") @DefaultValue("false") boolean includeAllVersions); - /** @deprecated since 0.7.0 use {@link #getLocation(String, String)} */ - @Deprecated - @GET - @Path("/locations/{locationId}") - @ApiOperation(value = "Fetch a location's definition from the catalog", - response = CatalogItemSummary.class, - responseContainer = "List") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Entity not found") - }) - public CatalogItemSummary getLocation_0_7_0( - @ApiParam(name = "locationId", value = "The ID of the location to retrieve", required = true) - @PathParam("locationId") String locationId) throws Exception; - @GET @Path("/locations/{locationId}/{version}") - @ApiOperation(value = "Fetch a location's definition from the catalog", + @ApiOperation( + value = "Fetch a location's definition from the catalog", + notes = "Version must exists, otherwise the API will return a 404. Alternatively, passing 'latest' will" + + "pick up the latest version for the given 'locationId'", response = CatalogItemSummary.class, responseContainer = "List") @ApiResponses(value = { @@@ -396,26 -301,9 +328,13 @@@ @ApiParam(name = "version", value = "The version identifier of the application to retrieve", required = true) @PathParam("version") String version) throws Exception; - /** @deprecated since 0.7.0 use {@link #getIcon(String, String)} */ - @Deprecated - @GET - @Path("/icon/{itemId}") - @ApiOperation(value = "Return the icon for a given catalog entry (application/image or HTTP redirect)") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Item not found") - }) - @Produces("application/image") - public Response getIcon_0_7_0( - @ApiParam(name = "itemId", value = "ID of catalog item (application, entity, policy, location)") - @PathParam("itemId") @DefaultValue("") String itemId); - @GET @Path("/icon/{itemId}/{version}") - @ApiOperation(value = "Return the icon for a given catalog entry (application/image or HTTP redirect)") + @ApiOperation( + value = "Return the icon for a given catalog entry (application/image or HTTP redirect)", + notes = "Version must exists, otherwise the API will return a 404. Alternatively, passing 'latest' will" + + "pick up the latest version for the given 'itemId'" + ) @ApiResponses(value = { @ApiResponse(code = 404, message = "Item not found") }) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f3d2eed5/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f3d2eed5/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/CatalogResourceTest.java ----------------------------------------------------------------------
