You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by jb...@apache.org on 2013/01/15 09:50:26 UTC

svn commit: r1433313 [2/2] - in /syncope/trunk: client/src/main/java/org/apache/syncope/services/ client/src/main/java/org/apache/syncope/services/proxy/ client/src/main/java/org/apache/syncope/types/ core/src/test/java/org/apache/syncope/core/rest/

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=1433313&r1=1433312&r2=1433313&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 Tue Jan 15 08:50:25 2013
@@ -33,6 +33,7 @@ import org.apache.syncope.client.to.User
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.client.validation.SyncopeClientException;
 import org.apache.syncope.services.SchemaService;
+import org.apache.syncope.types.AttributableType;
 import org.apache.syncope.types.SchemaType;
 import org.apache.syncope.types.SyncopeClientExceptionType;
 import org.junit.FixMethodOrder;
@@ -76,7 +77,7 @@ public class AuthenticationTestITCase ex
         schemaTO.setMandatoryCondition("false");
         schemaTO.setType(SchemaType.String);
 
-        SchemaTO newSchemaTO = schemaService.create("user", SchemaService.SchemaKind.NORMAL, schemaTO);
+        SchemaTO newSchemaTO = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertEquals(schemaTO, newSchemaTO);
 
         // 2. create an user with the role created above (as admin)
@@ -94,19 +95,19 @@ public class AuthenticationTestITCase ex
         assertNotNull(userTO);
 
         // 3. read the schema created above (as admin) - success
-        schemaTO = schemaService.read("user", SchemaService.SchemaKind.NORMAL, "authTestSchema");
+        schemaTO = schemaService.read(AttributableType.USER, SchemaService.SchemaType.NORMAL, "authTestSchema");
         assertNotNull(schemaTO);
 
         // 4. read the schema created above (as user) - success
         super.setupRestTemplate(userTO.getUsername(), "password123");
 
