You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2013/12/16 12:04:57 UTC
svn commit: r1551172 [6/7] - in /syncope/trunk: ./ client/
client/src/main/java/org/apache/syncope/client/
client/src/main/java/org/apache/syncope/client/rest/ common/
common/src/main/java/org/apache/syncope/common/
common/src/main/java/org/apache/sync...
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -24,7 +24,7 @@ import javax.ws.rs.BadRequestException;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.services.PolicyService;
import org.apache.syncope.common.to.AccountPolicyTO;
-import org.apache.syncope.common.to.CorrelationRuleClassTO;
+import org.apache.syncope.common.wrap.CorrelationRuleClass;
import org.apache.syncope.common.to.PasswordPolicyTO;
import org.apache.syncope.common.to.AbstractPolicyTO;
import org.apache.syncope.common.to.SyncPolicyTO;
@@ -117,7 +117,7 @@ public class PolicyServiceImpl extends A
}
@Override
- public List<CorrelationRuleClassTO> getSyncCorrelationRuleClasses() {
- return CollectionWrapper.wrap(policyController.getSyncCorrelationRuleClasses(), CorrelationRuleClassTO.class);
+ public List<CorrelationRuleClass> getSyncCorrelationRuleClasses() {
+ return CollectionWrapper.wrap(policyController.getSyncCorrelationRuleClasses(), CorrelationRuleClass.class);
}
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -26,13 +26,14 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import org.apache.syncope.common.services.ReportService;
-import org.apache.syncope.common.types.ReportletConfClasses;
+import org.apache.syncope.common.reqres.PagedResult;
import org.apache.syncope.common.to.ReportExecTO;
import org.apache.syncope.common.to.ReportTO;
import org.apache.syncope.common.types.RESTHeaders;
import org.apache.syncope.common.types.ReportExecExportFormat;
+import org.apache.syncope.common.util.CollectionWrapper;
+import org.apache.syncope.common.wrap.ReportletConfClass;
import org.apache.syncope.core.persistence.beans.ReportExec;
-import org.apache.syncope.core.persistence.dao.ReportDAO;
import org.apache.syncope.core.rest.controller.ReportController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -43,9 +44,6 @@ public class ReportServiceImpl extends A
@Autowired
private ReportController controller;
- @Autowired
- private ReportDAO reportDAO;
-
@Override
public Response create(final ReportTO reportTO) {
ReportTO createdReportTO = controller.create(reportTO);
@@ -61,23 +59,19 @@ public class ReportServiceImpl extends A
}
@Override
- public int count() {
- return reportDAO.count();
- }
-
- @Override
- public List<ReportTO> list() {
- return controller.list();
+ public PagedResult<ReportTO> list() {
+ return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE);
}
@Override
- public List<ReportTO> list(final int page, final int size) {
- return controller.list(page, size);
+ public PagedResult<ReportTO> list(final int page, final int size) {
+ checkPageSize(page, size);
+ return buildPagedResult(controller.list(page, size), page, size, controller.count());
}
@Override
- public ReportletConfClasses getReportletConfClasses() {
- return new ReportletConfClasses(controller.getReportletConfClasses());
+ public List<ReportletConfClass> getReportletConfClasses() {
+ return CollectionWrapper.wrap(controller.getReportletConfClasses(), ReportletConfClass.class);
}
@Override
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -28,11 +28,11 @@ import javax.ws.rs.core.Response;
import org.apache.syncope.common.services.ResourceService;
import org.apache.syncope.common.to.AbstractAttributableTO;
-import org.apache.syncope.common.to.BulkAction;
-import org.apache.syncope.common.to.BulkActionRes;
-import org.apache.syncope.common.to.BulkAssociationAction;
+import org.apache.syncope.common.reqres.BulkAction;
+import org.apache.syncope.common.reqres.BulkActionResult;
+import org.apache.syncope.common.reqres.BulkAssociationAction;
import org.apache.syncope.common.to.ConnObjectTO;
-import org.apache.syncope.common.to.PropagationActionClassTO;
+import org.apache.syncope.common.wrap.PropagationActionClass;
import org.apache.syncope.common.to.ResourceTO;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.common.types.RESTHeaders;
@@ -81,8 +81,8 @@ public class ResourceServiceImpl extends
}
@Override
- public List<PropagationActionClassTO> getPropagationActionsClasses() {
- return CollectionWrapper.wrap(controller.getPropagationActionsClasses(), PropagationActionClassTO.class);
+ public List<PropagationActionClass> getPropagationActionsClasses() {
+ return CollectionWrapper.wrap(controller.getPropagationActionsClasses(), PropagationActionClass.class);
}
@Override
@@ -106,12 +106,12 @@ public class ResourceServiceImpl extends
}
@Override
- public BulkActionRes bulk(final BulkAction bulkAction) {
+ public BulkActionResult bulk(final BulkAction bulkAction) {
return controller.bulk(bulkAction);
}
@Override
- public BulkActionRes bulkAssociation(final String resourceName,
+ public BulkActionResult bulkAssociation(final String resourceName,
final BulkAssociationAction bulkAssociationAction, final AttributableType type) {
if (bulkAssociationAction.getOperation() == null || type == AttributableType.MEMBERSHIP) {
@@ -122,7 +122,7 @@ public class ResourceServiceImpl extends
? userController
: roleController;
- final BulkActionRes res = new BulkActionRes();
+ final BulkActionResult res = new BulkActionResult();
for (Long id : bulkAssociationAction.getTargets()) {
final Set<String> resources = Collections.singleton(resourceName);
@@ -143,10 +143,10 @@ public class ResourceServiceImpl extends
default:
}
- res.add(id, BulkActionRes.Status.SUCCESS);
+ res.add(id, BulkActionResult.Status.SUCCESS);
} catch (Exception e) {
LOG.warn("While executing {} on {} {}", bulkAssociationAction.getOperation(), type, id, e);
- res.add(id, BulkActionRes.Status.FAILURE);
+ res.add(id, BulkActionResult.Status.FAILURE);
}
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -25,13 +25,13 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import org.apache.syncope.common.mod.RoleMod;
-import org.apache.syncope.common.search.NodeCond;
-import org.apache.syncope.common.services.InvalidSearchConditionException;
import org.apache.syncope.common.services.RoleService;
-import org.apache.syncope.common.to.ResourceNameTO;
+import org.apache.syncope.common.reqres.PagedResult;
+import org.apache.syncope.common.wrap.ResourceName;
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.types.ResourceAssociationActionType;
import org.apache.syncope.common.util.CollectionWrapper;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
import org.apache.syncope.core.rest.controller.RoleController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -48,11 +48,6 @@ public class RoleServiceImpl extends Abs
}
@Override
- public int count() {
- return controller.count();
- }
-
- @Override
public Response create(final RoleTO roleTO) {
RoleTO created = controller.create(roleTO);
return createResponse(created.getId(), created).build();
@@ -62,7 +57,7 @@ public class RoleServiceImpl extends Abs
public Response delete(final Long roleId) {
RoleTO role = controller.read(roleId);
- ResponseBuilder builder = context.getRequest().evaluatePreconditions(new EntityTag(role.getETagValue()));
+ ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EntityTag(role.getETagValue()));
if (builder == null) {
RoleTO deleted = controller.delete(roleId);
builder = modificationResponse(deleted);
@@ -72,13 +67,14 @@ public class RoleServiceImpl extends Abs
}
@Override
- public List<RoleTO> list() {
- return list(1, 25);
+ public PagedResult<RoleTO> list() {
+ return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE);
}
@Override
- public List<RoleTO> list(final int page, final int size) {
- return controller.list(page, size);
+ public PagedResult<RoleTO> list(final int page, final int size) {
+ checkPageSize(page, size);
+ return buildPagedResult(controller.list(page, size), page, size, controller.count());
}
@Override
@@ -92,20 +88,15 @@ public class RoleServiceImpl extends Abs
}
@Override
- public List<RoleTO> search(final NodeCond searchCondition) throws InvalidSearchConditionException {
- return controller.search(searchCondition, 1, 25);
- }
-
- @Override
- public List<RoleTO> search(final NodeCond searchCondition, final int page, final int size)
- throws InvalidSearchConditionException {
-
- return controller.search(searchCondition, page, size);
+ public PagedResult<RoleTO> search(final String fiql) {
+ return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE);
}
@Override
- public int searchCount(final NodeCond searchCondition) throws InvalidSearchConditionException {
- return controller.searchCount(searchCondition);
+ public PagedResult<RoleTO> search(final String fiql, final int page, final int size) {
+ checkPageSize(page, size);
+ SearchCond cond = getSearchCond(fiql);
+ return buildPagedResult(controller.search(cond, page, size), page, size, controller.searchCount(cond));
}
@Override
@@ -117,7 +108,7 @@ public class RoleServiceImpl extends Abs
public Response update(final Long roleId, final RoleMod roleMod) {
RoleTO role = controller.read(roleId);
- ResponseBuilder builder = context.getRequest().evaluatePreconditions(new EntityTag(role.getETagValue()));
+ ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EntityTag(role.getETagValue()));
if (builder == null) {
roleMod.setId(roleId);
RoleTO updated = controller.update(roleMod);
@@ -129,11 +120,11 @@ public class RoleServiceImpl extends Abs
@Override
public Response associate(final Long roleId, final ResourceAssociationActionType type,
- final List<ResourceNameTO> resourceNames) {
+ final List<ResourceName> resourceNames) {
RoleTO role = controller.read(roleId);
- ResponseBuilder builder = context.getRequest().evaluatePreconditions(new EntityTag(role.getETagValue()));
+ ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EntityTag(role.getETagValue()));
if (builder == null) {
RoleTO updated;
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -23,15 +23,16 @@ import java.util.List;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.services.TaskService;
-import org.apache.syncope.common.to.BulkAction;
-import org.apache.syncope.common.to.BulkActionRes;
-import org.apache.syncope.common.to.JobClassTO;
+import org.apache.syncope.common.reqres.BulkAction;
+import org.apache.syncope.common.reqres.BulkActionResult;
+import org.apache.syncope.common.wrap.JobClass;
import org.apache.syncope.common.to.ReportExecTO;
import org.apache.syncope.common.to.SchedTaskTO;
-import org.apache.syncope.common.to.SyncActionClassTO;
+import org.apache.syncope.common.wrap.SyncActionClass;
import org.apache.syncope.common.to.SyncTaskTO;
import org.apache.syncope.common.to.TaskExecTO;
import org.apache.syncope.common.to.AbstractTaskTO;
+import org.apache.syncope.common.reqres.PagedResult;
import org.apache.syncope.common.types.RESTHeaders;
import org.apache.syncope.common.types.PropagationTaskExecStatus;
import org.apache.syncope.common.types.TaskType;
@@ -47,11 +48,6 @@ public class TaskServiceImpl extends Abs
private TaskController controller;
@Override
- public int count(final TaskType taskType) {
- return controller.count(taskType);
- }
-
- @Override
public <T extends SchedTaskTO> Response create(final T taskTO) {
T createdTask;
if (taskTO instanceof SyncTaskTO || taskTO instanceof SchedTaskTO) {
@@ -82,23 +78,26 @@ public class TaskServiceImpl extends Abs
}
@Override
- public List<JobClassTO> getJobClasses() {
- return CollectionWrapper.wrap(controller.getJobClasses(), JobClassTO.class);
+ public List<JobClass> getJobClasses() {
+ return CollectionWrapper.wrap(controller.getJobClasses(), JobClass.class);
}
@Override
- public List<SyncActionClassTO> getSyncActionsClasses() {
- return CollectionWrapper.wrap(controller.getSyncActionsClasses(), SyncActionClassTO.class);
+ public List<SyncActionClass> getSyncActionsClasses() {
+ return CollectionWrapper.wrap(controller.getSyncActionsClasses(), SyncActionClass.class);
}
@Override
- public <T extends AbstractTaskTO> List<T> list(final TaskType taskType) {
- return controller.list(taskType);
+ public <T extends AbstractTaskTO> PagedResult<T> list(final TaskType taskType) {
+ return list(taskType, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE);
}
@Override
- public <T extends AbstractTaskTO> List<T> list(final TaskType taskType, final int page, final int size) {
- return controller.list(taskType, page, size);
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractTaskTO> PagedResult<T> list(final TaskType taskType, final int page, final int size) {
+ checkPageSize(page, size);
+ return (PagedResult<T>) buildPagedResult(
+ controller.list(taskType, page, size), page, size, controller.count(taskType));
}
@Override
@@ -129,7 +128,7 @@ public class TaskServiceImpl extends Abs
}
@Override
- public BulkActionRes bulk(final BulkAction bulkAction) {
+ public BulkActionResult bulk(final BulkAction bulkAction) {
return controller.bulk(bulkAction);
}
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserSelfServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserSelfServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserSelfServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserSelfServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -36,7 +36,7 @@ public class UserSelfServiceImpl extends
@Override
public Response getOptions() {
- return Response.ok().header(HttpHeaders.ALLOW, "GET,POST,OPTIONS,HEAD").
+ return Response.ok().header(HttpHeaders.ALLOW, OPTIONS_ALLOW).
header(RESTHeaders.SELFREGISTRATION_ALLOWED, controller.isSelfRegistrationAllowed()).
build();
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -25,16 +25,16 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import org.apache.syncope.common.mod.StatusMod;
import org.apache.syncope.common.mod.UserMod;
-import org.apache.syncope.common.search.NodeCond;
-import org.apache.syncope.common.services.InvalidSearchConditionException;
import org.apache.syncope.common.services.UserService;
-import org.apache.syncope.common.to.BulkAction;
-import org.apache.syncope.common.to.BulkActionRes;
-import org.apache.syncope.common.to.ResourceNameTO;
+import org.apache.syncope.common.reqres.BulkAction;
+import org.apache.syncope.common.reqres.BulkActionResult;
+import org.apache.syncope.common.reqres.PagedResult;
+import org.apache.syncope.common.wrap.ResourceName;
import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.types.RESTHeaders;
import org.apache.syncope.common.types.ResourceAssociationActionType;
import org.apache.syncope.common.util.CollectionWrapper;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
import org.apache.syncope.core.rest.controller.UserController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -47,24 +47,19 @@ public class UserServiceImpl extends Abs
@Override
public Response getUsername(final Long userId) {
- return Response.ok().header(HttpHeaders.ALLOW, "GET,POST,OPTIONS,HEAD").
+ return Response.ok().header(HttpHeaders.ALLOW, OPTIONS_ALLOW).
header(RESTHeaders.USERNAME, controller.getUsername(userId)).
build();
}
@Override
public Response getUserId(final String username) {
- return Response.ok().header(HttpHeaders.ALLOW, "GET,POST,OPTIONS,HEAD").
+ return Response.ok().header(HttpHeaders.ALLOW, OPTIONS_ALLOW).
header(RESTHeaders.USER_ID, controller.getUserId(username)).
build();
}
@Override
- public int count() {
- return controller.count();
- }
-
- @Override
public Response create(final UserTO userTO) {
UserTO created = controller.create(userTO);
return createResponse(created.getId(), created).build();
@@ -74,7 +69,7 @@ public class UserServiceImpl extends Abs
public Response delete(final Long userId) {
UserTO user = controller.read(userId);
- ResponseBuilder builder = context.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
+ ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
if (builder == null) {
UserTO deleted = controller.delete(userId);
builder = modificationResponse(deleted);
@@ -84,13 +79,14 @@ public class UserServiceImpl extends Abs
}
@Override
- public List<UserTO> list() {
- return list(1, 25);
+ public PagedResult<UserTO> list() {
+ return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE);
}
@Override
- public List<UserTO> list(final int page, final int size) {
- return controller.list(page, size);
+ public PagedResult<UserTO> list(final int page, final int size) {
+ checkPageSize(page, size);
+ return buildPagedResult(controller.list(page, size), page, size, controller.count());
}
@Override
@@ -99,27 +95,22 @@ public class UserServiceImpl extends Abs
}
@Override
- public List<UserTO> search(final NodeCond searchCondition) throws InvalidSearchConditionException {
- return controller.search(searchCondition, 1, 25);
- }
-
- @Override
- public List<UserTO> search(final NodeCond searchCondition, final int page, final int size)
- throws InvalidSearchConditionException {
-
- return controller.search(searchCondition, page, size);
+ public PagedResult<UserTO> search(final String fiql) {
+ return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE);
}
@Override
- public int searchCount(final NodeCond searchCondition) throws InvalidSearchConditionException {
- return controller.searchCount(searchCondition);
+ public PagedResult<UserTO> search(final String fiql, final int page, final int size) {
+ checkPageSize(page, size);
+ SearchCond cond = getSearchCond(fiql);
+ return buildPagedResult(controller.search(cond, page, size), page, size, controller.searchCount(cond));
}
@Override
public Response update(final Long userId, final UserMod userMod) {
UserTO user = controller.read(userId);
- ResponseBuilder builder = context.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
+ ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
if (builder == null) {
userMod.setId(userId);
UserTO updated = controller.update(userMod);
@@ -133,7 +124,7 @@ public class UserServiceImpl extends Abs
public Response status(final Long userId, final StatusMod statusMod) {
UserTO user = controller.read(userId);
- ResponseBuilder builder = context.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
+ ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
if (builder == null) {
statusMod.setId(userId);
UserTO updated = controller.status(statusMod);
@@ -144,17 +135,17 @@ public class UserServiceImpl extends Abs
}
@Override
- public BulkActionRes bulk(final BulkAction bulkAction) {
+ public BulkActionResult bulk(final BulkAction bulkAction) {
return controller.bulk(bulkAction);
}
@Override
public Response associate(final Long userId, final ResourceAssociationActionType type,
- final List<ResourceNameTO> resourceNames) {
+ final List<ResourceName> resourceNames) {
UserTO user = controller.read(userId);
- ResponseBuilder builder = context.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
+ ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EntityTag(user.getETagValue()));
if (builder == null) {
UserTO updated;
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java Mon Dec 16 11:04:52 2013
@@ -59,7 +59,7 @@ public class WorkflowServiceImpl extends
default:
}
- Response.ResponseBuilder builder = Response.ok().header(HttpHeaders.ALLOW, "GET,POST,OPTIONS,HEAD");
+ Response.ResponseBuilder builder = Response.ok().header(HttpHeaders.ALLOW, OPTIONS_ALLOW);
if (key != null && value != null) {
builder.header(key, value);
}
@@ -69,7 +69,7 @@ public class WorkflowServiceImpl extends
@Override
public Response exportDefinition(final AttributableType kind) {
final MediaType accept =
- context.getHttpHeaders().getAcceptableMediaTypes().contains(MediaType.APPLICATION_JSON_TYPE)
+ messageContext.getHttpHeaders().getAcceptableMediaTypes().contains(MediaType.APPLICATION_JSON_TYPE)
? MediaType.APPLICATION_JSON_TYPE
: MediaType.APPLICATION_XML_TYPE;
@@ -126,7 +126,7 @@ public class WorkflowServiceImpl extends
@Override
public void importDefinition(final AttributableType kind, final String definition) {
final MediaType contentType =
- context.getHttpHeaders().getMediaType().equals(MediaType.APPLICATION_JSON_TYPE)
+ messageContext.getHttpHeaders().getMediaType().equals(MediaType.APPLICATION_JSON_TYPE)
? MediaType.APPLICATION_JSON_TYPE
: MediaType.APPLICATION_XML_TYPE;
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java Mon Dec 16 11:04:52 2013
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.core.sync;
-import org.apache.syncope.common.search.NodeCond;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
import org.identityconnectors.framework.common.objects.ConnectorObject;
/**
@@ -32,5 +32,5 @@ public interface SyncCorrelationRule {
* @param connObj connector object.
* @return search condition.
*/
- NodeCond getSearchCond(ConnectorObject connObj);
+ SearchCond getSearchCond(ConnectorObject connObj);
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java Mon Dec 16 11:04:52 2013
@@ -30,10 +30,9 @@ import org.apache.commons.lang3.StringUt
import org.apache.syncope.common.mod.AttributeMod;
import org.apache.syncope.common.mod.RoleMod;
import org.apache.syncope.common.mod.UserMod;
-import org.apache.syncope.common.search.AttributableCond;
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.NodeCond;
-import org.apache.syncope.common.services.InvalidSearchConditionException;
+import org.apache.syncope.core.persistence.dao.search.AttributableCond;
+import org.apache.syncope.core.persistence.dao.search.AttributeCond;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
import org.apache.syncope.common.to.AbstractAttributableTO;
import org.apache.syncope.common.to.AttributeTO;
import org.apache.syncope.common.to.RoleTO;
@@ -310,13 +309,9 @@ public class SyncopeSyncResultHandler im
case UserDerivedSchema:
case RoleDerivedSchema:
- try {
- subjects = userDAO.findByDerAttrValue(accountIdItem.getIntAttrName(), uid, attrUtil);
- for (AbstractAttributable subject : subjects) {
- result.add(subject.getId());
- }
- } catch (InvalidSearchConditionException e) {
- LOG.error("Could not search for matching subjects", e);
+ subjects = userDAO.findByDerAttrValue(accountIdItem.getIntAttrName(), uid, attrUtil);
+ for (AbstractAttributable subject : subjects) {
+ result.add(subject.getId());
}
break;
@@ -355,7 +350,7 @@ public class SyncopeSyncResultHandler im
return result;
}
- protected List<Long> search(final NodeCond searchCond, final AttributableUtil attrUtil) {
+ protected List<Long> search(final SearchCond searchCond, final AttributableUtil attrUtil) {
final List<Long> result = new ArrayList<Long>();
final List<AbstractAttributable> subjects = searchDAO.search(
@@ -386,7 +381,7 @@ public class SyncopeSyncResultHandler im
}
// search for user/role by attribute(s) specified in the policy
- NodeCond searchCond = null;
+ SearchCond searchCond = null;
for (String schema : altSearchSchemas) {
Attribute value = extValues.get(schema);
@@ -404,7 +399,7 @@ public class SyncopeSyncResultHandler im
: value.getValue().get(0).toString();
}
- NodeCond nodeCond;
+ SearchCond nodeCond;
// users: just id or username can be selected to be used
// roles: just id or name can be selected to be used
if ("id".equalsIgnoreCase(schema) || "username".equalsIgnoreCase(schema)
@@ -415,19 +410,19 @@ public class SyncopeSyncResultHandler im
cond.setType(type);
cond.setExpression(expression);
- nodeCond = NodeCond.getLeafCond(cond);
+ nodeCond = SearchCond.getLeafCond(cond);
} else {
AttributeCond cond = new AttributeCond();
cond.setSchema(schema);
cond.setType(type);
cond.setExpression(expression);
- nodeCond = NodeCond.getLeafCond(cond);
+ nodeCond = SearchCond.getLeafCond(cond);
}
searchCond = searchCond == null
? nodeCond
- : NodeCond.getAndCond(searchCond, nodeCond);
+ : SearchCond.getAndCond(searchCond, nodeCond);
}
return search(searchCond, attrUtil);
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java Mon Dec 16 11:04:52 2013
@@ -66,7 +66,7 @@ import org.apache.syncope.common.to.Work
import org.apache.syncope.common.types.ResourceOperation;
import org.apache.syncope.common.types.WorkflowFormPropertyType;
import org.apache.syncope.common.util.BeanUtils;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
import org.apache.syncope.core.persistence.dao.NotFoundException;
import org.apache.syncope.core.persistence.validation.attrvalue.ParsingValidationException;
Modified: syncope/trunk/core/src/main/resources/restContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/restContext.xml?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/restContext.xml (original)
+++ syncope/trunk/core/src/main/resources/restContext.xml Mon Dec 16 11:04:52 2013
@@ -58,13 +58,6 @@ under the License.
<property name="innerElementCountThreshold" value="500"/>
</bean>
</property>
- <property name="marshallerProperties">
- <map>
- <entry key="jaxb.formatted.output">
- <value type="java.lang.Boolean">true</value>
- </entry>
- </map>
- </property>
<property name="collectionWrapperMap">
<map>
<entry>
@@ -84,6 +77,8 @@ under the License.
<bean id="exceptionMapper" class="org.apache.syncope.core.rest.utils.RestServiceExceptionMapper"/>
+ <bean id="searchContextProvider" class="org.apache.cxf.jaxrs.ext.search.SearchContextProvider"/>
+
<bean id="wadlGenerator" class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
<property name="applicationTitle" value="Apache Syncope ${project.version}"/>
<property name="namespacePrefix" value="syncope"/>
@@ -94,7 +89,7 @@ under the License.
</bean>
<bean id="addETagFilter" class="org.apache.syncope.core.services.AddETagFilter"/>
-
+
<jaxrs:server id="restContainer" address="/" staticSubresourceResolution="true">
<jaxrs:serviceBeans>
<ref bean="connectorServiceImpl"/>
@@ -116,10 +111,14 @@ under the License.
<jaxrs:resourceComparator>
<bean id="queryResourceInfoComparator" class="org.apache.syncope.core.rest.utils.QueryResourceInfoComparator"/>
</jaxrs:resourceComparator>
+ <jaxrs:properties>
+ <entry key="search.lax.property.match" value="true"/>
+ </jaxrs:properties>
<jaxrs:providers>
<ref bean="jaxbProvider"/>
<ref bean="jsonProvider"/>
<ref bean="exceptionMapper"/>
+ <ref bean="searchContextProvider"/>
<ref bean="wadlGenerator"/>
<ref bean="addETagFilter"/>
</jaxrs:providers>
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java Mon Dec 16 11:04:52 2013
@@ -37,9 +37,8 @@ import javax.mail.Session;
import javax.mail.Store;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.SyncopeClient;
import org.apache.syncope.common.SyncopeConstants;
-import org.apache.syncope.common.search.MembershipCond;
-import org.apache.syncope.common.search.NodeCond;
import org.apache.syncope.common.to.MembershipTO;
import org.apache.syncope.common.to.NotificationTaskTO;
import org.apache.syncope.common.to.UserTO;
@@ -210,14 +209,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = new Notification();
notification.addEvent("[REST]:[UserController]:[]:[create]:[SUCCESS]");
-
- MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(7L);
- notification.setAbout(NodeCond.getLeafCond(membCond));
-
- membCond = new MembershipCond();
- membCond.setRoleId(8L);
- notification.setRecipients(NodeCond.getLeafCond(membCond));
+ notification.setAbout(SyncopeClient.getSearchConditionBuilder().hasRoles(7L).query());
+ notification.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -266,14 +259,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = new Notification();
notification.addEvent("[REST]:[UserController]:[]:[create]:[SUCCESS]");
-
- MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(7L);
- notification.setAbout(NodeCond.getLeafCond(membCond));
-
- membCond = new MembershipCond();
- membCond.setRoleId(8L);
- notification.setRecipients(NodeCond.getLeafCond(membCond));
+ notification.setAbout(SyncopeClient.getSearchConditionBuilder().hasRoles(7L).query());
+ notification.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -324,12 +311,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = new Notification();
notification.addEvent("[REST]:[UserController]:[]:[create]:[SUCCESS]");
-
notification.setAbout(null);
-
- MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(8L);
- notification.setRecipients(NodeCond.getLeafCond(membCond));
+ notification.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -378,12 +361,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = new Notification();
notification.addEvent("[REST]:[UserController]:[]:[create]:[SUCCESS]");
-
notification.setAbout(null);
-
- MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(8L);
- notification.setRecipients(NodeCond.getLeafCond(membCond));
+ notification.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java Mon Dec 16 11:04:52 2013
@@ -27,11 +27,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.common.search.AttributableCond;
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.MembershipCond;
-import org.apache.syncope.common.search.NodeCond;
-import org.apache.syncope.common.search.ResourceCond;
+import org.apache.syncope.core.persistence.dao.search.AttributableCond;
+import org.apache.syncope.core.persistence.dao.search.AttributeCond;
+import org.apache.syncope.core.persistence.dao.search.MembershipCond;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
+import org.apache.syncope.core.persistence.dao.search.ResourceCond;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -69,12 +69,12 @@ public class AttributableSearchTest {
MembershipCond membershipCond = new MembershipCond();
membershipCond.setRoleId(5L);
- assertFalse(searchDAO.matches(user, NodeCond.getLeafCond(membershipCond),
+ assertFalse(searchDAO.matches(user, SearchCond.getLeafCond(membershipCond),
AttributableUtil.getInstance(AttributableType.USER)));
membershipCond.setRoleId(1L);
- assertTrue(searchDAO.matches(user, NodeCond.getLeafCond(membershipCond),
+ assertTrue(searchDAO.matches(user, SearchCond.getLeafCond(membershipCond),
AttributableUtil.getInstance(AttributableType.USER)));
}
@@ -87,7 +87,7 @@ public class AttributableSearchTest {
attrCond.setSchema("show");
attrCond.setType(AttributeCond.Type.ISNOTNULL);
- assertTrue(searchDAO.matches(role, NodeCond.getLeafCond(attrCond),
+ assertTrue(searchDAO.matches(role, SearchCond.getLeafCond(attrCond),
AttributableUtil.getInstance(AttributableType.ROLE)));
}
@@ -104,12 +104,12 @@ public class AttributableSearchTest {
loginDateCond.setSchema("loginDate");
loginDateCond.setExpression("2009-05-26");
- NodeCond subCond = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond), NodeCond.getLeafCond(
+ SearchCond subCond = SearchCond.getAndCond(SearchCond.getLeafCond(fullnameLeafCond), SearchCond.getLeafCond(
membershipCond));
assertTrue(subCond.isValid());
- NodeCond cond = NodeCond.getAndCond(subCond, NodeCond.getLeafCond(loginDateCond));
+ SearchCond cond = SearchCond.getAndCond(subCond, SearchCond.getLeafCond(loginDateCond));
assertTrue(cond.isValid());
@@ -125,7 +125,7 @@ public class AttributableSearchTest {
fullnameLeafCond.setSchema("fullname");
fullnameLeafCond.setExpression("Giuseppe Verdi");
- final NodeCond cond = NodeCond.getNotLeafCond(fullnameLeafCond);
+ final SearchCond cond = SearchCond.getNotLeafCond(fullnameLeafCond);
assertTrue(cond.isValid());
final List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), cond,
@@ -147,7 +147,7 @@ public class AttributableSearchTest {
coolLeafCond.setSchema("cool");
coolLeafCond.setExpression("true");
- final NodeCond cond = NodeCond.getLeafCond(coolLeafCond);
+ final SearchCond cond = SearchCond.getLeafCond(coolLeafCond);
assertTrue(cond.isValid());
final List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), cond,
@@ -171,12 +171,12 @@ public class AttributableSearchTest {
loginDateCond.setSchema("loginDate");
loginDateCond.setExpression("2009-05-26");
- NodeCond subCond = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond), NodeCond.getLeafCond(
+ SearchCond subCond = SearchCond.getAndCond(SearchCond.getLeafCond(fullnameLeafCond), SearchCond.getLeafCond(
membershipCond));
assertTrue(subCond.isValid());
- NodeCond cond = NodeCond.getAndCond(subCond, NodeCond.getLeafCond(loginDateCond));
+ SearchCond cond = SearchCond.getAndCond(subCond, SearchCond.getLeafCond(loginDateCond));
assertTrue(cond.isValid());
@@ -197,7 +197,7 @@ public class AttributableSearchTest {
membershipCond.setRoleId(1L);
List<SyncopeUser> users = searchDAO.search(
- EntitlementUtil.getRoleIds(entitlementDAO.findAll()), NodeCond.getLeafCond(membershipCond),
+ EntitlementUtil.getRoleIds(entitlementDAO.findAll()), SearchCond.getLeafCond(membershipCond),
AttributableUtil.getInstance(AttributableType.USER));
assertNotNull(users);
assertEquals(2, users.size());
@@ -206,7 +206,7 @@ public class AttributableSearchTest {
membershipCond.setRoleId(5L);
users = searchDAO.search(
- EntitlementUtil.getRoleIds(entitlementDAO.findAll()), NodeCond.getNotLeafCond(membershipCond),
+ EntitlementUtil.getRoleIds(entitlementDAO.findAll()), SearchCond.getNotLeafCond(membershipCond),
AttributableUtil.getInstance(AttributableType.USER));
assertNotNull(users);
assertEquals(5, users.size());
@@ -218,7 +218,7 @@ public class AttributableSearchTest {
coolLeafCond.setSchema("cool");
List<SyncopeUser> users = searchDAO.search(
- EntitlementUtil.getRoleIds(entitlementDAO.findAll()), NodeCond.getLeafCond(coolLeafCond),
+ EntitlementUtil.getRoleIds(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
AttributableUtil.getInstance(AttributableType.USER));
assertNotNull(users);
assertEquals(4, users.size());
@@ -227,7 +227,7 @@ public class AttributableSearchTest {
coolLeafCond.setSchema("cool");
users = searchDAO.search(
- EntitlementUtil.getRoleIds(entitlementDAO.findAll()), NodeCond.getLeafCond(coolLeafCond),
+ EntitlementUtil.getRoleIds(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
AttributableUtil.getInstance(AttributableType.USER));
assertNotNull(users);
assertEquals(1, users.size());
@@ -241,7 +241,7 @@ public class AttributableSearchTest {
ResourceCond ws1 = new ResourceCond();
ws1.setResourceName("ws-target-resource-list-mappings-2");
- NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getNotLeafCond(ws2), NodeCond.getLeafCond(ws1));
+ SearchCond searchCondition = SearchCond.getAndCond(SearchCond.getNotLeafCond(ws2), SearchCond.getLeafCond(ws1));
assertTrue(searchCondition.isValid());
@@ -263,8 +263,8 @@ public class AttributableSearchTest {
idRightCond.setSchema("id");
idRightCond.setExpression("2");
- final NodeCond searchCondition = NodeCond.getOrCond(NodeCond.getLeafCond(usernameLeafCond),
- NodeCond.getLeafCond(idRightCond));
+ final SearchCond searchCondition = SearchCond.getOrCond(SearchCond.getLeafCond(usernameLeafCond),
+ SearchCond.getLeafCond(idRightCond));
final List<SyncopeUser> matchingUsers = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
searchCondition, AttributableUtil.getInstance(AttributableType.USER));
@@ -285,8 +285,8 @@ public class AttributableSearchTest {
idRightCond.setSchema("id");
idRightCond.setExpression("2");
- final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(rolenameLeafCond),
- NodeCond.getLeafCond(idRightCond));
+ final SearchCond searchCondition = SearchCond.getAndCond(SearchCond.getLeafCond(rolenameLeafCond),
+ SearchCond.getLeafCond(idRightCond));
assertTrue(searchCondition.isValid());
@@ -309,8 +309,8 @@ public class AttributableSearchTest {
idRightCond.setSchema("fullname");
idRightCond.setExpression("Giuseppe V%");
- final NodeCond searchCondition = NodeCond.getOrCond(NodeCond.getLeafCond(usernameLeafCond),
- NodeCond.getLeafCond(idRightCond));
+ final SearchCond searchCondition = SearchCond.getOrCond(SearchCond.getLeafCond(usernameLeafCond),
+ SearchCond.getLeafCond(idRightCond));
final List<SyncopeUser> matchingUsers =
searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCondition,
@@ -326,7 +326,7 @@ public class AttributableSearchTest {
idLeafCond.setSchema("id");
idLeafCond.setExpression("2");
- NodeCond searchCondition = NodeCond.getLeafCond(idLeafCond);
+ SearchCond searchCondition = SearchCond.getLeafCond(idLeafCond);
assertTrue(searchCondition.isValid());
List<SyncopeUser> users =
@@ -341,7 +341,7 @@ public class AttributableSearchTest {
idLeafCond.setSchema("id");
idLeafCond.setExpression("4");
- searchCondition = NodeCond.getNotLeafCond(idLeafCond);
+ searchCondition = SearchCond.getNotLeafCond(idLeafCond);
assertTrue(searchCondition.isValid());
users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCondition,
@@ -366,8 +366,8 @@ public class AttributableSearchTest {
final ResourceCond ws1 = new ResourceCond();
ws1.setResourceName("ws-target-resource-list-mappings-1");
- final NodeCond searchCondition =
- NodeCond.getAndCond(NodeCond.getNotLeafCond(ws2), NodeCond.getNotLeafCond(ws1));
+ final SearchCond searchCondition =
+ SearchCond.getAndCond(SearchCond.getNotLeafCond(ws2), SearchCond.getNotLeafCond(ws1));
assertTrue(searchCondition.isValid());
final List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
@@ -389,7 +389,7 @@ public class AttributableSearchTest {
cond.setSchema("id");
cond.setExpression("test%");
- final NodeCond searchCondition = NodeCond.getLeafCond(cond);
+ final SearchCond searchCondition = SearchCond.getLeafCond(cond);
assertTrue(searchCondition.isValid());
final List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
@@ -404,7 +404,7 @@ public class AttributableSearchTest {
cond.setSchema("username");
cond.setExpression("%ossin%");
- NodeCond searchCondition = NodeCond.getLeafCond(cond);
+ SearchCond searchCondition = SearchCond.getLeafCond(cond);
assertTrue(searchCondition.isValid());
List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
@@ -422,7 +422,8 @@ public class AttributableSearchTest {
likeCond.setSchema("username");
likeCond.setExpression("%ossin%");
- NodeCond searchCond = NodeCond.getOrCond(NodeCond.getLeafCond(isNullCond), NodeCond.getLeafCond(likeCond));
+ SearchCond searchCond = SearchCond.getOrCond(
+ SearchCond.getLeafCond(isNullCond), SearchCond.getLeafCond(likeCond));
Integer count = searchDAO.count(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCond,
AttributableUtil.getInstance(AttributableType.USER));
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java Mon Dec 16 11:04:52 2013
@@ -18,23 +18,15 @@
*/
package org.apache.syncope.core.persistence.dao;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.MembershipCond;
-import org.apache.syncope.common.search.NodeCond;
-import org.apache.syncope.common.types.EntityViolationType;
+import org.apache.syncope.client.SyncopeClient;
import org.apache.syncope.common.types.IntMappingType;
import org.apache.syncope.core.persistence.beans.Notification;
-import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -52,9 +44,7 @@ public class NotificationTest extends Ab
assertNotNull(notification.getEvents());
assertFalse(notification.getEvents().isEmpty());
assertNotNull(notification.getAbout());
- assertTrue(notification.getAbout().isValid());
assertNotNull(notification.getRecipients());
- assertTrue(notification.getRecipients().isValid());
}
@Test
@@ -69,22 +59,10 @@ public class NotificationTest extends Ab
Notification notification = new Notification();
notification.addEvent("save");
- AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
- fullnameLeafCond1.setSchema("fullname");
- fullnameLeafCond1.setExpression("%o%");
- AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
- fullnameLeafCond2.setSchema("fullname");
- fullnameLeafCond2.setExpression("%i%");
- NodeCond about = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1), NodeCond.getLeafCond(
- fullnameLeafCond2));
-
- notification.setAbout(about);
-
- MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(7L);
- NodeCond recipients = NodeCond.getLeafCond(membCond);
+ notification.setAbout(SyncopeClient.getSearchConditionBuilder().
+ is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query());
- notification.setRecipients(recipients);
+ notification.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(7L).query());
notification.setRecipientAttrName("email");
notification.setRecipientAttrType(IntMappingType.UserSchema);
@@ -99,40 +77,6 @@ public class NotificationTest extends Ab
}
@Test
- public void saveWithException() {
- Notification notification = new Notification();
- notification.addEvent("saveWithException");
-
- MembershipCond membCond = new MembershipCond();
- NodeCond about = NodeCond.getLeafCond(membCond);
-
- notification.setAbout(about);
-
- NodeCond recipients = NodeCond.getLeafCond(membCond);
-
- notification.setRecipients(recipients);
-
- notification.setRecipientAttrName("email");
- notification.setRecipientAttrType(IntMappingType.UserSchema);
-
- notification.setSender("syncope@syncope.apache.org");
- notification.setSubject("Test notification");
- notification.setTemplate("test");
-
- Map<Class<?>, Set<EntityViolationType>> violations;
- try {
- notificationDAO.save(notification);
- violations = null;
- } catch (InvalidEntityException e) {
- violations = e.getViolations();
- }
-
- assertNotNull(violations);
- assertEquals(1, violations.size());
- assertFalse(violations.get(Notification.class).isEmpty());
- }
-
- @Test
public void delete() {
notificationDAO.delete(1L);
assertNull(notificationDAO.find(1L));
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java Mon Dec 16 11:04:52 2013
@@ -26,7 +26,6 @@ import java.util.Date;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.common.services.InvalidSearchConditionException;
import org.apache.syncope.common.types.CipherAlgorithm;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
import org.apache.syncope.core.persistence.beans.user.UAttrValue;
@@ -80,21 +79,18 @@ public class UserTest extends AbstractDA
}
@Test
- public void findByDerAttributeValue()
- throws InvalidSearchConditionException {
+ public void findByDerAttributeValue() {
final List<SyncopeUser> list = userDAO.findByDerAttrValue("cn", "Vivaldi, Antonio");
assertEquals("did not get expected number of users ", 1, list.size());
}
- @Test(expected = InvalidSearchConditionException.class)
- public void findByInvalidDerAttrValue()
- throws InvalidSearchConditionException {
+ @Test(expected = IllegalArgumentException.class)
+ public void findByInvalidDerAttrValue() {
userDAO.findByDerAttrValue("cn", "Antonio, Maria, Rossi");
}
- @Test(expected = InvalidSearchConditionException.class)
- public void findByInvalidDerAttrExpression()
- throws InvalidSearchConditionException {
+ @Test(expected = IllegalArgumentException.class)
+ public void findByInvalidDerAttrExpression() {
userDAO.findByDerAttrValue("noschema", "Antonio, Maria");
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttributableSearchTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttributableSearchTest.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttributableSearchTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttributableSearchTest.java Mon Dec 16 11:04:52 2013
@@ -26,8 +26,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.NodeCond;
+import org.apache.syncope.core.persistence.dao.search.AttributeCond;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -70,7 +70,7 @@ public class AttributableSearchTest {
coolLeafCond.setSchema("cool");
coolLeafCond.setExpression("true");
- final NodeCond cond = NodeCond.getLeafCond(coolLeafCond);
+ final SearchCond cond = SearchCond.getLeafCond(coolLeafCond);
assertTrue(cond.isValid());
final List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), cond,
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java Mon Dec 16 11:04:52 2013
@@ -31,17 +31,16 @@ import java.util.Map;
import java.util.Set;
import javax.ws.rs.core.Response;
+import org.apache.syncope.client.SyncopeClient;
import org.apache.syncope.common.mod.StatusMod;
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.NodeCond;
import org.apache.syncope.common.services.EntitlementService;
-import org.apache.syncope.common.services.InvalidSearchConditionException;
import org.apache.syncope.common.services.SchemaService;
import org.apache.syncope.common.services.UserService;
import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.EntitlementTO;
+import org.apache.syncope.common.wrap.EntitlementTO;
import org.apache.syncope.common.to.MembershipTO;
+import org.apache.syncope.common.reqres.PagedResult;
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.SchemaTO;
import org.apache.syncope.common.to.UserTO;
@@ -52,7 +51,7 @@ import org.apache.syncope.common.types.A
import org.apache.syncope.common.types.SchemaType;
import org.apache.syncope.common.types.ClientExceptionType;
import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.apache.syncope.core.workflow.ActivitiDetector;
import org.junit.Assume;
import org.junit.FixMethodOrder;
@@ -189,7 +188,7 @@ public class AuthenticationTestITCase ex
}
@Test
- public void testUserSearch() throws InvalidSearchConditionException {
+ public void testUserSearch() {
UserTO userTO = UserTestITCase.getUniqueSampleTO("testusersearch@test.org");
MembershipTO membershipTO = new MembershipTO();
@@ -206,28 +205,25 @@ public class AuthenticationTestITCase ex
UserService userService2 = clientFactory.create(userTO.getUsername(), "password123").
getService(UserService.class);
- AttributeCond isNullCond = new AttributeCond(AttributeCond.Type.ISNOTNULL);
- isNullCond.setSchema("loginDate");
- NodeCond searchCondition = NodeCond.getLeafCond(isNullCond);
-
- List<UserTO> matchedUsers = userService2.search(searchCondition);
+ PagedResult<UserTO> matchedUsers = userService2.search(
+ SyncopeClient.getSearchConditionBuilder().isNotNull("loginDate").query());
assertNotNull(matchedUsers);
- assertFalse(matchedUsers.isEmpty());
- Set<Long> userIds = new HashSet<Long>(matchedUsers.size());
- for (UserTO user : matchedUsers) {
+ assertFalse(matchedUsers.getResult().isEmpty());
+ Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
+ for (UserTO user : matchedUsers.getResult()) {
userIds.add(user.getId());
}
assertTrue(userIds.contains(1L));
UserService userService3 = clientFactory.create("verdi", "password").getService(UserService.class);
- matchedUsers = userService3.search(searchCondition);
-
+ matchedUsers = userService3.search(
+ SyncopeClient.getSearchConditionBuilder().isNotNull("loginDate").query());
assertNotNull(matchedUsers);
- userIds = new HashSet<Long>(matchedUsers.size());
+ userIds = new HashSet<Long>(matchedUsers.getResult().size());
- for (UserTO user : matchedUsers) {
+ for (UserTO user : matchedUsers.getResult()) {
userIds.add(user.getId());
}
assertFalse(userIds.contains(1L));
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java Mon Dec 16 11:04:52 2013
@@ -39,7 +39,7 @@ import org.apache.syncope.common.service
import org.apache.syncope.common.to.ConfigurationTO;
import org.apache.syncope.common.types.EntityViolationType;
import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java Mon Dec 16 11:04:52 2013
@@ -39,7 +39,7 @@ import javax.ws.rs.core.Response;
import org.apache.commons.io.IOUtils;
import org.apache.syncope.common.services.ConnectorService;
import org.apache.syncope.common.services.ResourceService;
-import org.apache.syncope.common.to.BulkAction;
+import org.apache.syncope.common.reqres.BulkAction;
import org.apache.syncope.common.to.ConnBundleTO;
import org.apache.syncope.common.to.ConnIdObjectClassTO;
import org.apache.syncope.common.to.ConnInstanceTO;
@@ -52,7 +52,7 @@ import org.apache.syncope.common.types.C
import org.apache.syncope.common.types.ConnConfProperty;
import org.apache.syncope.common.types.ConnectorCapability;
import org.apache.syncope.common.types.IntMappingType;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.apache.syncope.core.util.ConnIdBundleManager;
import org.identityconnectors.common.security.GuardedString;
import org.junit.BeforeClass;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java Mon Dec 16 11:04:52 2013
@@ -32,7 +32,7 @@ import org.apache.syncope.common.types.A
import org.apache.syncope.common.types.EntityViolationType;
import org.apache.syncope.common.types.SchemaType;
import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java Mon Dec 16 11:04:52 2013
@@ -26,16 +26,13 @@ import static org.junit.Assert.fail;
import java.util.List;
import javax.ws.rs.core.Response;
-
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.MembershipCond;
-import org.apache.syncope.common.search.NodeCond;
+import org.apache.syncope.client.SyncopeClient;
import org.apache.syncope.common.services.NotificationService;
import org.apache.syncope.common.to.NotificationTO;
import org.apache.syncope.common.types.IntMappingType;
import org.apache.syncope.common.types.ClientExceptionType;
import org.apache.syncope.common.types.TraceLevel;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
@@ -48,16 +45,8 @@ public class NotificationTestITCase exte
notificationTO.setTraceLevel(TraceLevel.SUMMARY);
notificationTO.getEvents().add("create");
- AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
- fullnameLeafCond1.setSchema("fullname");
- fullnameLeafCond1.setExpression("%o%");
- AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
- fullnameLeafCond2.setSchema("fullname");
- fullnameLeafCond2.setExpression("%i%");
- NodeCond about = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1),
- NodeCond.getLeafCond(fullnameLeafCond2));
-
- notificationTO.setAbout(about);
+ notificationTO.setAbout(SyncopeClient.getSearchConditionBuilder().
+ is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query());
notificationTO.setRecipientAttrName("email");
notificationTO.setRecipientAttrType(IntMappingType.UserSchema);
@@ -87,11 +76,7 @@ public class NotificationTestITCase exte
@Test
public void create() {
NotificationTO notificationTO = buildNotificationTO();
-
- MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(7L);
- NodeCond recipients = NodeCond.getLeafCond(membCond);
- notificationTO.setRecipients(recipients);
+ notificationTO.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(7L).query());
Response response = notificationService.create(notificationTO);
NotificationTO actual = getObject(response.getLocation(), NotificationService.class,
@@ -106,23 +91,7 @@ public class NotificationTestITCase exte
@Test
public void update() {
NotificationTO notificationTO = notificationService.read(1L);
- assertNotNull(notificationTO);
-
- notificationTO.setRecipients(NodeCond.getLeafCond(new MembershipCond()));
-
- SyncopeClientException exception = null;
- try {
- notificationService.update(notificationTO.getId(), notificationTO);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidNotification, e.getType());
- }
-
- MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(7L);
- NodeCond recipients = NodeCond.getLeafCond(membCond);
-
- notificationTO.setRecipients(recipients);
+ notificationTO.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(7L).query());
notificationService.update(notificationTO.getId(), notificationTO);
NotificationTO actual = notificationService.read(notificationTO.getId());
@@ -153,12 +122,11 @@ public class NotificationTestITCase exte
notificationTO.setSelfAsRecipient(true);
NotificationTO actual = null;
- SyncopeClientException exception = null;
try {
Response response = notificationService.create(notificationTO);
actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
} catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidNotification, e.getType());
+ assertNotNull(e);
}
assertNotNull(actual);
assertNotNull(actual.getId());
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java Mon Dec 16 11:04:52 2013
@@ -31,7 +31,7 @@ import org.apache.syncope.common.types.P
import org.apache.syncope.common.types.PolicyType;
import org.apache.syncope.common.types.SyncPolicySpec;
import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.apache.syncope.core.sync.TestSyncRule;
import org.junit.FixMethodOrder;
import org.junit.Test;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java Mon Dec 16 11:04:52 2013
@@ -33,12 +33,13 @@ import org.apache.commons.io.IOUtils;
import org.apache.syncope.common.SyncopeConstants;
import org.apache.syncope.common.report.UserReportletConf;
import org.apache.syncope.common.services.ReportService;
-import org.apache.syncope.common.types.ReportletConfClasses;
+import org.apache.syncope.common.reqres.PagedResult;
import org.apache.syncope.common.to.ReportExecTO;
import org.apache.syncope.common.to.ReportTO;
import org.apache.syncope.common.types.ReportExecExportFormat;
import org.apache.syncope.common.types.ReportExecStatus;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
+import org.apache.syncope.common.wrap.ReportletConfClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
@@ -54,24 +55,17 @@ public class ReportTestITCase extends Ab
@Test
public void getReportletClasses() {
- ReportletConfClasses reportletClasses = reportService.getReportletConfClasses();
+ List<ReportletConfClass> reportletClasses = reportService.getReportletConfClasses();
assertNotNull(reportletClasses);
- assertFalse(reportletClasses.getConfClasses().isEmpty());
- }
-
- @Test
- public void count() {
- Integer count = reportService.count();
- assertNotNull(count);
- assertTrue(count > 0);
+ assertFalse(reportletClasses.isEmpty());
}
@Test
public void list() {
- List<ReportTO> reports = reportService.list();
+ PagedResult<ReportTO> reports = reportService.list();
assertNotNull(reports);
- assertFalse(reports.isEmpty());
- for (ReportTO report : reports) {
+ assertFalse(reports.getResult().isEmpty());
+ for (ReportTO report : reports.getResult()) {
assertNotNull(report);
}
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java Mon Dec 16 11:04:52 2013
@@ -34,11 +34,11 @@ import java.util.Set;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.services.ResourceService;
-import org.apache.syncope.common.to.BulkAction;
+import org.apache.syncope.common.reqres.BulkAction;
import org.apache.syncope.common.to.MappingItemTO;
import org.apache.syncope.common.to.MappingTO;
-import org.apache.syncope.common.to.PropagationActionClassTO;
+import org.apache.syncope.common.wrap.PropagationActionClass;
import org.apache.syncope.common.to.ResourceTO;
import org.apache.syncope.common.types.ConnConfPropSchema;
import org.apache.syncope.common.types.ConnConfProperty;
@@ -46,7 +46,7 @@ import org.apache.syncope.common.types.E
import org.apache.syncope.common.types.IntMappingType;
import org.apache.syncope.common.types.MappingPurpose;
import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
@@ -90,7 +90,7 @@ public class ResourceTestITCase extends
@Test
public void getPropagationActionsClasses() {
- List<PropagationActionClassTO> actions = resourceService.getPropagationActionsClasses();
+ List<PropagationActionClass> actions = resourceService.getPropagationActionsClasses();
assertNotNull(actions);
assertFalse(actions.isEmpty());
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java Mon Dec 16 11:04:52 2013
@@ -36,7 +36,8 @@ import org.apache.syncope.client.Syncope
import org.apache.syncope.common.mod.RoleMod;
import org.apache.syncope.common.services.RoleService;
import org.apache.syncope.common.to.ConnObjectTO;
-import org.apache.syncope.common.to.ResourceNameTO;
+import org.apache.syncope.common.reqres.PagedResult;
+import org.apache.syncope.common.wrap.ResourceName;
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.SchemaTO;
import org.apache.syncope.common.to.UserTO;
@@ -47,7 +48,7 @@ import org.apache.syncope.common.types.R
import org.apache.syncope.common.types.ResourceAssociationActionType;
import org.apache.syncope.common.types.SchemaType;
import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.identityconnectors.framework.common.objects.Name;
import org.junit.FixMethodOrder;
import org.junit.Test;
@@ -169,10 +170,10 @@ public class RoleTestITCase extends Abst
@Test
public void list() {
- List<RoleTO> roleTOs = roleService.list();
+ PagedResult<RoleTO> roleTOs = roleService.list();
assertNotNull(roleTOs);
- assertTrue(roleTOs.size() >= 8);
- for (RoleTO roleTO : roleTOs) {
+ assertTrue(roleTOs.getResult().size() >= 8);
+ for (RoleTO roleTO : roleTOs.getResult()) {
assertNotNull(roleTO);
}
}
@@ -403,7 +404,7 @@ public class RoleTestITCase extends Abst
actual = roleService.associate(actual.getId(),
ResourceAssociationActionType.UNLINK,
- CollectionWrapper.wrap("resource-ldap", ResourceNameTO.class)).
+ CollectionWrapper.wrap("resource-ldap", ResourceName.class)).
readEntity(RoleTO.class);
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
@@ -425,7 +426,7 @@ public class RoleTestITCase extends Abst
actual = roleService.associate(actual.getId(),
ResourceAssociationActionType.UNASSIGN,
- CollectionWrapper.wrap("resource-ldap", ResourceNameTO.class)).
+ CollectionWrapper.wrap("resource-ldap", ResourceName.class)).
readEntity(RoleTO.class);
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
@@ -451,7 +452,7 @@ public class RoleTestITCase extends Abst
actual = roleService.associate(actual.getId(),
ResourceAssociationActionType.DEPROVISION,
- CollectionWrapper.wrap("resource-ldap", ResourceNameTO.class)).
+ CollectionWrapper.wrap("resource-ldap", ResourceName.class)).
readEntity(RoleTO.class);
assertNotNull(actual);
assertFalse(actual.getResources().isEmpty());
@@ -516,7 +517,7 @@ public class RoleTestITCase extends Abst
}
RoleService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(RoleService.class);
- assertFalse(anonymous.list().isEmpty());
+ assertFalse(anonymous.list().getResult().isEmpty());
}
@Test
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java Mon Dec 16 11:04:52 2013
@@ -40,7 +40,7 @@ import org.apache.syncope.common.types.A
import org.apache.syncope.common.types.SchemaType;
import org.apache.syncope.common.types.ClientExceptionType;
import org.apache.syncope.common.util.AttributableOperations;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;