syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject syncope git commit: [SYNCOPE-898] Missing parts on core now fixed
Date Thu, 07 Jul 2016 10:02:06 GMT
Repository: syncope
Updated Branches:
  refs/heads/master 0656bc07f -> f8212ae2b


[SYNCOPE-898] Missing parts on core now fixed


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/f8212ae2
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/f8212ae2
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/f8212ae2

Branch: refs/heads/master
Commit: f8212ae2b290acadbc47e5b737b057b33dda5654
Parents: 0656bc0
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Thu Jul 7 12:02:00 2016 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Thu Jul 7 12:02:00 2016 +0200

----------------------------------------------------------------------
 .../src/test/resources/domains/MasterContent.xml            | 2 +-
 .../core/provisioning/java/utils/ConnObjectUtils.java       | 2 +-
 .../syncope/core/provisioning/java/utils/TemplateUtils.java | 9 +++++----
 fit/build-tools/src/main/resources/content.ldif             | 1 +
 .../java/org/apache/syncope/fit/core/PullTaskITCase.java    | 8 +++++++-
 5 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/f8212ae2/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
index 39ccf38..ed9edad 100644
--- a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
@@ -1070,7 +1070,7 @@ under the License.
         destinationRealm_id="e4c28e7a-9dbf-4ee7-9441-93812a0d4a28" pullMode="FULL_RECONCILIATION"
performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
         unmatchingRule="PROVISION" matchingRule="UPDATE" active="1"/>
   <AnyTemplatePullTask id="df655a2a-40c0-43b1-a157-3f4988802f58" pullTask_id="1e419ca4-ea81-4493-a14f-28b90113686d"
anyType_id="USER"
-                       template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":null,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":[],"derAttrs":[],"virAttrs":[{"schema":"virtualReadOnly","readonly":true,"values":[""]}],"resources":["resource-ldap"],"roles":[],"dynRoles":[],"relationships":[],"memberships":[],"dynGroups":[],"plainAttrs":[]}'/>
+                       template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":null,"type":"USER","realm":"&apos;/&apos;
+ title","status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":["minimal
group"],"derAttrs":[],"virAttrs":[{"schema":"virtualReadOnly","readonly":true,"values":[""]}],"resources":["resource-ldap"],"roles":[],"dynRoles":[],"relationships":[],"memberships":[],"dynGroups":[],"plainAttrs":[]}'/>
   <AnyTemplatePullTask id="fda22ff3-98f3-42e4-a2ae-cd9a28282d57" pullTask_id="1e419ca4-ea81-4493-a14f-28b90113686d"
anyType_id="GROUP"
                        template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":null,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"plainAttrs":[{"schema":"show","readonly":false,"values":["true"]}]}'/>
   <PullTask_actionsClassNames pullTask_id="1e419ca4-ea81-4493-a14f-28b90113686d" actionClassName="org.apache.syncope.core.provisioning.java.pushpull.LDAPMembershipPullActions"/>

http://git-wip-us.apache.org/repos/asf/syncope/blob/f8212ae2/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
index c0ed5fc..94822ed 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
@@ -133,7 +133,7 @@ public class ConnObjectUtils {
 
         // (for users) if password was not set above, generate
         if (anyTO instanceof UserTO && StringUtils.isBlank(((UserTO) anyTO).getPassword()))
{
-            final UserTO userTO = (UserTO) anyTO;
+            UserTO userTO = (UserTO) anyTO;
 
             List<PasswordRuleConf> ruleConfs = new ArrayList<>();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/f8212ae2/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/TemplateUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/TemplateUtils.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/TemplateUtils.java
index f750cbf..de0480f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/TemplateUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/TemplateUtils.java
@@ -69,7 +69,10 @@ public class TemplateUtils {
 
     private void fill(final AnyTO anyTO, final AnyTO template) {
         if (template.getRealm() != null) {
-            anyTO.setRealm(template.getRealm());
+            String evaluated = JexlUtils.evaluate(template.getRealm(), anyTO, new MapContext());
+            if (StringUtils.isNotBlank(evaluated)) {
+                anyTO.setRealm(evaluated);
+            }
         }
 
         Map<String, AttrTO> currentAttrMap = anyTO.getPlainAttrMap();
@@ -99,9 +102,7 @@ public class TemplateUtils {
             }
         }
 
-        for (String resource : template.getResources()) {
-            anyTO.getResources().add(resource);
-        }
+        anyTO.getResources().addAll(template.getResources());
 
         anyTO.getAuxClasses().addAll(template.getAuxClasses());
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/f8212ae2/fit/build-tools/src/main/resources/content.ldif
----------------------------------------------------------------------
diff --git a/fit/build-tools/src/main/resources/content.ldif b/fit/build-tools/src/main/resources/content.ldif
index 982728b..18f184f 100644
--- a/fit/build-tools/src/main/resources/content.ldif
+++ b/fit/build-tools/src/main/resources/content.ldif
@@ -44,6 +44,7 @@ sn: Surname
 uid: pullFromLDAP
 userpassword:: cGFzc3dvcmQxMjM=
 givenname: pullFromLDAP
+title: odd
 registeredAddress:  5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8
 jpegPhoto:: /9j/4AAQSkZJRgABAQEBKwErAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoH
  BwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQk

http://git-wip-us.apache.org/repos/asf/syncope/blob/f8212ae2/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index b08fc3d..74f8b17 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -208,7 +208,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
             ExecTO exec = execProvisioningTask(taskService, PULL_TASK_KEY, 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
-            
+
             LOG.debug("Execution of task {}:\n{}", PULL_TASK_KEY, exec);
 
             // check for pull results
@@ -382,6 +382,10 @@ public class PullTaskITCase extends AbstractTaskITCase {
                 build());
         assertNotNull(matchingGroups);
         assertEquals(1, matchingGroups.getResult().size());
+        // SYNCOPE-898
+        PullTaskTO task = taskService.read("1e419ca4-ea81-4493-a14f-28b90113686d", false);
+        assertEquals("/", task.getDestinationRealm());
+        assertEquals("/", matchingGroups.getResult().get(0).getRealm());
 
         // 3. verify that pulled user is found
         PagedResult<UserTO> matchingUsers = userService.search(
@@ -390,6 +394,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
                 build());
         assertNotNull(matchingUsers);
         assertEquals(1, matchingUsers.getResult().size());
+        // SYNCOPE-898
+        assertEquals("/odd", matchingUsers.getResult().get(0).getRealm());
 
         // Check for SYNCOPE-436
         assertEquals("pullFromLDAP",


Mime
View raw message