-        schemaTO = schemaService.read("user", SchemaService.SchemaKind.NORMAL, "authTestSchema");
+        schemaTO = schemaService.read(AttributableType.USER, SchemaService.SchemaType.NORMAL, "authTestSchema");
         assertNotNull(schemaTO);
 
         // 5. update the schema create above (as user) - failure
         HttpClientErrorException exception = null;
         try {
-            schemaService.update("role", SchemaService.SchemaKind.NORMAL, schemaTO.getName(), schemaTO);
+            schemaService.update(AttributableType.ROLE, SchemaService.SchemaType.NORMAL, schemaTO.getName(), schemaTO);
         } catch (HttpClientErrorException e) {
             exception = e;
         }

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=1433313&r1=1433312&r2=1433313&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 Tue Jan 15 08:50:25 2013
@@ -24,6 +24,7 @@ import java.util.List;
 import org.apache.syncope.client.to.DerivedSchemaTO;
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.services.SchemaService;
+import org.apache.syncope.types.AttributableType;
 import org.apache.syncope.types.SyncopeClientExceptionType;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -32,15 +33,9 @@ import org.junit.runners.MethodSorters;
 @FixMethodOrder(MethodSorters.JVM)
 public class DerivedSchemaTestITCase extends AbstractTest {
 
-    private static final String ROLE = "role";
-
-    private static final String USER = "user";
-
-    private static final String MEMBERSHIP = "membership";
-
     @Test
     public void list() {
-        List<DerivedSchemaTO> derivedSchemas = schemaService.list(USER, SchemaService.SchemaKind.DERIVED);
+        List<DerivedSchemaTO> derivedSchemas = schemaService.list(AttributableType.USER, SchemaService.SchemaType.DERIVED);
         assertFalse(derivedSchemas.isEmpty());
         for (DerivedSchemaTO derivedSchemaTO : derivedSchemas) {
             assertNotNull(derivedSchemaTO);
@@ -49,7 +44,7 @@ public class DerivedSchemaTestITCase ext
 
     @Test
     public void read() {
-        DerivedSchemaTO derivedSchemaTO = schemaService.read(USER, SchemaService.SchemaKind.DERIVED, "cn");
+        DerivedSchemaTO derivedSchemaTO = schemaService.read(AttributableType.USER, SchemaService.SchemaType.DERIVED, "cn");
         assertNotNull(derivedSchemaTO);
     }
 
@@ -59,31 +54,31 @@ public class DerivedSchemaTestITCase ext
         schema.setName("derived");
         schema.setExpression("derived_sx + '_' + derived_dx");
 
-        DerivedSchemaTO actual = schemaService.create(USER, SchemaService.SchemaKind.DERIVED, schema);
+        DerivedSchemaTO actual = schemaService.create(AttributableType.USER, SchemaService.SchemaType.DERIVED, schema);
         assertNotNull(actual);
 
-        actual = schemaService.read(USER, SchemaService.SchemaKind.DERIVED, actual.getName());
+        actual = schemaService.read(AttributableType.USER, SchemaService.SchemaType.DERIVED, actual.getName());
         assertNotNull(actual);
         assertEquals(actual.getExpression(), "derived_sx + '_' + derived_dx");
     }
 
     @Test
     public void delete() {
-        DerivedSchemaTO schema = schemaService.read(ROLE, SchemaService.SchemaKind.DERIVED, "rderiveddata");
+        DerivedSchemaTO schema = schemaService.read(AttributableType.ROLE, SchemaService.SchemaType.DERIVED, "rderiveddata");
         assertNotNull(schema);
 
-        DerivedSchemaTO schemaToDelete = schemaService.delete(ROLE, SchemaService.SchemaKind.DERIVED, schema.getName());
+        DerivedSchemaTO schemaToDelete = schemaService.delete(AttributableType.ROLE, SchemaService.SchemaType.DERIVED, schema.getName());
         assertNotNull(schemaToDelete);
 
         Throwable t = null;
         try {
-            schemaService.read(ROLE, SchemaService.SchemaKind.DERIVED, "rderiveddata");
+            schemaService.read(AttributableType.ROLE, SchemaService.SchemaType.DERIVED, "rderiveddata");
         } catch (SyncopeClientCompositeErrorException e) {
             t = e;
             assertNotNull(e.getException(SyncopeClientExceptionType.NotFound));
         } finally {
             // Recreate schema to make test re-runnable
-            schema = schemaService.create(ROLE, SchemaService.SchemaKind.DERIVED, schemaToDelete);
+            schema = schemaService.create(AttributableType.ROLE, SchemaService.SchemaType.DERIVED, schemaToDelete);
             assertNotNull(schema);
         }
         assertNotNull(t);
@@ -91,22 +86,22 @@ public class DerivedSchemaTestITCase ext
 
     @Test
     public void update() {
-        DerivedSchemaTO schema = schemaService.read(MEMBERSHIP, SchemaService.SchemaKind.DERIVED, "mderiveddata");
+        DerivedSchemaTO schema = schemaService.read(AttributableType.MEMBERSHIP, SchemaService.SchemaType.DERIVED, "mderiveddata");
         assertNotNull(schema);
         assertEquals("mderived_sx + '-' + mderived_dx", schema.getExpression());
         try {
             schema.setExpression("mderived_sx + '.' + mderived_dx");
 
-            schema = schemaService.update(MEMBERSHIP, SchemaService.SchemaKind.DERIVED, schema.getName(), schema);
+            schema = schemaService.update(AttributableType.MEMBERSHIP, SchemaService.SchemaType.DERIVED, schema.getName(), schema);
             assertNotNull(schema);
 
-            schema = schemaService.read(MEMBERSHIP, SchemaService.SchemaKind.DERIVED, "mderiveddata");
+            schema = schemaService.read(AttributableType.MEMBERSHIP, SchemaService.SchemaType.DERIVED, "mderiveddata");
             assertNotNull(schema);
             assertEquals("mderived_sx + '.' + mderived_dx", schema.getExpression());
         } finally {
             // Set updated back to make test re-runnable
             schema.setExpression("mderived_sx + '-' + mderived_dx");
-            schema = schemaService.update(MEMBERSHIP, SchemaService.SchemaKind.DERIVED, schema.getName(), schema);
+            schema = schemaService.update(AttributableType.MEMBERSHIP, SchemaService.SchemaType.DERIVED, schema.getName(), schema);
             assertNotNull(schema);
         }
     }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java Tue Jan 15 08:50:25 2013
@@ -51,14 +51,14 @@ public class PolicyTestITCase extends Ab
 
     @Test
     public void read() {
-        SyncPolicyTO policyTO = policyService.read(1L, SyncPolicyTO.class);
+        SyncPolicyTO policyTO = policyService.read(PolicyType.SYNC, 1L);
 
         assertNotNull(policyTO);
     }
 
     @Test
     public void getGlobalPasswordPolicy() {
-        PasswordPolicyTO policyTO = policyService.readGlobal(PolicyType.PASSWORD, PasswordPolicyTO.class);
+        PasswordPolicyTO policyTO = policyService.readGlobal(PolicyType.PASSWORD);
 
         assertNotNull(policyTO);
         assertEquals(PolicyType.GLOBAL_PASSWORD, policyTO.getType());
@@ -67,7 +67,7 @@ public class PolicyTestITCase extends Ab
 
     @Test
     public void getGlobalAccountPolicy() {
-        AccountPolicyTO policyTO = policyService.readGlobal(PolicyType.ACCOUNT, AccountPolicyTO.class);
+        AccountPolicyTO policyTO = policyService.readGlobal(PolicyType.ACCOUNT);
 
         assertNotNull(policyTO);
         assertEquals(PolicyType.GLOBAL_ACCOUNT, policyTO.getType());
@@ -82,7 +82,7 @@ public class PolicyTestITCase extends Ab
 
         Throwable t = null;
         try {
-            policyService.create(policy);
+            policyService.create(PolicyType.PASSWORD, policy);
             fail();
         } catch (SyncopeClientCompositeErrorException sccee) {
             t = sccee.getException(SyncopeClientExceptionType.InvalidPasswordPolicy);
@@ -97,7 +97,7 @@ public class PolicyTestITCase extends Ab
 
         Throwable t = null;
         try {
-            policyService.create(policy);
+            policyService.create(PolicyType.SYNC, policy);
             fail();
         } catch (SyncopeClientCompositeErrorException sccee) {
             t = sccee.getException(SyncopeClientExceptionType.InvalidSyncPolicy);
@@ -109,7 +109,7 @@ public class PolicyTestITCase extends Ab
     public void create() {
         SyncPolicyTO policy = buildSyncPolicyTO();
 
-        SyncPolicyTO policyTO = policyService.create(policy);
+        SyncPolicyTO policyTO = policyService.create(PolicyType.SYNC, policy);
 
         assertNotNull(policyTO);
         assertEquals(PolicyType.SYNC, policyTO.getType());
@@ -118,17 +118,17 @@ public class PolicyTestITCase extends Ab
     @Test
     public void update() {
         // get global password
-        PasswordPolicyTO globalPolicy = policyService.read(2L, PasswordPolicyTO.class);
+        PasswordPolicyTO globalPolicy = policyService.read(PolicyType.PASSWORD, 2L);
 
         PasswordPolicyTO policy = new PasswordPolicyTO();
         policy.setDescription("A simple password policy");
         policy.setSpecification(globalPolicy.getSpecification());
 
         // create a new password policy using global password as a template
-        policy = policyService.create(policy);
+        policy = policyService.create(PolicyType.PASSWORD, policy);
 
         // read new password policy
-        policy = policyService.read(policy.getId(), PasswordPolicyTO.class);
+        policy = policyService.read(PolicyType.PASSWORD, policy.getId());
 
         assertNotNull("find to update did not work", policy);
 
@@ -137,7 +137,7 @@ public class PolicyTestITCase extends Ab
         policy.setSpecification(policySpec);
 
         // update new password policy
-        policy = policyService.update(policy.getId(), policy);
+        policy = policyService.update(PolicyType.PASSWORD, policy.getId(), policy);
 
         assertNotNull(policy);
         assertEquals(PolicyType.PASSWORD, policy.getType());
@@ -148,16 +148,16 @@ public class PolicyTestITCase extends Ab
     @Test
     public void delete() {
         SyncPolicyTO policy = buildSyncPolicyTO();
-        SyncPolicyTO policyTO = policyService.create(policy);
+        SyncPolicyTO policyTO = policyService.create(PolicyType.SYNC, policy);
         assertNotNull(policyTO);
 
         PolicyTO policyToDelete =
-                policyService.delete(policyTO.getId(), SyncPolicyTO.class);
+                policyService.delete(PolicyType.SYNC, policyTO.getId());
         assertNotNull(policyToDelete);
 
         Throwable t = null;
         try {
-        	policyService.read(policyTO.getId(), SyncPolicyTO.class);
+        	policyService.read(PolicyType.SYNC, policyTO.getId());
         } catch (SyncopeClientCompositeErrorException e) {
             t = e;
         }

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=1433313&r1=1433312&r2=1433313&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 Tue Jan 15 08:50:25 2013
@@ -29,6 +29,7 @@ import org.apache.syncope.client.util.At
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.client.validation.SyncopeClientException;
 import org.apache.syncope.services.SchemaService;
+import org.apache.syncope.types.AttributableType;
 import org.apache.syncope.types.EntityViolationType;
 import org.apache.syncope.types.SchemaType;
 import org.apache.syncope.types.SyncopeClientExceptionType;
@@ -41,12 +42,6 @@ import org.springframework.web.client.Ht
 @FixMethodOrder(MethodSorters.JVM)
 public class SchemaTestITCase extends AbstractTest {
 
-    private static final String ROLE = "role";
-
-    private static final String USER = "user";
-
-    private static final String MEMBERSHIP = "membership";
-
     @Test
     public void create() {
         SchemaTO schemaTO = new SchemaTO();
@@ -54,10 +49,10 @@ public class SchemaTestITCase extends Ab
         schemaTO.setMandatoryCondition("false");
         schemaTO.setType(SchemaType.String);
 
-        SchemaTO newSchemaTO = schemaService.create(USER, SchemaService.SchemaKind.NORMAL, schemaTO);
+        SchemaTO newSchemaTO = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertEquals(schemaTO, newSchemaTO);
 
-        newSchemaTO = schemaService.create(MEMBERSHIP, SchemaService.SchemaKind.NORMAL, schemaTO);
+        newSchemaTO = schemaService.create(AttributableType.MEMBERSHIP, SchemaService.SchemaType.NORMAL, schemaTO);
         assertEquals(schemaTO, newSchemaTO);
     }
 
@@ -68,7 +63,7 @@ public class SchemaTestITCase extends Ab
         schemaTO.setType(SchemaType.String);
 
         try {
-            schemaService.create(USER, SchemaService.SchemaKind.NORMAL, schemaTO);
+            schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
             fail("This should not be reacheable");
         } catch (SyncopeClientCompositeErrorException scce) {
             SyncopeClientException sce = scce.getException(SyncopeClientExceptionType.InvalidUSchema);
@@ -87,7 +82,7 @@ public class SchemaTestITCase extends Ab
         schemaTO.setType(SchemaType.Enum);
 
         try {
-            schemaService.create(ROLE, SchemaService.SchemaKind.NORMAL, schemaTO);
+            schemaService.create(AttributableType.ROLE, SchemaService.SchemaType.NORMAL, schemaTO);
             fail("This should not be reacheable");
         } catch (SyncopeClientCompositeErrorException scce) {
             SyncopeClientException sce = scce.getException(SyncopeClientExceptionType.InvalidRSchema);
@@ -106,7 +101,7 @@ public class SchemaTestITCase extends Ab
         schemaTO.setType(SchemaType.Enum);
 
         try {
-            schemaService.create(USER, SchemaService.SchemaKind.NORMAL, schemaTO);
+            schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
             fail("This should not be reacheable");
         } catch (SyncopeClientCompositeErrorException scce) {
             SyncopeClientException sce = scce.getException(SyncopeClientExceptionType.InvalidUSchema);
@@ -120,11 +115,11 @@ public class SchemaTestITCase extends Ab
 
     @Test
     public void delete() {
-        SchemaTO deletedSchema = schemaService.delete(USER, SchemaService.SchemaKind.NORMAL, "cool");
+        SchemaTO deletedSchema = schemaService.delete(AttributableType.USER, SchemaService.SchemaType.NORMAL, "cool");
         assertNotNull(deletedSchema);
         SchemaTO firstname = null;
         try {
-            firstname = schemaService.read(USER, SchemaService.SchemaKind.NORMAL, "cool");
+            firstname = schemaService.read(AttributableType.USER, SchemaService.SchemaType.NORMAL, "cool");
         } catch (HttpClientErrorException e) {
             assertEquals(HttpStatus.NOT_FOUND, e.getStatusCode());
         }
@@ -133,19 +128,19 @@ public class SchemaTestITCase extends Ab
 
     @Test
     public void list() {
-        List<SchemaTO> userSchemas = schemaService.list(USER, SchemaService.SchemaKind.NORMAL);
+        List<SchemaTO> userSchemas = schemaService.list(AttributableType.USER, SchemaService.SchemaType.NORMAL);
         assertFalse(userSchemas.isEmpty());
         for (SchemaTO schemaTO : userSchemas) {
             assertNotNull(schemaTO);
         }
 
-        List<SchemaTO> roleSchemas = schemaService.list(ROLE, SchemaService.SchemaKind.NORMAL);
+        List<SchemaTO> roleSchemas = schemaService.list(AttributableType.ROLE, SchemaService.SchemaType.NORMAL);
         assertFalse(roleSchemas.isEmpty());
         for (SchemaTO schemaTO : roleSchemas) {
             assertNotNull(schemaTO);
         }
 
-        List<SchemaTO> membershipSchemas = schemaService.list(MEMBERSHIP, SchemaService.SchemaKind.NORMAL);
+        List<SchemaTO> membershipSchemas = schemaService.list(AttributableType.MEMBERSHIP, SchemaService.SchemaType.NORMAL);
         assertFalse(membershipSchemas.isEmpty());
         for (SchemaTO schemaTO : membershipSchemas) {
             assertNotNull(schemaTO);
@@ -154,15 +149,15 @@ public class SchemaTestITCase extends Ab
 
     @Test
     public void update() {
-        SchemaTO schemaTO = schemaService.read(ROLE, SchemaService.SchemaKind.NORMAL, "icon");
+        SchemaTO schemaTO = schemaService.read(AttributableType.ROLE, SchemaService.SchemaType.NORMAL, "icon");
         assertNotNull(schemaTO);
 
-        SchemaTO updatedTO = schemaService.update(ROLE, SchemaService.SchemaKind.NORMAL, schemaTO.getName(), schemaTO);
+        SchemaTO updatedTO = schemaService.update(AttributableType.ROLE, SchemaService.SchemaType.NORMAL, schemaTO.getName(), schemaTO);
         assertEquals(schemaTO, updatedTO);
 
         updatedTO.setType(SchemaType.Date);
         try {
-            schemaService.update(ROLE, SchemaService.SchemaKind.NORMAL, schemaTO.getName(), updatedTO);
+            schemaService.update(AttributableType.ROLE, SchemaService.SchemaType.NORMAL, schemaTO.getName(), updatedTO);
             fail("This should not be reacheable");
         } catch (SyncopeClientCompositeErrorException scce) {
             SyncopeClientException sce = scce.getException(SyncopeClientExceptionType.InvalidRSchema);
@@ -176,7 +171,7 @@ public class SchemaTestITCase extends Ab
         schemaTO.setName("schema_issue258");
         schemaTO.setType(SchemaType.Double);
 
-        schemaTO = schemaService.create(USER, SchemaService.SchemaKind.NORMAL, schemaTO);
+        schemaTO = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getSampleTO("issue258@syncope.apache.org");
@@ -187,7 +182,7 @@ public class SchemaTestITCase extends Ab
 
         schemaTO.setType(SchemaType.Long);
         try {
-            schemaService.update(USER, SchemaService.SchemaKind.NORMAL, schemaTO.getName(), schemaTO);
+            schemaService.update(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO.getName(), schemaTO);
             fail("This should not be reacheable");
         } catch (SyncopeClientCompositeErrorException scce) {
             SyncopeClientException sce = scce.getException(SyncopeClientExceptionType.InvalidUSchema);
@@ -202,7 +197,7 @@ public class SchemaTestITCase extends Ab
         schemaTO.setUniqueConstraint(true);
         schemaTO.setType(SchemaType.Long);
 
-        schemaTO = schemaService.create(USER, SchemaService.SchemaKind.NORMAL, schemaTO);
+        schemaTO = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getSampleTO("issue259@syncope.apache.org");
@@ -228,7 +223,7 @@ public class SchemaTestITCase extends Ab
         schemaTO.setType(SchemaType.Double);
         schemaTO.setUniqueConstraint(true);
 
-        schemaTO = schemaService.create(USER, SchemaService.SchemaKind.NORMAL, schemaTO);
+        schemaTO = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getSampleTO("issue260@syncope.apache.org");
@@ -238,7 +233,7 @@ public class SchemaTestITCase extends Ab
 
         schemaTO.setUniqueConstraint(false);
         try {
-            schemaService.update(USER, SchemaService.SchemaKind.NORMAL, schemaTO.getName(), schemaTO);
+            schemaService.update(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO.getName(), schemaTO);
             fail("This should not be reacheable");
         } catch (SyncopeClientCompositeErrorException scce) {
             SyncopeClientException sce = scce.getException(SyncopeClientExceptionType.InvalidUSchema);

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=1433313&r1=1433312&r2=1433313&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 Tue Jan 15 08:50:25 2013
@@ -47,6 +47,7 @@ import org.apache.syncope.core.sync.Test
 import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.apache.syncope.types.IntMappingType;
 import org.apache.syncope.types.PropagationTaskExecStatus;
+import org.apache.syncope.types.TaskType;
 import org.apache.syncope.types.TraceLevel;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -96,7 +97,7 @@ public class TaskTestITCase extends Abst
         SyncTaskTO actual = taskService.create(task);
         assertNotNull(actual);
 
-        task = taskService.read(actual.getId(), SyncTaskTO.class);
+        task = taskService.read(TaskType.SYNCHRONIZATION, actual.getId());
         assertNotNull(task);
         assertEquals(actual.getId(), task.getId());
         assertEquals(actual.getJobClassName(), task.getJobClassName());
@@ -106,7 +107,7 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void update() {
-        SchedTaskTO task = taskService.read(SCHED_TASK_ID, SchedTaskTO.class);
+        SchedTaskTO task = taskService.read(TaskType.SCHEDULED, SCHED_TASK_ID);
         assertNotNull(task);
 
         SchedTaskTO taskMod = new SchedTaskTO();
@@ -121,14 +122,14 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void count() {
-        Integer count = taskService.count("propagation");
+        Integer count = taskService.count(TaskType.PROPAGATION);
         assertNotNull(count);
         assertTrue(count > 0);
     }
 
     @Test
     public void list() {
-        List<PropagationTaskTO> tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -139,7 +140,7 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void paginatedList() {
-        List<PropagationTaskTO> tasks = taskService.list("propagation", 1, 2, PropagationTaskTO[].class);
+        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION, 1, 2);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -149,7 +150,7 @@ public class TaskTestITCase extends Abst
             assertNotNull(task);
         }
 
-        tasks = taskService.list("propagation", 2, 2, PropagationTaskTO[].class);
+        tasks = taskService.list(TaskType.PROPAGATION, 2, 2);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -158,7 +159,7 @@ public class TaskTestITCase extends Abst
             assertNotNull(task);
         }
 
-        tasks = taskService.list("propagation", 100, 2, PropagationTaskTO[].class);
+        tasks = taskService.list(TaskType.PROPAGATION, 100, 2);
 
         assertNotNull(tasks);
         assertTrue(tasks.isEmpty());
@@ -166,7 +167,7 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void listExecutions() {
-        List<TaskExecTO> executions = taskService.listExecutions("propagation");
+        List<TaskExecTO> executions = taskService.listExecutions(TaskType.PROPAGATION);
         assertNotNull(executions);
         assertFalse(executions.isEmpty());
         for (TaskExecTO execution : executions) {
@@ -176,7 +177,7 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void read() {
-        PropagationTaskTO taskTO = taskService.read(3L, PropagationTaskTO.class);
+        PropagationTaskTO taskTO = taskService.read(TaskType.PROPAGATION, 3L);
 
         assertNotNull(taskTO);
         assertNotNull(taskTO.getExecutions());
@@ -192,7 +193,7 @@ public class TaskTestITCase extends Abst
     @Test
     public void deal() {
         try {
-            taskService.delete(0L, TaskTO.class);
+            taskService.delete(TaskType.PROPAGATION, 0L);
         } catch (HttpStatusCodeException e) {
             assertEquals(HttpStatus.NOT_FOUND, e.getStatusCode());
         }
@@ -203,7 +204,7 @@ public class TaskTestITCase extends Abst
         assertEquals(PropagationTaskExecStatus.SUCCESS.name(), exec.getStatus());
         assertEquals("OK", exec.getMessage());
 
-        taskService.delete(1L, PropagationTaskTO.class);
+        taskService.delete(TaskType.PROPAGATION, 1L);
         try {
             taskService.readExecution(exec.getId());
         } catch (HttpStatusCodeException e) {
@@ -235,7 +236,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(usersPre);
 
         // Update sync task
-        SyncTaskTO task = taskService.read(SYNC_TASK_ID, SyncTaskTO.class);
+        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, SYNC_TASK_ID);
         assertNotNull(task);
 
         //  add custom SyncJob actions
@@ -243,8 +244,7 @@ public class TaskTestITCase extends Abst
 
         //  add user template
         UserTO template = new UserTO();
-        template.addAttribute(attributeTO("type",
-                "email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"));
+        template.addAttribute(attributeTO("type", "email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"));
         template.addDerivedAttribute(attributeTO("cn", null));
         template.addResource("resource-testdb");
 
@@ -260,7 +260,7 @@ public class TaskTestITCase extends Abst
         assertEquals(task.getId(), actual.getId());
         assertEquals(TestSyncActions.class.getName(), actual.getActionsClassName());
 
-        execTask(SyncTaskTO.class, SYNC_TASK_ID, 50, false);
+        execSyncTask(SYNC_TASK_ID, 50, false);
 
         // after execution of the sync task the user data should be synced from
         // csv datasource and processed by user template
@@ -309,7 +309,7 @@ public class TaskTestITCase extends Abst
     @Test
     public void reconcileUsers() {
         // Update sync task
-        SyncTaskTO task = taskService.read(7L, SyncTaskTO.class);
+        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 7L);
         assertNotNull(task);
 
         //  add user template
@@ -327,7 +327,7 @@ public class TaskTestITCase extends Abst
         assertEquals(template, actual.getUserTemplate());
         assertEquals(new RoleTO(), actual.getRoleTemplate());
 
-        TaskExecTO execution = execTask(SyncTaskTO.class, actual.getId(), 20, false);
+        TaskExecTO execution = execSyncTask(actual.getId(), 20, false);
 
         final String status = execution.getStatus();
         assertNotNull(status);
@@ -335,14 +335,13 @@ public class TaskTestITCase extends Abst
 
         final 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.getAttributeMap().get("userId").getValues().get(0));
     }
 
     @Test
     public void reconcileRoles() {
         // Update sync task
-        SyncTaskTO task = taskService.read(11L, SyncTaskTO.class);
+        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 11L);
         assertNotNull(task);
 
         //  add user template
@@ -358,7 +357,7 @@ public class TaskTestITCase extends Abst
         assertEquals(template, actual.getRoleTemplate());
         assertEquals(new UserTO(), actual.getUserTemplate());
 
-        TaskExecTO execution = execTask(SyncTaskTO.class, actual.getId(), 20, false);
+        TaskExecTO execution = execSyncTask(actual.getId(), 20, false);
 
         // 1. verify execution status
         final String status = execution.getStatus();
@@ -397,15 +396,14 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void dryRun() {
-        TaskExecTO execution = execTask(SyncTaskTO.class, SYNC_TASK_ID, 50, true);
-        assertEquals(
-                "Execution of task " + execution.getTask() + " failed with message " + execution.getMessage(),
+        TaskExecTO execution = execSyncTask(SYNC_TASK_ID, 50, true);
+        assertEquals("Execution of task " + execution.getTask() + " failed with message " + execution.getMessage(),
                 "SUCCESS", execution.getStatus());
     }
 
     @Test
     public void issueSYNCOPE81() {
-        NotificationTaskTO taskTO = taskService.read(8L, NotificationTaskTO.class);
+        NotificationTaskTO taskTO = taskService.read(TaskType.NOTIFICATION, 8L);
         assertNotNull(taskTO);
 
         int executions = taskTO.getExecutions().size();
@@ -426,7 +424,7 @@ public class TaskTestITCase extends Abst
                 } catch (InterruptedException e) {
                 }
 
-                taskTO = taskService.read(taskTO.getId(), NotificationTaskTO.class);
+                taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getId());
 
                 assertNotNull(taskTO);
                 assertNotNull(taskTO.getExecutions());
@@ -437,7 +435,7 @@ public class TaskTestITCase extends Abst
             assertFalse(taskTO.getExecutions().isEmpty());
         }
 
-        taskTO = taskService.delete(taskTO.getId(), NotificationTaskTO.class);
+        taskTO = taskService.delete(TaskType.NOTIFICATION, taskTO.getId());
         assertNotNull(taskTO);
     }
 
@@ -479,7 +477,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(userTO);
 
         // 3. get NotificationTaskTO for user just created
-        List<NotificationTaskTO> tasks = taskService.list("notification", NotificationTaskTO[].class);
+        List<NotificationTaskTO> tasks = taskService.list(TaskType.NOTIFICATION);
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
 
@@ -497,7 +495,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(execution);
 
         // 5. verify
-        taskTO = taskService.read(taskTO.getId(), NotificationTaskTO.class);
+        taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getId());
         assertNotNull(taskTO);
         assertEquals(1, taskTO.getExecutions().size());
     }
@@ -547,7 +545,7 @@ public class TaskTestITCase extends Abst
         //-----------------------------
 
         // Update sync task
-        SyncTaskTO task = taskService.read(9L, SyncTaskTO.class);
+        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 9L);
         assertNotNull(task);
 
         task.setUserTemplate(template);
@@ -558,15 +556,14 @@ public class TaskTestITCase extends Abst
         assertFalse(actual.getUserTemplate().getResources().isEmpty());
         assertFalse(actual.getUserTemplate().getMemberships().isEmpty());
 
-        TaskExecTO execution = execTask(SyncTaskTO.class, actual.getId(), 50, false);
+        TaskExecTO execution = execSyncTask(actual.getId(), 50, false);
         final String status = execution.getStatus();
         assertNotNull(status);
         assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
 
         userTO = userService.read("testuser2");
         assertNotNull(userTO);
-        assertEquals("testuser2@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues()
-                .get(0));
+        assertEquals("testuser2@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
         assertEquals(2, userTO.getMemberships().size());
         assertEquals(4, userTO.getResources().size());
     }
@@ -583,7 +580,7 @@ public class TaskTestITCase extends Abst
         assertEquals("issueSYNCOPE144", actual.getName());
         assertEquals("issueSYNCOPE144 Description", actual.getDescription());
 
-        task = taskService.read(actual.getId(), SchedTaskTO.class);
+        task = taskService.read(TaskType.SCHEDULED, actual.getId());
         assertNotNull(task);
         assertEquals("issueSYNCOPE144", task.getName());
         assertEquals("issueSYNCOPE144 Description", task.getDescription());
@@ -600,7 +597,7 @@ public class TaskTestITCase extends Abst
     @Test
     public void issueSYNCOPE230() {
         // 1. read SyncTask for resource-db-sync (table TESTSYNC on external H2)
-        execTask(SyncTaskTO.class, 10L, 20, false);
+        execSyncTask(10L, 20, false);
 
         // 3. read e-mail address for user created by the SyncTask first execution
         UserTO userTO = userService.read("issuesyncope230");
@@ -613,7 +610,7 @@ public class TaskTestITCase extends Abst
         jdbcTemplate.execute("UPDATE TESTSYNC SET email='updatedSYNCOPE230@syncope.apache.org'");
 
         // 5. re-execute the SyncTask
-        execTask(SyncTaskTO.class, 10L, 20, false);
+        execSyncTask(10L, 20, false);
 
         // 6. verify that the e-mail was updated
         userTO = userService.read("issuesyncope230");
@@ -623,10 +620,10 @@ public class TaskTestITCase extends Abst
         assertEquals("updatedSYNCOPE230@syncope.apache.org", email);
     }
 
-    private TaskExecTO execTask(final Class<? extends TaskTO> taskClass, final Long taskId,
-            final int maxWaitSeconds, final boolean dryRun) {
+    private TaskExecTO execSyncTask(final Long taskId, final int maxWaitSeconds,
+            final boolean dryRun) {
 
-        TaskTO taskTO = taskService.read(taskId, taskClass);
+        TaskTO taskTO = taskService.read(TaskType.SYNCHRONIZATION, taskId);
         assertNotNull(taskTO);
         assertNotNull(taskTO.getExecutions());
 
@@ -644,7 +641,7 @@ public class TaskTestITCase extends Abst
             } catch (InterruptedException e) {
             }
 
-            taskTO = taskService.read(taskTO.getId(), taskClass);
+            taskTO = taskService.read(TaskType.SYNCHRONIZATION, taskTO.getId());
 
             assertNotNull(taskTO);
             assertNotNull(taskTO.getExecutions());
@@ -677,7 +674,7 @@ public class TaskTestITCase extends Abst
         assertTrue(userTO.getPropagationTOs().get(0).getStatus().isSuccessful());
 
         // Update sync task
-        SyncTaskTO task = taskService.read(SYNC_TASK_ID, SyncTaskTO.class);
+        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, SYNC_TASK_ID);
         assertNotNull(task);
 
         // add user template
@@ -699,7 +696,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(actual);
         assertEquals(task.getId(), actual.getId());
 
-        TaskExecTO taskExecTO = execTask(SyncTaskTO.class, SYNC_TASK_ID, 50, false);
+        TaskExecTO taskExecTO = execSyncTask(SYNC_TASK_ID, 50, false);
         assertNotNull(actual);
         assertEquals(task.getId(), actual.getId());
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Tue Jan 15 08:50:25 2013
@@ -18,7 +18,12 @@
  */
 package org.apache.syncope.core.rest;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -26,6 +31,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+
 import org.apache.syncope.client.mod.AttributeMod;
 import org.apache.syncope.client.mod.MembershipMod;
 import org.apache.syncope.client.mod.UserMod;
@@ -33,7 +39,6 @@ import org.apache.syncope.client.to.Attr
 import org.apache.syncope.client.to.ConfigurationTO;
 import org.apache.syncope.client.to.ConnObjectTO;
 import org.apache.syncope.client.to.MembershipTO;
-import org.apache.syncope.client.to.PasswordPolicyTO;
 import org.apache.syncope.client.to.PolicyTO;
 import org.apache.syncope.client.to.PropagationTO;
 import org.apache.syncope.client.to.PropagationTaskTO;
@@ -48,8 +53,10 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.apache.syncope.types.AttributableType;
 import org.apache.syncope.types.CipherAlgorithm;
+import org.apache.syncope.types.PolicyType;
 import org.apache.syncope.types.PropagationTaskExecStatus;
 import org.apache.syncope.types.SyncopeClientExceptionType;
+import org.apache.syncope.types.TaskType;
 import org.identityconnectors.framework.common.objects.OperationalAttributes;
 import org.junit.Assume;
 import org.junit.FixMethodOrder;
@@ -72,7 +79,7 @@ public class UserTestITCase extends Abst
     public static UserTO getSampleUniqueTO() {
     	return getSampleTO(getUUIDString() + "@test.com");
     }
-    
+
     public static UserTO getSampleTO(final String email) {
     	String uid = email;
         UserTO userTO = new UserTO();
@@ -110,7 +117,7 @@ public class UserTestITCase extends Abst
     @Test
     public void createUserWithNoPropagation() {
         // get task list
-        List<PropagationTaskTO> tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -138,7 +145,7 @@ public class UserTestITCase extends Abst
         userService.create(userTO);
 
         // get the new task list
-        tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        tasks = taskService.list(TaskType.PROPAGATION);
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
 
@@ -153,7 +160,7 @@ public class UserTestITCase extends Abst
         assertTrue(newMaxId > maxId);
 
         // get last task
-        PropagationTaskTO taskTO = taskService.read(newMaxId, PropagationTaskTO.class);
+        PropagationTaskTO taskTO = taskService.read(TaskType.PROPAGATION, newMaxId);
 
         assertNotNull(taskTO);
         assertTrue(taskTO.getExecutions().isEmpty());
@@ -167,11 +174,11 @@ public class UserTestITCase extends Abst
      * introducing a simple control.
      */
     public void issue172() {
-        PolicyTO policyTO = policyService.read(2L, PasswordPolicyTO.class);
+        PolicyTO policyTO = policyService.read(PolicyType.PASSWORD, 2L);
 
         assertNotNull(policyTO);
 
-        policyService.delete(2L, PasswordPolicyTO.class);
+        policyService.delete(PolicyType.PASSWORD, 2L);
 
         UserTO userTO = new UserTO();
         userTO.setUsername("issue172@syncope.apache.org");
@@ -184,7 +191,7 @@ public class UserTestITCase extends Abst
 
         userService.create(userTO);
 
-        policyService.create(policyTO);
+        policyService.create(PolicyType.PASSWORD, policyTO);
 
         assertNotNull(policyTO);
     }
@@ -409,7 +416,7 @@ public class UserTestITCase extends Abst
     public void create() {
         // get task list
         List<PropagationTaskTO> tasks =
-                taskService.list("propagation", PropagationTaskTO[].class);
+                taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -421,7 +428,7 @@ public class UserTestITCase extends Abst
                 maxId = task.getId();
             }
         }
-        PropagationTaskTO taskTO = taskService.read(maxId, PropagationTaskTO.class);
+        PropagationTaskTO taskTO = taskService.read(TaskType.PROPAGATION, maxId);
 
         assertNotNull(taskTO);
         int maxTaskExecutions = taskTO.getExecutions().size();
@@ -462,7 +469,7 @@ public class UserTestITCase extends Abst
         assertEquals("virtualvalue", newUserTO.getVirtualAttributeMap().get("virtualdata").getValues().get(0));
 
         // get the new task list
-        tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -481,7 +488,7 @@ public class UserTestITCase extends Abst
         assertEquals(newMaxId, maxId);
 
         // get last task
-        taskTO = taskService.read(newMaxId, PropagationTaskTO.class);
+        taskTO = taskService.read(TaskType.PROPAGATION, newMaxId);
 
         assertNotNull(taskTO);
         assertEquals(maxTaskExecutions, taskTO.getExecutions().size());
@@ -914,7 +921,7 @@ public class UserTestITCase extends Abst
 
     @Test
     public void updatePasswordOnly() {
-        List<PropagationTaskTO> beforeTasks = taskService.list("propagation", PropagationTaskTO[].class);
+        List<PropagationTaskTO> beforeTasks = taskService.list(TaskType.PROPAGATION);
         assertNotNull(beforeTasks);
         assertFalse(beforeTasks.isEmpty());
 
@@ -939,7 +946,7 @@ public class UserTestITCase extends Abst
         passwordTestUser.setPassword("newPassword123", CipherAlgorithm.SHA1, 0);
         assertEquals(passwordTestUser.getPassword(), userTO.getPassword());
 
-        List<PropagationTaskTO> afterTasks = taskService.list("propagation", PropagationTaskTO[].class);
+        List<PropagationTaskTO> afterTasks = taskService.list(TaskType.PROPAGATION);
         assertNotNull(afterTasks);
         assertFalse(afterTasks.isEmpty());
 
@@ -949,7 +956,7 @@ public class UserTestITCase extends Abst
     @Test
     public void verifyTaskRegistration() {
         // get task list
-        List<PropagationTaskTO> tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -978,7 +985,7 @@ public class UserTestITCase extends Abst
         assertNotNull(userTO);
 
         // get the new task list
-        tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -1009,7 +1016,7 @@ public class UserTestITCase extends Abst
         assertNotNull(userTO);
 
         // get the new task list
-        tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        tasks = taskService.list(TaskType.PROPAGATION);
 
         // get max task id
         maxId = newMaxId;
@@ -1024,7 +1031,7 @@ public class UserTestITCase extends Abst
         //             all update executions have to be registered
         assertTrue(newMaxId > maxId);
 
-        final PropagationTaskTO taskTO = taskService.read(newMaxId, PropagationTaskTO.class);
+        final PropagationTaskTO taskTO = taskService.read(TaskType.PROPAGATION, newMaxId);
 
         assertNotNull(taskTO);
         assertEquals(1, taskTO.getExecutions().size());
@@ -1035,7 +1042,7 @@ public class UserTestITCase extends Abst
         userService.delete(userTO.getId());
 
         // get the new task list
-        tasks = taskService.list("propagation", PropagationTaskTO[].class);
+        tasks = taskService.list(TaskType.PROPAGATION);
 
         // get max task id
         maxId = newMaxId;

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java Tue Jan 15 08:50:25 2013
@@ -24,6 +24,7 @@ import java.util.List;
 import org.apache.syncope.client.to.VirtualSchemaTO;
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.services.SchemaService;
+import org.apache.syncope.types.AttributableType;
 import org.apache.syncope.types.SyncopeClientExceptionType;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -32,15 +33,9 @@ import org.junit.runners.MethodSorters;
 @FixMethodOrder(MethodSorters.JVM)
 public class VirtualSchemaTestITCase extends AbstractTest {
 
-    private static final String ROLE = "role";
-
-    private static final String USER = "user";
-
-    private static final String MEMBERSHIP = "membership";
-
     @Test
     public void list() {
-        List<VirtualSchemaTO> vSchemas = schemaService.list(USER, SchemaService.SchemaKind.VIRTUAL);
+        List<VirtualSchemaTO> vSchemas = schemaService.list(AttributableType.USER, SchemaService.SchemaType.VIRTUAL);
         assertFalse(vSchemas.isEmpty());
         for (VirtualSchemaTO vSchemaTO : vSchemas) {
             assertNotNull(vSchemaTO);
@@ -49,7 +44,7 @@ public class VirtualSchemaTestITCase ext
 
     @Test
     public void read() {
-        VirtualSchemaTO vSchemaTO = schemaService.read(MEMBERSHIP, SchemaService.SchemaKind.VIRTUAL, "mvirtualdata");
+        VirtualSchemaTO vSchemaTO = schemaService.read(AttributableType.MEMBERSHIP, SchemaService.SchemaType.VIRTUAL, "mvirtualdata");
         assertNotNull(vSchemaTO);
     }
 
@@ -58,24 +53,24 @@ public class VirtualSchemaTestITCase ext
         VirtualSchemaTO schema = new VirtualSchemaTO();
         schema.setName("virtual");
 
-        VirtualSchemaTO actual = schemaService.create(USER, SchemaService.SchemaKind.VIRTUAL, schema);
+        VirtualSchemaTO actual = schemaService.create(AttributableType.USER, SchemaService.SchemaType.VIRTUAL, schema);
         assertNotNull(actual);
 
-        actual = schemaService.read(USER, SchemaService.SchemaKind.VIRTUAL, actual.getName());
+        actual = schemaService.read(AttributableType.USER, SchemaService.SchemaType.VIRTUAL, actual.getName());
         assertNotNull(actual);
     }
 
     @Test
     public void delete() {
-        VirtualSchemaTO schema = schemaService.read(ROLE, SchemaService.SchemaKind.VIRTUAL, "rvirtualdata");
+        VirtualSchemaTO schema = schemaService.read(AttributableType.ROLE, SchemaService.SchemaType.VIRTUAL, "rvirtualdata");
         assertNotNull(schema);
 
-        VirtualSchemaTO deletedSchema = schemaService.delete(ROLE, SchemaService.SchemaKind.VIRTUAL, schema.getName());
+        VirtualSchemaTO deletedSchema = schemaService.delete(AttributableType.ROLE, SchemaService.SchemaType.VIRTUAL, schema.getName());
         assertNotNull(deletedSchema);
 
         Throwable t = null;
         try {
-            schemaService.read(ROLE, SchemaService.SchemaKind.VIRTUAL, "rvirtualdata");
+            schemaService.read(AttributableType.ROLE, SchemaService.SchemaType.VIRTUAL, "rvirtualdata");
         } catch (SyncopeClientCompositeErrorException e) {
             t = e;
             assertNotNull(e.getException(SyncopeClientExceptionType.NotFound));