FIT server integration tests
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/80589a1b Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/80589a1b Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/80589a1b Branch: refs/heads/2_0_X Commit: 80589a1b9b384f07670afe4f1581c3ceb2794501 Parents: b7d9add Author: Francesco Chicchiriccò <[email protected]> Authored: Fri Jan 23 17:40:48 2015 +0100 Committer: Francesco Chicchiriccò <[email protected]> Committed: Fri Jan 23 17:40:48 2015 +0100 ---------------------------------------------------------------------- .../syncope/core/util/ContentExporter.java | 8 +- pom.xml | 1 + .../common/lib/AttributableOperations.java | 28 +- .../lib/annotation/FormAttributeField.java | 2 +- .../common/lib/mod/AbstractAttributableMod.java | 4 +- .../lib/report/AbstractReportletConf.java | 3 +- .../common/lib/report/RoleReportletConf.java | 18 +- .../common/lib/report/UserReportletConf.java | 18 +- .../syncope/common/lib/to/ConnObjectTO.java | 2 +- .../apache/syncope/common/lib/to/LoggerTO.java | 10 +- .../apache/syncope/common/lib/to/RoleTO.java | 10 +- .../common/lib/types/ClientExceptionType.java | 21 +- .../common/lib/types/IntMappingType.java | 12 +- syncope620/common/rest-api/pom.xml | 1 + .../common/rest/api/CollectionWrapper.java | 4 +- .../syncope/common/rest/api/RESTHeaders.java | 2 +- .../common/rest/api/service/ReportService.java | 18 +- .../rest/api/service/ResourceService.java | 2 +- .../common/rest/api/service/RoleService.java | 5 +- .../rest/api/service/UserSelfService.java | 6 +- .../rest/api/service/WorkflowService.java | 4 +- syncope620/fit/reference/pom.xml | 121 + .../DoubleValueAttributableTransformer.java | 75 + .../fit/server/reference/TestSyncActions.java | 83 + .../fit/server/reference/TestSyncRule.java | 37 + .../src/main/resources/connid.properties | 5 + .../src/main/resources/logic.properties | 18 + .../fit/server/reference/AbstractITCase.java | 365 +++ .../fit/server/reference/ActivitiDetector.java | 36 + .../server/reference/AuthenticationITCase.java | 440 ++++ .../server/reference/ConfigurationITCase.java | 210 ++ .../fit/server/reference/ConnectorITCase.java | 723 ++++++ .../fit/server/reference/DerSchemaITCase.java | 151 ++ .../fit/server/reference/LoggerITCase.java | 215 ++ .../server/reference/NotificationITCase.java | 172 ++ .../fit/server/reference/PlainSchemaITCase.java | 317 +++ .../fit/server/reference/PolicyITCase.java | 238 ++ .../fit/server/reference/ReportITCase.java | 252 ++ .../fit/server/reference/ResourceITCase.java | 590 +++++ .../fit/server/reference/RoleITCase.java | 797 ++++++ .../fit/server/reference/SearchITCase.java | 182 ++ .../reference/SecurityQuestionITCase.java | 99 + .../fit/server/reference/TaskITCase.java | 1385 ++++++++++ .../fit/server/reference/UserITCase.java | 2442 ++++++++++++++++++ .../fit/server/reference/UserSelfITCase.java | 342 +++ .../server/reference/UserWorkflowITCase.java | 299 +++ .../fit/server/reference/VirAttrITCase.java | 872 +++++++ .../fit/server/reference/VirSchemaITCase.java | 122 + .../fit/server/reference/WorkflowITCase.java | 86 + .../reference/src/test/resources/favicon.jpg | Bin 0 -> 557 bytes .../fit/reference/src/test/resources/test.csv | 10 + .../src/test/resources/testJDBCContext.xml | 33 + syncope620/pom.xml | 144 +- .../syncope/server/logic/LoggerLogic.java | 8 +- .../syncope/server/logic/ReportLogic.java | 40 +- .../server/logic/SpringBeanJobFactory.java | 97 - .../apache/syncope/server/logic/TaskLogic.java | 6 +- .../apache/syncope/server/logic/UserLogic.java | 2 +- .../server/logic/init/JobInstanceLoader.java | 41 - .../logic/init/JobInstanceLoaderImpl.java | 1 + .../server/logic/report/RoleReportlet.java | 6 +- .../server/logic/report/UserReportlet.java | 8 +- .../syncope/server/logic/NotificationTest.java | 16 +- .../logic/src/test/resources/logicTest.xml | 2 +- .../syncope/server/misc/ConnObjectUtil.java | 8 +- .../apache/syncope/server/misc/MappingUtil.java | 18 +- .../misc/policy/AccountPolicyEnforcer.java | 1 + .../misc/policy/PasswordPolicyEnforcer.java | 7 +- .../server/misc/policy/UserSuspender.java | 26 - .../server/misc/security/AuthContextUtil.java | 2 +- .../jpa/content/XMLContentExporter.java | 9 +- .../jpa/dao/JPASubjectSearchDAO.java | 29 +- .../server/persistence/jpa/dao/JPATaskDAO.java | 2 +- .../server/persistence/jpa/dao/JPAUserDAO.java | 3 + .../jpa/entity/AbstractAttrTemplate.java | 14 - .../jpa/entity/AbstractDerAttrTemplate.java | 41 + .../jpa/entity/AbstractPlainAttrTemplate.java | 27 + .../jpa/entity/AbstractPlainSchema.java | 3 +- .../jpa/entity/AbstractVirAttrTemplate.java | 41 + .../jpa/entity/JPAAttributableUtil.java | 12 +- .../persistence/jpa/entity/JPAConnInstance.java | 4 +- .../persistence/jpa/entity/JPAReport.java | 2 - .../entity/membership/JPAMDerAttrTemplate.java | 4 +- .../membership/JPAMPlainAttrTemplate.java | 13 +- .../entity/membership/JPAMVirAttrTemplate.java | 4 +- .../jpa/entity/role/JPARDerAttrTemplate.java | 4 +- .../jpa/entity/role/JPARPlainAttrTemplate.java | 13 +- .../jpa/entity/role/JPARVirAttrTemplate.java | 4 +- .../jpa/entity/task/JPATaskUtil.java | 32 +- .../entity/EntityValidationListener.java | 28 +- .../src/main/resources/META-INF/orm.xml | 20 +- .../jpa/entity/AttributableSearchTest.java | 30 +- .../jpa/entity/NotificationTest.java | 6 +- .../persistence/jpa/entity/ResourceTest.java | 10 +- .../jpa/relationship/ResourceTest.java | 7 +- .../src/test/resources/content.xml | 100 +- .../server/provisioning/api/UserSuspender.java | 26 + .../provisioning/api/job/JobInstanceLoader.java | 41 + .../api/sync/ProvisioningActions.java | 5 +- .../api/sync/RolePushResultHandler.java | 23 + .../api/sync/RoleSyncResultHandler.java | 26 + .../api/sync/SyncopePushResultHandler.java | 26 + .../api/sync/SyncopeSyncResultHandler.java | 29 + .../api/sync/UserPushResultHandler.java | 23 + .../api/sync/UserSyncResultHandler.java | 23 + .../provisioning/java/AsyncConnectorFacade.java | 26 +- .../provisioning/java/ConnectorFacadeProxy.java | 13 +- .../java/DefaultRoleProvisioningManager.java | 2 +- .../java/DefaultUserProvisioningManager.java | 27 +- .../provisioning/java/UserSuspenderImpl.java | 51 + .../data/AbstractAttributableDataBinder.java | 8 +- .../java/data/ReportDataBinderImpl.java | 14 +- .../java/data/RoleDataBinderImpl.java | 12 +- .../java/data/SchemaDataBinderImpl.java | 13 +- .../java/data/TaskDataBinderImpl.java | 16 +- .../java/job/SpringBeanJobFactory.java | 97 + .../java/notification/NotificationManager.java | 2 +- .../PriorityPropagationTaskExecutor.java | 4 +- .../java/sync/AbstractProvisioningJob.java | 7 +- .../java/sync/AbstractPushResultHandler.java | 374 +++ .../sync/AbstractSubjectPushResultHandler.java | 371 --- .../sync/AbstractSubjectSyncResultHandler.java | 624 ----- .../java/sync/AbstractSyncResultHandler.java | 617 +++++ .../java/sync/DefaultPushActions.java | 6 +- .../java/sync/DefaultSyncActions.java | 6 +- .../java/sync/LDAPMembershipSyncActions.java | 16 +- .../provisioning/java/sync/PushJobImpl.java | 28 +- .../java/sync/RolePushResultHandler.java | 154 -- .../java/sync/RolePushResultHandlerImpl.java | 155 ++ .../java/sync/RoleSyncResultHandler.java | 167 -- .../java/sync/RoleSyncResultHandlerImpl.java | 169 ++ .../provisioning/java/sync/SyncJobImpl.java | 32 +- .../provisioning/java/sync/SyncUtilities.java | 27 +- .../java/sync/UserPushResultHandler.java | 159 -- .../java/sync/UserPushResultHandlerImpl.java | 160 ++ .../java/sync/UserSyncResultHandler.java | 155 -- .../java/sync/UserSyncResultHandlerImpl.java | 149 ++ .../main/resources/mailTemplates/optin.html.vm | 8 +- .../main/resources/mailTemplates/optin.txt.vm | 8 +- .../src/main/resources/provisioningContext.xml | 10 +- .../java/data/ResourceDataBinderTest.java | 2 +- .../rest/cxf/service/AbstractServiceImpl.java | 4 +- .../rest/cxf/service/LoggerServiceImpl.java | 2 +- .../rest/cxf/service/ReportServiceImpl.java | 12 +- .../cxf/service/RestServiceExceptionMapper.java | 3 +- 145 files changed, 13494 insertions(+), 2229 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java b/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java index e7fd35b..84e2bc4 100644 --- a/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java +++ b/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java @@ -70,9 +70,9 @@ public class ContentExporter extends AbstractContentDealer { "SYNCOPEUSER", "UATTR", "UATTRVALUE", "UATTRUNIQUEVALUE", "UDERATTR", "UVIRATTR", "MEMBERSHIP", "MATTR", "MATTRVALUE", "MATTRUNIQUEVALUE", "MDERATTR", "MVIRATTR" })); - + protected final static Set<String> TABLE_SUFFIXES_TO_BE_INCLUDED = - new HashSet<String>(Arrays.asList(new String[] {"TEMPLATE"})); + new HashSet<String>(Arrays.asList(new String[] { "TEMPLATE" })); protected static final Map<String, String> TABLES_TO_BE_FILTERED = Collections.singletonMap("TASK", "DTYPE <> 'PropagationTask'"); @@ -85,10 +85,10 @@ public class ContentExporter extends AbstractContentDealer { for (String prefix : TABLE_PREFIXES_TO_BE_EXCLUDED) { if (tableName.toUpperCase().startsWith(prefix)) { for (String suffix : TABLE_SUFFIXES_TO_BE_INCLUDED) { - if (!tableName.toUpperCase().endsWith(suffix)) { + if (!tableName.toUpperCase().endsWith(suffix)) { allowed = false; } - } + } } } return allowed; http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 924b4aa..26a6cb2 100644 --- a/pom.xml +++ b/pom.xml @@ -1428,6 +1428,7 @@ under the License. <exclude>**/.*</exclude> <exclude>**/deb/control/conffiles</exclude> <exclude>**/deb/control/control</exclude> + <exclude>**/syncope620/**</exclude> </excludes> </configuration> <executions> http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java index 983cee4..ad5d322 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java @@ -81,7 +81,7 @@ public final class AttributableOperations { if (virtuals) { result.getVirAttrsToUpdate().add(mod); } else { - result.getAttrsToUpdate().add(mod); + result.getPlainAttrsToUpdate().add(mod); } } else if (!updatedValues.equals(originalValues)) { // avoid unwanted inputs @@ -93,7 +93,7 @@ public final class AttributableOperations { if (virtuals) { result.getVirAttrsToRemove().add(mod.getSchema()); } else { - result.getAttrsToRemove().add(mod.getSchema()); + result.getPlainAttrsToRemove().add(mod.getSchema()); } } } @@ -104,7 +104,7 @@ public final class AttributableOperations { if (virtuals) { result.getVirAttrsToUpdate().add(mod); } else { - result.getAttrsToUpdate().add(mod); + result.getPlainAttrsToUpdate().add(mod); } } } @@ -124,15 +124,15 @@ public final class AttributableOperations { result.setKey(updated.getKey()); // 2. attributes - Map<String, AttrTO> updatedAttrs = new HashMap<>(updated.getAttrMap()); - Map<String, AttrTO> originalAttrs = new HashMap<>(original.getAttrMap()); + Map<String, AttrTO> updatedAttrs = new HashMap<>(updated.getPlainAttrMap()); + Map<String, AttrTO> originalAttrs = new HashMap<>(original.getPlainAttrMap()); Set<String> originalAttrNames = new HashSet<>(originalAttrs.keySet()); originalAttrNames.removeAll(updatedAttrs.keySet()); if (!incremental) { - result.getAttrsToRemove().clear(); - result.getAttrsToRemove().addAll(originalAttrNames); + result.getPlainAttrsToRemove().clear(); + result.getPlainAttrsToRemove().addAll(originalAttrNames); } Set<String> emptyUpdatedAttrs = new HashSet<>(); @@ -144,7 +144,7 @@ public final class AttributableOperations { } for (String emptyUpdatedAttr : emptyUpdatedAttrs) { updatedAttrs.remove(emptyUpdatedAttr); - result.getAttrsToRemove().add(emptyUpdatedAttr); + result.getPlainAttrsToRemove().add(emptyUpdatedAttr); } populate(updatedAttrs, originalAttrs, result); @@ -269,8 +269,8 @@ public final class AttributableOperations { attrMod.getValuesToBeAdded().addAll(attr.getValues()); if (!attrMod.isEmpty()) { - membMod.getAttrsToUpdate().add(attrMod); - membMod.getAttrsToRemove().add(attrMod.getSchema()); + membMod.getPlainAttrsToUpdate().add(attrMod); + membMod.getPlainAttrsToRemove().add(attrMod.getSchema()); } } for (AttrTO attr : entry.getValue().getDerAttrs()) { @@ -283,7 +283,7 @@ public final class AttributableOperations { if (!attrMod.isEmpty()) { membMod.getVirAttrsToUpdate().add(attrMod); - membMod.getAttrsToRemove().add(attrMod.getSchema()); + membMod.getPlainAttrsToRemove().add(attrMod.getSchema()); } } } @@ -333,7 +333,7 @@ public final class AttributableOperations { result.setInheritTemplates(updated.isInheritTemplates()); result.setInheritAccountPolicy(updated.isInheritAccountPolicy()); result.setInheritPasswordPolicy(updated.isInheritPasswordPolicy()); - result.setInheritPlainAttrs(updated.isInheritAttrs()); + result.setInheritPlainAttrs(updated.isInheritPlainAttrs()); result.setInheritDerAttrs(updated.isInheritDerAttrs()); result.setInheritVirAttrs(updated.isInheritVirAttrs()); @@ -448,8 +448,8 @@ public final class AttributableOperations { final K mod, final T result) { // 1. attributes - result.getPlainAttrs().addAll(getUpdateValues(to.getAttrMap(), - mod.getAttrsToRemove(), mod.getAttrsToUpdate())); + result.getPlainAttrs().addAll(getUpdateValues(to.getPlainAttrMap(), + mod.getPlainAttrsToRemove(), mod.getPlainAttrsToUpdate())); // 2. derived attributes Map<String, AttrTO> attrs = to.getDerAttrMap(); http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java index f007020..2c1c980 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java @@ -32,5 +32,5 @@ public @interface FormAttributeField { boolean roleSearch() default false; - IntMappingType schema() default IntMappingType.UserSchema; + IntMappingType schema() default IntMappingType.UserPlainSchema; } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractAttributableMod.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractAttributableMod.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractAttributableMod.java index 5d6b982..aa5d442 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractAttributableMod.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractAttributableMod.java @@ -61,14 +61,14 @@ public abstract class AbstractAttributableMod extends AbstractBaseBean { @XmlElementWrapper(name = "plainAttrsToRemove") @XmlElement(name = "attribute") @JsonProperty("plainAttrsToRemove") - public Set<String> getAttrsToRemove() { + public Set<String> getPlainAttrsToRemove() { return plainAttrsToRemove; } @XmlElementWrapper(name = "plainAttrsToUpdate") @XmlElement(name = "attributeMod") @JsonProperty("plainAttrsToUpdate") - public Set<AttrMod> getAttrsToUpdate() { + public Set<AttrMod> getPlainAttrsToUpdate() { return plainAttrsToUpdate; } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java index 6efdb32..0082591 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java @@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.report; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; +import org.apache.commons.lang3.StringUtils; import org.apache.syncope.common.lib.AbstractBaseBean; @XmlType @@ -31,7 +32,7 @@ public abstract class AbstractReportletConf extends AbstractBaseBean implements private String name; public AbstractReportletConf() { - this(""); + this(StringUtils.EMPTY); setName(getClass().getName()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java index 295316b..e91252d 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java @@ -52,16 +52,16 @@ public class RoleReportletConf extends AbstractReportletConf { @FormAttributeField(userSearch = true) private String matchingCond; - @FormAttributeField(schema = IntMappingType.RoleSchema) - private final List<String> attrs = new ArrayList<String>(); + @FormAttributeField(schema = IntMappingType.RolePlainSchema) + private final List<String> attrs = new ArrayList<>(); @FormAttributeField(schema = IntMappingType.RoleDerivedSchema) - private final List<String> derAttrs = new ArrayList<String>(); + private final List<String> derAttrs = new ArrayList<>(); @FormAttributeField(schema = IntMappingType.RoleVirtualSchema) - private final List<String> virAttrs = new ArrayList<String>(); + private final List<String> virAttrs = new ArrayList<>(); - private final List<Feature> features = new ArrayList<Feature>(); + private final List<Feature> features = new ArrayList<>(); public RoleReportletConf() { super(); @@ -71,10 +71,10 @@ public class RoleReportletConf extends AbstractReportletConf { super(name); } - @XmlElementWrapper(name = "attributes") - @XmlElement(name = "attribute") - @JsonProperty("attributes") - public List<String> getAttrs() { + @XmlElementWrapper(name = "plainAttributes") + @XmlElement(name = "plainAttribute") + @JsonProperty("plainAttributes") + public List<String> getPlainAttrs() { return attrs; } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java index afd806a..c82052c 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java @@ -57,16 +57,16 @@ public class UserReportletConf extends AbstractReportletConf { @FormAttributeField(userSearch = true) private String matchingCond; - @FormAttributeField(schema = IntMappingType.UserSchema) - private final List<String> attrs = new ArrayList<String>(); + @FormAttributeField(schema = IntMappingType.UserPlainSchema) + private final List<String> attrs = new ArrayList<>(); @FormAttributeField(schema = IntMappingType.UserDerivedSchema) - private final List<String> derAttrs = new ArrayList<String>(); + private final List<String> derAttrs = new ArrayList<>(); @FormAttributeField(schema = IntMappingType.UserVirtualSchema) - private final List<String> virAttrs = new ArrayList<String>(); + private final List<String> virAttrs = new ArrayList<>(); - private final List<Feature> features = new ArrayList<Feature>(); + private final List<Feature> features = new ArrayList<>(); public UserReportletConf() { super(); @@ -76,10 +76,10 @@ public class UserReportletConf extends AbstractReportletConf { super(name); } - @XmlElementWrapper(name = "attributes") - @XmlElement(name = "attribute") - @JsonProperty("attributes") - public List<String> getAttrs() { + @XmlElementWrapper(name = "plainAttributes") + @XmlElement(name = "plainAttribute") + @JsonProperty("plainAttributes") + public List<String> getPlainAttrs() { return attrs; } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java index d298609..78256ba 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java @@ -46,7 +46,7 @@ public class ConnObjectTO extends AbstractAnnotatedBean { } @JsonIgnore - public Map<String, AttrTO> getAttrMap() { + public Map<String, AttrTO> getPlainAttrMap() { Map<String, AttrTO> result = new HashMap<>(attrs.size()); for (AttrTO attributeTO : attrs) { result.put(attributeTO.getSchema(), attributeTO); http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/LoggerTO.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/LoggerTO.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/LoggerTO.java index 263ab97..810a143 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/LoggerTO.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/LoggerTO.java @@ -29,7 +29,7 @@ public class LoggerTO extends AbstractBaseBean { private static final long serialVersionUID = -7794833835668648505L; - private String name; + private String key; private LoggerLevel level; @@ -41,11 +41,11 @@ public class LoggerTO extends AbstractBaseBean { this.level = level; } - public String getName() { - return name; + public String getKey() { + return key; } - public void setName(final String name) { - this.name = name; + public void setKey(final String key) { + this.key = key; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java index 6e24929..2a353cf 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java @@ -47,7 +47,7 @@ public class RoleTO extends AbstractSubjectTO { private boolean inheritTemplates; - private boolean inheritAttrs; + private boolean inheritPlainAttrs; private boolean inheritDerAttrs; @@ -123,12 +123,12 @@ public class RoleTO extends AbstractSubjectTO { this.inheritTemplates = inheritTemplates; } - public boolean isInheritAttrs() { - return inheritAttrs; + public boolean isInheritPlainAttrs() { + return inheritPlainAttrs; } - public void setInheritAttrs(final boolean inheritAttrs) { - this.inheritAttrs = inheritAttrs; + public void setInheritPlainAttrs(final boolean inheritPlainAttrs) { + this.inheritPlainAttrs = inheritPlainAttrs; } public boolean isInheritDerAttrs() { http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java index 0c272a9..c55cebd 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java @@ -29,30 +29,25 @@ public enum ClientExceptionType { EntityExists(Response.Status.CONFLICT), GenericPersistence(Response.Status.BAD_REQUEST), InvalidSecurityAnswer(Response.Status.BAD_REQUEST), + InvalidEntity(Response.Status.BAD_REQUEST), InvalidLogger(Response.Status.BAD_REQUEST), InvalidConnInstance(Response.Status.BAD_REQUEST), InvalidConnIdConf(Response.Status.BAD_REQUEST), InvalidPolicy(Response.Status.BAD_REQUEST), - InvalidSyncopeConf(Response.Status.BAD_REQUEST), - InvalidSyncopeRole(Response.Status.BAD_REQUEST), + InvalidConf(Response.Status.BAD_REQUEST), + InvalidRole(Response.Status.BAD_REQUEST), + InvalidReport(Response.Status.BAD_REQUEST), InvalidReportExec(Response.Status.BAD_REQUEST), InvalidRoles(Response.Status.BAD_REQUEST), InvalidSchemaDefinition(Response.Status.BAD_REQUEST), InvalidSearchExpression(Response.Status.BAD_REQUEST), InvalidPageOrSize(Response.Status.BAD_REQUEST), InvalidPropagationTaskExecReport(Response.Status.BAD_REQUEST), - InvalidUSchema(Response.Status.BAD_REQUEST), - InvalidUDerSchema(Response.Status.BAD_REQUEST), - InvalidUVirSchema(Response.Status.BAD_REQUEST), - InvalidRSchema(Response.Status.BAD_REQUEST), - InvalidRDerSchema(Response.Status.BAD_REQUEST), - InvalidRVirSchema(Response.Status.BAD_REQUEST), - InvalidMSchema(Response.Status.BAD_REQUEST), - InvalidMDerSchema(Response.Status.BAD_REQUEST), - InvalidMVirSchema(Response.Status.BAD_REQUEST), - InvalidCSchema(Response.Status.BAD_REQUEST), + InvalidPlainSchema(Response.Status.BAD_REQUEST), + InvalidDerSchema(Response.Status.BAD_REQUEST), + InvalidVirSchema(Response.Status.BAD_REQUEST), InvalidSchemaMapping(Response.Status.BAD_REQUEST), - InvalidSyncopeUser(Response.Status.BAD_REQUEST), + InvalidUser(Response.Status.BAD_REQUEST), InvalidExternalResource(Response.Status.BAD_REQUEST), InvalidNotification(Response.Status.BAD_REQUEST), InvalidPropagationTask(Response.Status.BAD_REQUEST), http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java ---------------------------------------------------------------------- diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java index 5fefcc9..7dd60d6 100644 --- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java +++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java @@ -35,7 +35,7 @@ public enum IntMappingType { // ------------------------- // User attribute types (the same in UserMappingType) // ------------------------- - UserSchema(AttributableType.USER), + UserPlainSchema(AttributableType.USER), UserDerivedSchema(AttributableType.USER), UserVirtualSchema(AttributableType.USER), UserId(AttributableType.USER), @@ -44,7 +44,7 @@ public enum IntMappingType { // ------------------------- // Role attribute types (the same in RoleMappingType) // ------------------------- - RoleSchema(AttributableType.ROLE), + RolePlainSchema(AttributableType.ROLE), RoleDerivedSchema(AttributableType.ROLE), RoleVirtualSchema(AttributableType.ROLE), RoleId(AttributableType.ROLE), @@ -53,7 +53,7 @@ public enum IntMappingType { // ------------------------- // Membership attribute types (the same in MembershipMappingType) // ------------------------- - MembershipSchema(AttributableType.MEMBERSHIP), + MembershipPlainSchema(AttributableType.MEMBERSHIP), MembershipDerivedSchema(AttributableType.MEMBERSHIP), MembershipVirtualSchema(AttributableType.MEMBERSHIP), MembershipId(AttributableType.MEMBERSHIP); @@ -164,7 +164,7 @@ public enum IntMappingType { */ private enum UserMappingType { - UserSchema, + UserPlainSchema, UserDerivedSchema, UserVirtualSchema, UserId, @@ -178,7 +178,7 @@ public enum IntMappingType { */ private enum RoleMappingType { - RoleSchema, + RolePlainSchema, RoleDerivedSchema, RoleVirtualSchema, RoleId, @@ -192,7 +192,7 @@ public enum IntMappingType { */ private enum MembershipMappingType { - MembershipSchema, + MembershipPlainSchema, MembershipDerivedSchema, MembershipVirtualSchema, MembershipId; http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/pom.xml ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/pom.xml b/syncope620/common/rest-api/pom.xml index 967573e..addc3b9 100644 --- a/syncope620/common/rest-api/pom.xml +++ b/syncope620/common/rest-api/pom.xml @@ -73,6 +73,7 @@ under the License. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> + <inherited>true</inherited> <executions> <execution> <id>attach-javadocs</id> http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java index 070f73c..1ab407d 100644 --- a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java +++ b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java @@ -59,7 +59,7 @@ public final class CollectionWrapper { List<AuditLoggerName> respons = new ArrayList<AuditLoggerName>(); for (LoggerTO l : logger) { try { - respons.add(AuditLoggerName.fromLoggerName(l.getName())); + respons.add(AuditLoggerName.fromLoggerName(l.getKey())); } catch (Exception ignore) { // ignore } @@ -71,7 +71,7 @@ public final class CollectionWrapper { List<LoggerTO> respons = new ArrayList<LoggerTO>(); for (AuditLoggerName l : auditNames) { LoggerTO loggerTO = new LoggerTO(); - loggerTO.setName(l.toLoggerName()); + loggerTO.setKey(l.toLoggerName()); loggerTO.setLevel(LoggerLevel.DEBUG); respons.add(loggerTO); } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java index 715270b..20e58c6 100644 --- a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java +++ b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java @@ -77,7 +77,7 @@ public final class RESTHeaders { /** * Declares the type of exception being raised. * - * @see ClientExceptionType + * @see org.apache.syncope.common.lib.types.ClientExceptionType */ public static final String ERROR_CODE = "X-Application-Error-Code"; http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java index b8f2826..1e9f943 100644 --- a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java +++ b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java @@ -72,13 +72,13 @@ public interface ReportService extends JAXRSService { /** * Returns report execution with matching key. * - * @param executionId report execution id to be selected + * @param executionKey report execution id to be selected * @return report execution with matching key */ @GET - @Path("executions/{executionId}") + @Path("executions/{executionKey}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - ReportExecTO readExecution(@NotNull @PathParam("executionId") Long executionId); + ReportExecTO readExecution(@NotNull @PathParam("executionKey") Long executionKey); /** * Returns a paged list of all existing reports. @@ -163,11 +163,11 @@ public interface ReportService extends JAXRSService { /** * Deletes report execution with matching key. * - * @param executionId key of execution report to be deleted + * @param executionKey key of execution report to be deleted */ @DELETE - @Path("executions/{executionId}") - void deleteExecution(@NotNull @PathParam("executionId") Long executionId); + @Path("executions/{executionKey}") + void deleteExecution(@NotNull @PathParam("executionKey") Long executionKey); /** * Executes the report with matching key. @@ -183,13 +183,13 @@ public interface ReportService extends JAXRSService { /** * Exports the report execution with matching key in the requested format. * - * @param executionId key of execution report to be selected + * @param executionKey key of execution report to be selected * @param fmt file-format selection * @return a stream for content download */ @GET - @Path("executions/{executionId}/stream") + @Path("executions/{executionKey}/stream") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response exportExecutionResult(@NotNull @PathParam("executionId") Long executionId, + Response exportExecutionResult(@NotNull @PathParam("executionKey") Long executionKey, @QueryParam("format") ReportExecExportFormat fmt); } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java index 9b62de3..044025b 100644 --- a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java +++ b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java @@ -58,7 +58,7 @@ public interface ResourceService extends JAXRSService { * @return connector object from the external resource, for the given type and key */ @GET - @Path("{resourceKey}/{type}/{id}") + @Path("{resourceKey}/{type}/{key}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) ConnObjectTO getConnectorObject(@NotNull @PathParam("resourceKey") String resourceKey, @NotNull @PathParam("type") SubjectType type, @NotNull @PathParam("key") Long key); http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java index f0bbf08..5d1b737 100644 --- a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java +++ b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java @@ -264,7 +264,7 @@ public interface RoleService extends JAXRSService { * @param type resource association action type * @param resourceNames external resources to be used for propagation-related operations * @return <tt>Response</tt> object featuring - * {@link org.apache.syncope.common.reqres.BulkActionResult} as <tt>Entity</tt> + * {@link BulkActionResult} as <tt>Entity</tt> */ @Descriptions({ @Description(target = DocTarget.RESPONSE, @@ -284,8 +284,7 @@ public interface RoleService extends JAXRSService { * @param roleKey role id. * @param type resource association action type * @param resourceNames external resources to be used for propagation-related operations - * @return <tt>Response</tt> object featuring {@link org.apache.syncope.common.reqres.BulkActionResult} - * as <tt>Entity</tt> + * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt> */ @Descriptions({ @Description(target = DocTarget.RESPONSE, http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java index cd3a302..75b6af2 100644 --- a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java +++ b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java @@ -48,9 +48,9 @@ public interface UserSelfService extends JAXRSService { * * @return <tt>Response</tt> contains special Syncope HTTP header indicating if user self registration and / or * password reset is allowed - * @see org.apache.syncope.common.types.RESTHeaders#SELFREG_ALLOWED - * @see org.apache.syncope.common.types.RESTHeaders#PWDRESET_ALLOWED - * @see org.apache.syncope.common.types.RESTHeaders#PWDRESET_NEEDS_SECURITYQUESTIONS + * @see org.apache.syncope.common.rest.api.RESTHeaders#SELFREG_ALLOWED + * @see org.apache.syncope.common.rest.api.RESTHeaders#PWDRESET_ALLOWED + * @see org.apache.syncope.common.rest.api.RESTHeaders#PWDRESET_NEEDS_SECURITYQUESTIONS */ @Descriptions({ @Description(target = DocTarget.RESPONSE, http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java ---------------------------------------------------------------------- diff --git a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java index 709ab37..7b8aded 100644 --- a/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java +++ b/syncope620/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java @@ -46,8 +46,8 @@ public interface WorkflowService extends JAXRSService { * @param kind user or role * @return <tt>Response</tt> contains special syncope HTTP header indicating if Activiti is enabled for * users / roles - * @see org.apache.syncope.common.types.RESTHeaders#ACTIVITI_USER_ENABLED - * @see org.apache.syncope.common.types.RESTHeaders#ACTIVITI_ROLE_ENABLED + * @see org.apache.syncope.common.rest.api.RESTHeaders#ACTIVITI_USER_ENABLED + * @see org.apache.syncope.common.rest.api.RESTHeaders#ACTIVITI_ROLE_ENABLED */ @Descriptions({ @Description(target = DocTarget.RESPONSE, http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/pom.xml ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/pom.xml b/syncope620/fit/reference/pom.xml index 148c71a..564d8f0 100644 --- a/syncope620/fit/reference/pom.xml +++ b/syncope620/fit/reference/pom.xml @@ -132,6 +132,24 @@ under the License. <groupId>org.webjars</groupId> <artifactId>highlightjs</artifactId> </dependency> + + <!-- TEST --> + <dependency> + <groupId>org.apache.syncope.client</groupId> + <artifactId>syncope-client-lib</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> @@ -161,6 +179,45 @@ under the License. </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <inherited>true</inherited> + <executions> + <execution> + <id>setupCSV</id> + <phase>pre-integration-test</phase> + <configuration> + <target> + <copy file="${project.build.directory}/test-classes/test.csv" todir="${test.csvdir.path}" overwrite="true"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <inherited>true</inherited> + <configuration> + <systemPropertyVariables> + <jaxrsContentType>${jaxrs.content.type}</jaxrsContentType> + </systemPropertyVariables> + </configuration> + <executions> + <execution> + <id>verify</id> + <goals> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <inherited>true</inherited> @@ -270,12 +327,22 @@ under the License. <filtering>true</filtering> </resource> </resources> + <testResources> + <testResource> + <directory>src/test/resources</directory> + <filtering>true</filtering> + </testResource> + </testResources> </build> <profiles> <profile> <id>debug</id> + <properties> + <skipTests>true</skipTests> + </properties> + <build> <defaultGoal>clean verify cargo:run</defaultGoal> @@ -306,5 +373,59 @@ under the License. </plugins> </build> </profile> + + <profile> + <id>skipTests</id> + + <dependencies> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <inherited>true</inherited> + <configuration> + <skipTests>${skipTests}</skipTests> + </configuration> + </plugin> + + <plugin> + <groupId>org.codehaus.cargo</groupId> + <artifactId>cargo-maven2-plugin</artifactId> + <inherited>true</inherited> + <configuration> + <deployables> + <deployable> + <location>${project.build.directory}/${project.build.finalName}.war</location> + </deployable> + </deployables> + </configuration> + <executions> + <execution> + <id>install-container</id> + <phase>package</phase> + <goals> + <goal>install</goal> + </goals> + </execution> + <execution> + <id>start-container</id> + <phase>none</phase> + </execution> + <execution> + <id>stop-container</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> </profiles> </project> http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/DoubleValueAttributableTransformer.java ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/DoubleValueAttributableTransformer.java b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/DoubleValueAttributableTransformer.java new file mode 100644 index 0000000..da25a34 --- /dev/null +++ b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/DoubleValueAttributableTransformer.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.fit.server.reference; + +import java.util.ArrayList; +import java.util.List; +import org.apache.syncope.common.lib.mod.AbstractAttributableMod; +import org.apache.syncope.common.lib.mod.AttrMod; +import org.apache.syncope.common.lib.to.AbstractAttributableTO; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.server.provisioning.api.AttributableTransformer; + +/** + * Class for integration tests: transform (by making it double) any attribute value for defined schema. + */ +public class DoubleValueAttributableTransformer implements AttributableTransformer { + + private static final String NAME = "makeItDouble"; + + @Override + public <T extends AbstractAttributableTO> T transform(final T input) { + for (AttrTO attr : input.getPlainAttrs()) { + if (NAME.equals(attr.getSchema())) { + List<String> values = new ArrayList<>(attr.getValues().size()); + for (String value : attr.getValues()) { + try { + values.add(String.valueOf(2 * Long.valueOf(value))); + } catch (NumberFormatException e) { + // ignore + } + } + attr.getValues().clear(); + attr.getValues().addAll(values); + } + } + + return input; + } + + @Override + public <T extends AbstractAttributableMod> T transform(final T input) { + for (AttrMod attr : input.getPlainAttrsToUpdate()) { + if (NAME.equals(attr.getSchema())) { + List<String> values = new ArrayList<>(attr.getValuesToBeAdded().size()); + for (String value : attr.getValuesToBeAdded()) { + try { + values.add(String.valueOf(2 * Long.valueOf(value))); + } catch (NumberFormatException e) { + // ignore + } + } + attr.getValuesToBeAdded().clear(); + attr.getValuesToBeAdded().addAll(values); + } + } + + return input; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncActions.java ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncActions.java b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncActions.java new file mode 100644 index 0000000..01da2c9 --- /dev/null +++ b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncActions.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.fit.server.reference; + +import org.apache.syncope.common.lib.mod.AbstractSubjectMod; +import org.apache.syncope.common.lib.mod.AttrMod; +import org.apache.syncope.common.lib.to.AbstractSubjectTO; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.server.provisioning.api.sync.ProvisioningProfile; +import org.apache.syncope.server.provisioning.java.sync.DefaultSyncActions; +import org.identityconnectors.framework.common.objects.SyncDelta; +import org.quartz.JobExecutionException; + +public class TestSyncActions extends DefaultSyncActions { + + private int counter = 0; + + @Override + public <T extends AbstractSubjectTO> SyncDelta beforeProvision( + final ProvisioningProfile<?, ?> profile, + final SyncDelta delta, + final T subject) throws JobExecutionException { + + AttrTO attrTO = null; + for (int i = 0; i < subject.getPlainAttrs().size(); i++) { + if ("fullname".equals(subject.getPlainAttrs().get(i).getSchema())) { + attrTO = subject.getPlainAttrs().get(i); + } + } + if (attrTO == null) { + attrTO = new AttrTO(); + attrTO.setSchema("fullname"); + subject.getPlainAttrs().add(attrTO); + } + attrTO.getValues().clear(); + attrTO.getValues().add(String.valueOf(counter++)); + + return delta; + } + + @Override + public <T extends AbstractSubjectTO, K extends AbstractSubjectMod> SyncDelta beforeUpdate( + final ProvisioningProfile<?, ?> profile, + final SyncDelta delta, + final T subject, + final K subjectMod) throws JobExecutionException { + + subjectMod.getPlainAttrsToRemove().add("fullname"); + + AttrMod fullnameMod = null; + for (AttrMod attrMod : subjectMod.getPlainAttrsToUpdate()) { + if ("fullname".equals(attrMod.getSchema())) { + fullnameMod = attrMod; + } + } + if (fullnameMod == null) { + fullnameMod = new AttrMod(); + fullnameMod.setSchema("fullname"); + subjectMod.getPlainAttrsToUpdate().add(fullnameMod); + } + + fullnameMod.getValuesToBeAdded().clear(); + fullnameMod.getValuesToBeAdded().add(String.valueOf(counter++)); + + return delta; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncRule.java ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncRule.java b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncRule.java new file mode 100644 index 0000000..8454ec6 --- /dev/null +++ b/syncope620/fit/reference/src/main/java/org/apache/syncope/fit/server/reference/TestSyncRule.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.fit.server.reference; + +import org.apache.syncope.server.persistence.api.dao.search.AttributeCond; +import org.apache.syncope.server.persistence.api.dao.search.SearchCond; +import org.apache.syncope.server.provisioning.api.sync.SyncCorrelationRule; +import org.identityconnectors.framework.common.objects.ConnectorObject; + +public class TestSyncRule implements SyncCorrelationRule { + + @Override + public SearchCond getSearchCond(ConnectorObject connObj) { + AttributeCond cond = new AttributeCond(); + cond.setSchema("email"); + cond.setType(AttributeCond.Type.EQ); + cond.setExpression(connObj.getName().getNameValue()); + + return SearchCond.getLeafCond(cond); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/src/main/resources/connid.properties ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/src/main/resources/connid.properties b/syncope620/fit/reference/src/main/resources/connid.properties index 54d83c3..40d649c 100644 --- a/syncope620/fit/reference/src/main/resources/connid.properties +++ b/syncope620/fit/reference/src/main/resources/connid.properties @@ -16,3 +16,8 @@ # under the License. connid.locations=${connid.location},\ connid://${testconnectorserver.key}@localhost:${testconnectorserver.port} + +## for test only +testdb.url=${testdb.url} +connid.soap.version=${connid.soap.version} +connid.db.table.version=${connid.db.table.version} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/src/main/resources/logic.properties ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/src/main/resources/logic.properties b/syncope620/fit/reference/src/main/resources/logic.properties new file mode 100644 index 0000000..2477c4b --- /dev/null +++ b/syncope620/fit/reference/src/main/resources/logic.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +attributableTransformer=org.apache.syncope.fit.server.reference.DoubleValueAttributableTransformer +logicInvocationHandler=org.apache.syncope.server.logic.LogicInvocationHandler http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/AbstractITCase.java ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/AbstractITCase.java b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/AbstractITCase.java new file mode 100644 index 0000000..fc81657 --- /dev/null +++ b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/AbstractITCase.java @@ -0,0 +1,365 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.fit.server.reference; + +import static org.junit.Assert.assertNotNull; + +import java.io.InputStream; +import java.net.URI; +import java.util.Hashtable; +import java.util.Map; +import java.util.Properties; +import java.util.UUID; +import javax.naming.Context; +import javax.naming.directory.InitialDirContext; +import javax.sql.DataSource; +import javax.ws.rs.core.Response; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.syncope.client.lib.SyncopeClient; +import org.apache.syncope.client.lib.SyncopeClientFactoryBean; +import org.apache.syncope.common.lib.mod.AttrMod; +import org.apache.syncope.common.lib.mod.RoleMod; +import org.apache.syncope.common.lib.mod.UserMod; +import org.apache.syncope.common.lib.to.AbstractPolicyTO; +import org.apache.syncope.common.lib.to.AbstractSchemaTO; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.common.lib.to.ResourceTO; +import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.UserTO; +import org.apache.syncope.common.lib.types.AttributableType; +import org.apache.syncope.common.lib.types.ConnConfProperty; +import org.apache.syncope.common.lib.types.SchemaType; +import org.apache.syncope.common.rest.api.RESTHeaders; +import org.apache.syncope.common.rest.api.service.ConfigurationService; +import org.apache.syncope.common.rest.api.service.ConnectorService; +import org.apache.syncope.common.rest.api.service.EntitlementService; +import org.apache.syncope.common.rest.api.service.LoggerService; +import org.apache.syncope.common.rest.api.service.NotificationService; +import org.apache.syncope.common.rest.api.service.PolicyService; +import org.apache.syncope.common.rest.api.service.ReportService; +import org.apache.syncope.common.rest.api.service.ResourceService; +import org.apache.syncope.common.rest.api.service.RoleService; +import org.apache.syncope.common.rest.api.service.SchemaService; +import org.apache.syncope.common.rest.api.service.SecurityQuestionService; +import org.apache.syncope.common.rest.api.service.TaskService; +import org.apache.syncope.common.rest.api.service.UserSelfService; +import org.apache.syncope.common.rest.api.service.UserService; +import org.apache.syncope.common.rest.api.service.UserWorkflowService; +import org.apache.syncope.common.rest.api.service.WorkflowService; +import org.identityconnectors.common.security.Encryptor; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { "classpath:testJDBCContext.xml" }) +public abstract class AbstractITCase { + + /** + * Logger. + */ + protected static final Logger LOG = LoggerFactory.getLogger(AbstractITCase.class); + + protected static final String ADMIN_UNAME = "admin"; + + protected static final String ADMIN_PWD = "password"; + + private static final String ADDRESS = "http://localhost:9080/syncope/rest"; + + private static final String ENV_KEY_CONTENT_TYPE = "jaxrsContentType"; + + protected static final SyncopeClientFactoryBean clientFactory = new SyncopeClientFactoryBean().setAddress(ADDRESS); + + protected static final String RESOURCE_NAME_WS1 = "ws-target-resource-1"; + + protected static final String RESOURCE_NAME_WS2 = "ws-target-resource-2"; + + protected static final String RESOURCE_NAME_LDAP = "resource-ldap"; + + protected static final String RESOURCE_NAME_TESTDB = "resource-testdb"; + + protected static final String RESOURCE_NAME_TESTDB2 = "resource-testdb2"; + + protected static final String RESOURCE_NAME_CSV = "resource-csv"; + + protected static final String RESOURCE_NAME_DBSYNC = "resource-db-sync"; + + protected static final String RESOURCE_NAME_DBVIRATTR = "resource-db-virattr"; + + protected static final String RESOURCE_NAME_NOPROPAGATION = "ws-target-resource-nopropagation"; + + protected static final String RESOURCE_NAME_NOPROPAGATION2 = "ws-target-resource-nopropagation2"; + + protected static final String RESOURCE_NAME_NOPROPAGATION3 = "ws-target-resource-nopropagation3"; + + protected static final String RESOURCE_NAME_NOPROPAGATION4 = "ws-target-resource-nopropagation4"; + + protected static final String RESOURCE_NAME_RESETSYNCTOKEN = "ws-target-resource-update-resetsynctoken"; + + protected static final String RESOURCE_NAME_TIMEOUT = "ws-target-resource-timeout"; + + protected static final String RESOURCE_NAME_MAPPINGS1 = "ws-target-resource-list-mappings-1"; + + protected static final String RESOURCE_NAME_MAPPINGS2 = "ws-target-resource-list-mappings-2"; + + protected static final String RESOURCE_NAME_CREATE = "ws-target-resource-create"; + + protected static final String RESOURCE_NAME_CREATE_SINGLE = "ws-target-resource-create-single"; + + protected static final String RESOURCE_NAME_CREATE_WRONG = "ws-target-resource-create-wrong"; + + protected static final String RESOURCE_NAME_DELETE = "ws-target-resource-delete"; + + protected static final String RESOURCE_NAME_UPDATE = "ws-target-resource-update"; + + protected static final String RESOURCE_NAME_CREATE_NONE = "ws-target-resource-create-none"; + + protected static String ANONYMOUS_UNAME; + + protected static String ANONYMOUS_KEY; + + protected static SyncopeClient adminClient; + + protected static UserService userService; + + protected static UserSelfService userSelfService; + + protected static UserWorkflowService userWorkflowService; + + protected static RoleService roleService; + + protected static ResourceService resourceService; + + protected static EntitlementService entitlementService; + + protected static ConfigurationService configurationService; + + protected static ConnectorService connectorService; + + protected static LoggerService loggerService; + + protected static ReportService reportService; + + protected static TaskService taskService; + + protected static WorkflowService workflowService; + + protected static NotificationService notificationService; + + protected static SchemaService schemaService; + + protected static PolicyService policyService; + + protected static SecurityQuestionService securityQuestionService; + + @Autowired + protected DataSource testDataSource; + + @BeforeClass + public static void securitySetup() { + InputStream propStream = null; + try { + propStream = Encryptor.class.getResourceAsStream("/security.properties"); + Properties props = new Properties(); + props.load(propStream); + + ANONYMOUS_UNAME = props.getProperty("anonymousUser"); + ANONYMOUS_KEY = props.getProperty("anonymousKey"); + } catch (Exception e) { + LOG.error("Could not read secretKey", e); + } finally { + IOUtils.closeQuietly(propStream); + } + + assertNotNull(ANONYMOUS_UNAME); + assertNotNull(ANONYMOUS_KEY); + } + + @BeforeClass + public static void restSetup() { + final String envContentType = System.getProperty(ENV_KEY_CONTENT_TYPE); + if (StringUtils.isNotBlank(envContentType)) { + clientFactory.setContentType(envContentType); + } + LOG.info("Performing IT with content type {}", clientFactory.getContentType().getMediaType()); + + adminClient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD); + + userService = adminClient.getService(UserService.class); + userSelfService = adminClient.getService(UserSelfService.class); + userWorkflowService = adminClient.getService(UserWorkflowService.class); + roleService = adminClient.getService(RoleService.class); + resourceService = adminClient.getService(ResourceService.class); + entitlementService = adminClient.getService(EntitlementService.class); + configurationService = adminClient.getService(ConfigurationService.class); + connectorService = adminClient.getService(ConnectorService.class); + loggerService = adminClient.getService(LoggerService.class); + reportService = adminClient.getService(ReportService.class); + taskService = adminClient.getService(TaskService.class); + policyService = adminClient.getService(PolicyService.class); + workflowService = adminClient.getService(WorkflowService.class); + notificationService = adminClient.getService(NotificationService.class); + schemaService = adminClient.getService(SchemaService.class); + securityQuestionService = adminClient.getService(SecurityQuestionService.class); + } + + protected static String getUUIDString() { + return UUID.randomUUID().toString().substring(0, 8); + } + + protected static AttrTO attrTO(final String schema, final String value) { + AttrTO attr = new AttrTO(); + attr.setSchema(schema); + attr.getValues().add(value); + return attr; + } + + protected static AttrMod attrMod(final String schema, final String valueToBeAdded) { + AttrMod attr = new AttrMod(); + attr.setSchema(schema); + attr.getValuesToBeAdded().add(valueToBeAdded); + return attr; + } + + protected UserTO createUser(final UserTO userTO) { + return createUser(userTO, true); + } + + protected UserTO createUser(final UserTO userTO, final boolean storePassword) { + Response response = userService.create(userTO, storePassword); + if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { + Exception ex = clientFactory.getExceptionMapper().fromResponse(response); + if (ex != null) { + throw (RuntimeException) ex; + } + } + return response.readEntity(UserTO.class); + } + + protected UserTO readUser(final String username) { + return userService.read(Long.valueOf( + userService.getUserId(username).getHeaderString(RESTHeaders.USER_ID))); + } + + protected UserTO updateUser(final UserMod userMod) { + return userService.update(userMod.getKey(), userMod).readEntity(UserTO.class); + } + + protected UserTO deleteUser(final Long id) { + return userService.delete(id).readEntity(UserTO.class); + } + + public <T> T getObject(final URI location, final Class<?> serviceClass, final Class<T> resultClass) { + WebClient webClient = WebClient.fromClient(WebClient.client(adminClient.getService(serviceClass))); + webClient.accept(clientFactory.getContentType().getMediaType()).to(location.toASCIIString(), false); + + return webClient.get(resultClass); + } + + @SuppressWarnings("unchecked") + protected <T extends AbstractSchemaTO> T createSchema(final AttributableType kind, + final SchemaType type, final T schemaTO) { + + Response response = schemaService.create(kind, type, schemaTO); + if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { + Exception ex = clientFactory.getExceptionMapper().fromResponse(response); + if (ex != null) { + throw (RuntimeException) ex; + } + } + + return (T) getObject(response.getLocation(), SchemaService.class, schemaTO.getClass()); + } + + protected RoleTO createRole(final RoleTO newRoleTO) { + Response response = roleService.create(newRoleTO); + if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { + Exception ex = clientFactory.getExceptionMapper().fromResponse(response); + if (ex != null) { + throw (RuntimeException) ex; + } + } + return getObject(response.getLocation(), RoleService.class, RoleTO.class); + } + + protected RoleTO updateRole(final RoleMod roleMod) { + return roleService.update(roleMod.getKey(), roleMod).readEntity(RoleTO.class); + } + + protected RoleTO deleteRole(final Long id) { + return roleService.delete(id).readEntity(RoleTO.class); + } + + @SuppressWarnings("unchecked") + protected <T extends AbstractPolicyTO> T createPolicy(final T policy) { + Response response = policyService.create(policy); + if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { + Exception ex = clientFactory.getExceptionMapper().fromResponse(response); + if (ex != null) { + throw (RuntimeException) ex; + } + } + return (T) getObject(response.getLocation(), PolicyService.class, policy.getClass()); + } + + protected ResourceTO createResource(final ResourceTO resourceTO) { + Response response = resourceService.create(resourceTO); + if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { + Exception ex = clientFactory.getExceptionMapper().fromResponse(response); + if (ex != null) { + throw (RuntimeException) ex; + } + } + return getObject(response.getLocation(), ResourceService.class, ResourceTO.class); + } + + protected Object getLdapRemoteObject(final String objectDn) { + return getLdapRemoteObject(null, null, objectDn); + } + + @SuppressWarnings({ "unchecked", "rawtypes", "UseOfObsoleteCollectionType" }) + protected Object getLdapRemoteObject(final String bindDn, final String bindPwd, final String objectDn) { + ResourceTO ldapRes = resourceService.read(RESOURCE_NAME_LDAP); + final Map<String, ConnConfProperty> ldapConnConf = + connectorService.read(ldapRes.getConnectorId()).getConfigurationMap(); + + Hashtable env = new Hashtable(); + env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.PROVIDER_URL, "ldap://" + ldapConnConf.get("host").getValues().get(0) + + ":" + ldapConnConf.get("port").getValues().get(0) + "/"); + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + env.put(Context.SECURITY_PRINCIPAL, + bindDn == null ? ldapConnConf.get("principal").getValues().get(0) : bindDn); + env.put(Context.SECURITY_CREDENTIALS, + bindPwd == null ? ldapConnConf.get("credentials").getValues().get(0) : bindPwd); + + try { + final InitialDirContext ctx = new InitialDirContext(env); + return ctx.lookup(objectDn); + } catch (Exception e) { + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ActivitiDetector.java ---------------------------------------------------------------------- diff --git a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ActivitiDetector.java b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ActivitiDetector.java new file mode 100644 index 0000000..ae35a23 --- /dev/null +++ b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ActivitiDetector.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.fit.server.reference; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +// TODO: REMOVE!!! +public class ActivitiDetector { + + private static final Logger LOG = LoggerFactory.getLogger(ActivitiDetector.class); + + public static boolean isActivitiEnabledForUsers() { + return false; + } + + public static boolean isActivitiEnabledForRoles() { + return false; + } +}
