You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ge...@apache.org on 2017/04/18 13:34:21 UTC
[1/3] brooklyn-server git commit: Remove deprecated APIs
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 <th...@cloudsoftcorp.com>
Authored: Fri Apr 14 09:07:40 2017 +0100
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
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+.*"));
- }
-
-}
[3/3] brooklyn-server git commit: Closes #637
Posted by ge...@apache.org.
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 <ge...@cloudsoftcorp.com>
Authored: Tue Apr 18 14:32:35 2017 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
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
----------------------------------------------------------------------
[2/3] brooklyn-server git commit: Fix unit tests and launcher config
Posted by ge...@apache.org.
Fix unit tests and launcher config
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/e36ef90f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/e36ef90f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/e36ef90f
Branch: refs/heads/master
Commit: e36ef90f6d18a3d8d25faf587fccfd7dd7ac31a0
Parents: e47107e
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Fri Apr 14 13:21:34 2017 +0100
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Fri Apr 14 13:21:34 2017 +0100
----------------------------------------------------------------------
.../resources/OSGI-INF/blueprint/service.xml | 2 --
.../rest/resources/ErrorResponseTest.java | 2 +-
.../rest/resources/PolicyResourceTest.java | 3 +--
.../rest-server/src/main/webapp/WEB-INF/web.xml | 1 -
.../brooklyn/rest/CorsFilterLauncherTest.java | 20 ++++++++++----------
.../rest/CsrfTokenFilterLauncherTest.java | 14 +++++++-------
6 files changed, 19 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e36ef90f/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml
index 2cfb915..c773806 100644
--- a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml
+++ b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml
@@ -84,7 +84,6 @@ limitations under the License.
<bean id="sensorResourceBean" class="org.apache.brooklyn.rest.resources.SensorResource"/>
<bean id="serverResourceBean" class="org.apache.brooklyn.rest.resources.ServerResource"/>
<bean id="usageResourceBean" class="org.apache.brooklyn.rest.resources.UsageResource"/>
- <bean id="versionResourceBean" class="org.apache.brooklyn.rest.resources.VersionResource"/>
<bean id="logoutResourceBean" class="org.apache.brooklyn.rest.resources.LogoutResource"/>
<jaxrs:server id="brooklynRestApiV1" address="/">
@@ -104,7 +103,6 @@ limitations under the License.
<ref component-id="sensorResourceBean"/>
<ref component-id="serverResourceBean"/>
<ref component-id="usageResourceBean"/>
- <ref component-id="versionResourceBean"/>
<ref component-id="logoutResourceBean"/>
</jaxrs:serviceBeans>
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e36ef90f/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 b1ae6df..27d8ea5 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
@@ -75,7 +75,7 @@ public class ErrorResponseTest extends BrooklynRestResourceTest {
+ RestMockSimplePolicy.INTEGER_CONFIG.getName();
Response response = client().path(resource)
- .post(toJsonEntity(ImmutableMap.of("value", "notanumber")));
+ .post(toJsonEntity("notanumber"));
assertEquals(response.getStatus(), Status.BAD_REQUEST.getStatusCode());
assertEquals(response.getHeaders().getFirst("Content-Type"), MediaType.APPLICATION_JSON);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e36ef90f/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 78a29ca..3498e00 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
@@ -121,8 +121,7 @@ public class PolicyResourceTest extends BrooklynRestResourceTest {
String configName = RestMockSimplePolicy.SAMPLE_CONFIG.getName();
Response response = client().path(ENDPOINT + policyId + "/config/" + configName)
- .header("Content-type", "plain/text")
- .post("newval");
+ .post(toJsonEntity("newval"));
assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e36ef90f/rest/rest-server/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/main/webapp/WEB-INF/web.xml b/rest/rest-server/src/main/webapp/WEB-INF/web.xml
index de15d08..347417a 100644
--- a/rest/rest-server/src/main/webapp/WEB-INF/web.xml
+++ b/rest/rest-server/src/main/webapp/WEB-INF/web.xml
@@ -60,7 +60,6 @@
org.apache.brooklyn.rest.resources.SensorResource,
org.apache.brooklyn.rest.resources.ServerResource,
org.apache.brooklyn.rest.resources.UsageResource,
- org.apache.brooklyn.rest.resources.VersionResource
</param-value>
</init-param>
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e36ef90f/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CorsFilterLauncherTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CorsFilterLauncherTest.java b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CorsFilterLauncherTest.java
index 313b35e..8197014 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CorsFilterLauncherTest.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CorsFilterLauncherTest.java
@@ -57,30 +57,30 @@ public class CorsFilterLauncherTest extends BrooklynRestApiLauncherTestFixture {
HttpClient client = client();
// preflight request
- HttpToolResponse response = HttpTool.execAndConsume(client, httpOptionsRequest("server/status", "GET", shouldAllowOrigin));
+ HttpToolResponse response = HttpTool.execAndConsume(client, httpOptionsRequest("server/ha/state", "GET", shouldAllowOrigin));
assertAcAllowOrigin(response, shouldAllowOrigin, "GET");
assertOkayResponse(response, "");
- HttpUriRequest httpRequest = RequestBuilder.get(getBaseUriRest() + "server/status")
+ HttpUriRequest httpRequest = RequestBuilder.get(getBaseUriRest() + "server/ha/state")
.addHeader("Origin", shouldAllowOrigin)
.addHeader(HEADER_AC_REQUEST_METHOD, "GET")
.build();
response = HttpTool.execAndConsume(client, httpRequest);
assertAcAllowOrigin(response, shouldAllowOrigin, "GET", false);
- assertOkayResponse(response, "MASTER");
+ assertOkayResponse(response, "\"MASTER\"");
// preflight request
- response = HttpTool.execAndConsume(client, httpOptionsRequest("server/status", "GET", thirdPartyOrigin));
+ response = HttpTool.execAndConsume(client, httpOptionsRequest("server/ha/state", "GET", thirdPartyOrigin));
assertAcNotAllowOrigin(response);
assertOkayResponse(response, "");
- httpRequest = RequestBuilder.get(getBaseUriRest() + "server/status")
+ httpRequest = RequestBuilder.get(getBaseUriRest() + "server/ha/state")
.addHeader("Origin", thirdPartyOrigin)
.addHeader(HEADER_AC_REQUEST_METHOD, "GET")
.build();
response = HttpTool.execAndConsume(client, httpRequest);
assertAcNotAllowOrigin(response);
- assertOkayResponse(response, "MASTER");
+ assertOkayResponse(response, "\"MASTER\"");
}
@Test
@@ -124,7 +124,7 @@ public class CorsFilterLauncherTest extends BrooklynRestApiLauncherTestFixture {
setCorsFilterFeature(true, ImmutableList.<String>of());
HttpClient client = client();
// preflight request
- HttpToolResponse response = HttpTool.execAndConsume(client, httpOptionsRequest("server/status", "GET", shouldAllowOrigin));
+ HttpToolResponse response = HttpTool.execAndConsume(client, httpOptionsRequest("server/ha/state", "GET", shouldAllowOrigin));
List<String> accessControlAllowOrigin = response.getHeaderLists().get(HEADER_AC_ALLOW_ORIGIN);
assertEquals(accessControlAllowOrigin.size(), 1);
assertEquals(accessControlAllowOrigin.get(0), "*", "Should allow GET requests made from " + shouldAllowOrigin);
@@ -133,7 +133,7 @@ public class CorsFilterLauncherTest extends BrooklynRestApiLauncherTestFixture {
assertEquals(response.getHeaderLists().get(HEADER_AC_ALLOW_HEADERS).get(0), "x-csrf-token", "Should have asked and allowed x-csrf-token header from " + shouldAllowOrigin);
assertOkayResponse(response, "");
- HttpUriRequest httpRequest = RequestBuilder.get(getBaseUriRest() + "server/status")
+ HttpUriRequest httpRequest = RequestBuilder.get(getBaseUriRest() + "server/ha/state")
.addHeader("Origin", shouldAllowOrigin)
.addHeader(HEADER_AC_REQUEST_METHOD, "GET")
.build();
@@ -141,7 +141,7 @@ public class CorsFilterLauncherTest extends BrooklynRestApiLauncherTestFixture {
accessControlAllowOrigin = response.getHeaderLists().get(HEADER_AC_ALLOW_ORIGIN);
assertEquals(accessControlAllowOrigin.size(), 1);
assertEquals(accessControlAllowOrigin.get(0), "*", "Should allow GET requests made from " + shouldAllowOrigin);
- assertOkayResponse(response, "MASTER");
+ assertOkayResponse(response, "\"MASTER\"");
}
@Test
@@ -185,7 +185,7 @@ public class CorsFilterLauncherTest extends BrooklynRestApiLauncherTestFixture {
setCorsFilterFeature(false, null);
HttpClient client = client();
- HttpToolResponse response = HttpTool.execAndConsume(client, httpOptionsRequest("server/status", "GET", shouldAllowOrigin));
+ HttpToolResponse response = HttpTool.execAndConsume(client, httpOptionsRequest("server/ha/state", "GET", shouldAllowOrigin));
assertAcNotAllowOrigin(response);
assertOkayResponse(response, "");
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e36ef90f/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CsrfTokenFilterLauncherTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CsrfTokenFilterLauncherTest.java b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CsrfTokenFilterLauncherTest.java
index d442875..7c77590 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CsrfTokenFilterLauncherTest.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/CsrfTokenFilterLauncherTest.java
@@ -52,12 +52,12 @@ public class CsrfTokenFilterLauncherTest extends BrooklynRestApiLauncherTestFixt
HttpClient client = client();
HttpToolResponse response = HttpTool.httpGet(
- client, URI.create(getBaseUriRest() + "server/status"),
+ client, URI.create(getBaseUriRest() + "server/ha/state"),
ImmutableMap.<String,String>of(
CsrfTokenFilter.CSRF_TOKEN_REQUIRED_HEADER, CsrfTokenFilter.CsrfTokenRequiredForRequests.WRITE.toString()));
// comes back okay
- assertOkayResponse(response, "MASTER");
+ assertOkayResponse(response, "\"MASTER\"");
Map<String, List<String>> cookies = response.getCookieKeyValues();
String token = Iterables.getOnlyElement(cookies.get(CsrfTokenFilter.CSRF_TOKEN_VALUE_COOKIE));
@@ -84,19 +84,19 @@ public class CsrfTokenFilterLauncherTest extends BrooklynRestApiLauncherTestFixt
// can get without token
response = HttpTool.httpGet(
- client, URI.create(getBaseUriRest() + "server/status"),
+ client, URI.create(getBaseUriRest() + "server/ha/state"),
ImmutableMap.<String,String>of());
- assertOkayResponse(response, "MASTER");
+ assertOkayResponse(response, "\"MASTER\"");
// but if we set required ALL then need a token to get
response = HttpTool.httpGet(
- client, URI.create(getBaseUriRest() + "server/status"),
+ client, URI.create(getBaseUriRest() + "server/ha/state"),
ImmutableMap.<String,String>of(
CsrfTokenFilter.CSRF_TOKEN_REQUIRED_HEADER, CsrfTokenFilter.CsrfTokenRequiredForRequests.ALL.toString().toLowerCase()
));
- assertOkayResponse(response, "MASTER");
+ assertOkayResponse(response, "\"MASTER\"");
response = HttpTool.httpGet(
- client, URI.create(getBaseUriRest() + "server/status"),
+ client, URI.create(getBaseUriRest() + "server/ha/state"),
ImmutableMap.<String,String>of());
assertEquals(response.getResponseCode(), HttpStatus.SC_UNAUTHORIZED);