[SYNCOPE-736] Leveraging JAX-RS specs by appending ';qs=0.9' to XML content type to get JSON preferred by default
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/b13fc178 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b13fc178 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b13fc178 Branch: refs/heads/master Commit: b13fc1781a7fa276b1eeef6798e5e2812343978b Parents: eaa00e8 Author: Francesco Chicchiriccò <[email protected]> Authored: Mon Nov 30 12:07:08 2015 +0100 Committer: Francesco Chicchiriccò <[email protected]> Committed: Mon Nov 30 12:07:08 2015 +0100 ---------------------------------------------------------------------- .../rest/api/service/AnyObjectService.java | 2 +- .../common/rest/api/service/AnyService.java | 44 +++--- .../rest/api/service/AnyTypeClassService.java | 8 +- .../common/rest/api/service/AnyTypeService.java | 8 +- .../rest/api/service/ConfigurationService.java | 8 +- .../rest/api/service/ConnectorService.java | 22 +-- .../common/rest/api/service/DomainService.java | 8 +- .../common/rest/api/service/GroupService.java | 4 +- .../common/rest/api/service/JAXRSService.java | 4 + .../common/rest/api/service/LoggerService.java | 8 +- .../rest/api/service/NotificationService.java | 8 +- .../common/rest/api/service/PolicyService.java | 8 +- .../common/rest/api/service/RealmService.java | 8 +- .../api/service/RelationshipTypeService.java | 8 +- .../common/rest/api/service/ReportService.java | 16 +- .../rest/api/service/ResourceService.java | 26 ++-- .../common/rest/api/service/RoleService.java | 8 +- .../common/rest/api/service/SchemaService.java | 8 +- .../api/service/SecurityQuestionService.java | 12 +- .../common/rest/api/service/SyncopeService.java | 2 +- .../common/rest/api/service/TaskService.java | 18 +-- .../rest/api/service/UserSelfService.java | 18 +-- .../common/rest/api/service/UserService.java | 10 +- .../rest/api/service/UserWorkflowService.java | 16 +- .../rest/api/service/WorkflowService.java | 4 +- .../rest/api/service/CamelRouteService.java | 6 +- .../syncope/fit/core/reference/GroupITCase.java | 37 ----- .../syncope/fit/core/reference/RESTITCase.java | 147 +++++++++++++++++++ .../syncope/fit/core/reference/UserITCase.java | 70 --------- .../fit/core/reference/UserSelfITCase.java | 23 +-- 30 files changed, 296 insertions(+), 273 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java index 9e72fc4..5599ed1 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java @@ -44,7 +44,7 @@ public interface AnyObjectService extends AnyService<AnyObjectTO, AnyObjectPatch * @return paged list of existing any objects matching the given query, for the given type */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) PagedResult<AnyObjectTO> list(@NotNull @MatrixParam("type") String type, @BeanParam AnyListQuery listQuery); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java index 1d1bb0f..ec46d19 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java @@ -54,7 +54,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @GET @Path("{key}/{schemaType}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Set<AttrTO> read(@NotNull @PathParam("key") Long key, @NotNull @PathParam("schemaType") SchemaType schemaType); /** @@ -67,7 +67,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @GET @Path("{key}/{schemaType}/{schema}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) AttrTO read( @NotNull @PathParam("key") Long key, @NotNull @PathParam("schemaType") SchemaType schemaType, @@ -81,7 +81,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) TO read(@NotNull @PathParam("key") Long key); /** @@ -92,7 +92,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @GET @Path("search") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) PagedResult<TO> search(@BeanParam AnySearchQuery searchQuery); /** @@ -103,8 +103,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS * object itself enriched with propagation status information - ProvisioningResult as Entity */ @POST - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull TO anyTO); /** @@ -116,8 +116,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @PATCH @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response update(@NotNull P anyPatch); /** @@ -130,8 +130,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @PUT @Path("{key}/{schemaType}/{schema}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response update( @NotNull @PathParam("key") Long key, @NotNull @PathParam("schemaType") SchemaType schemaType, @@ -146,8 +146,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @PUT @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response update(@NotNull TO anyTO); /** @@ -159,8 +159,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @DELETE @Path("{key}/{schemaType}/{schema}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void delete( @NotNull @PathParam("key") Long key, @NotNull @PathParam("schemaType") SchemaType schemaType, @@ -175,8 +175,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @DELETE @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response delete(@NotNull @PathParam("key") Long key); /** @@ -187,8 +187,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @POST @Path("{key}/deassociate/{action}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response deassociate(@NotNull DeassociationPatch patch); /** @@ -199,8 +199,8 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @POST @Path("{key}/associate/{action}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response associate(@NotNull AssociationPatch patch); /** @@ -211,7 +211,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS */ @POST @Path("bulk") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) BulkActionResult bulk(@NotNull BulkAction bulkAction); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java index fff0eb5..729511d 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java @@ -44,7 +44,7 @@ public interface AnyTypeClassService extends JAXRSService { * @return list of all anyTypeClasss. */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<AnyTypeClassTO> list(); /** @@ -55,7 +55,7 @@ public interface AnyTypeClassService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) AnyTypeClassTO read(@NotNull @PathParam("key") String key); /** @@ -65,7 +65,7 @@ public interface AnyTypeClassService extends JAXRSService { * @return Response object featuring Location header of created anyTypeClass */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull AnyTypeClassTO anyTypeClassTO); /** @@ -75,7 +75,7 @@ public interface AnyTypeClassService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull AnyTypeClassTO anyTypeClassTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java index 818bea4..5cfe997 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java @@ -44,7 +44,7 @@ public interface AnyTypeService extends JAXRSService { * @return list of all anyTypes. */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<AnyTypeTO> list(); /** @@ -55,7 +55,7 @@ public interface AnyTypeService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) AnyTypeTO read(@NotNull @PathParam("key") String key); /** @@ -65,7 +65,7 @@ public interface AnyTypeService extends JAXRSService { * @return Response object featuring Location header of created anyType */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull AnyTypeTO anyTypeTO); /** @@ -75,7 +75,7 @@ public interface AnyTypeService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull AnyTypeTO anyTypeTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java index 59339c4..09d290d 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java @@ -52,7 +52,7 @@ public interface ConfigurationService extends JAXRSService { * @return all configuration parameters */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<AttrTO> list(); /** @@ -63,7 +63,7 @@ public interface ConfigurationService extends JAXRSService { */ @GET @Path("{schema}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) AttrTO get(@NotNull @PathParam("schema") String schema); /** @@ -73,7 +73,7 @@ public interface ConfigurationService extends JAXRSService { */ @PUT @Path("{schema}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void set(@NotNull AttrTO value); /** @@ -83,6 +83,6 @@ public interface ConfigurationService extends JAXRSService { */ @DELETE @Path("{schema}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void delete(@NotNull @PathParam("schema") String schema); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java index bc111ed..ad76af3 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java @@ -52,7 +52,7 @@ public interface ConnectorService extends JAXRSService { */ @GET @Path("bundles") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<ConnBundleTO> getBundles(@QueryParam("lang") String lang); /** @@ -67,8 +67,8 @@ public interface ConnectorService extends JAXRSService { */ @POST @Path("{key}/supportedObjectClasses") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<ConnIdObjectClassTO> buildObjectClassInfo( @NotNull ConnInstanceTO connInstanceTO, @QueryParam("includeSpecial") @DefaultValue("false") boolean includeSpecial); @@ -83,7 +83,7 @@ public interface ConnectorService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) ConnInstanceTO read(@NotNull @PathParam("key") Long key, @QueryParam("lang") String lang); /** @@ -96,7 +96,7 @@ public interface ConnectorService extends JAXRSService { */ @GET @Path("byResource/{resourceName}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) ConnInstanceTO readByResource( @NotNull @PathParam("resourceName") String resourceName, @QueryParam("lang") String lang); @@ -108,7 +108,7 @@ public interface ConnectorService extends JAXRSService { * @return list of all connector instances with property keys in the matching language */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<ConnInstanceTO> list(@QueryParam("lang") String lang); /** @@ -118,7 +118,7 @@ public interface ConnectorService extends JAXRSService { * @return Response object featuring Location header of created connector instance */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull ConnInstanceTO connInstanceTO); /** @@ -128,7 +128,7 @@ public interface ConnectorService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull ConnInstanceTO connInstanceTO); /** @@ -147,7 +147,7 @@ public interface ConnectorService extends JAXRSService { */ @POST @Path("check") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void check(@NotNull ConnInstanceTO connInstanceTO); /** @@ -165,7 +165,7 @@ public interface ConnectorService extends JAXRSService { */ @POST @Path("bulk") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) BulkActionResult bulk(@NotNull BulkAction bulkAction); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java index 9471f7a..e9309ae 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java @@ -44,7 +44,7 @@ public interface DomainService extends JAXRSService { * @return list of all domains. */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<DomainTO> list(); /** @@ -55,7 +55,7 @@ public interface DomainService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) DomainTO read(@NotNull @PathParam("key") String key); /** @@ -65,7 +65,7 @@ public interface DomainService extends JAXRSService { * @return Response object featuring Location header of created domain */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull DomainTO domainTO); /** @@ -75,7 +75,7 @@ public interface DomainService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull DomainTO domainTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java index 08535dc..9d5308c 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java @@ -43,7 +43,7 @@ public interface GroupService extends AnyService<GroupTO, GroupPatch> { */ @GET @Path("own") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<GroupTO> own(); /** @@ -53,6 +53,6 @@ public interface GroupService extends AnyService<GroupTO, GroupPatch> { * @return paged list of existing groups matching the given query */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) PagedResult<GroupTO> list(@BeanParam AnyListQuery listQuery); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java index 68afb1a..11cdcd3 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java @@ -18,8 +18,12 @@ */ package org.apache.syncope.common.rest.api.service; +import javax.ws.rs.core.MediaType; + public interface JAXRSService { + String APPLICATION_XML = MediaType.APPLICATION_XML + ";qs=0.9"; + String PARAM_FIQL = "fiql"; String PARAM_PAGE = "page"; http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java index 763efc3..f6c9f39 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java @@ -46,7 +46,7 @@ public interface LoggerService extends JAXRSService { */ @GET @Path("events") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<EventCategoryTO> events(); /** @@ -58,7 +58,7 @@ public interface LoggerService extends JAXRSService { */ @GET @Path("{type}/{name}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) LoggerTO read(@NotNull @PathParam("type") LoggerType type, @NotNull @PathParam("name") final String name); /** @@ -69,7 +69,7 @@ public interface LoggerService extends JAXRSService { */ @GET @Path("{type}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<LoggerTO> list(@NotNull @PathParam("type") LoggerType type); /** @@ -80,7 +80,7 @@ public interface LoggerService extends JAXRSService { */ @PUT @Path("{type}/{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull @PathParam("type") LoggerType type, @NotNull LoggerTO logger); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java index 1bdfbf8..d67e4a0 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java @@ -46,7 +46,7 @@ public interface NotificationService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) NotificationTO read(@NotNull @PathParam("key") Long key); /** @@ -55,7 +55,7 @@ public interface NotificationService extends JAXRSService { * @return list of all notifications. */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<NotificationTO> list(); /** @@ -65,7 +65,7 @@ public interface NotificationService extends JAXRSService { * @return Response object featuring Location header of created notification */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull NotificationTO notificationTO); /** @@ -75,7 +75,7 @@ public interface NotificationService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull NotificationTO notificationTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java index c39f98a..c0e33e7 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java @@ -49,7 +49,7 @@ public interface PolicyService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) <T extends AbstractPolicyTO> T read(@NotNull @PathParam("key") Long key); /** @@ -60,7 +60,7 @@ public interface PolicyService extends JAXRSService { * @return list of policies with matching type */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) <T extends AbstractPolicyTO> List<T> list(@NotNull @MatrixParam("type") PolicyType type); /** @@ -70,7 +70,7 @@ public interface PolicyService extends JAXRSService { * @return Response object featuring Location header of created policy */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull AbstractPolicyTO policyTO); /** @@ -80,7 +80,7 @@ public interface PolicyService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull AbstractPolicyTO policyTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java index fdd0b6b..db772ce 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java @@ -44,7 +44,7 @@ public interface RealmService extends JAXRSService { * @return list of all realms. */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<RealmTO> list(); /** @@ -55,7 +55,7 @@ public interface RealmService extends JAXRSService { */ @GET @Path("{fullPath:.*}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<RealmTO> list(@NotNull @PathParam("fullPath") String fullPath); /** @@ -67,7 +67,7 @@ public interface RealmService extends JAXRSService { */ @POST @Path("{parentPath:.*}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull @PathParam("parentPath") String parentPath, @NotNull RealmTO realmTO); /** @@ -77,7 +77,7 @@ public interface RealmService extends JAXRSService { */ @PUT @Path("{fullPath:.*}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull RealmTO realmTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java index abfc6b6..a2b199b 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java @@ -44,7 +44,7 @@ public interface RelationshipTypeService extends JAXRSService { * @return list of all relationshipTypes. */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<RelationshipTypeTO> list(); /** @@ -55,7 +55,7 @@ public interface RelationshipTypeService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) RelationshipTypeTO read(@NotNull @PathParam("key") String key); /** @@ -65,7 +65,7 @@ public interface RelationshipTypeService extends JAXRSService { * @return Response object featuring Location header of created relationshipType */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull RelationshipTypeTO relationshipTypeTO); /** @@ -75,7 +75,7 @@ public interface RelationshipTypeService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull RelationshipTypeTO relationshipTypeTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java index 1f8399f..e871505 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java @@ -52,7 +52,7 @@ public interface ReportService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) ReportTO read(@NotNull @PathParam("key") Long key); /** @@ -63,7 +63,7 @@ public interface ReportService extends JAXRSService { */ @GET @Path("executions/{executionKey}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) ReportExecTO readExecution(@NotNull @PathParam("executionKey") Long executionKey); /** @@ -72,7 +72,7 @@ public interface ReportService extends JAXRSService { * @return paged list of existing reports matching the given query */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<ReportTO> list(); /** @@ -82,7 +82,7 @@ public interface ReportService extends JAXRSService { * @return Response object featuring Location header of created report */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull ReportTO reportTO); /** @@ -92,7 +92,7 @@ public interface ReportService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull ReportTO reportTO); /** @@ -121,7 +121,7 @@ public interface ReportService extends JAXRSService { */ @POST @Path("{key}/execute") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) ReportExecTO execute(@NotNull @PathParam("key") Long key); /** @@ -133,7 +133,7 @@ public interface ReportService extends JAXRSService { */ @GET @Path("executions/{executionKey}/stream") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response exportExecutionResult(@NotNull @PathParam("executionKey") Long executionKey, @QueryParam("format") ReportExecExportFormat fmt); @@ -145,7 +145,7 @@ public interface ReportService extends JAXRSService { */ @GET @Path("jobs") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<ReportExecTO> listJobs(@MatrixParam("type") JobStatusType type); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java index d515268..a007eaf 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java @@ -55,7 +55,7 @@ public interface ResourceService extends JAXRSService { */ @GET @Path("{key}/{anyTypeKey}/{anyKey}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) ConnObjectTO readConnObject( @NotNull @PathParam("key") String key, @NotNull @PathParam("anyTypeKey") String anyTypeKey, @@ -72,7 +72,7 @@ public interface ResourceService extends JAXRSService { */ @GET @Path("{key}/{anyTypeKey}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) PagedConnObjectTOResult listConnObjects( @NotNull @PathParam("key") String key, @NotNull @PathParam("anyTypeKey") String anyTypeKey, @@ -86,7 +86,7 @@ public interface ResourceService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) ResourceTO read(@NotNull @PathParam("key") String key); /** @@ -95,7 +95,7 @@ public interface ResourceService extends JAXRSService { * @return list of all resources */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<ResourceTO> list(); /** @@ -105,7 +105,7 @@ public interface ResourceService extends JAXRSService { * @return Response object featuring Location header of created resource */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull ResourceTO resourceTO); /** @@ -115,7 +115,7 @@ public interface ResourceService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull ResourceTO resourceTO); /** @@ -125,7 +125,7 @@ public interface ResourceService extends JAXRSService { */ @DELETE @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void delete(@NotNull @PathParam("key") String key); /** @@ -135,8 +135,8 @@ public interface ResourceService extends JAXRSService { */ @POST @Path("check") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void check(@NotNull ResourceTO resourceTO); /** @@ -147,8 +147,8 @@ public interface ResourceService extends JAXRSService { */ @POST @Path("{key}/bulkDeassociation/{anyTypeKey}/{action}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) BulkActionResult bulkDeassociation(@NotNull ResourceDeassociationPatch patch); /** @@ -159,7 +159,7 @@ public interface ResourceService extends JAXRSService { */ @POST @Path("bulk") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) BulkActionResult bulk(@NotNull BulkAction bulkAction); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java index 8a9082b..6fe55a6 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java @@ -44,7 +44,7 @@ public interface RoleService extends JAXRSService { * @return list of all roles. */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<RoleTO> list(); /** @@ -55,7 +55,7 @@ public interface RoleService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) RoleTO read(@NotNull @PathParam("key") String key); /** @@ -65,7 +65,7 @@ public interface RoleService extends JAXRSService { * @return Response object featuring Location header of created role */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull RoleTO roleTO); /** @@ -75,7 +75,7 @@ public interface RoleService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull RoleTO roleTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java index bdb11ee..48f9b40 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java @@ -51,7 +51,7 @@ public interface SchemaService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) <T extends AbstractSchemaTO> T read( @NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String key); @@ -63,7 +63,7 @@ public interface SchemaService extends JAXRSService { * @return list of schemas with matching type, for the given anyTypeClass if provided */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) <T extends AbstractSchemaTO> List<T> list(@BeanParam SchemaQuery query); /** @@ -74,7 +74,7 @@ public interface SchemaService extends JAXRSService { * @return Response object featuring Location header of created schema */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO); /** @@ -85,7 +85,7 @@ public interface SchemaService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java index 8104679..be69f40 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java @@ -44,7 +44,7 @@ public interface SecurityQuestionService extends JAXRSService { * @return list of all security questions */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<SecurityQuestionTO> list(); /** @@ -55,7 +55,7 @@ public interface SecurityQuestionService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) SecurityQuestionTO read(@NotNull @PathParam("key") Long key); /** @@ -65,7 +65,7 @@ public interface SecurityQuestionService extends JAXRSService { * @return Response object featuring Location header of created security question */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull SecurityQuestionTO securityQuestionTO); /** @@ -75,7 +75,7 @@ public interface SecurityQuestionService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull SecurityQuestionTO securityQuestionTO); /** @@ -95,7 +95,7 @@ public interface SecurityQuestionService extends JAXRSService { */ @GET @Path("byUser/{username}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) SecurityQuestionTO readByUser(@NotNull @PathParam("username") String username); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java index 772c09e..50f994d 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java @@ -36,6 +36,6 @@ public interface SyncopeService extends JAXRSService { * @return information summary about this Apache Syncope deployment's configuration */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) SyncopeTO info(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java index 5aacaae..0f2b8dd 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java @@ -59,7 +59,7 @@ public interface TaskService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) <T extends AbstractTaskTO> T read(@NotNull @PathParam("key") Long key); /** @@ -70,7 +70,7 @@ public interface TaskService extends JAXRSService { */ @GET @Path("executions/{executionKey}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) TaskExecTO readExecution(@NotNull @PathParam("executionKey") Long executionKey); /** @@ -81,7 +81,7 @@ public interface TaskService extends JAXRSService { * @return paged list of existing tasks matching type and the given query */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) <T extends AbstractTaskTO> PagedResult<T> list(@BeanParam TaskQuery query); /** @@ -91,7 +91,7 @@ public interface TaskService extends JAXRSService { * @return Response object featuring Location header of created task */ @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull SchedTaskTO taskTO); /** @@ -101,7 +101,7 @@ public interface TaskService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull AbstractTaskTO taskTO); /** @@ -131,7 +131,7 @@ public interface TaskService extends JAXRSService { */ @POST @Path("{key}/execute") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) TaskExecTO execute(@NotNull @PathParam("key") Long key, @QueryParam("dryRun") @DefaultValue("false") boolean dryRun); @@ -143,8 +143,8 @@ public interface TaskService extends JAXRSService { */ @POST @Path("bulk") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) BulkActionResult bulk(@NotNull BulkAction bulkAction); /** @@ -155,7 +155,7 @@ public interface TaskService extends JAXRSService { */ @GET @Path("jobs") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<TaskExecTO> listJobs(@MatrixParam("type") JobStatusType type); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java index 21140ed..1248da5 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java @@ -47,7 +47,7 @@ public interface UserSelfService extends JAXRSService { * {@link org.apache.syncope.common.rest.api.RESTHeaders#OWNED_ENTITLEMENTS} */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response read(); /** @@ -59,8 +59,8 @@ public interface UserSelfService extends JAXRSService { * itself - ProvisioningResult as Entity */ @POST - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create(@NotNull UserTO userTO, @DefaultValue("true") @QueryParam("storePassword") boolean storePassword); @@ -72,8 +72,8 @@ public interface UserSelfService extends JAXRSService { */ @PATCH @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response update(@NotNull UserPatch patch); /** @@ -84,8 +84,8 @@ public interface UserSelfService extends JAXRSService { */ @PUT @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response update(@NotNull UserTO user); /** @@ -94,7 +94,7 @@ public interface UserSelfService extends JAXRSService { * @return Response object featuring the deleted user - ProvisioningResult as Entity */ @DELETE - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response delete(); /** @@ -106,7 +106,7 @@ public interface UserSelfService extends JAXRSService { */ @POST @Path("changePassword") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response changePassword(@NotNull @QueryParam("password") String password); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java index 1fc14f9..c333163 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java @@ -70,7 +70,7 @@ public interface UserService extends AnyService<UserTO, UserPatch> { * @return paged list of existing users matching the given query */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) PagedResult<UserTO> list(@BeanParam AnyListQuery listQuery); /** @@ -82,8 +82,8 @@ public interface UserService extends AnyService<UserTO, UserPatch> { * enriched with propagation status information - ProvisioningResult as Entity */ @POST - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response create( @NotNull UserTO userTO, @DefaultValue("true") @QueryParam("storePassword") boolean storePassword); @@ -97,7 +97,7 @@ public interface UserService extends AnyService<UserTO, UserPatch> { */ @POST @Path("{key}/status") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response status(@NotNull StatusPatch statusPatch); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowService.java index 256317d..a8e0a05 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowService.java @@ -43,7 +43,7 @@ public interface UserWorkflowService extends JAXRSService { */ @GET @Path("forms") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<WorkflowFormTO> getForms(); /** @@ -55,7 +55,7 @@ public interface UserWorkflowService extends JAXRSService { */ @GET @Path("forms/{userKey}/{name}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<WorkflowFormTO> getFormsByName( @NotNull @PathParam("userKey") final Long userKey, @NotNull @PathParam("name") final String name); @@ -67,7 +67,7 @@ public interface UserWorkflowService extends JAXRSService { */ @GET @Path("forms/{userKey}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) WorkflowFormTO getFormForUser(@NotNull @PathParam("userKey") Long userKey); /** @@ -78,7 +78,7 @@ public interface UserWorkflowService extends JAXRSService { */ @POST @Path("forms/{taskId}/claim") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) WorkflowFormTO claimForm(@NotNull @PathParam("taskId") String taskId); /** @@ -89,8 +89,8 @@ public interface UserWorkflowService extends JAXRSService { */ @POST @Path("forms") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) UserTO submitForm(@NotNull WorkflowFormTO form); /** @@ -102,7 +102,7 @@ public interface UserWorkflowService extends JAXRSService { */ @POST @Path("tasks/{taskId}/execute") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) UserTO executeTask(@NotNull @PathParam("taskId") String taskId, @NotNull UserTO userTO); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java index 1a1370c..7654e6b 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java @@ -43,7 +43,7 @@ public interface WorkflowService extends JAXRSService { * @return workflow definition for matching kind */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) Response exportDefinition(@NotNull @PathParam("anyTypeKind") AnyTypeKind anyTypeKind); /** @@ -64,7 +64,7 @@ public interface WorkflowService extends JAXRSService { * @param definition workflow definition for matching kind */ @PUT - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void importDefinition(@NotNull @PathParam("anyTypeKind") AnyTypeKind anyTypeKind, @NotNull String definition); } http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java ---------------------------------------------------------------------- diff --git a/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java b/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java index 6d7fd50..66bdfc1 100644 --- a/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java +++ b/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java @@ -45,7 +45,7 @@ public interface CamelRouteService extends JAXRSService { * @return all routes for the given any type kind */ @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) List<CamelRouteTO> list(@NotNull @MatrixParam("anyTypeKind") AnyTypeKind anyTypeKind); /** @@ -56,7 +56,7 @@ public interface CamelRouteService extends JAXRSService { */ @GET @Path("{key}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Produces({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) CamelRouteTO read(@NotNull @PathParam("key") String key); /** @@ -66,7 +66,7 @@ public interface CamelRouteService extends JAXRSService { */ @PUT @Path("{key}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ JAXRSService.APPLICATION_XML, MediaType.APPLICATION_JSON }) void update(@NotNull CamelRouteTO route); /** http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java index 811d2bd..c45fba4 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java @@ -25,8 +25,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.IOException; -import java.io.InputStream; import java.security.AccessControlException; import java.util.List; import javax.naming.NamingEnumeration; @@ -38,9 +36,6 @@ import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.patch.AssociationPatch; @@ -75,8 +70,6 @@ import org.apache.syncope.common.lib.types.PropagationTaskExecStatus; import org.apache.syncope.common.lib.types.ResourceAssociationAction; import org.apache.syncope.common.lib.types.ResourceDeassociationAction; import org.apache.syncope.common.lib.types.SchemaType; -import org.apache.syncope.common.rest.api.Preference; -import org.apache.syncope.common.rest.api.RESTHeaders; import org.apache.syncope.common.rest.api.beans.AnyListQuery; import org.apache.syncope.common.rest.api.beans.AnySearchQuery; import org.apache.syncope.common.rest.api.service.GroupService; @@ -551,36 +544,6 @@ public class GroupITCase extends AbstractITCase { } @Test - public void noContent() throws IOException { - SyncopeClient noContentclient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD); - GroupService noContentService = noContentclient.prefer(GroupService.class, Preference.RETURN_NO_CONTENT); - - GroupTO group = getSampleTO("noContent"); - - Response response = noContentService.create(group); - assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); - assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); - assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity())); - - group = getObject(response.getLocation(), GroupService.class, GroupTO.class); - assertNotNull(group); - - GroupPatch groupPatch = new GroupPatch(); - groupPatch.setKey(group.getKey()); - groupPatch.getPlainAttrs().add(attrAddReplacePatch("badge", "xxxxxxxxxx")); - - response = noContentService.update(groupPatch); - assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); - assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); - assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity())); - - response = noContentService.delete(group.getKey()); - assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); - assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); - assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity())); - } - - @Test public void dynMembership() { assertTrue(userService.read(4L).getDynGroups().isEmpty()); http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RESTITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RESTITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RESTITCase.java new file mode 100644 index 0000000..a3bc1c7 --- /dev/null +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RESTITCase.java @@ -0,0 +1,147 @@ +/* + * 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.syncope.fit.core.reference; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.InputStream; +import javax.ws.rs.core.EntityTag; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import org.apache.commons.lang3.StringUtils; +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.syncope.client.lib.SyncopeClient; +import org.apache.syncope.client.lib.SyncopeClientFactoryBean; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.apache.syncope.common.lib.patch.GroupPatch; +import org.apache.syncope.common.lib.patch.StringReplacePatchItem; +import org.apache.syncope.common.lib.patch.UserPatch; +import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; +import org.apache.syncope.common.lib.to.UserTO; +import org.apache.syncope.common.lib.types.ClientExceptionType; +import org.apache.syncope.common.rest.api.Preference; +import org.apache.syncope.common.rest.api.RESTHeaders; +import org.apache.syncope.common.rest.api.service.AnyTypeClassService; +import org.apache.syncope.common.rest.api.service.GroupService; +import org.apache.syncope.common.rest.api.service.UserService; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +@FixMethodOrder(MethodSorters.JVM) +public class RESTITCase extends AbstractITCase { + + @Test + public void noContent() throws IOException { + SyncopeClient noContentclient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD); + GroupService noContentService = noContentclient.prefer(GroupService.class, Preference.RETURN_NO_CONTENT); + + GroupTO group = GroupITCase.getSampleTO("noContent"); + + Response response = noContentService.create(group); + assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); + assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); + assertEquals(StringUtils.EMPTY, org.apache.commons.io.IOUtils.toString((InputStream) response.getEntity())); + + group = getObject(response.getLocation(), GroupService.class, GroupTO.class); + assertNotNull(group); + + GroupPatch groupPatch = new GroupPatch(); + groupPatch.setKey(group.getKey()); + groupPatch.getPlainAttrs().add(attrAddReplacePatch("badge", "xxxxxxxxxx")); + + response = noContentService.update(groupPatch); + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); + assertEquals(StringUtils.EMPTY, org.apache.commons.io.IOUtils.toString((InputStream) response.getEntity())); + + response = noContentService.delete(group.getKey()); + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); + assertEquals(StringUtils.EMPTY, org.apache.commons.io.IOUtils.toString((InputStream) response.getEntity())); + } + + @Test + public void ifMatch() { + UserTO userTO = userService.create(UserITCase.getUniqueSampleTO("[email protected]"), true). + readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }).getAny(); + assertNotNull(userTO); + assertNotNull(userTO.getKey()); + + EntityTag etag = adminClient.getLatestEntityTag(userService); + assertNotNull(etag); + assertTrue(StringUtils.isNotBlank(etag.getValue())); + + UserPatch userPatch = new UserPatch(); + userPatch.setKey(userTO.getKey()); + userPatch.setUsername(new StringReplacePatchItem.Builder().value(userTO.getUsername() + "XX").build()); + userTO = userService.update(userPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }).getAny(); + assertTrue(userTO.getUsername().endsWith("XX")); + EntityTag etag1 = adminClient.getLatestEntityTag(userService); + assertFalse(etag.getValue().equals(etag1.getValue())); + + UserService ifMatchService = adminClient.ifMatch(UserService.class, etag); + userPatch.setUsername(new StringReplacePatchItem.Builder().value(userTO.getUsername() + "YY").build()); + try { + ifMatchService.update(userPatch); + fail(); + } catch (SyncopeClientException e) { + assertEquals(ClientExceptionType.ConcurrentModification, e.getType()); + } + + userTO = userService.read(userTO.getKey()); + assertTrue(userTO.getUsername().endsWith("XX")); + } + + @Test + public void defaultContentType() { + // manualy instantiate SyncopeClient so that media type can be set to */* + SyncopeClientFactoryBean factory = new SyncopeClientFactoryBean().setAddress(ADDRESS); + SyncopeClient client = new SyncopeClient( + MediaType.WILDCARD_TYPE, + factory.getRestClientFactoryBean(), + factory.getExceptionMapper(), + ADMIN_UNAME, + ADMIN_PWD, + false); + + // perform operation + AnyTypeClassService service = client.getService(AnyTypeClassService.class); + service.list(); + + // check that */* was actually sent + MultivaluedMap<String, String> requestHeaders = WebClient.client(service).getHeaders(); + assertEquals(MediaType.WILDCARD, requestHeaders.getFirst(HttpHeaders.ACCEPT)); + + // check that application/json was received + String contentType = WebClient.client(service).getResponse().getHeaderString(HttpHeaders.CONTENT_TYPE); + assertTrue(contentType.startsWith(MediaType.APPLICATION_JSON)); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java index 21adebb..44f09c2 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java @@ -27,7 +27,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; -import java.io.InputStream; import java.security.AccessControlException; import java.text.SimpleDateFormat; import java.util.Collection; @@ -38,17 +37,14 @@ import java.util.List; import java.util.Map; import java.util.Set; import javax.naming.NamingException; -import javax.ws.rs.core.EntityTag; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.Transformer; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.cxf.common.util.Base64Utility; import org.apache.cxf.helpers.IOUtils; -import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.patch.AssociationPatch; @@ -89,8 +85,6 @@ import org.apache.syncope.common.lib.types.ResourceAssociationAction; import org.apache.syncope.common.lib.types.ResourceDeassociationAction; import org.apache.syncope.common.lib.types.StatusPatchType; import org.apache.syncope.common.lib.types.TaskType; -import org.apache.syncope.common.rest.api.Preference; -import org.apache.syncope.common.rest.api.RESTHeaders; import org.apache.syncope.common.rest.api.beans.AnySearchQuery; import org.apache.syncope.common.rest.api.beans.TaskQuery; import org.apache.syncope.common.rest.api.service.ResourceService; @@ -1139,36 +1133,6 @@ public class UserITCase extends AbstractITCase { } @Test - public void noContent() throws IOException { - SyncopeClient noContentclient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD); - UserService noContentService = noContentclient.prefer(UserService.class, Preference.RETURN_NO_CONTENT); - - UserTO user = getUniqueSampleTO("[email protected]"); - - Response response = noContentService.create(user, true); - assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); - assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); - assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity())); - - user = getObject(response.getLocation(), UserService.class, UserTO.class); - assertNotNull(user); - - UserPatch userPatch = new UserPatch(); - userPatch.setKey(user.getKey()); - userPatch.setPassword(new PasswordPatch.Builder().value("password321").build()); - - response = noContentService.update(userPatch); - assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); - assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); - assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity())); - - response = noContentService.delete(user.getKey()); - assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); - assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); - assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity())); - } - - @Test public void customPolicyRules() { // Using custom policy rules with application/xml requires to overwrite // org.apache.syncope.common.lib.policy.AbstractAccountRuleConf's and / or @@ -2133,40 +2097,6 @@ public class UserITCase extends AbstractITCase { } @Test - public void ifMatch() { - UserTO userTO = userService.create(getUniqueSampleTO("[email protected]"), true). - readEntity(new GenericType<ProvisioningResult<UserTO>>() { - }).getAny(); - assertNotNull(userTO); - assertNotNull(userTO.getKey()); - - EntityTag etag = adminClient.getLatestEntityTag(userService); - assertNotNull(etag); - assertTrue(StringUtils.isNotBlank(etag.getValue())); - - UserPatch userPatch = new UserPatch(); - userPatch.setKey(userTO.getKey()); - userPatch.setUsername(new StringReplacePatchItem.Builder().value(userTO.getUsername() + "XX").build()); - userTO = userService.update(userPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() { - }).getAny(); - assertTrue(userTO.getUsername().endsWith("XX")); - EntityTag etag1 = adminClient.getLatestEntityTag(userService); - assertFalse(etag.getValue().equals(etag1.getValue())); - - UserService ifMatchService = adminClient.ifMatch(UserService.class, etag); - userPatch.setUsername(new StringReplacePatchItem.Builder().value(userTO.getUsername() + "YY").build()); - try { - ifMatchService.update(userPatch); - fail(); - } catch (SyncopeClientException e) { - assertEquals(ClientExceptionType.ConcurrentModification, e.getType()); - } - - userTO = userService.read(userTO.getKey()); - assertTrue(userTO.getUsername().endsWith("XX")); - } - - @Test public void issueSYNCOPE454() throws NamingException { // 1. create user with LDAP resource (with 'Generate password if missing' enabled) UserTO userTO = getUniqueSampleTO("[email protected]"); http://git-wip-us.apache.org/repos/asf/syncope/blob/b13fc178/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java index 23722f8..7145b3c 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java @@ -26,16 +26,12 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.IOException; -import java.io.InputStream; import java.security.AccessControlException; import java.util.Map; import java.util.Set; import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; -import org.apache.cxf.helpers.IOUtils; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.patch.BooleanReplacePatchItem; @@ -52,8 +48,6 @@ import org.apache.syncope.common.lib.to.WorkflowFormTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.PatchOperation; -import org.apache.syncope.common.rest.api.Preference; -import org.apache.syncope.common.rest.api.RESTHeaders; import org.apache.syncope.common.rest.api.service.ResourceService; import org.apache.syncope.common.rest.api.service.UserSelfService; import org.apache.syncope.common.rest.api.service.UserService; @@ -235,7 +229,7 @@ public class UserSelfITCase extends AbstractITCase { SyncopeClient authClient = clientFactory.create(created.getUsername(), "password123"); UserTO deleted = authClient.getService(UserSelfService.class).delete().readEntity( new GenericType<ProvisioningResult<UserTO>>() { - }).getAny(); + }).getAny(); assertNotNull(deleted); assertEquals(ActivitiDetector.isActivitiEnabledForUsers(syncopeService) ? "deleteApproval" : null, deleted.getStatus()); @@ -248,21 +242,6 @@ public class UserSelfITCase extends AbstractITCase { } @Test - public void noContent() throws IOException { - Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers(syncopeService)); - - SyncopeClient anonClient = clientFactory.create(); - UserSelfService noContentService = anonClient.prefer(UserSelfService.class, Preference.RETURN_NO_CONTENT); - - UserTO user = UserITCase.getUniqueSampleTO("[email protected]"); - - Response response = noContentService.create(user, true); - assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); - assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED)); - assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity())); - } - - @Test public void passwordReset() { // 0. ensure that password request DOES require security question configurationService.set(attrTO("passwordReset.securityQuestion", "true"));
