syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [01/18] syncope git commit: [SYNCOPE-956] Core implementation
Date Tue, 10 Oct 2017 06:36:50 GMT
Repository: syncope
Updated Branches:
  refs/heads/master e8e56d521 -> cea47da1a


http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
index 01965ab..0100d5a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
@@ -39,16 +39,21 @@ import org.apache.syncope.common.lib.report.UserReportletConf;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.log.LoggerTO;
 import org.apache.syncope.common.lib.to.ExecTO;
+import org.apache.syncope.common.lib.to.ImplementationTO;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.AuditElements;
 import org.apache.syncope.common.lib.types.AuditLoggerName;
 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.LoggerLevel;
 import org.apache.syncope.common.lib.types.LoggerType;
 import org.apache.syncope.common.lib.types.ReportExecExportFormat;
 import org.apache.syncope.common.lib.types.ReportExecStatus;
+import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.beans.BulkExecDeleteQuery;
 import org.apache.syncope.common.rest.api.beans.ExecuteQuery;
+import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
 import org.apache.syncope.fit.AbstractITCase;
 import org.junit.jupiter.api.Test;
 
@@ -56,7 +61,8 @@ public class ReportITCase extends AbstractITCase {
 
     @Test
     public void getReportletConfs() {
-        Set<String> reportletConfs = syncopeService.platform().getReportletConfs();
+        Set<String> reportletConfs = syncopeService.platform().
+                getJavaImplInfo(ImplementationType.REPORTLET).get().getClasses();
         assertNotNull(reportletConfs);
         assertFalse(reportletConfs.isEmpty());
         assertTrue(reportletConfs.contains(UserReportletConf.class.getName()));
@@ -67,9 +73,9 @@ public class ReportITCase extends AbstractITCase {
         List<ReportTO> reports = reportService.list();
         assertNotNull(reports);
         assertFalse(reports.isEmpty());
-        for (ReportTO report : reports) {
+        reports.forEach(report -> {
             assertNotNull(report);
-        }
+        });
     }
 
     @Test
@@ -83,10 +89,26 @@ public class ReportITCase extends AbstractITCase {
 
     @Test
     public void create() {
+        ImplementationTO reportlet1 = new ImplementationTO();
+        reportlet1.setKey("UserReportletConf" + getUUIDString());
+        reportlet1.setEngine(ImplementationEngine.JAVA);
+        reportlet1.setType(ImplementationType.REPORTLET);
+        reportlet1.setBody(POJOHelper.serialize(new UserReportletConf("first")));
+        Response response = implementationService.create(reportlet1);
+        reportlet1.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
+        ImplementationTO reportlet2 = new ImplementationTO();
+        reportlet2.setKey("UserReportletConf" + getUUIDString());
+        reportlet2.setEngine(ImplementationEngine.JAVA);
+        reportlet2.setType(ImplementationType.REPORTLET);
+        reportlet2.setBody(POJOHelper.serialize(new UserReportletConf("second")));
+        response = implementationService.create(reportlet2);
+        reportlet2.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
         ReportTO report = new ReportTO();
         report.setName("testReportForCreate" + getUUIDString());
-        report.getReportletConfs().add(new UserReportletConf("first"));
-        report.getReportletConfs().add(new UserReportletConf("second"));
+        report.getReportlets().add(reportlet1.getKey());
+        report.getReportlets().add(reportlet2.getKey());
         report.setTemplate("sample");
 
         report = createReport(report);
@@ -100,30 +122,70 @@ public class ReportITCase extends AbstractITCase {
 
     @Test
     public void update() {
+        ImplementationTO reportlet1 = new ImplementationTO();
+        reportlet1.setKey("UserReportletConf" + getUUIDString());
+        reportlet1.setEngine(ImplementationEngine.JAVA);
+        reportlet1.setType(ImplementationType.REPORTLET);
+        reportlet1.setBody(POJOHelper.serialize(new UserReportletConf("first")));
+        Response response = implementationService.create(reportlet1);
+        reportlet1.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
+        ImplementationTO reportlet2 = new ImplementationTO();
+        reportlet2.setKey("UserReportletConf" + getUUIDString());
+        reportlet2.setEngine(ImplementationEngine.JAVA);
+        reportlet2.setType(ImplementationType.REPORTLET);
+        reportlet2.setBody(POJOHelper.serialize(new UserReportletConf("second")));
+        response = implementationService.create(reportlet2);
+        reportlet2.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
         ReportTO report = new ReportTO();
         report.setName("testReportForUpdate" + getUUIDString());
-        report.getReportletConfs().add(new UserReportletConf("first"));
-        report.getReportletConfs().add(new UserReportletConf("second"));
+        report.getReportlets().add(reportlet1.getKey());
+        report.getReportlets().add(reportlet2.getKey());
         report.setTemplate("sample");
 
         report = createReport(report);
         assertNotNull(report);
-        assertEquals(2, report.getReportletConfs().size());
+        assertEquals(2, report.getReportlets().size());
 
-        report.getReportletConfs().add(new UserReportletConf("last"));
+        ImplementationTO reportlet3 = new ImplementationTO();
+        reportlet3.setKey("UserReportletConf" + getUUIDString());
+        reportlet3.setEngine(ImplementationEngine.JAVA);
+        reportlet3.setType(ImplementationType.REPORTLET);
+        reportlet3.setBody(POJOHelper.serialize(new UserReportletConf("last")));
+        response = implementationService.create(reportlet3);
+        reportlet3.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
+        report.getReportlets().add(reportlet3.getKey());
 
         reportService.update(report);
         ReportTO updated = reportService.read(report.getKey());
         assertNotNull(updated);
-        assertEquals(3, updated.getReportletConfs().size());
+        assertEquals(3, updated.getReportlets().size());
     }
 
     @Test
     public void delete() {
+        ImplementationTO reportlet1 = new ImplementationTO();
+        reportlet1.setKey("UserReportletConf" + getUUIDString());
+        reportlet1.setEngine(ImplementationEngine.JAVA);
+        reportlet1.setType(ImplementationType.REPORTLET);
+        reportlet1.setBody(POJOHelper.serialize(new UserReportletConf("first")));
+        Response response = implementationService.create(reportlet1);
+        reportlet1.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
+        ImplementationTO reportlet2 = new ImplementationTO();
+        reportlet2.setKey("UserReportletConf" + getUUIDString());
+        reportlet2.setEngine(ImplementationEngine.JAVA);
+        reportlet2.setType(ImplementationType.REPORTLET);
+        reportlet2.setBody(POJOHelper.serialize(new UserReportletConf("second")));
+        response = implementationService.create(reportlet2);
+        reportlet2.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
         ReportTO report = new ReportTO();
         report.setName("testReportForDelete" + getUUIDString());
-        report.getReportletConfs().add(new UserReportletConf("first"));
-        report.getReportletConfs().add(new UserReportletConf("second"));
+        report.getReportlets().add(reportlet1.getKey());
+        report.getReportlets().add(reportlet2.getKey());
         report.setTemplate("sample");
 
         report = createReport(report);
@@ -259,10 +321,18 @@ public class ReportITCase extends AbstractITCase {
             loggerTO.setLevel(LoggerLevel.DEBUG);
             loggerService.update(LoggerType.AUDIT, loggerTO);
 
+            ImplementationTO auditReportlet = new ImplementationTO();
+            auditReportlet.setKey("UserReportletConf" + getUUIDString());
+            auditReportlet.setEngine(ImplementationEngine.JAVA);
+            auditReportlet.setType(ImplementationType.REPORTLET);
+            auditReportlet.setBody(POJOHelper.serialize(new AuditReportletConf("auditReportlet"
+ getUUIDString())));
+            Response response = implementationService.create(auditReportlet);
+            auditReportlet.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
             ReportTO report = new ReportTO();
             report.setName("auditReport" + getUUIDString());
             report.setActive(true);
-            report.getReportletConfs().add(new AuditReportletConf("auditReportlet" + getUUIDString()));
+            report.getReportlets().add(auditReportlet.getKey());
             report.setTemplate("sample");
             report = createReport(report);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
index 6a318ee..2515264 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
@@ -54,6 +54,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.ConnConfPropSchema;
 import org.apache.syncope.common.lib.types.ConnConfProperty;
 import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.TraceLevel;
 import org.apache.syncope.common.rest.api.beans.ConnObjectTOListQuery;
@@ -102,7 +103,8 @@ public class ResourceITCase extends AbstractITCase {
 
     @Test
     public void getPropagationActionsClasses() {
-        Set<String> actions = syncopeService.platform().getPropagationActions();
+        Set<String> actions = syncopeService.platform().
+                getJavaImplInfo(ImplementationType.PROPAGATION_ACTIONS).get().getClasses();
         assertNotNull(actions);
         assertFalse(actions.isEmpty());
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/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 9ae9644..a88327f 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
@@ -37,6 +37,8 @@ import org.apache.syncope.common.lib.to.PushTaskTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.to.ExecTO;
+import org.apache.syncope.common.lib.to.ImplementationTO;
+import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.common.lib.types.JobAction;
 import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.rest.api.beans.ExecuteQuery;
@@ -50,7 +52,8 @@ public class SchedTaskITCase extends AbstractTaskITCase {
 
     @Test
     public void getJobClasses() {
-        Set<String> jobClasses = syncopeService.platform().getTaskJobs();
+        Set<String> jobClasses = syncopeService.platform().
+                getJavaImplInfo(ImplementationType.TASKJOB_DELEGATE).get().getClasses();
         assertNotNull(jobClasses);
         assertFalse(jobClasses.isEmpty());
     }
@@ -86,10 +89,13 @@ public class SchedTaskITCase extends AbstractTaskITCase {
 
     @Test
     public void deferred() {
+        ImplementationTO taskJobDelegate = implementationService.read(TestSampleJobDelegate.class.getSimpleName());
+        assertNotNull(taskJobDelegate);
+
         SchedTaskTO task = new SchedTaskTO();
         task.setActive(true);
         task.setName("deferred");
-        task.setJobDelegateClassName(TestSampleJobDelegate.class.getName());
+        task.setJobDelegate(taskJobDelegate.getKey());
 
         Response response = taskService.create(task);
         task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
@@ -128,10 +134,13 @@ public class SchedTaskITCase extends AbstractTaskITCase {
 
     @Test
     public void issueSYNCOPE144() {
+        ImplementationTO taskJobDelegate = implementationService.read(TestSampleJobDelegate.class.getSimpleName());
+        assertNotNull(taskJobDelegate);
+
         SchedTaskTO task = new SchedTaskTO();
         task.setName("issueSYNCOPE144");
         task.setDescription("issueSYNCOPE144 Description");
-        task.setJobDelegateClassName(TestSampleJobDelegate.class.getName());
+        task.setJobDelegate(taskJobDelegate.getKey());
 
         Response response = taskService.create(task);
         task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
@@ -159,10 +168,13 @@ public class SchedTaskITCase extends AbstractTaskITCase {
         List<JobTO> jobs = taskService.listJobs();
         int old_size = jobs.size();
 
+        ImplementationTO taskJobDelegate = implementationService.read(TestSampleJobDelegate.class.getSimpleName());
+        assertNotNull(taskJobDelegate);
+
         SchedTaskTO task = new SchedTaskTO();
         task.setName("issueSYNCOPE660");
         task.setDescription("issueSYNCOPE660 Description");
-        task.setJobDelegateClassName(TestSampleJobDelegate.class.getName());
+        task.setJobDelegate(taskJobDelegate.getKey());
 
         Response response = taskService.create(task);
         task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
index 7dee2f1..6c33ee7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
@@ -59,6 +59,7 @@ import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.BulkActionResult.Status;
 import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.ImplementationTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.PropagationStatus;
@@ -69,17 +70,21 @@ import org.apache.syncope.common.lib.to.RealmTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 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.PatchOperation;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceAssociationAction;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
 import org.apache.syncope.common.lib.types.StatusPatchType;
 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.ResourceService;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.syncope.common.rest.api.service.UserService;
+import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
 import org.apache.syncope.fit.core.reference.TestAccountRuleConf;
 import org.apache.syncope.fit.core.reference.TestPasswordRuleConf;
 import org.apache.syncope.fit.AbstractITCase;
@@ -934,15 +939,31 @@ public class UserITCase extends AbstractITCase {
         // @XmlSeeAlso - the power of JAXB :-/
         assumeTrue(MediaType.APPLICATION_JSON_TYPE.equals(clientFactory.getContentType().getMediaType()));
 
+        ImplementationTO implementationTO = new ImplementationTO();
+        implementationTO.setKey("TestAccountRuleConf" + UUID.randomUUID().toString());
+        implementationTO.setEngine(ImplementationEngine.JAVA);
+        implementationTO.setType(ImplementationType.ACCOUNT_RULE);
+        implementationTO.setBody(POJOHelper.serialize(new TestAccountRuleConf()));
+        Response response = implementationService.create(implementationTO);
+        implementationTO.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
         AccountPolicyTO accountPolicy = new AccountPolicyTO();
         accountPolicy.setDescription("Account Policy with custom rules");
-        accountPolicy.getRuleConfs().add(new TestAccountRuleConf());
+        accountPolicy.getRules().add(implementationTO.getKey());
         accountPolicy = createPolicy(accountPolicy);
         assertNotNull(accountPolicy);
 
+        implementationTO = new ImplementationTO();
+        implementationTO.setKey("TestPasswordRuleConf" + UUID.randomUUID().toString());
+        implementationTO.setEngine(ImplementationEngine.JAVA);
+        implementationTO.setType(ImplementationType.PASSWORD_RULE);
+        implementationTO.setBody(POJOHelper.serialize(new TestPasswordRuleConf()));
+        response = implementationService.create(implementationTO);
+        implementationTO.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
         PasswordPolicyTO passwordPolicy = new PasswordPolicyTO();
         passwordPolicy.setDescription("Password Policy with custom rules");
-        passwordPolicy.getRuleConfs().add(new TestPasswordRuleConf());
+        passwordPolicy.getRules().add(implementationTO.getKey());
         passwordPolicy = createPolicy(passwordPolicy);
         assertNotNull(passwordPolicy);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/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 a7207ce..91072d1 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
@@ -37,6 +37,7 @@ import java.util.Set;
 import javax.naming.NamingException;
 import javax.sql.DataSource;
 import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.syncope.client.lib.SyncopeClient;
@@ -53,6 +54,7 @@ import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.ConnObjectTO;
 import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ImplementationTO;
 import org.apache.syncope.common.lib.to.ItemTO;
 import org.apache.syncope.common.lib.to.MappingTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
@@ -64,9 +66,14 @@ import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
 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.MappingPurpose;
 import org.apache.syncope.common.lib.types.PatchOperation;
 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;
 import org.apache.syncope.core.spring.security.Encryptor;
@@ -792,9 +799,18 @@ public class UserIssuesITCase extends AbstractITCase {
 
     @Test
     public void issueSYNCOPE420() {
+        ImplementationTO logicActions = new ImplementationTO();
+        logicActions.setKey(DoubleValueLogicActions.class.getSimpleName());
+        logicActions.setEngine(ImplementationEngine.JAVA);
+        logicActions.setType(ImplementationType.LOGIC_ACTIONS);
+        logicActions.setBody(DoubleValueLogicActions.class.getName());
+        Response response = implementationService.create(logicActions);
+        logicActions = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
+        assertNotNull(logicActions);
+
         RealmTO realm = realmService.list("/even/two").iterator().next();
         assertNotNull(realm);
-        realm.getActionsClassNames().add(DoubleValueLogicActions.class.getName());
+        realm.getActions().add(logicActions.getKey());
         realmService.update(realm);
 
         UserTO userTO = UserITCase.getUniqueSampleTO("syncope420@syncope.apache.org");
@@ -964,9 +980,18 @@ public class UserIssuesITCase extends AbstractITCase {
         assertTrue(user.getResources().isEmpty());
 
         // 2. Add DBPasswordPropagationActions
+        ImplementationTO propagationActions = new ImplementationTO();
+        propagationActions.setKey(DBPasswordPropagationActions.class.getSimpleName());
+        propagationActions.setEngine(ImplementationEngine.JAVA);
+        propagationActions.setType(ImplementationType.PROPAGATION_ACTIONS);
+        propagationActions.setBody(DBPasswordPropagationActions.class.getName());
+        Response response = implementationService.create(propagationActions);
+        propagationActions = getObject(response.getLocation(), ImplementationService.class,
ImplementationTO.class);
+        assertNotNull(propagationActions);
+
         ResourceTO resourceTO = resourceService.read(RESOURCE_NAME_TESTDB);
         assertNotNull(resourceTO);
-        resourceTO.getPropagationActionsClassNames().add(DBPasswordPropagationActions.class.getName());
+        resourceTO.getPropagationActions().add(propagationActions.getKey());
         resourceService.update(resourceTO);
 
         // 3. Add a db resource to the User
@@ -990,7 +1015,7 @@ public class UserIssuesITCase extends AbstractITCase {
         // 5. Remove DBPasswordPropagationActions
         resourceTO = resourceService.read(RESOURCE_NAME_TESTDB);
         assertNotNull(resourceTO);
-        resourceTO.getPropagationActionsClassNames().remove(DBPasswordPropagationActions.class.getName());
+        resourceTO.getPropagationActions().remove(propagationActions.getKey());
         resourceService.update(resourceTO);
     }
 
@@ -1004,9 +1029,18 @@ public class UserIssuesITCase extends AbstractITCase {
         assertTrue(user.getResources().isEmpty());
 
         // 2. Add LDAPPasswordPropagationActions
+        ImplementationTO propagationActions = new ImplementationTO();
+        propagationActions.setKey(LDAPPasswordPropagationActions.class.getSimpleName());
+        propagationActions.setEngine(ImplementationEngine.JAVA);
+        propagationActions.setType(ImplementationType.PROPAGATION_ACTIONS);
+        propagationActions.setBody(LDAPPasswordPropagationActions.class.getName());
+        Response response = implementationService.create(propagationActions);
+        propagationActions = getObject(response.getLocation(), ImplementationService.class,
ImplementationTO.class);
+        assertNotNull(propagationActions);
+
         ResourceTO resourceTO = resourceService.read(RESOURCE_NAME_LDAP);
         assertNotNull(resourceTO);
-        resourceTO.getPropagationActionsClassNames().add(LDAPPasswordPropagationActions.class.getName());
+        resourceTO.getPropagationActions().add(propagationActions.getKey());
         resourceTO.setRandomPwdIfNotProvided(false);
         resourceService.update(resourceTO);
 
@@ -1034,7 +1068,7 @@ public class UserIssuesITCase extends AbstractITCase {
         // 5. Remove LDAPPasswordPropagationActions
         resourceTO = resourceService.read(RESOURCE_NAME_LDAP);
         assertNotNull(resourceTO);
-        resourceTO.getPropagationActionsClassNames().remove(LDAPPasswordPropagationActions.class.getName());
+        resourceTO.getPropagationActions().remove(propagationActions.getKey());
         resourceTO.setRandomPwdIfNotProvided(true);
         resourceService.update(resourceTO);
     }
@@ -1179,12 +1213,20 @@ public class UserIssuesITCase extends AbstractITCase {
 
     @Test
     public void issueSYNCOPE626() {
-        PasswordPolicyTO passwordPolicy = new PasswordPolicyTO();
-        passwordPolicy.setDescription("Password Policy for SYNCOPE-626");
-
         DefaultPasswordRuleConf ruleConf = new DefaultPasswordRuleConf();
         ruleConf.setUsernameAllowed(false);
-        passwordPolicy.getRuleConfs().add(ruleConf);
+
+        ImplementationTO rule = new ImplementationTO();
+        rule.setKey("DefaultPasswordRuleConf" + getUUIDString());
+        rule.setEngine(ImplementationEngine.JAVA);
+        rule.setType(ImplementationType.PASSWORD_RULE);
+        rule.setBody(POJOHelper.serialize(ruleConf));
+        Response response = implementationService.create(rule);
+        rule.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
+
+        PasswordPolicyTO passwordPolicy = new PasswordPolicyTO();
+        passwordPolicy.setDescription("Password Policy for SYNCOPE-626");
+        passwordPolicy.getRules().add(rule.getKey());
 
         passwordPolicy = createPolicy(passwordPolicy);
         assertNotNull(passwordPolicy);

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/fit/core-reference/src/test/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/resources/log4j2.xml b/fit/core-reference/src/test/resources/log4j2.xml
index 151eedb..cfb3a62 100644
--- a/fit/core-reference/src/test/resources/log4j2.xml
+++ b/fit/core-reference/src/test/resources/log4j2.xml
@@ -19,8 +19,8 @@ under the License.
 -->
 <configuration status="WARN" shutdownHook="disable">
   <appenders>
-    <RollingRandomAccessFile name="main" fileName="${log.directory}/it.log"
-                             filePattern="${log.directory}/it-%d{yyyy-MM-dd}.log.gz"
+    <RollingRandomAccessFile name="main" fileName="${log.directory}/core-fit.log"
+                             filePattern="${log.directory}/core-fit-%d{yyyy-MM-dd}.log.gz"
                              immediateFlush="false" append="true">
       <PatternLayout>
         <pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>


Mime
View raw message