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/07/25 13:25:55 UTC

svn commit: r1506901 - in /syncope/trunk: ./ core/ core/src/main/java/org/apache/syncope/core/persistence/beans/ core/src/main/java/org/apache/syncope/core/persistence/dao/ core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ core/src/main/...

Author: ilgrosso
Date: Thu Jul 25 11:25:54 2013
New Revision: 1506901

URL: http://svn.apache.org/r1506901
Log:
[SYNCOPE-406] Using JPA entity listener for @PreUpdate and @PrePersit, removing AspectJ

Added:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationListener.java
      - copied, changed from r1506463, syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationInterceptor.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataBinderTest.java
      - copied, changed from r1506463, syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java
Removed:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntitlementCheck.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntitlementValidator.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationInterceptor.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java
Modified:
    syncope/trunk/core/pom.xml
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Entitlement.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Task.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/PolicyDAO.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/PolicyDAOImpl.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/InvalidEntityException.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserRequestDataBinder.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java
    syncope/trunk/core/src/main/resources/META-INF/orm.xml
    syncope/trunk/core/src/main/resources/META-INF/orm.xml.oracle
    syncope/trunk/core/src/main/resources/META-INF/orm.xml.sqlserver
    syncope/trunk/core/src/main/resources/META-INF/spring-persistence.xml
    syncope/trunk/core/src/main/resources/persistenceContext.xml
    syncope/trunk/core/src/main/webapp/cacheStats.jsp
    syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractNonDAOTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/trunk/core/src/test/resources/persistenceTestEnv.xml
    syncope/trunk/legal_ext/LICENSE
    syncope/trunk/legal_ext/NOTICE
    syncope/trunk/pom.xml

Modified: syncope/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/pom.xml?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/pom.xml (original)
+++ syncope/trunk/core/pom.xml Thu Jul 25 11:25:54 2013
@@ -126,10 +126,6 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
-      <artifactId>spring-aop</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
       <artifactId>spring-tx</artifactId>
     </dependency>
     <dependency>
@@ -164,11 +160,6 @@ under the License.
       <groupId>org.springframework.security</groupId>
       <artifactId>spring-security-config</artifactId>
     </dependency>
-
-    <dependency>
-      <groupId>org.aspectj</groupId>
-      <artifactId>aspectjweaver</artifactId>
-    </dependency>
 	
     <dependency>
       <groupId>com.fasterxml.jackson.jaxrs</groupId>
@@ -590,7 +581,6 @@ under the License.
                   org.apache.openjpa*;version="[2,3)",
                   org.apache.syncope.common*;version=${project.version},
                   org.apache.velocity*;version="[1.7,2)",
-                  org.aspectj.lang*;version="[1.7,2)",
                   org.codehaus.jackson*;version="[1.9,2)",
                   org.jasypt.digest;version="[1.9,2)",
                   org.quartz*;version="[2.1,3)",

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Entitlement.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Entitlement.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Entitlement.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Entitlement.java Thu Jul 25 11:25:54 2013
@@ -23,11 +23,8 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 
-import org.apache.syncope.core.persistence.validation.entity.EntitlementCheck;
-
 @Entity
 @Cacheable
