syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdisabat...@apache.org
Subject syncope git commit: [SYNCOPE-658] Duplicate derived attribute after sync task when it is configured as accountid
Date Mon, 13 Apr 2015 08:02:47 GMT
Repository: syncope
Updated Branches:
  refs/heads/1_2_X aea1c879b -> 6896c460f


[SYNCOPE-658] Duplicate derived attribute after sync task when it is configured as accountid


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

Branch: refs/heads/1_2_X
Commit: 6896c460fb3f6149221307fa2c27021141b03ad2
Parents: aea1c87
Author: Marco Di Sabatino Di Diodoro <mdisabatino@apache.org>
Authored: Mon Apr 13 10:01:57 2015 +0200
Committer: Marco Di Sabatino Di Diodoro <mdisabatino@apache.org>
Committed: Mon Apr 13 10:01:57 2015 +0200

----------------------------------------------------------------------
 .../apache/syncope/core/connid/ConnObjectUtil.java    |  4 ++--
 .../apache/syncope/core/util/AttributableUtil.java    | 14 --------------
 .../org/apache/syncope/core/rest/TaskTestITCase.java  | 10 +++++++++-
 3 files changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/6896c460/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java b/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
index 814e83b..ad3a340 100644
--- a/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
+++ b/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
@@ -256,8 +256,8 @@ public class ConnObjectUtil {
         final T subjectTO = attrUtil.newSubjectTO();
 
         // 1. fill with data from connector object
-        for (AbstractMappingItem item : attrUtil.getUidToMappingItems(syncTask.getResource(),
-                MappingPurpose.SYNCHRONIZATION, attrUtil.getType())) {
+        for (AbstractMappingItem item : 
+                attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION))
{
             Attribute attribute = obj.getAttributeByName(item.getExtAttrName());
 
             AttributeTO attributeTO;

http://git-wip-us.apache.org/repos/asf/syncope/blob/6896c460/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java b/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java
index b0e3830..9d921e1 100644
--- a/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java
+++ b/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java
@@ -32,7 +32,6 @@ import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.IntMappingType;
 import org.apache.syncope.common.types.MappingPurpose;
 import org.apache.syncope.common.types.SyncPolicySpec;
-import org.apache.syncope.common.util.BeanUtils;
 import org.apache.syncope.core.persistence.beans.AbstractAttr;
 import org.apache.syncope.core.persistence.beans.AbstractAttrTemplate;
 import org.apache.syncope.core.persistence.beans.AbstractAttrValue;
@@ -86,7 +85,6 @@ import org.apache.syncope.core.persistence.beans.user.UVirAttr;
 import org.apache.syncope.core.persistence.beans.user.UVirSchema;
 import org.apache.syncope.core.sync.SyncCorrelationRule;
 import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.Uid;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -291,18 +289,6 @@ public final class AttributableUtil {
         return result;
     }
 
-    @SuppressWarnings("unchecked")
-    public <T extends AbstractMappingItem> List<T> getUidToMappingItems(
-            final ExternalResource resource, final MappingPurpose purpose, final AttributableType
type) {
-        final List<T> items = getMappingItems(resource, MappingPurpose.SYNCHRONIZATION);
-        final AbstractMappingItem uidItem = type == AttributableType.USER ? new UMappingItem()
: new RMappingItem();
-        BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
-        uidItem.setExtAttrName(Uid.NAME);
-        uidItem.setAccountid(false);
-        items.add((T) uidItem);
-        return items;
-    }
-
     public <T extends AbstractMappingItem> Class<T> mappingItemClass() {
         Class result = null;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/6896c460/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
index 0cc137a..ecbebd9 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
@@ -383,7 +383,15 @@ public class TaskTestITCase extends AbstractTest {
             assertTrue(userTO.getMemberships().get(0).getAttrMap().containsKey("subscriptionDate"));
 
             // Unmatching --> Assign (link)
+            // SYNCOPE-658
             assertTrue(userTO.getResources().contains(RESOURCE_NAME_CSV));
+            int counter = 0;
+            for (AttributeTO attributeTO : userTO.getDerAttrs()) {
+                if ("csvuserid".equals(attributeTO.getSchema())) {
+                    counter++;
+                }
+            }
+            assertEquals(1, counter);
 
             userTO = readUser("test8");
             assertNotNull(userTO);
@@ -1425,7 +1433,7 @@ public class TaskTestITCase extends AbstractTest {
         assertNotNull(notification);
 
         execSyncTask(actual.getId(), 50, false);
-        
+
         NotificationTaskTO taskTO = findNotificationTaskBySender("syncope648@syncope.apache.org");
         assertNotNull(taskTO);
     }


Mime
View raw message