Repository: brooklyn-server Updated Branches: refs/heads/master 26e5fe2ad -> f3d2eed56
Remove deprecated APIs Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/e47107e2 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/e47107e2 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/e47107e2 Branch: refs/heads/master Commit: e47107e2833ce12286e5a4b7e014121e467629c7 Parents: c80e389 Author: Thomas Bouron <[email protected]> Authored: Fri Apr 14 09:07:40 2017 +0100 Committer: Thomas Bouron <[email protected]> Committed: Fri Apr 14 10:35:25 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 ------ .../rest/resources/CatalogResourceTest.java | 34 ------ .../rest/resources/ErrorResponseTest.java | 23 +--- .../rest/resources/PolicyResourceTest.java | 6 +- .../rest/resources/ServerResourceTest.java | 7 +- .../rest/resources/VersionResourceTest.java | 46 -------- 18 files changed, 11 insertions(+), 470 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java ---------------------------------------------------------------------- diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java index ba2fec2..edfdd7d 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java @@ -161,22 +161,6 @@ public interface ApplicationApi { required = true) @PathParam("application") String application); - /** @deprecated since 0.7.0 the {@link ApplicationSpec} is being retired in favour of CAMP YAML/ZIP - * (however in 0.7.0 you can still pass this object as JSON and it will be autodetected) */ - @POST - @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN}) - @ApiOperation( - value = "Create and start a new application from miscellaneous types, including JSON either new CAMP format or legacy AppSpec format", - response = org.apache.brooklyn.rest.domain.TaskSummary.class - ) - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Undefined entity or location"), - @ApiResponse(code = 412, message = "Application already registered") - }) - @Path("/createLegacy") - @Deprecated - public Response create(ApplicationSpec applicationSpec); - @GET @Path("/{application}/descendants") @ApiOperation(value = "Fetch entity info for all (or filtered) descendants", http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java ---------------------------------------------------------------------- diff --git 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 index a95aa9f..323cdb2 100644 --- 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,18 +139,6 @@ 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") @@ -229,20 +217,6 @@ public interface CatalogApi { @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", @@ -258,20 +232,6 @@ public interface CatalogApi { @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", @@ -300,20 +260,6 @@ public interface CatalogApi { @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", @@ -341,20 +287,6 @@ public interface CatalogApi { @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", @@ -369,19 +301,6 @@ public interface CatalogApi { @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)") @@ -395,18 +314,6 @@ public interface CatalogApi { @ApiParam(name = "version", value = "version identifier of catalog item (application, entity, policy, location)", required=true) @PathParam("version") String version); - - /** - * @deprecated since 0.8.0; use "/entities/{itemId}/deprecated" with payload of true/false - */ - @Deprecated - @POST - @Path("/entities/{itemId}/deprecated/{deprecated}") - public void setDeprecatedLegacy( - @ApiParam(name = "itemId", value = "The ID of the catalog item to be deprecated", required = true) - @PathParam("itemId") String itemId, - @ApiParam(name = "deprecated", value = "Whether or not the catalog item is deprecated", required = true) - @PathParam("deprecated") boolean deprecated); @POST @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN}) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java ---------------------------------------------------------------------- diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java index b3cae2f..de9cc77 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java @@ -74,13 +74,6 @@ public interface EntityApi { @PathParam("application") final String application, @PathParam("entity") final String entity); - /** @deprecated since 0.7.0 use /children */ - @Deprecated - @Path("/{entity}/entities") - public List<EntitySummary> getChildrenOld( - @PathParam("application") final String application, - @PathParam("entity") final String entity); - @POST @ApiOperation(value = "Add a child or children to this entity given a YAML spec", response = org.apache.brooklyn.rest.domain.TaskSummary.class) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java ---------------------------------------------------------------------- diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java index 6c26228..1e6bfe6 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java @@ -81,27 +81,9 @@ public interface PolicyConfigApi { @ApiParam(value = "Config key ID", required = true) @PathParam("config") String configKeyName); - /** @deprecated since 0.7.0 use set with object*/ @Deprecated - @POST - @Path("/{config}/set") - @ApiOperation(value = "Sets the given config on this policy") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Could not find application, entity, policy or config key") - }) - public Response set( - @ApiParam(value = "Application ID or name", required = true) - @PathParam("application") String application, - @ApiParam(value = "Entity ID or name", required = true) - @PathParam("entity") String entityToken, - @ApiParam(value = "Policy ID or name", required = true) - @PathParam("policy") String policyToken, - @ApiParam(value = "Config key ID", required = true) - @PathParam("config") String configKeyName, - @ApiParam(name = "value", value = "New value for the configuration", required = true) - @QueryParam("value") String value); - @POST @Path("/{config}") + @Consumes(value = {"*/*"}) @ApiOperation(value = "Sets the given config on this policy") @ApiResponses(value = { @ApiResponse(code = 404, message = "Could not find application, entity, policy or config key") http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java ---------------------------------------------------------------------- diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java index 0b56e3c..12e2c1c 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java @@ -98,14 +98,6 @@ public interface ServerApi { @Path("/healthy") @ApiOperation(value = "Returns whether this node is healthy - fully started, not stopping, and no errors") public boolean isHealthy(); - - @Deprecated /** @deprecated since 0.7.0 use /ha/node (which returns correct JSON) */ - @GET - @Path("/status") - @ApiOperation(value = "Returns the status of this Brooklyn instance [DEPRECATED; see ../ha/state]", - response = String.class, - responseContainer = "List") - public String getStatus(); @GET @Path("/up/extended") @@ -124,13 +116,6 @@ public interface ServerApi { public String getConfig( @ApiParam(value = "Config key ID", required = true) @PathParam("configKey") String configKey); - - @Deprecated /** @deprecated since 0.7.0 use /ha/states */ - @GET - @Path("/highAvailability") - @ApiOperation(value = "Returns the status of all Brooklyn instances in the management plane [DEPRECATED; see ../ha/states]", - response = org.apache.brooklyn.rest.domain.HighAvailabilitySummary.class) - public HighAvailabilitySummary getHighAvailability(); @GET @Path("/ha/state") http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java ---------------------------------------------------------------------- diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java deleted file mode 100644 index 12dc76e..0000000 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java +++ /dev/null @@ -1,43 +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.brooklyn.rest.api; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -@Path("/version") -@Api("Version") -@Produces(MediaType.APPLICATION_JSON) -@Consumes(MediaType.APPLICATION_JSON) -/** @deprecated since 0.7.0; use /server/version */ -@Deprecated -public interface VersionApi { - - @GET - @ApiOperation(value = "Return version identifier information for this Brooklyn instance; deprecated, use /server/version", - response = String.class, - responseContainer = "List") - public String getVersion(); -} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/BrooklynRestApi.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/BrooklynRestApi.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/BrooklynRestApi.java index df2be65..01e8ad5 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/BrooklynRestApi.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/BrooklynRestApi.java @@ -38,7 +38,6 @@ import org.apache.brooklyn.rest.resources.ScriptResource; import org.apache.brooklyn.rest.resources.SensorResource; import org.apache.brooklyn.rest.resources.ServerResource; import org.apache.brooklyn.rest.resources.UsageResource; -import org.apache.brooklyn.rest.resources.VersionResource; import org.apache.brooklyn.rest.util.DefaultExceptionMapper; import org.apache.brooklyn.rest.util.FormMapProvider; import org.apache.brooklyn.rest.util.json.BrooklynJacksonJsonProvider; @@ -67,7 +66,6 @@ public class BrooklynRestApi { resources.add(new ScriptResource()); resources.add(new ServerResource()); resources.add(new UsageResource()); - resources.add(new VersionResource()); resources.add(new LogoutResource()); return resources; } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java index 1ad0f63..4aec34b 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java @@ -220,11 +220,6 @@ public class ApplicationResource extends AbstractBrooklynRestResource implements return ApplicationTransformer.summaryFromApplication(brooklyn().getApplication(application), ui.getBaseUriBuilder()); } - @Override - public Response create(ApplicationSpec applicationSpec) { - return createFromAppSpec(applicationSpec); - } - /** @deprecated since 0.7.0 see #create */ @Deprecated protected Response createFromAppSpec(ApplicationSpec applicationSpec) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.DEPLOY_APPLICATION, applicationSpec)) { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java index 1421bd1..406044a 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.NoSuchElementException; import java.util.Set; import java.util.jar.Attributes; import java.util.jar.Manifest; @@ -56,9 +55,7 @@ import org.apache.brooklyn.core.catalog.internal.CatalogItemComparator; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.StringAndArgument; -import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts; import org.apache.brooklyn.core.typereg.RegisteredTypePredicates; -import org.apache.brooklyn.core.typereg.RegisteredTypes; import org.apache.brooklyn.rest.api.CatalogApi; import org.apache.brooklyn.rest.domain.ApiError; import org.apache.brooklyn.rest.domain.CatalogEntitySummary; @@ -74,7 +71,6 @@ import org.apache.brooklyn.util.collections.MutableSet; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.core.osgi.BundleMaker; import org.apache.brooklyn.util.exceptions.Exceptions; -import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.os.Os; import org.apache.brooklyn.util.osgi.VersionedName; import org.apache.brooklyn.util.stream.Streams; @@ -294,31 +290,6 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat ((BasicBrooklynCatalog)mgmt().getCatalog()).reset(CatalogDto.newDtoFromXmlContents(xml, "REST reset"), !ignoreErrors); return Response.ok().build(); } - - @Override - @Deprecated - public void deleteEntity_0_7_0(String entityId) throws Exception { - if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_CATALOG_ITEM, StringAndArgument.of(entityId, "delete"))) { - throw WebResourceUtils.forbidden("User '%s' is not authorized to modify catalog", - Entitlements.getEntitlementContext().user()); - } - try { - Maybe<RegisteredType> item = RegisteredTypes.tryValidate(mgmt().getTypeRegistry().get(entityId), RegisteredTypeLoadingContexts.spec(Entity.class)); - if (item.isNull()) { - throw WebResourceUtils.notFound("Entity with id '%s' not found", entityId); - } - if (item.isAbsent()) { - throw WebResourceUtils.notFound("Item with id '%s' is not an entity", entityId); - } - - brooklyn().getCatalog().deleteCatalogItem(item.get().getSymbolicName(), item.get().getVersion()); - - } catch (NoSuchElementException e) { - // shouldn't come here - throw WebResourceUtils.notFound("Entity with id '%s' could not be deleted", entityId); - - } - } @Override public void deleteApplication(String symbolicName, String version) throws Exception { @@ -396,24 +367,6 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat CatalogPredicates.<Application,EntitySpec<? extends Application>>disabled(false)); return getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment, allVersions); } - - @Override - @Deprecated - public CatalogEntitySummary getEntity_0_7_0(String entityId) { - if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, entityId)) { - throw WebResourceUtils.forbidden("User '%s' is not authorized to see catalog entry", - Entitlements.getEntitlementContext().user()); - } - - CatalogItem<Entity,EntitySpec<?>> result = - CatalogUtils.getCatalogItemOptionalVersion(mgmt(), Entity.class, entityId); - - if (result==null) { - throw WebResourceUtils.notFound("Entity with id '%s' not found", entityId); - } - - return CatalogTransformer.catalogEntitySummary(brooklyn(), result, ui.getBaseUriBuilder()); - } @Override public CatalogEntitySummary getEntity(String symbolicName, String version) { @@ -436,12 +389,6 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat } @Override - @Deprecated - public CatalogEntitySummary getApplication_0_7_0(String applicationId) throws Exception { - return getEntity_0_7_0(applicationId); - } - - @Override public CatalogEntitySummary getApplication(String symbolicName, String version) { return getEntity(symbolicName, version); } @@ -457,24 +404,6 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat } @Override - @Deprecated - public CatalogPolicySummary getPolicy_0_7_0(String policyId) { - if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, policyId)) { - throw WebResourceUtils.forbidden("User '%s' is not authorized to see catalog entry", - Entitlements.getEntitlementContext().user()); - } - - CatalogItem<? extends Policy, PolicySpec<?>> result = - CatalogUtils.getCatalogItemOptionalVersion(mgmt(), Policy.class, policyId); - - if (result==null) { - throw WebResourceUtils.notFound("Policy with id '%s' not found", policyId); - } - - return CatalogTransformer.catalogPolicySummary(brooklyn(), result, ui.getBaseUriBuilder()); - } - - @Override public CatalogPolicySummary getPolicy(String policyId, String version) throws Exception { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, policyId+(Strings.isBlank(version)?"":":"+version))) { throw WebResourceUtils.forbidden("User '%s' is not authorized to see catalog entry", @@ -503,24 +432,6 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat } @Override - @Deprecated - public CatalogLocationSummary getLocation_0_7_0(String locationId) { - if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, locationId)) { - throw WebResourceUtils.forbidden("User '%s' is not authorized to see catalog entry", - Entitlements.getEntitlementContext().user()); - } - - CatalogItem<? extends Location, LocationSpec<?>> result = - CatalogUtils.getCatalogItemOptionalVersion(mgmt(), Location.class, locationId); - - if (result==null) { - throw WebResourceUtils.notFound("Location with id '%s' not found", locationId); - } - - return CatalogTransformer.catalogLocationSummary(brooklyn(), result, ui.getBaseUriBuilder()); - } - - @Override public CatalogLocationSummary getLocation(String locationId, String version) throws Exception { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, locationId+(Strings.isBlank(version)?"":":"+version))) { throw WebResourceUtils.forbidden("User '%s' is not authorized to see catalog entry", @@ -559,17 +470,6 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat } @Override - @Deprecated - public Response getIcon_0_7_0(String itemId) { - if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, itemId)) { - throw WebResourceUtils.forbidden("User '%s' is not authorized to see catalog entry", - Entitlements.getEntitlementContext().user()); - } - - return getCatalogItemIcon( mgmt().getTypeRegistry().get(itemId) ); - } - - @Override public Response getIcon(String itemId, String version) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, itemId+(Strings.isBlank(version)?"":":"+version))) { throw WebResourceUtils.forbidden("User '%s' is not authorized to see catalog entry", @@ -578,13 +478,6 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat return getCatalogItemIcon(mgmt().getTypeRegistry().get(itemId, version)); } - - @Override - public void setDeprecatedLegacy(String itemId, boolean deprecated) { - log.warn("Use of deprecated \"/catalog/entities/{itemId}/deprecated/{deprecated}\" for "+itemId - +"; use \"/catalog/entities/{itemId}/deprecated\" with request body"); - setDeprecated(itemId, deprecated); - } @SuppressWarnings("deprecation") @Override http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityResource.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityResource.java index 3d1270b..1ebaad7 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityResource.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityResource.java @@ -105,12 +105,6 @@ public class EntityResource extends AbstractBrooklynRestResource implements Enti } @Override - public List<EntitySummary> getChildrenOld(String application, String entity) { - log.warn("Using deprecated call to /entities when /children should be used"); - return getChildren(application, entity); - } - - @Override public Response addChildren(String applicationToken, String entityToken, Boolean start, String timeoutS, String yaml) { final Entity parent = brooklyn().getEntity(applicationToken, entityToken); if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_ENTITY, parent)) { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java index e289e93..6dcdf19 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java @@ -80,12 +80,6 @@ public class PolicyConfigResource extends AbstractBrooklynRestResource implement return getStringValueForDisplay(brooklyn(), policy, policy.getConfig(ck)); } - @Override - @Deprecated - public Response set(String application, String entityToken, String policyToken, String configKeyName, String value) { - return set(application, entityToken, policyToken, configKeyName, (Object) value); - } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Response set(String application, String entityToken, String policyToken, String configKeyName, Object value) { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java index cfed891..2a6dcbd 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java @@ -376,13 +376,6 @@ public class ServerResource extends AbstractBrooklynRestResource implements Serv "healthy", isHealthy(), "ha", getHighAvailabilityPlaneStates()); } - - - @Deprecated - @Override - public String getStatus() { - return getHighAvailabilityNodeState().toString(); - } @Override public String getConfig(String configKey) { @@ -393,12 +386,6 @@ public class ServerResource extends AbstractBrooklynRestResource implements Serv return mgmt().getConfig().getConfig(config); } - @Deprecated - @Override - public HighAvailabilitySummary getHighAvailability() { - return getHighAvailabilityPlaneStates(); - } - @Override public ManagementNodeState getHighAvailabilityNodeState() { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SERVER_STATUS, null)) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/VersionResource.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/VersionResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/VersionResource.java deleted file mode 100644 index 7492af6..0000000 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/VersionResource.java +++ /dev/null @@ -1,32 +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.brooklyn.rest.resources; - -import org.apache.brooklyn.core.BrooklynVersion; -import org.apache.brooklyn.rest.api.VersionApi; - -/** @deprecated since 0.7.0; use /v1/server/version */ -@Deprecated -public class VersionResource extends AbstractBrooklynRestResource implements VersionApi { - - @Override - public String getVersion() { - return BrooklynVersion.get(); - } -} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/CatalogResourceTest.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/CatalogResourceTest.java b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/CatalogResourceTest.java index b2b098e..da40014 100644 --- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/CatalogResourceTest.java +++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/CatalogResourceTest.java @@ -232,33 +232,6 @@ public class CatalogResourceTest extends BrooklynRestResourceTest { } @Test - @Deprecated - // If we move to using a yaml catalog item, the details will be of the wrapping app, - // not of the entity itself, so the test won't make sense any more. - public void testGetCatalogEntityDetails() { - CatalogEntitySummary details = client() - .path(URI.create("/catalog/entities/org.apache.brooklyn.rest.resources.DummyIconEntity")) - .get(CatalogEntitySummary.class); - assertTrue(details.toString().contains("dummy.config"), "expected more config, only got: "+details); - // No icons in brooklyn-server entities - String iconUrl = "/catalog/icon/" + details.getSymbolicName(); - assertTrue(details.getIconUrl().contains(iconUrl), "expected brooklyn URL for icon image, but got: " + details.getIconUrl()); - } - - @Test - @Deprecated - // If we move to using a yaml catalog item, the details will be of the wrapping app, - // not of the entity itself, so the test won't make sense any more. - public void testGetCatalogEntityPlusVersionDetails() { - CatalogEntitySummary details = client() - .path(URI.create("/catalog/entities/org.apache.brooklyn.rest.resources.DummyIconEntity:0.0.0.SNAPSHOT")) - .get(CatalogEntitySummary.class); - assertTrue(details.toString().contains("dummy.config"), "expected more config, only got: "+details); - URI expectedIconUrl = URI.create(getEndpointAddress() + "/catalog/icon/" + details.getSymbolicName() + "/" + details.getVersion()).normalize(); - assertEquals(details.getIconUrl(), expectedIconUrl.getPath(), "expected brooklyn URL for icon image ("+expectedIconUrl+"), but got: "+details.getIconUrl()); - } - - @Test public void testGetCatalogEntityIconDetails() throws IOException { String catalogItemId = "testGetCatalogEntityIconDetails"; addTestCatalogItemAsEntity(catalogItemId); @@ -413,13 +386,6 @@ public class CatalogResourceTest extends BrooklynRestResourceTest { public void testSetDeprecated() { runSetDeprecated(DeprecateStyle.NEW_STYLE); } - - // Uses old-style "/catalog/{itemId}/deprecated/true", rather than the "true" in the request body. - @Test - @Deprecated - public void testSetDeprecatedLegacy() { - runSetDeprecated(DeprecateStyle.LEGACY_STYLE); - } protected void runSetDeprecated(DeprecateStyle style) { String symbolicName = "my.catalog.item.id.for.deprecation"; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ErrorResponseTest.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ErrorResponseTest.java b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ErrorResponseTest.java index d1c4f2d..b1ae6df 100644 --- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ErrorResponseTest.java +++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ErrorResponseTest.java @@ -70,13 +70,12 @@ public class ErrorResponseTest extends BrooklynRestResourceTest { } @Test - public void testResponseToBadRequest() { + public void testResponseToBadRequest() throws IOException { String resource = "/applications/simple-app/entities/simple-ent/policies/"+policyId+"/config/" - + RestMockSimplePolicy.INTEGER_CONFIG.getName() + "/set"; + + RestMockSimplePolicy.INTEGER_CONFIG.getName(); Response response = client().path(resource) - .query("value", "notanumber") - .post(null); + .post(toJsonEntity(ImmutableMap.of("value", "notanumber"))); assertEquals(response.getStatus(), Status.BAD_REQUEST.getStatusCode()); assertEquals(response.getHeaders().getFirst("Content-Type"), MediaType.APPLICATION_JSON); @@ -86,20 +85,4 @@ public class ErrorResponseTest extends BrooklynRestResourceTest { assertNotNull(error.getError()); assertEquals(error.getError(), response.getStatus(), Status.BAD_REQUEST.getStatusCode()); } - - @Test - public void testResponseToWrongMethod() throws IOException { - String resource = "/applications/simple-app/entities/simple-ent/policies/"+policyId+"/config/" - + RestMockSimplePolicy.INTEGER_CONFIG.getName() + "/set"; - - // Should be POST, not GET - Response response = client().path(resource) - .query("value", "4") - .get(); - - assertEquals(response.getStatus(), 405); - // no input stream; not an API Error - InputStream entity = (InputStream) response.getEntity(); - Assert.assertEquals(entity.read(), -1); - } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/PolicyResourceTest.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/PolicyResourceTest.java b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/PolicyResourceTest.java index 21f1210..78a29ca 100644 --- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/PolicyResourceTest.java +++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/PolicyResourceTest.java @@ -120,9 +120,9 @@ public class PolicyResourceTest extends BrooklynRestResourceTest { public void testReconfigureConfig() throws Exception { String configName = RestMockSimplePolicy.SAMPLE_CONFIG.getName(); - Response response = client().path(ENDPOINT + policyId + "/config/" + configName + "/set") - .query("value", "newval") - .post(null); + Response response = client().path(ENDPOINT + policyId + "/config/" + configName) + .header("Content-type", "plain/text") + .post("newval"); assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java index 24f9e3d..f97b87b 100644 --- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java +++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.brooklyn.api.entity.ImplementedBy; import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.core.BrooklynVersion; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; @@ -59,15 +60,15 @@ public class ServerResourceTest extends BrooklynRestResourceTest { @Test public void testGetStatus() throws Exception { - String status = client().path("/server/status").get(String.class); - assertEquals(status, "MASTER"); + ManagementNodeState nodeState = client().path("/server/ha/state").get(ManagementNodeState.class); + assertEquals(nodeState.name(), "MASTER"); } @Test public void testGetHighAvailability() throws Exception { // Note by default management context from super is started without HA enabled. // Therefore can only assert a minimal amount of stuff. - HighAvailabilitySummary summary = client().path("/server/highAvailability").get(HighAvailabilitySummary.class); + HighAvailabilitySummary summary = client().path("/server/ha/states").get(HighAvailabilitySummary.class); log.info("HA summary is: "+summary); String ownNodeId = getManagementContext().getManagementNodeId(); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e47107e2/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/VersionResourceTest.java ---------------------------------------------------------------------- diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/VersionResourceTest.java b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/VersionResourceTest.java deleted file mode 100644 index fad05cc..0000000 --- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/VersionResourceTest.java +++ /dev/null @@ -1,46 +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.brooklyn.rest.resources; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import javax.ws.rs.core.Response; - -import org.testng.annotations.Test; - -import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest; - -@Test(singleThreaded = true, - // by using a different suite name we disallow interleaving other tests between the methods of this test class, which wrecks the test fixtures - suiteName = "VersionResourceTest") -public class VersionResourceTest extends BrooklynRestResourceTest { - - @Test - public void testGetVersion() { - Response response = client().path("/version") - .get(); - - assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); - String version = response.readEntity(String.class); - - assertTrue(version.matches("^\\d+\\.\\d+\\.\\d+.*")); - } - -}
