You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2013/10/10 16:38:00 UTC

svn commit: r1531003 [8/9] - in /syncope/trunk: ./ common/src/main/java/org/apache/syncope/common/ common/src/main/java/org/apache/syncope/common/mod/ common/src/main/java/org/apache/syncope/common/to/ common/src/main/java/org/apache/syncope/common/uti...

Modified: syncope/trunk/core/src/main/resources/indexes.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/indexes.xml?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/indexes.xml (original)
+++ syncope/trunk/core/src/main/resources/indexes.xml Thu Oct 10 14:37:56 2013
@@ -21,57 +21,6 @@ under the License.
 <properties>
   <comment>Additional indexes (in respect to JPA's)</comment>
 
-  <!-- These indexes are not needed by OpenJPA, only by Hibernate
-  <entry key="roleNameIndex">CREATE INDEX roleNameIndex ON SyncopeRole(name)</entry>
-  <entry key="ConnInstance_capabilities_Index_1">CREATE INDEX ConnInstance_ca_Index_1 ON ConnInstance_capabilities(ConnInstance_id)</entry>    
-  <entry key="ExternalResource_Index_2">CREATE INDEX ExternalResourc_Index_2 ON ExternalResource(connector_id)</entry>
-  <entry key="ExternalResource_Index_3">CREATE INDEX ExternalResourc_Index_3 ON ExternalResource(accountPolicy_id)</entry>
-  <entry key="ExternalResource_Index_4">CREATE INDEX ExternalResourc_Index_4 ON ExternalResource(passwordPolicy_id)</entry>
-  <entry key="ExternalResource_Index_5">CREATE INDEX ExternalResourc_Index_5 ON ExternalResource(syncPolicy_id)</entry>
-  <entry key="MAttr_Index_6">CREATE INDEX MAttr_Index_6 ON MAttr(schema_name)</entry>
-  <entry key="MAttr_Index_7">CREATE INDEX MAttr_Index_7 ON MAttr(owner_id)</entry>
-  <entry key="MAttrUniqueValue_Index_9">CREATE INDEX MAttrUniqueValu_Index_9 ON MAttrUniqueValue(schema_name)</entry>
-  <entry key="MAttrValue_Index_10">CREATE INDEX MAttrValue_Index_10 ON MAttrValue(attribute_id)</entry>
-  <entry key="MDerAttr_Index_11">CREATE INDEX MDerAttr_Index_11 ON MDerAttr(derivedSchema_name)</entry>
-  <entry key="MDerAttr_Index_12">CREATE INDEX MDerAttr_Index_12 ON MDerAttr(owner_id)</entry>
-  <entry key="MVirAttr_Index_13">CREATE INDEX MVirAttr_Index_13 ON MVirAttr(virtualSchema_name)</entry>
-  <entry key="MVirAttr_Index_14">CREATE INDEX MVirAttr_Index_14 ON MVirAttr(owner_id)</entry>
-  <entry key="Membership_Index_15">CREATE INDEX Membership_Index_15 ON Membership(syncopeUser_id)</entry>
-  <entry key="Membership_Index_16">CREATE INDEX Membership_Index_16 ON Membership(syncopeRole_id)</entry>
-  <entry key="NotificationTask_recipients_Index_19">CREATE INDEX NotificationTas_Index_19 ON NotificationTask_recipients(NotificationTask_id)</entry>
-  <entry key="Notification_events_Index_20">CREATE INDEX Notification_ev_Index_20 ON Notification_events(Notification_id)</entry>
-  <entry key="RAttr_Index_21">CREATE INDEX RAttr_Index_21 ON RAttr(schema_name)</entry>
-  <entry key="RAttr_Index_22">CREATE INDEX RAttr_Index_22 ON RAttr(owner_id)</entry>
-  <entry key="RAttrUniqueValue_Index_24">CREATE INDEX RAttrUniqueValu_Index_24 ON RAttrUniqueValue(schema_name)</entry>
-  <entry key="RAttrValue_Index_25">CREATE INDEX RAttrValue_Index_25 ON RAttrValue(attribute_id)</entry>
-  <entry key="RDerAttr_Index_26">CREATE INDEX RDerAttr_Index_26 ON RDerAttr(derivedSchema_name)</entry>
-  <entry key="RDerAttr_Index_27">CREATE INDEX RDerAttr_Index_27 ON RDerAttr(owner_id)</entry>
-  <entry key="RVirAttr_Index_28">CREATE INDEX RVirAttr_Index_28 ON RVirAttr(virtualSchema_name)</entry>
-  <entry key="RVirAttr_Index_29">CREATE INDEX RVirAttr_Index_29 ON RVirAttr(owner_id)</entry>
-  <entry key="SchemaMapping_Index_30">CREATE INDEX SchemaMapping_Index_30 ON SchemaMapping(resource_name)</entry>
-  <entry key="SyncopeRole_Index_31">CREATE INDEX SyncopeRole_Index_31 ON SyncopeRole(accountPolicy_id)</entry>
-  <entry key="SyncopeRole_Index_32">CREATE INDEX SyncopeRole_Index_32 ON SyncopeRole(passwordPolicy_id)</entry>
-  <entry key="SyncopeRole_Index_33">CREATE INDEX SyncopeRole_Index_33 ON SyncopeRole(parent_id)</entry>
-  <entry key="SyncopeRole_Entitlement_Index_34">CREATE INDEX SyncopeRole_Ent_Index_34 ON SyncopeRole_Entitlement(entitlement_name)</entry>
-  <entry key="SyncopeRole_Entitlement_Index_35">CREATE INDEX SyncopeRole_Ent_Index_35 ON SyncopeRole_Entitlement(role_id)</entry>
-  <entry key="SyncopeRole_ExternalResource_Index_36">CREATE INDEX SyncopeRole_Ext_Index_36 ON SyncopeRole_ExternalResource(resource_name)</entry>
-  <entry key="SyncopeRole_ExternalResource_Index_37">CREATE INDEX SyncopeRole_Ext_Index_37 ON SyncopeRole_ExternalResource(role_id)</entry>
-  <entry key="SyncopeUser_ExternalResource_Index_38">CREATE INDEX SyncopeUser_Ext_Index_38 ON SyncopeUser_ExternalResource(resource_name)</entry>
-  <entry key="SyncopeUser_ExternalResource_Index_39">CREATE INDEX SyncopeUser_Ext_Index_39 ON SyncopeUser_ExternalResource(user_id)</entry>
-  <entry key="SyncopeUser_passwordHistory_Index_40">CREATE INDEX SyncopeUser_pas_Index_40 ON SyncopeUser_passwordHistory(SyncopeUser_id)</entry>
-  <entry key="Task_Index_41">CREATE INDEX Task_Index_41 ON Task(syncopeUser_id)</entry>
-  <entry key="Task_Index_42">CREATE INDEX Task_Index_42 ON Task(resource_name)</entry>
-  <entry key="TaskExec_Index_43">CREATE INDEX TaskExec_Index_43 ON TaskExec(task_id)</entry>
-  <entry key="UAttr_Index_44">CREATE INDEX UAttr_Index_44 ON UAttr(schema_name)</entry>
-  <entry key="UAttr_Index_45">CREATE INDEX UAttr_Index_45 ON UAttr(owner_id)</entry>
-  <entry key="UAttrUniqueValue_Index_47">CREATE INDEX UAttrUniqueValu_Index_47 ON UAttrUniqueValue(schema_name)</entry>
-  <entry key="UAttrValue_Index_48">CREATE INDEX UAttrValue_Index_48 ON UAttrValue(attribute_id)</entry>
-  <entry key="UDerAttr_Index_49">CREATE INDEX UDerAttr_Index_49 ON UDerAttr(derivedSchema_name)</entry>
-  <entry key="UDerAttr_Index_50">CREATE INDEX UDerAttr_Index_50 ON UDerAttr(owner_id)</entry>
-  <entry key="UVirAttr_Index_51">CREATE INDEX UVirAttr_Index_51 ON UVirAttr(virtualSchema_name)</entry>
-  <entry key="UVirAttr_Index_52">CREATE INDEX UVirAttr_Index_52 ON UVirAttr(owner_id)</entry>
-  -->
-
   <entry key="UAttrValue_stringvalueIndex">CREATE INDEX UAttrValue_stringvalueIndex ON UAttrValue(stringvalue)</entry>
   <entry key="UAttrValue_datevalueIndex">CREATE INDEX UAttrValue_datevalueIndex ON UAttrValue(datevalue)</entry>
   <entry key="UAttrValue_longvalueIndex">CREATE INDEX UAttrValue_longvalueIndex ON UAttrValue(longvalue)</entry>

Modified: syncope/trunk/core/src/main/resources/views.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/views.xml?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/views.xml (original)
+++ syncope/trunk/core/src/main/resources/views.xml Thu Oct 10 14:37:56 2013
@@ -94,27 +94,29 @@ under the License.
     CREATE VIEW role_search_unique_attr AS
 
     SELECT ra.owner_id AS subject_id,
-    ra.schema_name AS schema_name,
+    rat.schema_name AS schema_name,
     rav.booleanvalue AS booleanvalue,
     rav.datevalue AS datevalue,
     rav.doublevalue AS doublevalue,
     rav.longvalue AS longvalue,
     rav.stringvalue AS stringvalue
-    FROM RAttrUniqueValue rav, RAttr ra
+    FROM RAttrUniqueValue rav, RAttr ra, RAttrTemplate rat
     WHERE rav.attribute_id = ra.id
+    AND ra.template_id = rat.id
   </entry>
   <entry key="role_search_attr">
     CREATE VIEW role_search_attr AS
 
     SELECT ra.owner_id AS subject_id,
-    ra.schema_name AS schema_name,
+    rat.schema_name AS schema_name,
     rav.booleanvalue AS booleanvalue,
     rav.datevalue AS datevalue,
     rav.doublevalue AS doublevalue,
     rav.longvalue AS longvalue,
     rav.stringvalue AS stringvalue
-    FROM RAttrValue rav, RAttr ra
+    FROM RAttrValue rav, RAttr ra, RAttrTemplate rat
     WHERE rav.attribute_id = ra.id
+    AND ra.template_id = rat.id
   </entry>
   <entry key="role_search_null_attr">
     CREATE VIEW role_search_null_attr AS
@@ -127,7 +129,8 @@ under the License.
     NULL AS longvalue,
     NULL AS stringvalue
     FROM SyncopeRole r CROSS JOIN RSchema
-    LEFT OUTER JOIN RAttr ra ON (RSchema.name = ra.schema_name AND ra.owner_id = r.id)
+    LEFT OUTER JOIN RAttr ra ON (ra.owner_id = r.id)
+    LEFT OUTER JOIN RAttrTemplate rat ON (RSchema.name = rat.schema_name AND ra.template_id = rat.id)
     WHERE ra.id IS NULL
   </entry>
   <entry key="role_search_resource">

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java Thu Oct 10 14:37:56 2013
@@ -18,12 +18,10 @@
  */
 package org.apache.syncope.core.persistence.dao;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
-import java.util.List;
+import static org.junit.Assert.fail;
 
 import javax.validation.ValidationException;
 
@@ -52,12 +50,6 @@ public class AttrTest extends AbstractDA
     private SchemaDAO userSchemaDAO;
 
     @Test
-    public void findAll() {
-        List<UAttr> list = attrDAO.findAll(UAttr.class);
-        assertEquals("did not get expected number of attributes ", 28, list.size());
-    }
-
-    @Test
     public void findById() {
         UAttr attribute = attrDAO.find(100L, UAttr.class);
         assertNotNull("did not find expected attribute schema", attribute);
@@ -101,18 +93,6 @@ public class AttrTest extends AbstractDA
             thrown = e;
         }
         assertNotNull("validation exception expected here ", thrown);
-
-        InvalidEntityException iee = null;
-        try {
-            attribute = attrDAO.save(attribute);
-        } catch (InvalidEntityException e) {
-            iee = e;
-        }
-        assertNull(iee);
-
-        UAttr actual = attrDAO.find(attribute.getId(), UAttr.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(attribute, actual);
     }
 
     @Test
@@ -127,7 +107,7 @@ public class AttrTest extends AbstractDA
         UAttr attribute = new UAttr();
         attribute.setSchema(gender);
         attribute.setOwner(user);
-        user.addAttribute(attribute);
+        user.addAttr(attribute);
 
         Exception thrown = null;
 
@@ -142,21 +122,17 @@ public class AttrTest extends AbstractDA
 
         InvalidEntityException iee = null;
         try {
-            attribute = attrDAO.save(attribute);
+            user = userDAO.save(user);
         } catch (InvalidEntityException e) {
             iee = e;
         }
         assertNull(iee);
-
-        UAttr actual = attrDAO.find(attribute.getId(), UAttr.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(attribute, actual);
-        assertEquals(actual.getSchema(), gender);
-        assertEquals(actual.getValues().size(), 1);
     }
 
     @Test
     public void validateAndSave() {
+        SyncopeUser user = userDAO.find(1L);
+
         final USchema emailSchema = userSchemaDAO.find("email", USchema.class);
         assertNotNull(emailSchema);
 
@@ -173,9 +149,12 @@ public class AttrTest extends AbstractDA
 
         attribute.setUniqueValue(uauv);
 
+        user.addAttr(attribute);
+
         InvalidEntityException iee = null;
         try {
-            attrDAO.save(attribute);
+            userDAO.save(user);
+            fail();
         } catch (InvalidEntityException e) {
             iee = e;
         }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java Thu Oct 10 14:37:56 2013
@@ -28,10 +28,12 @@ import java.util.List;
 
 import org.apache.syncope.core.persistence.beans.membership.MAttrValue;
 import org.apache.syncope.core.persistence.beans.membership.MDerAttr;
+import org.apache.syncope.core.persistence.beans.membership.MDerAttrTemplate;
 import org.apache.syncope.core.persistence.beans.membership.MDerSchema;
 import org.apache.syncope.core.persistence.beans.membership.Membership;
 import org.apache.syncope.core.persistence.beans.role.RAttrValue;
 import org.apache.syncope.core.persistence.beans.role.RDerAttr;
+import org.apache.syncope.core.persistence.beans.role.RDerAttrTemplate;
 import org.apache.syncope.core.persistence.beans.role.RDerSchema;
 import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -73,8 +75,7 @@ public class DerAttrTest extends Abstrac
     }
 
     @Test
-    public void saveUDerAttribute()
-            throws ClassNotFoundException {
+    public void saveUDerAttribute() {
         UDerSchema cnSchema = derSchemaDAO.find("cn", UDerSchema.class);
         assertNotNull(cnSchema);
 
@@ -83,7 +84,7 @@ public class DerAttrTest extends Abstrac
 
         UDerAttr derivedAttribute = new UDerAttr();
         derivedAttribute.setOwner(owner);
-        derivedAttribute.setDerivedSchema(cnSchema);
+        derivedAttribute.setSchema(cnSchema);
 
         derivedAttribute = derAttrDAO.save(derivedAttribute);
 
@@ -91,67 +92,61 @@ public class DerAttrTest extends Abstrac
         assertNotNull("expected save to work", actual);
         assertEquals(derivedAttribute, actual);
 
-        UAttrValue firstnameAttribute = (UAttrValue) owner.getAttribute("firstname").getValues().iterator().next();
-        UAttrValue surnameAttribute = (UAttrValue) owner.getAttribute("surname").getValues().iterator().next();
+        UAttrValue firstnameAttribute = (UAttrValue) owner.getAttr("firstname").getValues().iterator().next();
+        UAttrValue surnameAttribute = (UAttrValue) owner.getAttr("surname").getValues().iterator().next();
 
         assertEquals(surnameAttribute.getValue() + ", " + firstnameAttribute.getValue(), derivedAttribute
-                .getValue(owner.getAttributes()));
+                .getValue(owner.getAttrs()));
     }
 
     @Test
-    public void saveMDerAttribute()
-            throws ClassNotFoundException {
-        MDerSchema deriveddata = derSchemaDAO.find("mderiveddata", MDerSchema.class);
-        assertNotNull(deriveddata);
-
+    public void saveMDerAttribute() {
         Membership owner = membershipDAO.find(1L);
         assertNotNull("did not get expected user", owner);
 
-        MDerAttr derivedAttribute = new MDerAttr();
-        derivedAttribute.setOwner(owner);
-        derivedAttribute.setDerivedSchema(deriveddata);
+        MDerAttr derAttr = new MDerAttr();
+        derAttr.setOwner(owner);
+        derAttr.setTemplate(owner.getSyncopeRole().getAttrTemplate(MDerAttrTemplate.class, "mderiveddata"));
 
-        derivedAttribute = derAttrDAO.save(derivedAttribute);
+        derAttr = derAttrDAO.save(derAttr);
+        assertNotNull(derAttr.getTemplate());
 
-        MDerAttr actual = derAttrDAO.find(derivedAttribute.getId(), MDerAttr.class);
+        MDerAttr actual = derAttrDAO.find(derAttr.getId(), MDerAttr.class);
         assertNotNull("expected save to work", actual);
-        assertEquals(derivedAttribute, actual);
+        assertEquals(derAttr, actual);
 
-        MAttrValue sx = (MAttrValue) owner.getAttribute("mderived_sx").getValues().iterator().next();
-        MAttrValue dx = (MAttrValue) owner.getAttribute("mderived_dx").getValues().iterator().next();
+        MAttrValue sx = (MAttrValue) owner.getAttr("mderived_sx").getValues().iterator().next();
+        MAttrValue dx = (MAttrValue) owner.getAttr("mderived_dx").getValues().iterator().next();
 
-        assertEquals(sx.getValue() + "-" + dx.getValue(), derivedAttribute.getValue(owner.getAttributes()));
+        assertEquals(sx.getValue() + "-" + dx.getValue(), derAttr.getValue(owner.getAttrs()));
     }
 
     @Test
-    public void saveRDerAttribute()
-            throws ClassNotFoundException {
-        RDerSchema deriveddata = derSchemaDAO.find("rderiveddata", RDerSchema.class);
-        assertNotNull(deriveddata);
-
+    public void saveRDerAttribute() {
         SyncopeRole owner = roleDAO.find(1L);
         assertNotNull("did not get expected user", owner);
 
-        RDerAttr derivedAttribute = new RDerAttr();
-        derivedAttribute.setOwner(owner);
-        derivedAttribute.setDerivedSchema(deriveddata);
+        RDerAttr derAttr = new RDerAttr();
+        derAttr.setOwner(owner);
+        derAttr.setTemplate(owner.getAttrTemplate(RDerAttrTemplate.class, "rderiveddata"));
 
-        derivedAttribute = derAttrDAO.save(derivedAttribute);
+        derAttr = derAttrDAO.save(derAttr);
+        assertNotNull(derAttr.getTemplate());
 
-        RDerAttr actual = derAttrDAO.find(derivedAttribute.getId(), RDerAttr.class);
+        RDerAttr actual = derAttrDAO.find(derAttr.getId(), RDerAttr.class);
         assertNotNull("expected save to work", actual);
-        assertEquals(derivedAttribute, actual);
+        assertEquals(derAttr, actual);
 
-        RAttrValue sx = (RAttrValue) owner.getAttribute("rderived_sx").getValues().iterator().next();
-        RAttrValue dx = (RAttrValue) owner.getAttribute("rderived_dx").getValues().iterator().next();
+        RAttrValue sx = (RAttrValue) owner.getAttr("rderived_sx").getValues().iterator().next();
+        RAttrValue dx = (RAttrValue) owner.getAttr("rderived_dx").getValues().iterator().next();
 
-        assertEquals(sx.getValue() + "-" + dx.getValue(), derivedAttribute.getValue(owner.getAttributes()));
+        assertEquals(sx.getValue() + "-" + dx.getValue(), derAttr.getValue(owner.getAttrs()));
     }
 
     @Test
     public void delete() {
         UDerAttr attribute = derAttrDAO.find(100L, UDerAttr.class);
-        String attributeSchemaName = attribute.getDerivedSchema().getName();
+        String attributeSchemaName = attribute.getSchema().getName();
 
         derAttrDAO.delete(attribute.getId(), UDerAttr.class);
 
@@ -180,7 +175,7 @@ public class DerAttrTest extends Abstrac
 
         UDerAttr derAttr = new UDerAttr();
         derAttr.setOwner(owner);
-        derAttr.setDerivedSchema(sderived);
+        derAttr.setSchema(sderived);
 
         derAttr = derAttrDAO.save(derAttr);
         derAttrDAO.flush();
@@ -188,7 +183,7 @@ public class DerAttrTest extends Abstrac
         derAttr = derAttrDAO.find(derAttr.getId(), UDerAttr.class);
         assertNotNull("expected save to work", derAttr);
 
-        String value = derAttr.getValue(owner.getAttributes());
+        String value = derAttr.getValue(owner.getAttrs());
         assertNotNull(value);
         assertFalse(value.isEmpty());
         assertTrue(value.startsWith("active - vivaldi - 2010-10-20"));
@@ -209,19 +204,24 @@ public class DerAttrTest extends Abstrac
         assertEquals(sderived, actual);
 
         SyncopeRole owner = roleDAO.find(7L);
-        assertNotNull("did not get expected user", owner);
+        assertNotNull("did not get expected role", owner);
+
+        RDerAttrTemplate template = new RDerAttrTemplate();
+        template.setSchema(sderived);
+        owner.getAttrTemplates(RDerAttrTemplate.class).add(template);
 
         RDerAttr derAttr = new RDerAttr();
         derAttr.setOwner(owner);
-        derAttr.setDerivedSchema(sderived);
+        derAttr.setTemplate(owner.getAttrTemplate(RDerAttrTemplate.class, sderived.getName()));
 
         derAttr = derAttrDAO.save(derAttr);
+        assertNotNull(derAttr.getTemplate());
         derAttrDAO.flush();
 
         derAttr = derAttrDAO.find(derAttr.getId(), RDerAttr.class);
         assertNotNull("expected save to work", derAttr);
 
-        String value = derAttr.getValue(owner.getAttributes());
+        String value = derAttr.getValue(owner.getAttrs());
         assertNotNull(value);
         assertFalse(value.isEmpty());
         assertTrue(value.startsWith("managingDirector"));
@@ -241,19 +241,24 @@ public class DerAttrTest extends Abstrac
         assertEquals(sderived, actual);
 
         Membership owner = membershipDAO.find(4L);
-        assertNotNull("did not get expected user", owner);
+        assertNotNull("did not get expected membership", owner);
+
+        MDerAttrTemplate template = new MDerAttrTemplate();
+        template.setSchema(sderived);
+        owner.getSyncopeRole().getAttrTemplates(MDerAttrTemplate.class).add(template);
 
         MDerAttr derAttr = new MDerAttr();
         derAttr.setOwner(owner);
-        derAttr.setDerivedSchema(sderived);
+        derAttr.setTemplate(owner.getSyncopeRole().getAttrTemplate(MDerAttrTemplate.class, sderived.getName()));
 
         derAttr = derAttrDAO.save(derAttr);
+        assertNotNull(derAttr.getTemplate());
         derAttrDAO.flush();
 
         derAttr = derAttrDAO.find(derAttr.getId(), MDerAttr.class);
         assertNotNull("expected save to work", derAttr);
 
-        String value = derAttr.getValue(owner.getAttributes());
+        String value = derAttr.getValue(owner.getAttrs());
         assertNotNull(value);
         assertFalse(value.isEmpty());
         assertTrue(value.equalsIgnoreCase("4"));

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java Thu Oct 10 14:37:56 2013
@@ -28,6 +28,8 @@ import java.util.List;
 
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.EntityViolationType;
+import org.apache.syncope.core.persistence.beans.AbstractDerSchema;
+import org.apache.syncope.core.persistence.beans.role.RDerSchema;
 import org.apache.syncope.core.persistence.beans.user.UDerSchema;
 import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
 import org.apache.syncope.core.util.AttributableUtil;
@@ -68,11 +70,22 @@ public class DerSchemaTest extends Abstr
 
     @Test
     public void delete() {
-        UDerSchema attributeSchema = derSchemaDAO.find("cn", UDerSchema.class);
+        UDerSchema cn = derSchemaDAO.find("cn", UDerSchema.class);
+        assertNotNull(cn);
+
+        derSchemaDAO.delete(cn.getName(), AttributableUtil.getInstance(AttributableType.USER));
+
+        AbstractDerSchema actual = derSchemaDAO.find("cn", UDerSchema.class);
+        assertNull("delete did not work", actual);
+
+        // ------------- //
+
+        RDerSchema rderiveddata = derSchemaDAO.find("rderiveddata", RDerSchema.class);
+        assertNotNull(rderiveddata);
 
-        derSchemaDAO.delete(attributeSchema.getName(), AttributableUtil.getInstance(AttributableType.USER));
+        derSchemaDAO.delete(rderiveddata.getName(), AttributableUtil.getInstance(AttributableType.ROLE));
 
-        UDerSchema actual = derSchemaDAO.find("cn", UDerSchema.class);
+        actual = derSchemaDAO.find("rderiveddata", RDerSchema.class);
         assertNull("delete did not work", actual);
     }
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java Thu Oct 10 14:37:56 2013
@@ -63,21 +63,21 @@ public class RoleTest extends AbstractDA
     public void inheritedAttributes() {
         SyncopeRole director = roleDAO.find(7L);
 
-        assertEquals(1, director.findInheritedAttributes().size());
+        assertEquals(1, director.findInheritedAttrs().size());
     }
 
     @Test
     public void inheritedDerivedAttributes() {
         SyncopeRole director = roleDAO.find(7L);
 
-        assertEquals(1, director.findInheritedDerivedAttributes().size());
+        assertEquals(1, director.findInheritedDerAttrs().size());
     }
 
     @Test
     public void inheritedVirtualAttributes() {
         SyncopeRole director = roleDAO.find(7L);
 
-        assertEquals(1, director.findInheritedVirtualAttributes().size());
+        assertEquals(1, director.findInheritedVirAttrs().size());
     }
 
     @Test

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java Thu Oct 10 14:37:56 2013
@@ -26,11 +26,12 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.util.List;
+import org.apache.syncope.common.SyncopeConstants;
 
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.AttributeSchemaType;
 import org.apache.syncope.common.types.EntityViolationType;
-import org.apache.syncope.core.persistence.beans.AbstractSchema;
+import org.apache.syncope.core.persistence.beans.AbstractNormalSchema;
 import org.apache.syncope.core.persistence.beans.role.RAttr;
 import org.apache.syncope.core.persistence.beans.role.RSchema;
 import org.apache.syncope.core.persistence.beans.user.USchema;
@@ -57,19 +58,18 @@ public class SchemaTest extends Abstract
 
     @Test
     public void findByName() {
-        USchema attributeSchema = schemaDAO.find("fullname", USchema.class);
-        assertNotNull("did not find expected attribute schema", attributeSchema);
+        USchema schema = schemaDAO.find("fullname", USchema.class);
+        assertNotNull("did not find expected attribute schema", schema);
     }
 
     @Test
-    public void getAttributes() {
+    public void findAttrs() {
         List<RSchema> schemas = schemaDAO.findAll(RSchema.class);
         assertNotNull(schemas);
         assertFalse(schemas.isEmpty());
 
-        List<RAttr> attrs;
         for (RSchema schema : schemas) {
-            attrs = schemaDAO.getAttributes(schema, RAttr.class);
+            List<RAttr> attrs = schemaDAO.findAttrs(schema, RAttr.class);
             assertNotNull(attrs);
             assertFalse(attrs.isEmpty());
         }
@@ -77,31 +77,31 @@ public class SchemaTest extends Abstract
 
     @Test
     public void save() {
-        USchema attributeSchema = new USchema();
-        attributeSchema.setName("secondaryEmail");
-        attributeSchema.setType(AttributeSchemaType.String);
-        attributeSchema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
-        attributeSchema.setMandatoryCondition("false");
-        attributeSchema.setMultivalue(true);
+        USchema schema = new USchema();
+        schema.setName("secondaryEmail");
+        schema.setType(AttributeSchemaType.String);
+        schema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
+        schema.setMandatoryCondition("false");
+        schema.setMultivalue(true);
 
-        schemaDAO.save(attributeSchema);
+        schemaDAO.save(schema);
 
         USchema actual = schemaDAO.find("secondaryEmail", USchema.class);
         assertNotNull("expected save to work", actual);
-        assertEquals(attributeSchema, actual);
+        assertEquals(schema, actual);
     }
 
     @Test(expected = InvalidEntityException.class)
     public void saveNonValid() {
-        USchema attributeSchema = new USchema();
-        attributeSchema.setName("secondaryEmail");
-        attributeSchema.setType(AttributeSchemaType.String);
-        attributeSchema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
-        attributeSchema.setMandatoryCondition("false");
-        attributeSchema.setMultivalue(true);
-        attributeSchema.setUniqueConstraint(true);
+        USchema schema = new USchema();
+        schema.setName("secondaryEmail");
+        schema.setType(AttributeSchemaType.String);
+        schema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
+        schema.setMandatoryCondition("false");
+        schema.setMultivalue(true);
+        schema.setUniqueConstraint(true);
 
-        schemaDAO.save(attributeSchema);
+        schemaDAO.save(schema);
     }
 
     @Test
@@ -118,8 +118,8 @@ public class SchemaTest extends Abstract
         }
         assertNotNull(ex);
 
-        schema.setEnumerationValues("red" + AbstractSchema.enumValuesSeparator + "yellow");
-        schema.setEnumerationKeys("1" + AbstractSchema.enumValuesSeparator + "2");
+        schema.setEnumerationValues("red" + SyncopeConstants.ENUM_VALUES_SEPARATOR + "yellow");
+        schema.setEnumerationKeys("1" + SyncopeConstants.ENUM_VALUES_SEPARATOR + "2");
 
         schemaDAO.save(schema);
 
@@ -138,9 +138,9 @@ public class SchemaTest extends Abstract
 
     @Test
     public void delete() {
-        USchema schema = schemaDAO.find("fullname", USchema.class);
+        USchema fullnam = schemaDAO.find("fullname", USchema.class);
 
-        schemaDAO.delete(schema.getName(), AttributableUtil.getInstance(AttributableType.USER));
+        schemaDAO.delete(fullnam.getName(), AttributableUtil.getInstance(AttributableType.USER));
 
         USchema actual = schemaDAO.find("fullname", USchema.class);
         assertNull("delete did not work", actual);

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java Thu Oct 10 14:37:56 2013
@@ -25,10 +25,10 @@ import static org.junit.Assert.assertNul
 import java.util.List;
 
 import org.apache.syncope.core.persistence.beans.membership.MVirAttr;
-import org.apache.syncope.core.persistence.beans.membership.MVirSchema;
+import org.apache.syncope.core.persistence.beans.membership.MVirAttrTemplate;
 import org.apache.syncope.core.persistence.beans.membership.Membership;
 import org.apache.syncope.core.persistence.beans.role.RVirAttr;
-import org.apache.syncope.core.persistence.beans.role.RVirSchema;
+import org.apache.syncope.core.persistence.beans.role.RVirAttrTemplate;
 import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.persistence.beans.user.UVirAttr;
@@ -68,68 +68,62 @@ public class VirAttrTest extends Abstrac
     }
 
     @Test
-    public void saveUVirAttribute() throws ClassNotFoundException {
-        UVirSchema virtualSchema = virSchemaDAO.find("virtualdata", UVirSchema.class);
-        assertNotNull(virtualSchema);
+    public void saveUVirAttribute() {
+        UVirSchema virSchema = virSchemaDAO.find("virtualdata", UVirSchema.class);
+        assertNotNull(virSchema);
 
         SyncopeUser owner = userDAO.find(3L);
         assertNotNull("did not get expected user", owner);
 
-        UVirAttr virtualAttribute = new UVirAttr();
-        virtualAttribute.setOwner(owner);
-        virtualAttribute.setVirtualSchema(virtualSchema);
+        UVirAttr virAttr = new UVirAttr();
+        virAttr.setOwner(owner);
+        virAttr.setSchema(virSchema);
 
-        virtualAttribute = virAttrDAO.save(virtualAttribute);
+        virAttr = virAttrDAO.save(virAttr);
 
-        UVirAttr actual = virAttrDAO.find(virtualAttribute.getId(), UVirAttr.class);
+        UVirAttr actual = virAttrDAO.find(virAttr.getId(), UVirAttr.class);
         assertNotNull("expected save to work", actual);
-        assertEquals(virtualAttribute, actual);
+        assertEquals(virAttr, actual);
     }
 
     @Test
-    public void saveMVirAttribute() throws ClassNotFoundException {
-
-        MVirSchema virtualSchema = new MVirSchema();
-        virtualSchema.setName("mvirtualdata");
-
+    public void saveMVirAttribute() {
         Membership owner = membershipDAO.find(3L);
         assertNotNull("did not get expected membership", owner);
 
-        MVirAttr virtualAttribute = new MVirAttr();
-        virtualAttribute.setOwner(owner);
-        virtualAttribute.setVirtualSchema(virtualSchema);
+        MVirAttr virAttr = new MVirAttr();
+        virAttr.setOwner(owner);
+        virAttr.setTemplate(owner.getSyncopeRole().getAttrTemplate(MVirAttrTemplate.class, "mvirtualdata"));
 
-        virtualAttribute = virAttrDAO.save(virtualAttribute);
+        virAttr = virAttrDAO.save(virAttr);
+        assertNotNull(virAttr.getTemplate());
 
-        MVirAttr actual = virAttrDAO.find(virtualAttribute.getId(), MVirAttr.class);
+        MVirAttr actual = virAttrDAO.find(virAttr.getId(), MVirAttr.class);
         assertNotNull("expected save to work", actual);
-        assertEquals(virtualAttribute, actual);
+        assertEquals(virAttr, actual);
     }
 
     @Test
-    public void saveRVirAttribute() throws ClassNotFoundException {
-
-        RVirSchema virtualSchema = new RVirSchema();
-        virtualSchema.setName("rvirtualdata");
-
+    public void saveRVirAttribute() {
         SyncopeRole owner = roleDAO.find(3L);
         assertNotNull("did not get expected membership", owner);
 
-        RVirAttr virtualAttribute = new RVirAttr();
-        virtualAttribute.setOwner(owner);
-        virtualAttribute.setVirtualSchema(virtualSchema);
+        RVirAttr virAttr = new RVirAttr();
+        virAttr.setOwner(owner);
+        virAttr.setTemplate(owner.getAttrTemplate(RVirAttrTemplate.class, "rvirtualdata"));
 
-        virtualAttribute = virAttrDAO.save(virtualAttribute);
+        virAttr = virAttrDAO.save(virAttr);
+        assertNotNull(virAttr.getTemplate());
 
-        RVirAttr actual = virAttrDAO.find(virtualAttribute.getId(), RVirAttr.class);
+        RVirAttr actual = virAttrDAO.find(virAttr.getId(), RVirAttr.class);
         assertNotNull("expected save to work", actual);
-        assertEquals(virtualAttribute, actual);
+        assertEquals(virAttr, actual);
     }
 
     @Test
     public void delete() {
         UVirAttr attribute = virAttrDAO.find(1000L, UVirAttr.class);
-        String attributeSchemaName = attribute.getVirtualSchema().getName();
+        String attributeSchemaName = attribute.getSchema().getName();
 
         virAttrDAO.delete(attribute.getId(), UVirAttr.class);
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java Thu Oct 10 14:37:56 2013
@@ -27,6 +27,8 @@ import static org.junit.Assert.fail;
 import java.util.List;
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.EntityViolationType;
+import org.apache.syncope.core.persistence.beans.AbstractVirSchema;
+import org.apache.syncope.core.persistence.beans.role.RVirSchema;
 import org.apache.syncope.core.persistence.beans.user.UVirSchema;
 import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
 import org.apache.syncope.core.util.AttributableUtil;
@@ -67,11 +69,21 @@ public class VirSchemaTest extends Abstr
 
     @Test
     public void delete() {
-        UVirSchema attributeSchema = virSchemaDAO.find("virtualdata", UVirSchema.class);
+        UVirSchema virtualdata = virSchemaDAO.find("virtualdata", UVirSchema.class);
+
+        virSchemaDAO.delete(virtualdata.getName(), AttributableUtil.getInstance(AttributableType.USER));
+
+        AbstractVirSchema actual = virSchemaDAO.find("virtualdata", UVirSchema.class);
+        assertNull("delete did not work", actual);
+
+        // ------------- //
+
+        RVirSchema rvirtualdata = virSchemaDAO.find("rvirtualdata", RVirSchema.class);
+        assertNotNull(rvirtualdata);
 
-        virSchemaDAO.delete(attributeSchema.getName(), AttributableUtil.getInstance(AttributableType.USER));
+        virSchemaDAO.delete(rvirtualdata.getName(), AttributableUtil.getInstance(AttributableType.ROLE));
 
-        UVirSchema actual = virSchemaDAO.find("virtualdata", UVirSchema.class);
+        actual = virSchemaDAO.find("rvirtualdata", RVirSchema.class);
         assertNull("delete did not work", actual);
     }
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java Thu Oct 10 14:37:56 2013
@@ -24,12 +24,15 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.AttributeSchemaType;
-import org.apache.syncope.core.persistence.beans.AbstractSchema;
 import org.apache.syncope.core.persistence.beans.membership.MAttr;
+import org.apache.syncope.core.persistence.beans.membership.MAttrTemplate;
 import org.apache.syncope.core.persistence.beans.membership.MSchema;
 import org.apache.syncope.core.persistence.beans.membership.Membership;
+import org.apache.syncope.core.persistence.beans.role.RAttrTemplate;
+import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.persistence.beans.user.UAttr;
 import org.apache.syncope.core.persistence.beans.user.UAttrValue;
@@ -41,6 +44,7 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.dao.DerAttrDAO;
 import org.apache.syncope.core.persistence.dao.DerSchemaDAO;
 import org.apache.syncope.core.persistence.dao.MembershipDAO;
+import org.apache.syncope.core.persistence.dao.RoleDAO;
 import org.apache.syncope.core.persistence.dao.SchemaDAO;
 import org.apache.syncope.core.persistence.dao.UserDAO;
 import org.apache.syncope.core.util.AttributableUtil;
@@ -70,6 +74,9 @@ public class AttrTest extends AbstractDA
     private MembershipDAO membershipDAO;
 
     @Autowired
+    private RoleDAO roleDAO;
+
+    @Autowired
     private UserDAO userDAO;
 
     @Test
@@ -99,32 +106,37 @@ public class AttrTest extends AbstractDA
 
     @Test
     public void checkForEnumType() {
+        SyncopeUser user = userDAO.find(1L);
+        Membership membership = user.getMembership(1L);
+        assertNotNull(membership);
+
         MSchema schema = new MSchema();
         schema.setType(AttributeSchemaType.Enum);
         schema.setName("color");
-        schema.setEnumerationValues("red" + AbstractSchema.enumValuesSeparator + "yellow");
+        schema.setEnumerationValues("red" + SyncopeConstants.ENUM_VALUES_SEPARATOR + "yellow");
 
         MSchema actualSchema = schemaDAO.save(schema);
         assertNotNull(actualSchema);
 
-        Membership membership = membershipDAO.find(1L);
-        assertNotNull(membership);
-
-        MAttr attribute = new MAttr();
-        attribute.setSchema(actualSchema);
-        attribute.setOwner(membership);
-        attribute.addValue("yellow", AttributableUtil.getInstance(AttributableType.MEMBERSHIP));
-        membership.addAttribute(attribute);
+        MAttrTemplate template = new MAttrTemplate();
+        template.setSchema(actualSchema);
+        membership.getSyncopeRole().getAttrTemplates(MAttrTemplate.class).add(template);
+
+        MAttr attr = new MAttr();
+        attr.setTemplate(template);
+        attr.setOwner(membership);
+        attr.addValue("yellow", AttributableUtil.getInstance(AttributableType.MEMBERSHIP));
+        membership.addAttr(attr);
 
-        MAttr actualAttribute = attrDAO.save(attribute);
+        MAttr actualAttribute = userDAO.save(user).getMembership(1L).getAttr("color");
         assertNotNull(actualAttribute);
 
         membership = membershipDAO.find(1L);
         assertNotNull(membership);
-        assertNotNull(membership.getAttribute(schema.getName()));
-        assertNotNull(membership.getAttribute(schema.getName()).getValues());
+        assertNotNull(membership.getAttr(schema.getName()));
+        assertNotNull(membership.getAttr(schema.getName()).getValues());
 
-        assertEquals(membership.getAttribute(schema.getName()).getValues().size(), 1);
+        assertEquals(membership.getAttr(schema.getName()).getValues().size(), 1);
     }
 
     @Test
@@ -145,7 +157,7 @@ public class AttrTest extends AbstractDA
 
         UDerAttr derAttr = new UDerAttr();
         derAttr.setOwner(owner);
-        derAttr.setDerivedSchema(sderived);
+        derAttr.setSchema(sderived);
 
         derAttr = derAttrDAO.save(derAttr);
         derAttrDAO.flush();
@@ -153,10 +165,28 @@ public class AttrTest extends AbstractDA
         derAttr = derAttrDAO.find(derAttr.getId(), UDerAttr.class);
         assertNotNull("expected save to work", derAttr);
 
-        String value = derAttr.getValue(owner.getAttributes());
+        String value = derAttr.getValue(owner.getAttrs());
         assertNotNull(value);
         assertFalse(value.isEmpty());
         assertTrue(value.startsWith("vivaldi - 2010-10-20"));
         assertTrue(value.endsWith("[0]"));
     }
+
+    @Test
+    public void unmatchedRoleAttr() {
+        SyncopeRole role = roleDAO.find(1L);
+        assertNotNull(role);
+
+        assertNotNull(role.getAttrTemplate(RAttrTemplate.class, "icon"));
+        assertNotNull(role.getAttr("icon"));
+
+        assertTrue(role.getAttrTemplates(RAttrTemplate.class).
+                remove(role.getAttrTemplate(RAttrTemplate.class, "icon")));
+
+        role = roleDAO.save(role);
+        roleDAO.flush();
+
+        assertNull(role.getAttrTemplate(RAttrTemplate.class, "icon"));
+        assertNull(role.getAttr("icon"));
+    }
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java Thu Oct 10 14:37:56 2013
@@ -54,6 +54,6 @@ public class DerSchemaTest extends Abstr
 
         assertNull(derSchemaDAO.find(schema.getName(), UDerSchema.class));
         assertNull(derAttrDAO.find(100L, UDerAttr.class));
-        assertNull(userDAO.find(3L).getDerivedAttribute(schema.getName()));
+        assertNull(userDAO.find(3L).getDerAttr(schema.getName()));
     }
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java Thu Oct 10 14:37:56 2013
@@ -112,8 +112,8 @@ public class SchemaTest extends Abstract
 
         assertNull(attrDAO.find(100L, UAttr.class));
         assertNull(attrDAO.find(300L, UAttr.class));
-        assertNull(userDAO.find(1L).getAttribute("fullname"));
-        assertNull(userDAO.find(3L).getAttribute("fullname"));
+        assertNull(userDAO.find(1L).getAttr("fullname"));
+        assertNull(userDAO.find(3L).getAttr("fullname"));
     }
 
     @Test

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java Thu Oct 10 14:37:56 2013
@@ -99,7 +99,7 @@ public class AuthenticationTestITCase ex
         AttributeTO testAttributeTO = new AttributeTO();
         testAttributeTO.setSchema("testAttribute");
         testAttributeTO.getValues().add("a value");
-        membershipTO.getAttributes().add(testAttributeTO);
+        membershipTO.getAttrs().add(testAttributeTO);
         userTO.getMemberships().add(membershipTO);
 
         userTO = createUser(userTO);
@@ -140,7 +140,7 @@ public class AuthenticationTestITCase ex
         AttributeTO testAttributeTO = new AttributeTO();
         testAttributeTO.setSchema("testAttribute");
         testAttributeTO.getValues().add("a value");
-        membershipTO.getAttributes().add(testAttributeTO);
+        membershipTO.getAttrs().add(testAttributeTO);
         userTO.getMemberships().add(membershipTO);
 
         userTO = createUser(userTO);
@@ -174,7 +174,7 @@ public class AuthenticationTestITCase ex
         AttributeTO testAttributeTO = new AttributeTO();
         testAttributeTO.setSchema("testAttribute");
         testAttributeTO.getValues().add("a value");
-        membershipTO.getAttributes().add(testAttributeTO);
+        membershipTO.getAttrs().add(testAttributeTO);
         userTO.getMemberships().add(membershipTO);
 
         userTO = createUser(userTO);
@@ -220,7 +220,7 @@ public class AuthenticationTestITCase ex
         AttributeTO testAttributeTO = new AttributeTO();
         testAttributeTO.setSchema("testAttribute");
         testAttributeTO.getValues().add("a value");
-        membershipTO.getAttributes().add(testAttributeTO);
+        membershipTO.getAttrs().add(testAttributeTO);
         userTO.getMemberships().add(membershipTO);
 
         userTO = createUser(userTO);
@@ -253,7 +253,7 @@ public class AuthenticationTestITCase ex
         AttributeTO testAttributeTO = new AttributeTO();
         testAttributeTO.setSchema("testAttribute");
         testAttributeTO.getValues().add("a value");
-        membershipTO.getAttributes().add(testAttributeTO);
+        membershipTO.getAttrs().add(testAttributeTO);
         userTO.getMemberships().add(membershipTO);
 
         userTO = createUser(userTO);

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java Thu Oct 10 14:37:56 2013
@@ -76,8 +76,7 @@ public class DerivedSchemaTestITCase ext
         DerSchemaTO schema = schemaService.read(AttributableType.ROLE, SchemaType.DERIVED, "rderiveddata");
         assertNotNull(schema);
 
-        schemaService.delete(AttributableType.ROLE, SchemaType.DERIVED,
-                schema.getName());
+        schemaService.delete(AttributableType.ROLE, SchemaType.DERIVED, schema.getName());
 
         Throwable t = null;
         try {

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java Thu Oct 10 14:37:56 2013
@@ -18,8 +18,6 @@
  */
 package org.apache.syncope.core.rest;
 
-import static org.apache.syncope.core.rest.AbstractTest.attributeTO;
-import static org.apache.syncope.core.rest.AbstractTest.roleService;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -36,8 +34,10 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.to.ConnObjectTO;
 import org.apache.syncope.common.to.PropagationTargetsTO;
 import org.apache.syncope.common.to.RoleTO;
+import org.apache.syncope.common.to.SchemaTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
@@ -67,7 +67,8 @@ public class RoleTestITCase extends Abst
         // inherited so setter execution should be ignored
         roleTO.setPasswordPolicy(2L);
 
-        roleTO.getAttributes().add(attributeTO("icon", "anIcon"));
+        roleTO.getRAttrTemplates().add("icon");
+        roleTO.getAttrs().add(attributeTO("icon", "anIcon"));
 
         roleTO.getResources().add("resource-ldap");
         return roleTO;
@@ -80,7 +81,7 @@ public class RoleTestITCase extends Abst
     @Test
     public void createWithException() {
         RoleTO newRoleTO = new RoleTO();
-        newRoleTO.getAttributes().add(attributeTO("attr1", "value1"));
+        newRoleTO.getAttrs().add(attributeTO("attr1", "value1"));
 
         try {
             createRole(roleService, newRoleTO);
@@ -93,16 +94,17 @@ public class RoleTestITCase extends Abst
     @Test
     public void create() {
         RoleTO roleTO = buildRoleTO("lastRole");
-        roleTO.getVirtualAttributes().add(attributeTO("rvirtualdata", "rvirtualvalue"));
+        roleTO.getRVirAttrTemplates().add("rvirtualdata");
+        roleTO.getVirAttrs().add(attributeTO("rvirtualdata", "rvirtualvalue"));
         roleTO.setRoleOwner(8L);
 
         roleTO = createRole(roleService, roleTO);
         assertNotNull(roleTO);
 
-        assertNotNull(roleTO.getVirtualAttributeMap());
-        assertNotNull(roleTO.getVirtualAttributeMap().get("rvirtualdata").getValues());
-        assertFalse(roleTO.getVirtualAttributeMap().get("rvirtualdata").getValues().isEmpty());
-        assertEquals("rvirtualvalue", roleTO.getVirtualAttributeMap().get("rvirtualdata").getValues().get(0));
+        assertNotNull(roleTO.getVirAttrMap());
+        assertNotNull(roleTO.getVirAttrMap().get("rvirtualdata").getValues());
+        assertFalse(roleTO.getVirAttrMap().get("rvirtualdata").getValues().isEmpty());
+        assertEquals("rvirtualvalue", roleTO.getVirAttrMap().get("rvirtualdata").getValues().get(0));
 
         assertNotNull(roleTO.getAccountPolicy());
         assertEquals(6L, (long) roleTO.getAccountPolicy());
@@ -114,7 +116,7 @@ public class RoleTestITCase extends Abst
 
         ConnObjectTO connObjectTO = readConnectorObject("resource-ldap", roleTO.getId());
         assertNotNull(connObjectTO);
-        assertNotNull(connObjectTO.getAttributeMap().get("owner"));
+        assertNotNull(connObjectTO.getAttrMap().get("owner"));
     }
 
     @Test
@@ -183,8 +185,8 @@ public class RoleTestITCase extends Abst
         RoleTO roleTO = roleService.read(1L);
 
         assertNotNull(roleTO);
-        assertNotNull(roleTO.getAttributes());
-        assertFalse(roleTO.getAttributes().isEmpty());
+        assertNotNull(roleTO.getAttrs());
+        assertFalse(roleTO.getAttrs().isEmpty());
     }
 
     @Test
@@ -209,16 +211,17 @@ public class RoleTestITCase extends Abst
 
         RoleTO roleTO = roleService2.selfRead(1L);
         assertNotNull(roleTO);
-        assertNotNull(roleTO.getAttributes());
-        assertFalse(roleTO.getAttributes().isEmpty());
+        assertNotNull(roleTO.getAttrs());
+        assertFalse(roleTO.getAttrs().isEmpty());
     }
 
     @Test
     public void update() {
         RoleTO roleTO = buildRoleTO("latestRole" + getUUIDString());
+        roleTO.getRAttrTemplates().add("show");
         roleTO = createRole(roleService, roleTO);
 
-        assertEquals(1, roleTO.getAttributes().size());
+        assertEquals(1, roleTO.getAttrs().size());
 
         assertNotNull(roleTO.getAccountPolicy());
         assertEquals(6L, (long) roleTO.getAccountPolicy());
@@ -230,7 +233,7 @@ public class RoleTestITCase extends Abst
         roleMod.setId(roleTO.getId());
         String modName = "finalRole" + getUUIDString();
         roleMod.setName(modName);
-        roleMod.getAttributesToBeUpdated().add(attributeMod("show", "FALSE"));
+        roleMod.getAttrsToUpdate().add(attributeMod("show", "FALSE"));
 
         // change password policy inheritance
         roleMod.setInheritPasswordPolicy(Boolean.FALSE);
@@ -238,7 +241,7 @@ public class RoleTestITCase extends Abst
         roleTO = roleService.update(roleMod.getId(), roleMod);
 
         assertEquals(modName, roleTO.getName());
-        assertEquals(2, roleTO.getAttributes().size());
+        assertEquals(2, roleTO.getAttrs().size());
 
         // changes ignored because not requested (null ReferenceMod)
         assertNotNull(roleTO.getAccountPolicy());
@@ -251,41 +254,43 @@ public class RoleTestITCase extends Abst
     @Test
     public void updateRemovingVirAttribute() {
         RoleTO roleTO = buildBasicRoleTO("withvirtual" + getUUIDString());
-        roleTO.getVirtualAttributes().add(attributeTO("rvirtualdata", null));
+        roleTO.getRVirAttrTemplates().add("rvirtualdata");
+        roleTO.getVirAttrs().add(attributeTO("rvirtualdata", null));
 
         roleTO = createRole(roleService, roleTO);
 
         assertNotNull(roleTO);
-        assertEquals(1, roleTO.getVirtualAttributes().size());
+        assertEquals(1, roleTO.getVirAttrs().size());
 
         final RoleMod roleMod = new RoleMod();
         roleMod.setId(roleTO.getId());
-        roleMod.getVirtualAttributesToBeRemoved().add("rvirtualdata");
+        roleMod.getVirAttrsToRemove().add("rvirtualdata");
 
         roleTO = roleService.update(roleMod.getId(), roleMod);
 
         assertNotNull(roleTO);
-        assertTrue(roleTO.getVirtualAttributes().isEmpty());
+        assertTrue(roleTO.getVirAttrs().isEmpty());
     }
 
     @Test
     public void updateRemovingDerAttribute() {
         RoleTO roleTO = buildBasicRoleTO("withderived" + getUUIDString());
-        roleTO.getDerivedAttributes().add(attributeTO("rderivedschema", null));
+        roleTO.getRDerAttrTemplates().add("rderivedschema");
+        roleTO.getDerAttrs().add(attributeTO("rderivedschema", null));
 
         roleTO = createRole(roleService, roleTO);
 
         assertNotNull(roleTO);
-        assertEquals(1, roleTO.getDerivedAttributes().size());
+        assertEquals(1, roleTO.getDerAttrs().size());
 
         final RoleMod roleMod = new RoleMod();
         roleMod.setId(roleTO.getId());
-        roleMod.getDerivedAttributesToBeRemoved().add("rderivedschema");
+        roleMod.getDerAttrsToRemove().add("rderivedschema");
 
         roleTO = roleService.update(roleMod.getId(), roleMod);
 
         assertNotNull(roleTO);
-        assertTrue(roleTO.getDerivedAttributes().isEmpty());
+        assertTrue(roleTO.getDerAttrs().isEmpty());
     }
 
     @Test
@@ -376,7 +381,7 @@ public class RoleTestITCase extends Abst
 
         RoleMod roleMod = new RoleMod();
         roleMod.setId(roleTO.getId());
-        roleMod.setInheritDerivedAttributes(Boolean.TRUE);
+        roleMod.setInheritDerAttrs(Boolean.TRUE);
 
         roleTO = roleService.update(roleMod.getId(), roleMod);
         assertNotNull(roleTO);
@@ -465,4 +470,41 @@ public class RoleTestITCase extends Abst
             // ignore
         }
     }
+
+    @Test
+    public void createWithMandatorySchemaNotTemplate() {
+        // 1. create a role mandatory schema
+        SchemaTO badge = new SchemaTO();
+        badge.setName("badge");
+        badge.setMandatoryCondition("true");
+        schemaService.create(AttributableType.ROLE, SchemaType.NORMAL, badge);
+
+        // 2. create a role *without* an attribute for that schema: it works
+        RoleTO roleTO = buildRoleTO("lastRole");
+        assertFalse(roleTO.getAttrMap().containsKey(badge.getName()));
+        roleTO = createRole(roleService, roleTO);
+        assertNotNull(roleTO);
+        assertFalse(roleTO.getAttrMap().containsKey(badge.getName()));
+
+        // 3. add a template for badge to the role just created - 
+        // failure since no values are provided and it is mandatory
+        RoleMod roleMod = new RoleMod();
+        roleMod.setId(roleTO.getId());
+        roleMod.setModRAttrTemplates(true);
+        roleMod.getRAttrTemplates().add("badge");
+
+        try {
+            roleService.update(roleMod.getId(), roleMod);
+            fail();
+        } catch (SyncopeClientCompositeException e) {
+            assertNotNull(e.getException(SyncopeClientExceptionType.RequiredValuesMissing));
+        }
+
+        // 4. also add an actual attribute for badge - it will work        
+        roleMod.getAttrsToUpdate().add(attributeMod(badge.getName(), "xxxxxxxxxx"));
+
+        roleTO = roleService.update(roleMod.getId(), roleMod);
+        assertNotNull(roleTO);
+        assertTrue(roleTO.getAttrMap().containsKey(badge.getName()));
+    }
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java Thu Oct 10 14:37:56 2013
@@ -181,7 +181,7 @@ public class SchemaTestITCase extends Ab
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("issue258@syncope.apache.org");
-        userTO.getAttributes().add(attributeTO(schemaTO.getName(), "1.2"));
+        userTO.getAttrs().add(attributeTO(schemaTO.getName(), "1.2"));
 
         userTO = createUser(userTO);
         assertNotNull(userTO);
@@ -205,7 +205,7 @@ public class SchemaTestITCase extends Ab
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("issue259@syncope.apache.org");
-        userTO.getAttributes().add(attributeTO(schemaTO.getName(), "1"));
+        userTO.getAttrs().add(attributeTO(schemaTO.getName(), "1"));
         userTO = createUser(userTO);
         assertNotNull(userTO);
 
@@ -229,7 +229,7 @@ public class SchemaTestITCase extends Ab
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("issue260@syncope.apache.org");
-        userTO.getAttributes().add(attributeTO(schemaTO.getName(), "1.2"));
+        userTO.getAttrs().add(attributeTO(schemaTO.getName(), "1.2"));
         userTO = createUser(userTO);
         assertNotNull(userTO);
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java Thu Oct 10 14:37:56 2013
@@ -208,7 +208,7 @@ public class SearchTestITCase extends Ab
     @Test
     public void searchByBooleanAttributableCond() throws InvalidSearchConditionException {
         final AttributableCond cond = new AttributableCond(AttributableCond.Type.EQ);
-        cond.setSchema("inheritAttributes");
+        cond.setSchema("inheritAttrs");
         cond.setExpression("true");
 
         final NodeCond searchCondition = NodeCond.getLeafCond(cond);

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Thu Oct 10 14:37:56 2013
@@ -234,13 +234,13 @@ public class TaskTestITCase extends Abst
         inUserTO.setPassword("password123");
         String userName = "test9";
         inUserTO.setUsername(userName);
-        inUserTO.getAttributes().add(attributeTO("firstname", "nome9"));
-        inUserTO.getAttributes().add(attributeTO("surname", "cognome"));
-        inUserTO.getAttributes().add(attributeTO("type", "a type"));
-        inUserTO.getAttributes().add(attributeTO("fullname", "nome cognome"));
-        inUserTO.getAttributes().add(attributeTO("userId", "puccini@syncope.apache.org"));
-        inUserTO.getAttributes().add(attributeTO("email", "puccini@syncope.apache.org"));
-        inUserTO.getDerivedAttributes().add(attributeTO("csvuserid", null));
+        inUserTO.getAttrs().add(attributeTO("firstname", "nome9"));
+        inUserTO.getAttrs().add(attributeTO("surname", "cognome"));
+        inUserTO.getAttrs().add(attributeTO("type", "a type"));
+        inUserTO.getAttrs().add(attributeTO("fullname", "nome cognome"));
+        inUserTO.getAttrs().add(attributeTO("userId", "puccini@syncope.apache.org"));
+        inUserTO.getAttrs().add(attributeTO("email", "puccini@syncope.apache.org"));
+        inUserTO.getDerAttrs().add(attributeTO("csvuserid", null));
 
         inUserTO = createUser(inUserTO);
         assertNotNull(inUserTO);
@@ -259,14 +259,14 @@ public class TaskTestITCase extends Abst
 
             // add user template
             UserTO template = new UserTO();
-            template.getAttributes().add(attributeTO("type",
+            template.getAttrs().add(attributeTO("type",
                     "email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"));
-            template.getDerivedAttributes().add(attributeTO("cn", null));
+            template.getDerAttrs().add(attributeTO("cn", null));
             template.getResources().add("resource-testdb");
 
             MembershipTO membershipTO = new MembershipTO();
             membershipTO.setRoleId(8L);
-            membershipTO.getAttributes().add(attributeTO("subscriptionDate", "'2009-08-18T16:33:12.203+0200'"));
+            membershipTO.getAttrs().add(attributeTO("subscriptionDate", "'2009-08-18T16:33:12.203+0200'"));
             template.getMemberships().add(membershipTO);
 
             task.setUserTemplate(template);
@@ -285,23 +285,23 @@ public class TaskTestITCase extends Abst
             assertNotNull(userTO);
             assertEquals("test9", userTO.getUsername());
             assertEquals(ActivitiDetector.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
-            assertEquals("test9@syncope.apache.org", userTO.getAttributeMap().get("email").getValues().get(0));
-            assertEquals("test9@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
-            assertTrue(Integer.valueOf(userTO.getAttributeMap().get("fullname").getValues().get(0)) <= 10);
+            assertEquals("test9@syncope.apache.org", userTO.getAttrMap().get("email").getValues().get(0));
+            assertEquals("test9@syncope.apache.org", userTO.getAttrMap().get("userId").getValues().get(0));
+            assertTrue(Integer.valueOf(userTO.getAttrMap().get("fullname").getValues().get(0)) <= 10);
 
             // check for user template
             userTO = userService.read("test7");
             assertNotNull(userTO);
-            assertEquals("TYPE_OTHER", userTO.getAttributeMap().get("type").getValues().get(0));
+            assertEquals("TYPE_OTHER", userTO.getAttrMap().get("type").getValues().get(0));
             assertEquals(2, userTO.getResources().size());
             assertTrue(userTO.getResources().contains("resource-testdb"));
             assertTrue(userTO.getResources().contains("ws-target-resource-2"));
             assertEquals(1, userTO.getMemberships().size());
-            assertTrue(userTO.getMemberships().get(0).getAttributeMap().containsKey("subscriptionDate"));
+            assertTrue(userTO.getMemberships().get(0).getAttrMap().containsKey("subscriptionDate"));
 
             userTO = userService.read("test8");
             assertNotNull(userTO);
-            assertEquals("TYPE_8", userTO.getAttributeMap().get("type").getValues().get(0));
+            assertEquals("TYPE_8", userTO.getAttrMap().get("type").getValues().get(0));
 
             // check for sync results
             int usersPost = userService.count();
@@ -335,10 +335,10 @@ public class TaskTestITCase extends Abst
 
         // add user template
         UserTO template = new UserTO();
-        template.getAttributes().add(attributeTO("type", "'type a'"));
-        template.getAttributes().add(attributeTO("userId", "'reconciled@syncope.apache.org'"));
-        template.getAttributes().add(attributeTO("fullname", "'reconciled fullname'"));
-        template.getAttributes().add(attributeTO("surname", "'surname'"));
+        template.getAttrs().add(attributeTO("type", "'type a'"));
+        template.getAttrs().add(attributeTO("userId", "'reconciled@syncope.apache.org'"));
+        template.getAttrs().add(attributeTO("fullname", "'reconciled fullname'"));
+        template.getAttrs().add(attributeTO("surname", "'surname'"));
 
         task.setUserTemplate(template);
 
@@ -355,7 +355,7 @@ public class TaskTestITCase extends Abst
 
         UserTO userTO = userService.read("testuser1");
         assertNotNull(userTO);
-        assertEquals("reconciled@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
+        assertEquals("reconciled@syncope.apache.org", userTO.getAttrMap().get("userId").getValues().get(0));
         assertEquals("suspended", userTO.getStatus());
 
         // enable user on external resource
@@ -382,7 +382,8 @@ public class TaskTestITCase extends Abst
         //  add user template
         RoleTO template = new RoleTO();
         template.setParent(8L);
-        template.getAttributes().add(attributeTO("show", "'true'"));
+        template.getRAttrTemplates().add("show");
+        template.getAttrs().add(attributeTO("show", "'true'"));
 
         task.setRoleTemplate(template);
 
@@ -419,7 +420,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(roleTO);
         assertEquals("testLDAPGroup", roleTO.getName());
         assertEquals(8L, roleTO.getParent());
-        assertEquals("true", roleTO.getAttributeMap().get("show").getValues().get(0));
+        assertEquals("true", roleTO.getAttrMap().get("show").getValues().get(0));
         assertEquals(matchingUsers.iterator().next().getId(), (long) roleTO.getUserOwner());
         assertNull(roleTO.getRoleOwner());
 
@@ -448,7 +449,6 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void issueSYNCOPE81() {
-
         String sender = createNotificationTask();
         NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
         assertNotNull(taskTO);
@@ -572,12 +572,12 @@ public class TaskTestITCase extends Abst
         userTO.setPassword("password123");
         userTO.setUsername("testuser2");
 
-        userTO.getAttributes().add(attributeTO("firstname", "testuser2"));
-        userTO.getAttributes().add(attributeTO("surname", "testuser2"));
-        userTO.getAttributes().add(attributeTO("type", "a type"));
-        userTO.getAttributes().add(attributeTO("fullname", "a type"));
-        userTO.getAttributes().add(attributeTO("userId", "testuser2@syncope.apache.org"));
-        userTO.getAttributes().add(attributeTO("email", "testuser2@syncope.apache.org"));
+        userTO.getAttrs().add(attributeTO("firstname", "testuser2"));
+        userTO.getAttrs().add(attributeTO("surname", "testuser2"));
+        userTO.getAttrs().add(attributeTO("type", "a type"));
+        userTO.getAttrs().add(attributeTO("fullname", "a type"));
+        userTO.getAttrs().add(attributeTO("userId", "testuser2@syncope.apache.org"));
+        userTO.getAttrs().add(attributeTO("email", "testuser2@syncope.apache.org"));
 
         userTO.getResources().add("ws-target-resource-nopropagation2");
         userTO.getResources().add("ws-target-resource-nopropagation4");
@@ -628,7 +628,7 @@ public class TaskTestITCase extends Abst
 
             userTO = userService.read("testuser2");
             assertNotNull(userTO);
-            assertEquals("testuser2@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
+            assertEquals("testuser2@syncope.apache.org", userTO.getAttrMap().get("userId").getValues().get(0));
             assertEquals(2, userTO.getMemberships().size());
             assertEquals(4, userTO.getResources().size());
         } finally {
@@ -673,7 +673,7 @@ public class TaskTestITCase extends Abst
         // 3. read e-mail address for user created by the SyncTask first execution
         UserTO userTO = userService.read("issuesyncope230");
         assertNotNull(userTO);
-        String email = userTO.getAttributeMap().get("email").getValues().iterator().next();
+        String email = userTO.getAttrMap().get("email").getValues().iterator().next();
         assertNotNull(email);
 
         // 4. update TESTSYNC on external H2 by changing e-mail address
@@ -686,7 +686,7 @@ public class TaskTestITCase extends Abst
         // 6. verify that the e-mail was updated
         userTO = userService.read("issuesyncope230");
         assertNotNull(userTO);
-        email = userTO.getAttributeMap().get("email").getValues().iterator().next();
+        email = userTO.getAttrMap().get("email").getValues().iterator().next();
         assertNotNull(email);
         assertEquals("updatedSYNCOPE230@syncope.apache.org", email);
     }
@@ -750,10 +750,10 @@ public class TaskTestITCase extends Abst
             newAttrTO.getValues().add("");
 
             UserTO template = new UserTO();
-            template.getAttributes().add(newAttrTO);
-            template.getAttributes().add(attributeTO("userId", "'test'"));
-            template.getAttributes().add(attributeTO("fullname", "'test'"));
-            template.getAttributes().add(attributeTO("surname", "'test'"));
+            template.getAttrs().add(newAttrTO);
+            template.getAttrs().add(attributeTO("userId", "'test'"));
+            template.getAttrs().add(attributeTO("fullname", "'test'"));
+            template.getAttrs().add(attributeTO("surname", "'test'"));
             template.getResources().add("resource-testdb");
 
             task.setUserTemplate(template);
@@ -772,7 +772,7 @@ public class TaskTestITCase extends Abst
 
             userTO = userService.read(userTO.getUsername());
             assertNotNull(userTO);
-            assertNotNull(userTO.getAttributeMap().get("firstname").getValues().get(0));
+            assertNotNull(userTO.getAttrMap().get("firstname").getValues().get(0));
         } finally {
             removeTestUsers();
         }
@@ -816,8 +816,8 @@ public class TaskTestITCase extends Abst
         // change email in order to unmatch the second user
         UserMod userMod = new UserMod();
         userMod.setId(userTO.getId());
-        userMod.getAttributesToBeRemoved().add("email");
-        userMod.getAttributesToBeUpdated().add(attributeMod("email", "s258@apache.org"));
+        userMod.getAttrsToRemove().add("email");
+        userMod.getAttrsToUpdate().add(attributeMod("email", "s258@apache.org"));
 
         userTO = userService.update(userMod.getId(), userMod);
 
@@ -837,7 +837,7 @@ public class TaskTestITCase extends Abst
 
         AttributeTO csvuserid = new AttributeTO();
         csvuserid.setSchema("csvuserid");
-        userTO.getDerivedAttributes().add(csvuserid);
+        userTO.getDerAttrs().add(csvuserid);
 
         userTO.getResources().clear();
         userTO.getResources().add("ws-target-resource-2");
@@ -847,7 +847,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(userTO);
 
         userTO = userService.read(userTO.getId());
-        assertEquals("virtualvalue", userTO.getVirtualAttributeMap().get("virtualdata").getValues().get(0));
+        assertEquals("virtualvalue", userTO.getVirAttrMap().get("virtualdata").getValues().get(0));
 
         // Update sync task
         SyncTaskTO task = taskService.read(12L);
@@ -858,10 +858,10 @@ public class TaskTestITCase extends Abst
         template.getResources().add("resource-db-virattr");
 
         AttributeTO userId = attributeTO("userId", "'s307@apache.org'");
-        template.getAttributes().add(userId);
+        template.getAttrs().add(userId);
 
         AttributeTO email = attributeTO("email", "'s307@apache.org'");
-        template.getAttributes().add(email);
+        template.getAttrs().add(email);
 
         task.setUserTemplate(template);
 
@@ -870,7 +870,7 @@ public class TaskTestITCase extends Abst
 
         // check for sync policy
         userTO = userService.read(userTO.getId());
-        assertEquals("virtualvalue", userTO.getVirtualAttributeMap().get("virtualdata").getValues().get(0));
+        assertEquals("virtualvalue", userTO.getVirAttrMap().get("virtualdata").getValues().get(0));
 
         try {
             final JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);