-@EntitlementCheck
 public class Entitlement extends AbstractBaseBean {
 
     private static final long serialVersionUID = 8044745999246422483L;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java Thu Jul 25 11:25:54 2013
@@ -22,6 +22,8 @@ import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
 import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
 import javax.persistence.Lob;
 import javax.validation.constraints.NotNull;
 import org.apache.syncope.common.types.AbstractPolicySpec;
@@ -30,6 +32,7 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.util.XMLSerializer;
 
 @Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @PolicyCheck
 public abstract class Policy extends AbstractBaseBean {
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Task.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Task.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Task.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Task.java Thu Jul 25 11:25:54 2013
@@ -26,12 +26,13 @@ import javax.persistence.DiscriminatorCo
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
 import javax.persistence.OneToMany;
 
 @Entity
-@Inheritance
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "DTYPE")
-public class Task extends AbstractBaseBean {
+public abstract class Task extends AbstractBaseBean {
 
     private static final long serialVersionUID = 5837401178128177511L;
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/PolicyDAO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/PolicyDAO.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/PolicyDAO.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/PolicyDAO.java Thu Jul 25 11:25:54 2013
@@ -42,5 +42,5 @@ public interface PolicyDAO extends DAO {
 
     <T extends Policy> T save(T policy);
 
-    void delete(Long id);
+    <T extends Policy> void delete(T policy);
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/PolicyDAOImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/PolicyDAOImpl.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/PolicyDAOImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/PolicyDAOImpl.java Thu Jul 25 11:25:54 2013
@@ -18,14 +18,22 @@
  */
 package org.apache.syncope.core.persistence.dao.impl;
 
+import static org.apache.syncope.common.types.PolicyType.ACCOUNT;
+import static org.apache.syncope.common.types.PolicyType.GLOBAL_ACCOUNT;
+import static org.apache.syncope.common.types.PolicyType.GLOBAL_PASSWORD;
+import static org.apache.syncope.common.types.PolicyType.GLOBAL_SYNC;
+import static org.apache.syncope.common.types.PolicyType.PASSWORD;
+import static org.apache.syncope.common.types.PolicyType.SYNC;
 import java.util.List;
 import javax.persistence.TypedQuery;
+import org.apache.syncope.common.types.EntityViolationType;
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.core.persistence.beans.AccountPolicy;
 import org.apache.syncope.core.persistence.beans.PasswordPolicy;
 import org.apache.syncope.core.persistence.beans.Policy;
 import org.apache.syncope.core.persistence.beans.SyncPolicy;
 import org.apache.syncope.core.persistence.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
 import org.springframework.stereotype.Repository;
 
 @Repository
@@ -77,11 +85,48 @@ public class PolicyDAOImpl extends Abstr
 
     @Override
     public <T extends Policy> T save(final T policy) {
+        switch (policy.getType()) {
+            case GLOBAL_PASSWORD:
+                // just one GLOBAL_PASSWORD policy
+                final PasswordPolicy passwordPolicy = getGlobalPasswordPolicy();
+
+                if (passwordPolicy != null && !passwordPolicy.getId().equals(policy.getId())) {
+                    throw new InvalidEntityException(PasswordPolicy.class, EntityViolationType.InvalidPasswordPolicy,
+                            "Global Password policy already exists");
+                }
+                break;
+
+            case GLOBAL_ACCOUNT:
+                // just one GLOBAL_ACCOUNT policy
+                final AccountPolicy accountPolicy = getGlobalAccountPolicy();
+
+                if (accountPolicy != null && !accountPolicy.getId().equals(policy.getId())) {
+                    throw new InvalidEntityException(PasswordPolicy.class, EntityViolationType.InvalidAccountPolicy,
+                            "Global Account policy already exists");
+                }
+                break;
+
+            case GLOBAL_SYNC:
+                // just one GLOBAL_SYNC policy
+                final SyncPolicy syncPolicy = getGlobalSyncPolicy();
+
+                if (syncPolicy != null && !syncPolicy.getId().equals(policy.getId())) {
+                    throw new InvalidEntityException(PasswordPolicy.class, EntityViolationType.InvalidSyncPolicy,
+                            "Global Synchronization policy already exists");
+                }
+                break;
+
+            case PASSWORD:
+            case ACCOUNT:
+            case SYNC:
+            default:
+        }
+
         return entityManager.merge(policy);
     }
 
     @Override
-    public void delete(final Long id) {
-        entityManager.remove(find(id));
+    public <T extends Policy> void delete(final T policy) {
+        entityManager.remove(policy);
     }
 }

Copied: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationListener.java (from r1506463, syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationInterceptor.java)
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationListener.java?p2=syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationListener.java&p1=syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationInterceptor.java&r1=1506463&r2=1506901&rev=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationInterceptor.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/EntityValidationListener.java Thu Jul 25 11:25:54 2013
@@ -19,49 +19,34 @@
 package org.apache.syncope.core.persistence.validation.entity;
 
 import java.util.Set;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
 
 import javax.validation.ConstraintViolation;
 import javax.validation.Validator;
+import org.apache.syncope.core.util.ApplicationContextProvider;
 
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
 
 /**
- * AOP proxy intercepting DAO calls.
+ * JPA validation listener implementing bean validation.
  */
-@Component
-@Aspect
-public class EntityValidationInterceptor {
+public class EntityValidationListener {
 
     /**
      * Logger.
      */
-    private static final Logger LOG = LoggerFactory.getLogger(EntityValidationInterceptor.class);
+    private static final Logger LOG = LoggerFactory.getLogger(EntityValidationListener.class);
 
-    @Autowired
-    private Validator validator;
-
-    /**
-     * Validate bean prior saving to DB.
-     *
-     * @param pjp Aspect's ProceedingJoinPoint
-     * @return DAO method's return value
-     * @throws Throwable if anything goes wrong
-     */
-    @Around("execution(* org.apache.syncope.core.persistence.dao..*.save(..))")
-    public final Object save(final ProceedingJoinPoint pjp) throws Throwable {
-
-        Set<ConstraintViolation<Object>> violations = validator.validate(pjp.getArgs()[0]);
+    @PrePersist
+    @PreUpdate
+    public void validate(final Object object) {
+        final Validator validator = ApplicationContextProvider.getApplicationContext().getBean(Validator.class);
+        Set<ConstraintViolation<Object>> violations = validator.validate(object);
         if (!violations.isEmpty()) {
             LOG.error("Bean validation errors found: {}", violations);
-            throw new InvalidEntityException(pjp.getArgs()[0].getClass().getSimpleName(), violations);
+            throw new InvalidEntityException(object.getClass().getSimpleName(), violations);
         }
-
-        return pjp.proceed();
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/InvalidEntityException.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/InvalidEntityException.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/InvalidEntityException.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/InvalidEntityException.java Thu Jul 25 11:25:54 2013
@@ -26,14 +26,44 @@ import javax.validation.ConstraintViolat
 import javax.validation.ValidationException;
 import org.apache.syncope.common.types.EntityViolationType;
 
+/**
+ * Exception thrown when any JPA entity fails bean validation.
+ */
 public class InvalidEntityException extends ValidationException {
 
     private static final long serialVersionUID = 3249297275444409691L;
 
-    private String entityClassSimpleName;
+    private final String entityClassSimpleName;
 
-    private final Map<Class<?>, Set<EntityViolationType>> violations;
+    private final Map<Class<?>, Set<EntityViolationType>> violations =
+            new HashMap<Class<?>, Set<EntityViolationType>>();
 
+    /**
+     * Constructs a singleton map of violations from given parameters.
+     *
+     * @param entityClass class of invalid entity
+     * @param entityViolationType type of violation found
+     * @param message message to be associated to the violation
+     */
+    public InvalidEntityException(final Class<?> entityClass,
+            final EntityViolationType entityViolationType, final String message) {
+
+        super();
+
+        this.entityClassSimpleName = entityClass.getSimpleName();
+
+        entityViolationType.setMessage(message.trim());
+
+        this.violations.put(entityClass, EnumSet.noneOf(EntityViolationType.class));
+        this.violations.get(entityClass).add(entityViolationType);
+    }
+
+    /**
+     * Constructs a map of violations out of given <tt>ConstraintViolation</tt> set.
+     *
+     * @param entityClassSimpleName simple class name of invalid entity
+     * @param violations as returned by bean validation
+     */
     public InvalidEntityException(final String entityClassSimpleName,
             final Set<ConstraintViolation<Object>> violations) {
 
@@ -41,7 +71,6 @@ public class InvalidEntityException exte
 
         this.entityClassSimpleName = entityClassSimpleName;
 
-        this.violations = new HashMap<Class<?>, Set<EntityViolationType>>();
         for (ConstraintViolation<Object> violation : violations) {
             int firstComma = violation.getMessageTemplate().indexOf(';');
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java Thu Jul 25 11:25:54 2013
@@ -57,52 +57,6 @@ public class PolicyValidator extends Abs
             return false;
         }
 
-        switch (object.getType()) {
-            case GLOBAL_PASSWORD:
-                // just one GLOBAL_PASSWORD policy
-                final PasswordPolicy passwordPolicy = policyDAO.getGlobalPasswordPolicy();
-
-                if (passwordPolicy != null && !passwordPolicy.getId().equals(object.getId())) {
-                    context.buildConstraintViolationWithTemplate(
-                            getTemplate(EntityViolationType.InvalidPasswordPolicy, "Password policy already exists")).
-                            addNode(object.getClass().getSimpleName()).addConstraintViolation();
-
-                    return false;
-                }
-                break;
-
-            case GLOBAL_ACCOUNT:
-                // just one GLOBAL_ACCOUNT policy
-                final AccountPolicy accountPolicy = policyDAO.getGlobalAccountPolicy();
-
-                if (accountPolicy != null && !accountPolicy.getId().equals(object.getId())) {
-                    context.buildConstraintViolationWithTemplate(getTemplate(
-                            EntityViolationType.InvalidAccountPolicy, "Global Account policy already exists")).
-                            addNode(object.getClass().getSimpleName()).addConstraintViolation();
-
-                    return false;
-                }
-                break;
-
-            case GLOBAL_SYNC:
-                // just one GLOBAL_SYNC policy
-                final SyncPolicy syncPolicy = policyDAO.getGlobalSyncPolicy();
-
-                if (syncPolicy != null && !syncPolicy.getId().equals(object.getId())) {
-                    context.buildConstraintViolationWithTemplate(getTemplate(
-                            EntityViolationType.InvalidSyncPolicy, "Global Sync policy already exists")).
-                            addNode(object.getClass().getSimpleName()).addConstraintViolation();
-
-                    return false;
-                }
-                break;
-
-            case PASSWORD:
-            case ACCOUNT:
-            case SYNC:
-            default:
-        }
-
         return true;
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java Thu Jul 25 11:25:54 2013
@@ -198,7 +198,7 @@ public class PolicyController extends Ab
         }
 
         AbstractPolicyTO policyToDelete = binder.getPolicyTO(policy);
-        policyDAO.delete(id);
+        policyDAO.delete(policy);
 
         auditManager.audit(Category.policy, PolicySubCategory.delete, Result.success,
                 "Successfully deleted policy: " + id);

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserRequestDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserRequestDataBinder.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserRequestDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserRequestDataBinder.java Thu Jul 25 11:25:54 2013
@@ -19,7 +19,6 @@
 package org.apache.syncope.core.rest.data;
 
 import javax.persistence.RollbackException;
-
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.UserRequestTO;
 import org.apache.syncope.common.to.UserTO;
@@ -81,6 +80,7 @@ public class UserRequestDataBinder {
         SyncopeUser user = new SyncopeUser();
         userDataBinder.create(user, userTO);
         userDAO.save(user);
+        userDAO.flush();
 
         throw new RollbackException();
     }
@@ -90,6 +90,7 @@ public class UserRequestDataBinder {
         SyncopeUser user = getUserFromId(userMod.getId());
         userDataBinder.update(user, userMod);
         userDAO.save(user);
+        userDAO.flush();
 
         throw new RollbackException();
     }
@@ -98,6 +99,7 @@ public class UserRequestDataBinder {
     public void testDelete(final Long userId) throws NotFoundException, UnauthorizedRoleException {
         SyncopeUser user = getUserFromId(userId);
         userDAO.delete(user);
+        userDAO.flush();
 
         throw new RollbackException();
     }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java Thu Jul 25 11:25:54 2013
@@ -22,6 +22,7 @@ import java.util.Map;
 import java.util.Set;
 import javax.persistence.EntityExistsException;
 import javax.persistence.PersistenceException;
+import javax.persistence.RollbackException;
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
@@ -45,6 +46,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.orm.jpa.JpaSystemException;
 import org.springframework.security.access.AccessDeniedException;
+import org.springframework.transaction.TransactionSystemException;
 
 @Provider
 public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, ResponseExceptionMapper<Exception> {
@@ -85,17 +87,17 @@ public class RestServiceExceptionMapper 
                     getExMessage(ex));
         }
 
-        Response response = processBadRequestExceptions(ex);
+        Response response = processNotFoundExceptions(ex);
         if (response != null) {
             return response;
         }
 
-        response = processNotFoundExceptions(ex);
+        response = processInvalidEntityExceptions(ex);
         if (response != null) {
             return response;
         }
 
-        response = processServerErrorExceptions(ex);
+        response = processBadRequestExceptions(ex);
         if (response != null) {
             return response;
         }
@@ -125,21 +127,6 @@ public class RestServiceExceptionMapper 
         return responseBuilder.build();
     }
 
-    private Response processServerErrorExceptions(final Exception ex) {
-        ResponseBuilder responseBuilder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
-        if (ex instanceof org.apache.ibatis.exceptions.PersistenceException) {
-            return buildResponse(responseBuilder, SyncopeClientExceptionType.Workflow, getMessage(ex,
-                    "Currently unavailable. Please try later."));
-        } else if (ex instanceof JpaSystemException) {
-            return buildResponse(responseBuilder, SyncopeClientExceptionType.DataIntegrityViolation, getExMessage(ex));
-
-        } else if (ex instanceof ConfigurationException) {
-            return buildResponse(responseBuilder, SyncopeClientExceptionType.InvalidConnIdConf, getExMessage(ex));
-        }
-
-        return null;
-    }
-
     private Response processNotFoundExceptions(final Exception ex) {
         ResponseBuilder responseBuilder = Response.status(Response.Status.NOT_FOUND);
 
@@ -156,6 +143,39 @@ public class RestServiceExceptionMapper 
         return null;
     }
 
+    private Response processInvalidEntityExceptions(final Exception ex) {
+        InvalidEntityException iee = null;
+
+        if (ex instanceof InvalidEntityException) {
+            iee = (InvalidEntityException) ex;
+        }
+        if (ex instanceof TransactionSystemException && ex.getCause() instanceof RollbackException
+                && ex.getCause().getCause() instanceof InvalidEntityException) {
+
+            iee = (InvalidEntityException) ex.getCause().getCause();
+        }
+
+        if (iee != null) {
+            ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
+
+            SyncopeClientExceptionType exType =
+                    SyncopeClientExceptionType.valueOf("Invalid" + iee.getEntityClassSimpleName());
+
+            builder.header(SyncopeClientCompositeErrorException.EXCEPTION_TYPE_HEADER, exType.getHeaderValue());
+
+            for (Map.Entry<Class<?>, Set<EntityViolationType>> violation : iee.getViolations().entrySet()) {
+                for (EntityViolationType violationType : violation.getValue()) {
+                    builder.header(exType.getElementHeaderName(),
+                            violationType.name() + ": " + violationType.getMessage());
+                }
+            }
+
+            return builder.build();
+        }
+
+        return null;
+    }
+
     private Response processBadRequestExceptions(final Exception ex) {
         ResponseBuilder responseBuilder = Response.status(Response.Status.BAD_REQUEST);
 
@@ -165,29 +185,19 @@ public class RestServiceExceptionMapper 
             } else {
                 return ((BadRequestException) ex).getResponse();
             }
-
-        } else if (ex instanceof InvalidEntityException) {
-            SyncopeClientExceptionType exType = SyncopeClientExceptionType.valueOf("Invalid"
-                    + ((InvalidEntityException) ex).getEntityClassSimpleName());
-
-            responseBuilder.header(
-                    SyncopeClientCompositeErrorException.EXCEPTION_TYPE_HEADER, exType.getHeaderValue());
-
-            for (Map.Entry<Class<?>, Set<EntityViolationType>> violation
-                    : ((InvalidEntityException) ex).getViolations().entrySet()) {
-
-                for (EntityViolationType violationType : violation.getValue()) {
-                    responseBuilder.header(exType.getElementHeaderName(),
-                            violation.getClass().getSimpleName() + ": " + violationType);
-                }
-            }
-            return responseBuilder.build();
         } else if (ex instanceof WorkflowException) {
             return buildResponse(responseBuilder, SyncopeClientExceptionType.Workflow, getExMessage(ex));
         } else if (ex instanceof InvalidSearchConditionException) {
             return buildResponse(responseBuilder, SyncopeClientExceptionType.InvalidSearchCondition, getExMessage(ex));
         } else if (ex instanceof PersistenceException) {
             return buildResponse(responseBuilder, SyncopeClientExceptionType.GenericPersistence, getExMessage(ex));
+        } else if (ex instanceof org.apache.ibatis.exceptions.PersistenceException) {
+            return buildResponse(responseBuilder, SyncopeClientExceptionType.Workflow, getMessage(ex,
+                    "Currently unavailable. Please try later."));
+        } else if (ex instanceof JpaSystemException) {
+            return buildResponse(responseBuilder, SyncopeClientExceptionType.DataIntegrityViolation, getExMessage(ex));
+        } else if (ex instanceof ConfigurationException) {
+            return buildResponse(responseBuilder, SyncopeClientExceptionType.InvalidConnIdConf, getExMessage(ex));
         }
 
         return null;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java Thu Jul 25 11:25:54 2013
@@ -30,7 +30,6 @@ import org.apache.commons.jexl2.JexlCont
 import org.apache.commons.jexl2.MapContext;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.mod.AttributeMod;
-import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.IntMappingType;
 import org.apache.syncope.common.types.AttributeSchemaType;
 import org.apache.syncope.core.connid.PasswordGenerator;

Modified: syncope/trunk/core/src/main/resources/META-INF/orm.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/META-INF/orm.xml?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/META-INF/orm.xml (original)
+++ syncope/trunk/core/src/main/resources/META-INF/orm.xml Thu Jul 25 11:25:54 2013
@@ -16,14 +16,24 @@ software distributed under the License i
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-
 -->
-<entity-mappings  xmlns="http://java.sun.com/xml/ns/persistence/orm"
-                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm 
-                                      http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
-                  version="2.0">
-
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm 
+                                     http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
+                 version="2.0">
+  
+  <persistence-unit-metadata>
+    <persistence-unit-defaults>
+      <entity-listeners>
+        <entity-listener class="org.apache.syncope.core.persistence.validation.entity.EntityValidationListener">
+          <pre-persist method-name="validate"/>
+          <pre-update method-name="validate"/>
+        </entity-listener>
+      </entity-listeners>
+    </persistence-unit-defaults>
+  </persistence-unit-metadata>
+  
   <table-generator name="SEQ_UAttrValue" pk-column-value="SEQ_UAttrValue" initial-value="100"/>
   <table-generator name="SEQ_RAttrValue" pk-column-value="SEQ_RAttrValue" initial-value="100"/>
   <table-generator name="SEQ_MAttrValue" pk-column-value="SEQ_MAttrValue" initial-value="100"/>

Modified: syncope/trunk/core/src/main/resources/META-INF/orm.xml.oracle
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/META-INF/orm.xml.oracle?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/META-INF/orm.xml.oracle (original)
+++ syncope/trunk/core/src/main/resources/META-INF/orm.xml.oracle Thu Jul 25 11:25:54 2013
@@ -24,6 +24,17 @@ under the License.
                                       http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
                   version="2.0">
 
+  <persistence-unit-metadata>
+    <persistence-unit-defaults>
+      <entity-listeners>
+        <entity-listener class="org.apache.syncope.core.persistence.validation.entity.EntityValidationListener">
+          <pre-persist method-name="validate"/>
+          <pre-update method-name="validate"/>
+        </entity-listener>
+      </entity-listeners>
+    </persistence-unit-defaults>
+  </persistence-unit-metadata>
+  
   <table-generator name="SEQ_UAttrValue" pk-column-value="SEQ_UAttrValue" initial-value="100"/>
   <table-generator name="SEQ_RAttrValue" pk-column-value="SEQ_RAttrValue" initial-value="100"/>
   <table-generator name="SEQ_MAttrValue" pk-column-value="SEQ_MAttrValue" initial-value="100"/>

Modified: syncope/trunk/core/src/main/resources/META-INF/orm.xml.sqlserver
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/META-INF/orm.xml.sqlserver?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/META-INF/orm.xml.sqlserver (original)
+++ syncope/trunk/core/src/main/resources/META-INF/orm.xml.sqlserver Thu Jul 25 11:25:54 2013
@@ -23,7 +23,18 @@ under the License.
                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm 
                                       http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
                   version="2.0">
-
+  
+  <persistence-unit-metadata>
+    <persistence-unit-defaults>
+      <entity-listeners>
+        <entity-listener class="org.apache.syncope.core.persistence.validation.entity.EntityValidationListener">
+          <pre-persist method-name="validate"/>
+          <pre-update method-name="validate"/>
+        </entity-listener>
+      </entity-listeners>
+    </persistence-unit-defaults>
+  </persistence-unit-metadata>
+  
   <table-generator name="SEQ_UAttrValue" pk-column-value="SEQ_UAttrValue" initial-value="100"/>
   <table-generator name="SEQ_RAttrValue" pk-column-value="SEQ_RAttrValue" initial-value="100"/>
   <table-generator name="SEQ_MAttrValue" pk-column-value="SEQ_MAttrValue" initial-value="100"/>

Modified: syncope/trunk/core/src/main/resources/META-INF/spring-persistence.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/META-INF/spring-persistence.xml?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/META-INF/spring-persistence.xml (original)
+++ syncope/trunk/core/src/main/resources/META-INF/spring-persistence.xml Thu Jul 25 11:25:54 2013
@@ -16,15 +16,16 @@ software distributed under the License i
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-
 -->
 <persistence xmlns="http://java.sun.com/xml/ns/persistence"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
-             http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+                                 http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
              version="2.0">
+  
   <persistence-unit name="syncopePersistenceUnit">
     <mapping-file>META-INF/orm.xml</mapping-file>
     <validation-mode>NONE</validation-mode>
   </persistence-unit>
+  
 </persistence>

Modified: syncope/trunk/core/src/main/resources/persistenceContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/persistenceContext.xml?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/persistenceContext.xml (original)
+++ syncope/trunk/core/src/main/resources/persistenceContext.xml Thu Jul 25 11:25:54 2013
@@ -21,15 +21,12 @@ under the License.
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:tx="http://www.springframework.org/schema/tx"
-       xmlns:aop="http://www.springframework.org/schema/aop"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context.xsd
                            http://www.springframework.org/schema/tx
-                           http://www.springframework.org/schema/tx/spring-tx.xsd
-                           http://www.springframework.org/schema/aop
-                           http://www.springframework.org/schema/aop/spring-aop.xsd">
+                           http://www.springframework.org/schema/tx/spring-tx.xsd">
 
   <import resource="persistenceContextEMFactory.xml"/>
 
@@ -38,8 +35,6 @@ under the License.
   <context:component-scan base-package="org.apache.syncope.core.util"/>
   <context:component-scan base-package="org.apache.syncope.core.policy"/>
 
-  <aop:aspectj-autoproxy/>
-
   <bean id="xStream" class="com.thoughtworks.xstream.XStream"/>
 
   <!-- Use JNDI datasource as default but, when not available, revert to

Modified: syncope/trunk/core/src/main/webapp/cacheStats.jsp
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/webapp/cacheStats.jsp?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/main/webapp/cacheStats.jsp (original)
+++ syncope/trunk/core/src/main/webapp/cacheStats.jsp Thu Jul 25 11:25:54 2013
@@ -74,8 +74,7 @@ under the License.
     <%
         ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
 
-        EntityManagerFactory emf = context.getBean(
-                EntityManagerFactory.class);
+        EntityManagerFactory emf = context.getBean(EntityManagerFactory.class);
         OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(emf);
 
         QueryStatistics<QueryKey> queryStatistics =
@@ -86,14 +85,10 @@ under the License.
         String action = request.getParameter("do");
         StringBuilder info = new StringBuilder(512);
 
-        if ("activate".equals(action)
-                && !statistics.isEnabled()) {
-
+        if ("activate".equals(action) && !statistics.isEnabled()) {
             statistics.enable();
             info.append("Statistics enabled\n");
-        } else if ("deactivate".equals(action)
-                && !statistics.isEnabled()) {
-
+        } else if ("deactivate".equals(action) && !statistics.isEnabled()) {
             statistics.disable();
             info.append("Statistics disabled\n");
         } else if ("clear".equals(action)) {
@@ -102,8 +97,7 @@ under the License.
             info.append("Statistics cleared\n");
         }
 
-        SimpleDateFormat sdf = new SimpleDateFormat(
-                SyncopeConstants.DEFAULT_DATE_PATTERN);
+        SimpleDateFormat sdf = new SimpleDateFormat(SyncopeConstants.DEFAULT_DATE_PATTERN);
         if (info.length() > 0) {
     %>
     <p/><div class="success">
@@ -113,10 +107,8 @@ under the License.
     <p/>
     <a href="?">Reload</a>
     <p/>
-       <a href="?do=<%=(statistics.isEnabled()
-            ? "deactivate" : "activate")%>">
-      <%=(statistics.isEnabled()
-              ? "DEACTIVATE" : "ACTIVATE")%></a>
+    <a href="?do=<%=(statistics.isEnabled() ? "deactivate" : "activate")%>">
+      <%=(statistics.isEnabled() ? "DEACTIVATE" : "ACTIVATE")%></a>
     <a href="?do=clear">CLEAR</a>
     <p/>
     Last update: <%=sdf.format(statistics.since())%><br/>

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractNonDAOTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractNonDAOTest.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractNonDAOTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractNonDAOTest.java Thu Jul 25 11:25:54 2013
@@ -23,7 +23,11 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:syncopeContext.xml", "classpath:persistenceContext.xml",
-    "classpath:schedulingContext.xml", "classpath:workflowContext.xml"})
+@ContextConfiguration(locations = {
+    "classpath:syncopeContext.xml",
+    "classpath:persistenceContext.xml",
+    "classpath:schedulingContext.xml",
+    "classpath:workflowContext.xml"
+})
 public abstract class AbstractNonDAOTest extends AbstractTest {
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java Thu Jul 25 11:25:54 2013
@@ -23,12 +23,11 @@ import org.apache.syncope.core.persisten
 public class DummyConnectorRegistry implements ConnectorRegistry {
 
     @Override
-    public void registerConnector(ExternalResource resource)
+    public void registerConnector(final ExternalResource resource)
             throws NotFoundException {
     }
 
     @Override
-    public void unregisterConnector(String id) {
+    public void unregisterConnector(final String id) {
     }
-
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java Thu Jul 25 11:25:54 2013
@@ -143,7 +143,7 @@ public class PolicyTest extends Abstract
         Policy policy = policyDAO.find(1L);
         assertNotNull("find to delete did not work", policy);
 
-        policyDAO.delete(policy.getId());
+        policyDAO.delete(policy);
 
         Policy actual = policyDAO.find(1L);
         assertNull("delete did not work", actual);

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=1506901&r1=1506900&r2=1506901&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 Jul 25 11:25:54 2013
@@ -59,6 +59,16 @@ public class SchemaTest extends Abstract
 
     @Test
     public void deleteFullname() {
+        // fullname is mapped as AccountId for ws-target-resource-2, need to swap it otherwise validation errors 
+        // will be raised
+        for (AbstractMappingItem item : resourceDAO.find("ws-target-resource-2").getUmapping().getItems()) {
+            if ("fullname".equals(item.getIntAttrName())) {
+                item.setAccountid(false);
+            } else if ("surname".equals(item.getIntAttrName())) {
+                item.setAccountid(true);
+            }
+        }
+
         // search for user schema fullname
         USchema schema = schemaDAO.find("fullname", USchema.class);
         assertNotNull(schema);

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java Thu Jul 25 11:25:54 2013
@@ -88,6 +88,7 @@ public class NotificationTestITCase exte
         SyncopeClientException exception = null;
         try {
             notificationService.update(notificationTO.getId(), notificationTO);
+            fail();
         } catch (SyncopeClientCompositeErrorException e) {
             exception = e.getException(SyncopeClientExceptionType.InvalidNotification);
         }

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=1506901&r1=1506900&r2=1506901&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 Thu Jul 25 11:25:54 2013
@@ -180,16 +180,10 @@ public class UserTestITCase extends Abst
     }
 
     @Test
-    /*
-     * This test has been introduced to verify and solve the following issue:
-     * http://code.google.com/p/syncope/issues/detail?id=172. Creations of a new user without having a global password
-     * policy stored into the local repository used to fail with a null pointer exception. This bug has been fixed
-     * introducing a simple control.
-     */
     public void issue172() {
         List<PasswordPolicyTO> policies = policyService.list(PolicyType.GLOBAL_PASSWORD);
         for (PasswordPolicyTO policyTO : policies) {
-            policyService.delete(PolicyType.PASSWORD, policyTO.getId());
+            policyService.delete(PolicyType.GLOBAL_PASSWORD, policyTO.getId());
         }
 
         try {

Copied: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataBinderTest.java (from r1506463, syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java)
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataBinderTest.java?p2=syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataBinderTest.java&p1=syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java&r1=1506463&r2=1506901&rev=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataBinderTest.java Thu Jul 25 11:25:54 2013
@@ -46,7 +46,7 @@ import org.springframework.beans.factory
 import org.springframework.transaction.annotation.Transactional;
 
 @Transactional
-public class ResourceDataTest extends AbstractNonDAOTest {
+public class ResourceDataBinderTest extends AbstractNonDAOTest {
 
     @Autowired
     private ResourceDAO resourceDAO;
@@ -87,9 +87,6 @@ public class ResourceDataTest extends Ab
         assertEquals(resourceTOs, Arrays.asList(actual));
     }
 
-    /**
-     * @see http://code.google.com/p/syncope/issues/detail?id=42
-     */
     @Test
     public void issue42() {
         USchema userId = schemaDAO.find("userId", USchema.class);

Modified: syncope/trunk/core/src/test/resources/persistenceTestEnv.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/persistenceTestEnv.xml?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/persistenceTestEnv.xml (original)
+++ syncope/trunk/core/src/test/resources/persistenceTestEnv.xml Thu Jul 25 11:25:54 2013
@@ -22,15 +22,15 @@ under the License.
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:tx="http://www.springframework.org/schema/tx"
-       xmlns:aop="http://www.springframework.org/schema/aop"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context.xsd
                            http://www.springframework.org/schema/tx
-                           http://www.springframework.org/schema/tx/spring-tx.xsd
-                           http://www.springframework.org/schema/aop
-                           http://www.springframework.org/schema/aop/spring-aop.xsd">
+                           http://www.springframework.org/schema/tx/spring-tx.xsd">
+
+  <!-- Uncomment to enable single unit test execution via -Dtest=... -->
+  <!--<bean class="org.apache.syncope.core.util.ApplicationContextProvider"/>-->
 
   <bean class="org.apache.syncope.core.persistence.dao.impl.TestDbInitializer"/>
   <bean class="org.apache.syncope.core.persistence.dao.DummyConnectorRegistry"/> 

Modified: syncope/trunk/legal_ext/LICENSE
URL: http://svn.apache.org/viewvc/syncope/trunk/legal_ext/LICENSE?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/legal_ext/LICENSE (original)
+++ syncope/trunk/legal_ext/LICENSE Thu Jul 25 11:25:54 2013
@@ -299,13 +299,6 @@ This is licensed under the AL 2.0, see a
 
 ==
 
-For AspectJ (http://www.eclipse.org/aspectj/):
-
-This program and the accompanying materials are licensed under
-the terms of the Eclipse Public License v 1.0, see above.
-
-==
-
 For Groovy (http://groovy.codehaus.org/):
 This is licensed under the AL 2.0, see above.
 

Modified: syncope/trunk/legal_ext/NOTICE
URL: http://svn.apache.org/viewvc/syncope/trunk/legal_ext/NOTICE?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/legal_ext/NOTICE (original)
+++ syncope/trunk/legal_ext/NOTICE Thu Jul 25 11:25:54 2013
@@ -39,12 +39,6 @@ This product includes software developed
 
 ==
 
-This product includes AspectJ (>= 1.52) software developed by the Eclipse 
-Software Foundation.
-This software is included in binary form only.
-
-==
-
 This product includes software developed by the Groovy project.
 
 ==
@@ -160,4 +154,4 @@ This product includes software developed
 Copyright (c) 2009, http://code.google.com/p/atinject/
 All rights reserved.
 
-==
\ No newline at end of file
+==

Modified: syncope/trunk/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/pom.xml?rev=1506901&r1=1506900&r2=1506901&view=diff
==============================================================================
--- syncope/trunk/pom.xml (original)
+++ syncope/trunk/pom.xml Thu Jul 25 11:25:54 2013
@@ -307,7 +307,6 @@ under the License.
     <cxf.version>2.7.7-SNAPSHOT</cxf.version>	
     <spring.version>3.2.3.RELEASE</spring.version>
     <spring-security.version>3.1.4.RELEASE</spring-security.version>
-    <aspectj.version>1.7.3</aspectj.version>
     <jackson.version>2.2.2</jackson.version>
     <xstream.version>1.4.4</xstream.version>
     <velocity.version>1.7</velocity.version>
@@ -536,11 +535,6 @@ under the License.
       </dependency>
       <dependency>
         <groupId>org.springframework</groupId>
-        <artifactId>spring-aop</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
         <artifactId>spring-jdbc</artifactId>
         <version>${spring.version}</version>
       </dependency>
@@ -587,12 +581,6 @@ under the License.
       <!-- /Spring -->
 
       <dependency>
-        <groupId>org.aspectj</groupId>
-        <artifactId>aspectjweaver</artifactId>
-        <version>${aspectj.version}</version>
-      </dependency>
-
-      <dependency>
         <groupId>javax.ws.rs</groupId>
         <artifactId>javax.ws.rs-api</artifactId>
         <version>2.0-m15</version>