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 2018/02/13 21:26:40 UTC
[2/4] syncope git commit: [SYNCOPE-1262] Last matrix parameter still
there
[SYNCOPE-1262] Last matrix parameter still there
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/5cbdfe7b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/5cbdfe7b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/5cbdfe7b
Branch: refs/heads/master
Commit: 5cbdfe7bc58c37a026226b743d2ed9685ad19c37
Parents: 7958ebd
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Feb 13 18:24:07 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Feb 13 18:24:07 2018 +0100
----------------------------------------------------------------------
.../panels/ImplementationDirectoryPanel.java | 2 +-
.../policies/PolicyRuleDirectoryPanel.java | 8 ++++++-
.../policies/PolicyRuleWizardBuilder.java | 15 ++++++++----
.../reports/ReportletDirectoryPanel.java | 11 +++++----
.../console/reports/ReportletWizardBuilder.java | 12 ++++++----
.../console/rest/ImplementationRestClient.java | 8 +++----
.../syncope/common/lib/to/ImplementationTO.java | 1 +
.../syncope/common/lib/types/AuditElements.java | 7 +++---
.../common/lib/types/AuditLoggerName.java | 6 +----
.../rest/api/service/ImplementationService.java | 16 ++++++++-----
.../syncope/core/logic/ImplementationLogic.java | 16 +++++++++++--
.../cxf/service/ImplementationServiceImpl.java | 8 +++----
.../syncope/fit/core/ImplementationITCase.java | 10 ++++----
.../fit/core/NotificationTaskITCase.java | 5 ++--
.../apache/syncope/fit/core/PolicyITCase.java | 8 +++----
.../apache/syncope/fit/core/PullTaskITCase.java | 25 +++++++++++++-------
.../syncope/fit/core/SchedTaskITCase.java | 9 ++++---
.../syncope/fit/core/UserIssuesITCase.java | 10 ++++----
18 files changed, 108 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/client/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java
index 60a56d1..4aaea78 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java
@@ -160,7 +160,7 @@ public class ImplementationDirectoryPanel extends DirectoryPanel<
@Override
public void onClick(final AjaxRequestTarget target, final ImplementationTO ignore) {
try {
- restClient.delete(model.getObject().getKey());
+ restClient.delete(model.getObject().getType(), model.getObject().getKey());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
index 150c359..600ebd8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
@@ -48,6 +48,7 @@ import org.apache.syncope.common.lib.policy.PolicyTO;
import org.apache.syncope.common.lib.policy.RuleConf;
import org.apache.syncope.common.lib.to.ImplementationTO;
import org.apache.syncope.common.lib.types.ImplementationEngine;
+import org.apache.syncope.common.lib.types.ImplementationType;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -82,6 +83,8 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
private final PolicyType type;
+ private final ImplementationType implementationType;
+
private final String policy;
protected PolicyRuleDirectoryPanel(
@@ -92,6 +95,9 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
this.baseModal = baseModal;
this.type = type;
+ this.implementationType = type == PolicyType.ACCOUNT
+ ? ImplementationType.ACCOUNT_RULE
+ : ImplementationType.PASSWORD_RULE;
this.policy = policy;
this.restClient = new PolicyRestClient();
@@ -234,7 +240,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
@SuppressWarnings("unchecked")
private List<PolicyRuleWrapper> getPolicyRuleWrappers(final ComposablePolicy policy) {
return policy.getRules().stream().map(rule -> {
- ImplementationTO implementation = implementationClient.read(rule);
+ ImplementationTO implementation = implementationClient.read(implementationType, rule);
PolicyRuleWrapper wrapper = new PolicyRuleWrapper(false).
setImplementationKey(implementation.getKey()).
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
index eb93982..855837e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
@@ -59,6 +59,8 @@ public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper
private final PolicyType type;
+ private final ImplementationType implementationType;
+
public PolicyRuleWizardBuilder(
final String policy,
final PolicyType type,
@@ -69,6 +71,9 @@ public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper
this.policy = policy;
this.type = type;
+ this.implementationType = type == PolicyType.ACCOUNT
+ ? ImplementationType.ACCOUNT_RULE
+ : ImplementationType.PASSWORD_RULE;
}
@Override
@@ -83,7 +88,7 @@ public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper
}
if (modelObject.getImplementationEngine() == ImplementationEngine.JAVA) {
- ImplementationTO rule = implementationClient.read(modelObject.getImplementationKey());
+ ImplementationTO rule = implementationClient.read(implementationType, modelObject.getImplementationKey());
try {
rule.setBody(MAPPER.writeValueAsString(modelObject.getConf()));
implementationClient.update(rule);
@@ -145,11 +150,11 @@ public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper
@Override
protected void onEvent(final AjaxRequestTarget target) {
- ImplementationTO implementation = implementationClient.read(conf.getModelObject());
- rule.setImplementationEngine(implementation.getEngine());
- if (implementation.getEngine() == ImplementationEngine.JAVA) {
+ ImplementationTO impl = implementationClient.read(implementationType, conf.getModelObject());
+ rule.setImplementationEngine(impl.getEngine());
+ if (impl.getEngine() == ImplementationEngine.JAVA) {
try {
- RuleConf ruleConf = MAPPER.readValue(implementation.getBody(), RuleConf.class);
+ RuleConf ruleConf = MAPPER.readValue(impl.getBody(), RuleConf.class);
rule.setConf(ruleConf);
} catch (Exception e) {
LOG.error("During deserialization", e);
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java
index db7f4b8..6ac03e2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java
@@ -47,6 +47,7 @@ import org.apache.syncope.common.lib.report.ReportletConf;
import org.apache.syncope.common.lib.to.ImplementationTO;
import org.apache.syncope.common.lib.to.ReportTO;
import org.apache.syncope.common.lib.types.ImplementationEngine;
+import org.apache.syncope.common.lib.types.ImplementationType;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
@@ -224,14 +225,14 @@ public class ReportletDirectoryPanel extends DirectoryPanel<
private List<ReportletWrapper> getReportletWrappers(final ReportTO reportTO) {
return reportTO.getReportlets().stream().map(reportlet -> {
- ImplementationTO implementation = implementationClient.read(reportlet);
+ ImplementationTO impl = implementationClient.read(ImplementationType.REPORTLET, reportlet);
ReportletWrapper wrapper = new ReportletWrapper(false).
- setImplementationKey(implementation.getKey()).
- setImplementationEngine(implementation.getEngine());
- if (implementation.getEngine() == ImplementationEngine.JAVA) {
+ setImplementationKey(impl.getKey()).
+ setImplementationEngine(impl.getEngine());
+ if (impl.getEngine() == ImplementationEngine.JAVA) {
try {
- ReportletConf reportletConf = MAPPER.readValue(implementation.getBody(), ReportletConf.class);
+ ReportletConf reportletConf = MAPPER.readValue(impl.getBody(), ReportletConf.class);
wrapper.setConf(reportletConf);
} catch (Exception e) {
LOG.error("During deserialization", e);
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java
index 8668103..17785b0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java
@@ -64,7 +64,8 @@ public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletWrapper>
@Override
protected Serializable onApplyInternal(final ReportletWrapper modelObject) {
if (modelObject.getImplementationEngine() == ImplementationEngine.JAVA) {
- ImplementationTO reportlet = implementationClient.read(modelObject.getImplementationKey());
+ ImplementationTO reportlet = implementationClient.read(
+ ImplementationType.REPORTLET, modelObject.getImplementationKey());
try {
reportlet.setBody(MAPPER.writeValueAsString(modelObject.getConf()));
implementationClient.update(reportlet);
@@ -109,11 +110,12 @@ public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletWrapper>
@Override
protected void onEvent(final AjaxRequestTarget target) {
- ImplementationTO implementation = implementationClient.read(conf.getModelObject());
- reportlet.setImplementationEngine(implementation.getEngine());
- if (implementation.getEngine() == ImplementationEngine.JAVA) {
+ ImplementationTO impl = implementationClient.read(
+ ImplementationType.REPORTLET, conf.getModelObject());
+ reportlet.setImplementationEngine(impl.getEngine());
+ if (impl.getEngine() == ImplementationEngine.JAVA) {
try {
- ReportletConf conf = MAPPER.readValue(implementation.getBody(), ReportletConf.class);
+ ReportletConf conf = MAPPER.readValue(impl.getBody(), ReportletConf.class);
reportlet.setConf(conf);
} catch (Exception e) {
LOG.error("During deserialization", e);
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java
index 106d271..7d99c7c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java
@@ -32,8 +32,8 @@ public class ImplementationRestClient extends BaseRestClient {
return getService(ImplementationService.class).list(type);
}
- public ImplementationTO read(final String key) {
- return getService(ImplementationService.class).read(key);
+ public ImplementationTO read(final ImplementationType type, final String key) {
+ return getService(ImplementationService.class).read(type, key);
}
public ImplementationTO create(final ImplementationTO implementation) {
@@ -46,8 +46,8 @@ public class ImplementationRestClient extends BaseRestClient {
getService(ImplementationService.class).update(implementation);
}
- public void delete(final String key) {
- getService(ImplementationService.class).delete(key);
+ public void delete(final ImplementationType type, final String key) {
+ getService(ImplementationService.class).delete(type, key);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ImplementationTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ImplementationTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ImplementationTO.java
index b212021..842045e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ImplementationTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ImplementationTO.java
@@ -62,6 +62,7 @@ public class ImplementationTO extends AbstractBaseBean implements EntityTO {
return type;
}
+ @PathParam("type")
public void setType(final ImplementationType type) {
this.type = type;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
index 16f6d69..32e87a2 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
@@ -20,7 +20,6 @@ package org.apache.syncope.common.lib.types;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlEnum;
-import org.apache.commons.lang3.StringUtils;
public final class AuditElements implements Serializable {
@@ -33,12 +32,12 @@ public final class AuditElements implements Serializable {
@XmlEnum
public enum EventCategoryType {
- LOGIC(StringUtils.EMPTY),
- TASK(StringUtils.EMPTY),
+ LOGIC("LOGIC"),
+ TASK("TASK"),
PROPAGATION("PropagationTask"),
PULL("PullTask"),
PUSH("PushTask"),
- CUSTOM(StringUtils.EMPTY);
+ CUSTOM("CUSTOM");
private final String value;
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
index a595e9b..31622ec 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
@@ -185,11 +185,7 @@ public class AuditLoggerName extends AbstractBaseBean {
eventBuilder.append('[');
if (type != null) {
- if (StringUtils.isNotBlank(type.toString())) {
- eventBuilder.append(type.toString());
- } else {
- eventBuilder.append(type.name());
- }
+ eventBuilder.append(type.toString());
}
eventBuilder.append("]:[");
if (StringUtils.isNotBlank(category)) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ImplementationService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ImplementationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ImplementationService.java
index fa5e59d..620d3fc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ImplementationService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ImplementationService.java
@@ -26,7 +26,6 @@ import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
-import javax.ws.rs.MatrixParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
@@ -54,19 +53,21 @@ public interface ImplementationService extends JAXRSService {
* @return list of all implementations.
*/
@GET
+ @Path("{type}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- List<ImplementationTO> list(@NotNull @MatrixParam("type") ImplementationType type);
+ List<ImplementationTO> list(@NotNull @PathParam("type") ImplementationType type);
/**
* Returns implementation with matching key.
*
+ * @param type implementation type
* @param key key of implementation to be read
* @return implementation with matching key
*/
@GET
- @Path("{key}")
+ @Path("{type}/{key}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- ImplementationTO read(@NotNull @PathParam("key") String key);
+ ImplementationTO read(@NotNull @PathParam("type") ImplementationType type, @NotNull @PathParam("key") String key);
/**
* Creates a new implementation.
@@ -75,6 +76,7 @@ public interface ImplementationService extends JAXRSService {
* @return Response object featuring Location header of created implementation
*/
@POST
+ @Path("{type}/{key}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
Response create(@NotNull ImplementationTO implementationTO);
@@ -86,6 +88,7 @@ public interface ImplementationService extends JAXRSService {
* @return an empty response if operation was successful
*/
@PUT
+ @Path("{type}/{key}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
Response update(@NotNull ImplementationTO implementationTO);
@@ -93,12 +96,13 @@ public interface ImplementationService extends JAXRSService {
/**
* Deletes the implementation matching the given key.
*
+ * @param type implementation type
* @param key key for implementation to be deleted
* @return an empty response if operation was successful
*/
@DELETE
- @Path("{key}")
+ @Path("{type}/{key}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- Response delete(@NotNull @PathParam("key") String key);
+ Response delete(@NotNull @PathParam("type") ImplementationType type, @NotNull @PathParam("key") String key);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
index 65e6290..83bc933 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
@@ -81,7 +81,7 @@ public class ImplementationLogic extends AbstractTransactionalLogic<Implementati
}
@PreAuthorize("hasRole('" + StandardEntitlement.IMPLEMENTATION_READ + "')")
- public ImplementationTO read(final String key) {
+ public ImplementationTO read(final ImplementationType type, final String key) {
Implementation implementation = implementationDAO.find(key);
if (implementation == null) {
LOG.error("Could not find implementation '" + key + "'");
@@ -89,6 +89,12 @@ public class ImplementationLogic extends AbstractTransactionalLogic<Implementati
throw new NotFoundException(key);
}
+ if (implementation.getType() != type) {
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+ sce.getElements().add("Found " + type + ", expected " + implementation.getType());
+ throw sce;
+ }
+
return binder.getImplementationTO(implementation);
}
@@ -124,7 +130,7 @@ public class ImplementationLogic extends AbstractTransactionalLogic<Implementati
}
@PreAuthorize("hasRole('" + StandardEntitlement.IMPLEMENTATION_DELETE + "')")
- public void delete(final String key) {
+ public void delete(final ImplementationType type, final String key) {
Implementation implementation = implementationDAO.find(key);
if (implementation == null) {
LOG.error("Could not find implementation '" + key + "'");
@@ -132,6 +138,12 @@ public class ImplementationLogic extends AbstractTransactionalLogic<Implementati
throw new NotFoundException(key);
}
+ if (implementation.getType() != type) {
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+ sce.getElements().add("Found " + type + ", expected " + implementation.getType());
+ throw sce;
+ }
+
boolean inUse = false;
switch (implementation.getType()) {
case REPORTLET:
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ImplementationServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ImplementationServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ImplementationServiceImpl.java
index c85793b..6113c81 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ImplementationServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ImplementationServiceImpl.java
@@ -41,8 +41,8 @@ public class ImplementationServiceImpl extends AbstractServiceImpl implements Im
}
@Override
- public ImplementationTO read(final String key) {
- return logic.read(key);
+ public ImplementationTO read(final ImplementationType type, final String key) {
+ return logic.read(type, key);
}
@Override
@@ -61,8 +61,8 @@ public class ImplementationServiceImpl extends AbstractServiceImpl implements Im
}
@Override
- public Response delete(final String key) {
- logic.delete(key);
+ public Response delete(final ImplementationType type, final String key) {
+ logic.delete(type, key);
return Response.noContent().build();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
index 109e750..7b5bb7e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
@@ -31,7 +31,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.ImplementationEngine;
import org.apache.syncope.common.lib.types.ImplementationType;
import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.common.rest.api.service.ImplementationService;
+import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.fit.AbstractITCase;
import org.apache.syncope.fit.core.reference.TestPullActions;
import org.junit.jupiter.api.Test;
@@ -63,8 +63,8 @@ public class ImplementationITCase extends AbstractITCase {
}
}
- ImplementationTO actual =
- getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ ImplementationTO actual = implementationService.read(
+ implementationTO.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(actual);
assertEquals(actual, implementationTO);
}
@@ -95,7 +95,7 @@ public class ImplementationITCase extends AbstractITCase {
// fails because the implementation is used
try {
- implementationService.delete(implementationTO.getKey());
+ implementationService.delete(implementationTO.getType(), implementationTO.getKey());
fail("Unexpected");
} catch (SyncopeClientException e) {
assertEquals(e.getType(), ClientExceptionType.InUse);
@@ -104,7 +104,7 @@ public class ImplementationITCase extends AbstractITCase {
pullTask.getActions().remove(implementationTO.getKey());
taskService.update(TaskType.PULL, pullTask);
- implementationService.delete(implementationTO.getKey());
+ implementationService.delete(implementationTO.getType(), implementationTO.getKey());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
index 8ac0cea..ea2714f 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
@@ -39,9 +39,9 @@ import org.apache.syncope.common.lib.types.ImplementationEngine;
import org.apache.syncope.common.lib.types.ImplementationType;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.common.lib.types.TraceLevel;
+import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.beans.ExecuteQuery;
import org.apache.syncope.common.rest.api.beans.TaskQuery;
-import org.apache.syncope.common.rest.api.service.ImplementationService;
import org.apache.syncope.common.rest.api.service.NotificationService;
import org.apache.syncope.core.provisioning.java.job.notification.NotificationJob;
import org.apache.syncope.fit.core.reference.TestNotificationRecipientsProvider;
@@ -231,7 +231,8 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase {
recipientsProvider.setType(ImplementationType.RECIPIENTS_PROVIDER);
recipientsProvider.setBody(TestNotificationRecipientsProvider.class.getName());
Response response = implementationService.create(recipientsProvider);
- recipientsProvider = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ recipientsProvider = implementationService.read(
+ recipientsProvider.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(recipientsProvider);
NotificationTO notification = new NotificationTO();
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
index 943ce6a..7ae759f 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
@@ -45,7 +45,6 @@ import org.apache.syncope.common.lib.to.ImplementationTO;
import org.apache.syncope.common.lib.types.ImplementationEngine;
import org.apache.syncope.common.lib.types.ImplementationType;
import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.ImplementationService;
import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
import org.apache.syncope.fit.AbstractITCase;
import org.apache.syncope.fit.core.reference.DummyPullCorrelationRule;
@@ -56,7 +55,7 @@ public class PolicyITCase extends AbstractITCase {
private PullPolicyTO buildPullPolicyTO() throws IOException {
ImplementationTO corrRule = null;
try {
- corrRule = implementationService.read("TestPullRule");
+ corrRule = implementationService.read(ImplementationType.PULL_CORRELATION_RULE, "TestPullRule");
} catch (SyncopeClientException e) {
if (e.getType().getResponseStatus() == Response.Status.NOT_FOUND) {
corrRule = new ImplementationTO();
@@ -66,7 +65,8 @@ public class PolicyITCase extends AbstractITCase {
corrRule.setBody(IOUtils.toString(
getClass().getResourceAsStream("/TestPullRule.groovy"), StandardCharsets.UTF_8));
Response response = implementationService.create(corrRule);
- corrRule = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ corrRule = implementationService.read(
+ corrRule.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(corrRule);
}
}
@@ -132,7 +132,7 @@ public class PolicyITCase extends AbstractITCase {
assertNotNull(policy);
assertNotEquals("ce93fcda-dc3a-4369-a7b0-a6108c261c85", policy.getKey());
- ImplementationTO rule = implementationService.read(policy.getRules().get(0));
+ ImplementationTO rule = implementationService.read(ImplementationType.PASSWORD_RULE, policy.getRules().get(0));
assertNotNull(rule);
DefaultPasswordRuleConf ruleConf = POJOHelper.deserialize(rule.getBody(), DefaultPasswordRuleConf.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index 708c2fa..3e6d67a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -78,10 +78,10 @@ import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
import org.apache.syncope.common.lib.types.PullMode;
import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.beans.AnyQuery;
import org.apache.syncope.common.rest.api.beans.TaskQuery;
import org.apache.syncope.common.rest.api.service.ConnectorService;
-import org.apache.syncope.common.rest.api.service.ImplementationService;
import org.apache.syncope.common.rest.api.service.TaskService;
import org.apache.syncope.core.provisioning.java.pushpull.DBPasswordPullActions;
import org.apache.syncope.core.provisioning.java.pushpull.LDAPPasswordPullActions;
@@ -105,7 +105,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
public static void testPullActionsSetup() {
ImplementationTO pullActions = null;
try {
- pullActions = implementationService.read(TestPullActions.class.getSimpleName());
+ pullActions = implementationService.read(
+ ImplementationType.PULL_ACTIONS, TestPullActions.class.getSimpleName());
} catch (SyncopeClientException e) {
if (e.getType().getResponseStatus() == Response.Status.NOT_FOUND) {
pullActions = new ImplementationTO();
@@ -114,7 +115,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
pullActions.setType(ImplementationType.PULL_ACTIONS);
pullActions.setBody(TestPullActions.class.getName());
Response response = implementationService.create(pullActions);
- pullActions = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ pullActions = implementationService.read(
+ pullActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(pullActions);
}
}
@@ -444,7 +446,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
transformer.setBody(IOUtils.toString(
getClass().getResourceAsStream("/PrefixItemTransformer.groovy"), StandardCharsets.UTF_8));
Response response = implementationService.create(transformer);
- transformer = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ transformer = implementationService.read(
+ transformer.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(transformer);
mappingItem.getTransformers().clear();
@@ -534,7 +537,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
reconFilterBuilder.setBody(IOUtils.toString(
getClass().getResourceAsStream("/TestReconFilterBuilder.groovy"), StandardCharsets.UTF_8));
Response response = implementationService.create(reconFilterBuilder);
- reconFilterBuilder = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ reconFilterBuilder = implementationService.read(
+ reconFilterBuilder.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(reconFilterBuilder);
task = taskService.read(TaskType.PULL, "7c2242f4-14af-4ab5-af31-cdae23783655", true);
@@ -763,7 +767,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
// -----------------------------
ImplementationTO corrRule = null;
try {
- corrRule = implementationService.read("TestPullRule");
+ corrRule = implementationService.read(ImplementationType.PULL_CORRELATION_RULE, "TestPullRule");
} catch (SyncopeClientException e) {
if (e.getType().getResponseStatus() == Response.Status.NOT_FOUND) {
corrRule = new ImplementationTO();
@@ -773,7 +777,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
corrRule.setBody(IOUtils.toString(
getClass().getResourceAsStream("/TestPullRule.groovy"), StandardCharsets.UTF_8));
Response response = implementationService.create(corrRule);
- corrRule = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ corrRule = implementationService.read(
+ corrRule.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(corrRule);
}
}
@@ -927,7 +932,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
pullActions.setType(ImplementationType.PULL_ACTIONS);
pullActions.setBody(DBPasswordPullActions.class.getName());
Response response = implementationService.create(pullActions);
- pullActions = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ pullActions = implementationService.read(
+ pullActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(pullActions);
PullTaskTO pullTask = new PullTaskTO();
@@ -1016,7 +1022,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
pullActions.setType(ImplementationType.PULL_ACTIONS);
pullActions.setBody(LDAPPasswordPullActions.class.getName());
Response response = implementationService.create(pullActions);
- pullActions = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ pullActions = implementationService.read(
+ pullActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(pullActions);
pullTask = new PullTaskTO();
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
index 358506a..48cbe70 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
@@ -89,7 +89,8 @@ public class SchedTaskITCase extends AbstractTaskITCase {
@Test
public void deferred() {
- ImplementationTO taskJobDelegate = implementationService.read(TestSampleJobDelegate.class.getSimpleName());
+ ImplementationTO taskJobDelegate = implementationService.read(
+ ImplementationType.TASKJOB_DELEGATE, TestSampleJobDelegate.class.getSimpleName());
assertNotNull(taskJobDelegate);
SchedTaskTO task = new SchedTaskTO();
@@ -134,7 +135,8 @@ public class SchedTaskITCase extends AbstractTaskITCase {
@Test
public void issueSYNCOPE144() {
- ImplementationTO taskJobDelegate = implementationService.read(TestSampleJobDelegate.class.getSimpleName());
+ ImplementationTO taskJobDelegate = implementationService.read(
+ ImplementationType.TASKJOB_DELEGATE, TestSampleJobDelegate.class.getSimpleName());
assertNotNull(taskJobDelegate);
SchedTaskTO task = new SchedTaskTO();
@@ -168,7 +170,8 @@ public class SchedTaskITCase extends AbstractTaskITCase {
List<JobTO> jobs = taskService.listJobs();
int old_size = jobs.size();
- ImplementationTO taskJobDelegate = implementationService.read(TestSampleJobDelegate.class.getSimpleName());
+ ImplementationTO taskJobDelegate = implementationService.read(
+ ImplementationType.TASKJOB_DELEGATE, TestSampleJobDelegate.class.getSimpleName());
assertNotNull(taskJobDelegate);
SchedTaskTO task = new SchedTaskTO();
http://git-wip-us.apache.org/repos/asf/syncope/blob/5cbdfe7b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
index 8ff08a0..3e9024e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
@@ -74,7 +74,6 @@ import org.apache.syncope.common.lib.types.PatchOperation;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.ImplementationService;
import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
import org.apache.syncope.core.provisioning.java.propagation.DBPasswordPropagationActions;
import org.apache.syncope.core.provisioning.java.propagation.LDAPPasswordPropagationActions;
@@ -806,7 +805,8 @@ public class UserIssuesITCase extends AbstractITCase {
logicActions.setBody(org.apache.commons.io.IOUtils.toString(
getClass().getResourceAsStream("/DoubleValueLogicActions.groovy"), StandardCharsets.UTF_8));
Response response = implementationService.create(logicActions);
- logicActions = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ logicActions = implementationService.read(
+ logicActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(logicActions);
RealmTO realm = realmService.list("/even/two").iterator().next();
@@ -987,7 +987,8 @@ public class UserIssuesITCase extends AbstractITCase {
propagationActions.setType(ImplementationType.PROPAGATION_ACTIONS);
propagationActions.setBody(DBPasswordPropagationActions.class.getName());
Response response = implementationService.create(propagationActions);
- propagationActions = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ propagationActions = implementationService.read(
+ propagationActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(propagationActions);
ResourceTO resourceTO = resourceService.read(RESOURCE_NAME_TESTDB);
@@ -1036,7 +1037,8 @@ public class UserIssuesITCase extends AbstractITCase {
propagationActions.setType(ImplementationType.PROPAGATION_ACTIONS);
propagationActions.setBody(LDAPPasswordPropagationActions.class.getName());
Response response = implementationService.create(propagationActions);
- propagationActions = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+ propagationActions = implementationService.read(
+ propagationActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(propagationActions);
ResourceTO resourceTO = resourceService.read(RESOURCE_NAME_LDAP);