syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1433021 - in /syncope/trunk: ./ core/src/main/java/org/apache/syncope/core/init/ core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ core/src/main/java/org/apache/syncope/core/policy/ core/src/main/java/org/apache/syncope/core...
Date Mon, 14 Jan 2013 18:21:24 GMT
Author: cschneider
Date: Mon Jan 14 18:21:24 2013
New Revision: 1433021

URL: http://svn.apache.org/viewvc?rev=1433021&view=rev
Log:
SYNCOPE-241 Make persistence tests self contained so persistence can be moved to its own module

Added:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/init/WorkflowAdapterLoader.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ContentLoader.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/UserSuspender.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/ActivitiDetector.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowInstanceLoader.java
      - copied, changed from r1432115, syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowLoader.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowUserSuspender.java   (with props)
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java   (with props)
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TestDbInitializer.java   (with props)
    syncope/trunk/core/src/test/resources/persistenceTestEnv.xml   (with props)
Removed:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ContentLoader.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/impl/
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowLoader.java
Modified:
    syncope/trunk/   (props changed)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowAdapter.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/role/AbstractRoleWorkflowAdapter.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/AbstractUserWorkflowAdapter.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiWorkflowLoader.java
    syncope/trunk/core/src/main/resources/persistenceContext.xml
    syncope/trunk/core/src/main/resources/syncopeContext.xml
    syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java

Propchange: syncope/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan 14 18:21:24 2013
@@ -3,3 +3,7 @@ target
 .pom.xml.swp
 .CHANGES.swp
 .vi.swp
+
+.settings
+
+.project

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java Mon Jan 14 18:21:24 2013
@@ -18,24 +18,13 @@
  */
 package org.apache.syncope.core.init;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
 import javax.servlet.ServletContext;
+
+import org.apache.syncope.core.persistence.dao.impl.ContentLoader;
 import org.apache.syncope.core.propagation.ConnectorFactory;
-import org.apache.syncope.core.workflow.WorkflowLoader;
-import org.apache.syncope.core.workflow.role.RoleWorkflowAdapter;
-import org.apache.syncope.core.workflow.user.UserWorkflowAdapter;
-import org.apache.syncope.core.workflow.user.activiti.ActivitiUserWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.BeanFactoryAware;
+import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.stereotype.Component;
 import org.springframework.web.context.ServletContextAware;
 
@@ -43,66 +32,7 @@ import org.springframework.web.context.S
  * Take care of all initializations needed by Syncope to run up and safe.
  */
 @Component
-public class SpringContextInitializer implements ServletContextAware, BeanFactoryAware, InitializingBean {
-
-    /**
-     * Logger.
-     */
-    private static final Logger LOG = LoggerFactory.getLogger(SpringContextInitializer.class);
-
-    private static String uwfAdapterClassName;
-
-    private static String rwfAdapterClassName;
-
-    static {
-        try {
-            initWFAdapterClassNames();
-        } catch (IOException e) {
-            LOG.error("Could not init uwfAdapterClassName", e);
-        }
-    }
-
-    /**
-     * Read classpath:/workflow.properties in order to determine the configured workflow adapter class name.
-     *
-     * @throws IOException if anything goes wrong
-     */
-    private static void initWFAdapterClassNames() throws IOException {
-        Properties props = new java.util.Properties();
-        InputStream propStream = null;
-        try {
-            propStream = ContentLoader.class.getResourceAsStream("/workflow.properties");
-            props.load(propStream);
-            uwfAdapterClassName = props.getProperty("uwfAdapter");
-            rwfAdapterClassName = props.getProperty("rwfAdapter");
-        } catch (Exception e) {
-            LOG.error("Could not load workflow.properties", e);
-        } finally {
-            if (propStream != null) {
-                propStream.close();
-            }
-        }
-    }
-
-    /**
-     * Check if the configured user workflow adapter is Activiti's.
-     *
-     * @return whether Activiti is configured for user workflow or not
-     */
-    public static boolean isActivitiEnabledForUsers() {
-        return uwfAdapterClassName != null && uwfAdapterClassName.equals(ActivitiUserWorkflowAdapter.class.getName());
-    }
-
-    /**
-     * Check if the configured role workflow adapter is Activiti's.
-     *
-     * @return whether Activiti is configured for role workflow or not
-     */
-    public static boolean isActivitiEnabledForRoles() {
-        // ActivitiRoleWorkflowAdapter hasn't been developed (yet) as part of SYNCOPE-173 
-        //return rwfAdapterClassName != null && rwfAdapterClassName.equals(ActivitiRoleWorkflowAdapter.class.getName());
-        return false;
-    }
+public class SpringContextInitializer implements ServletContextAware, InitializingBean {
 
     @Autowired
     private ConnectorFactory connInstanceLoader;
@@ -114,45 +44,25 @@ public class SpringContextInitializer im
     private JobInstanceLoader jobInstanceLoader;
 
     @Autowired
-    private UserWorkflowAdapter uwfAdapter;
-
-    @Autowired
-    private RoleWorkflowAdapter rwfAdapter;
-
-    @Autowired
     private LoggerLoader loggerLoader;
 
     @Autowired
     private ImplementationClassNamesLoader classNamesLoader;
-
-    private DefaultListableBeanFactory beanFactory;
+    
+    @Autowired
+    private WorkflowAdapterLoader workflowSetup;
 
     @Override
     public void setServletContext(final ServletContext servletContext) {
     }
 
     @Override
-    public void setBeanFactory(final BeanFactory beanFactory) throws BeansException {
-        this.beanFactory = (DefaultListableBeanFactory) beanFactory;
-    }
-
-    @Override
     public void afterPropertiesSet() throws Exception {
-        contentLoader.load();
+        contentLoader.load(ActivitiDetector.isActivitiEnabledForUsers());
         connInstanceLoader.load();
         jobInstanceLoader.load();
         loggerLoader.load();
         classNamesLoader.load();
-
-        if (uwfAdapter.getLoaderClass() != null) {
-            final WorkflowLoader wfLoader = (WorkflowLoader) beanFactory.createBean(
-                    uwfAdapter.getLoaderClass(), AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
-            wfLoader.load();
-        }
-        if (rwfAdapter.getLoaderClass() != null) {
-            final WorkflowLoader wfLoader = (WorkflowLoader) beanFactory.createBean(
-                    rwfAdapter.getLoaderClass(), AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
-            wfLoader.load();
-        }
+        workflowSetup.load();
     }
 }

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/WorkflowAdapterLoader.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/WorkflowAdapterLoader.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/init/WorkflowAdapterLoader.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/init/WorkflowAdapterLoader.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.init;
+
+import org.apache.syncope.core.workflow.WorkflowInstanceLoader;
+import org.apache.syncope.core.workflow.role.RoleWorkflowAdapter;
+import org.apache.syncope.core.workflow.user.UserWorkflowAdapter;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowAdapterLoader implements BeanFactoryAware {
+    @Autowired
+    private UserWorkflowAdapter uwfAdapter;
+
+    @Autowired
+    private RoleWorkflowAdapter rwfAdapter;
+
+    private DefaultListableBeanFactory beanFactory;
+
+    @Override
+    public void setBeanFactory(final BeanFactory beanFactory) throws BeansException {
+        this.beanFactory = (DefaultListableBeanFactory) beanFactory;
+    }
+    
+    public void load() {
+        if (uwfAdapter.getLoaderClass() != null) {
+            final WorkflowInstanceLoader wfLoader = (WorkflowInstanceLoader) beanFactory.createBean(
+                    uwfAdapter.getLoaderClass(), AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
+            wfLoader.load();
+        }
+        if (rwfAdapter.getLoaderClass() != null) {
+            final WorkflowInstanceLoader wfLoader = (WorkflowInstanceLoader) beanFactory.createBean(
+                    rwfAdapter.getLoaderClass(), AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
+            wfLoader.load();
+        }
+    }
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/WorkflowAdapterLoader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ContentLoader.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ContentLoader.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ContentLoader.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ContentLoader.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.dao.impl;
+
+import java.io.Closeable;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.syncope.core.persistence.beans.SyncopeConf;
+import org.apache.syncope.core.util.ImportExport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.datasource.DataSourceUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Initialize Database with default content if no data is present already
+ */
+@Component
+public class ContentLoader {
+    private static final String VIEWS_FILE = "/views.xml";
+    private static final String INDEXES_FILE = "/indexes.xml";
+    private static final String CONTENT_FILE = "/content.xml";
+
+    /**
+     * Logger.
+     */
+    private static final Logger LOG = LoggerFactory.getLogger(ContentLoader.class);
+
+    @Autowired
+    private DataSource dataSource;
+
+    @Autowired
+    private ImportExport importExport;
+
+    @Transactional
+    public void load(boolean activitiEnabledForUsers) {
+        Connection conn = DataSourceUtils.getConnection(dataSource);
+
+        boolean existingData = isDataPresent(conn);
+        if (existingData) {
+            LOG.info("Data found in the database, leaving untouched");
+            closeConnection(conn);
+            return;
+        }
+
+        LOG.info("Empty database found, loading default content");
+
+        createViews(conn);
+        createIndexes(conn);
+        if (activitiEnabledForUsers) {
+            deleteActivitiProperties(conn);
+        }
+        closeConnection(conn);
+        loadDefaultContent();
+    }
+
+    private boolean isDataPresent(Connection conn) {
+        ResultSet resultSet = null;
+        PreparedStatement statement = null;
+        try {
+            final String queryContent = "SELECT * FROM " + SyncopeConf.class.getSimpleName();
+            statement = conn.prepareStatement(
+                    queryContent, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
+            resultSet = statement.executeQuery();
+            resultSet.last();
+            return resultSet.getRow() > 0;
+        } catch (SQLException e) {
+            LOG.error("Could not access to table " + SyncopeConf.class.getSimpleName(), e);
+            return true;
+        } finally {
+            closeResultSet(resultSet);
+            closeStatement(statement);
+        }
+    }
+
+    private void createViews(Connection conn) {
+        LOG.debug("Creating views");
+        try {
+            InputStream viewsStream = getClass().getResourceAsStream(VIEWS_FILE);
+            Properties views = new Properties();
+            views.loadFromXML(viewsStream);
+            close(viewsStream);
+
+            for (String idx : views.stringPropertyNames()) {
+                LOG.debug("Creating view {}", views.get(idx).toString());
+                PreparedStatement statement = null;
+                try {
+                    final String updateViews = views.get(idx).toString().replaceAll("\\n", " ");
+                    statement = conn.prepareStatement(updateViews);
+                    statement.executeUpdate();
+                } catch (SQLException e) {
+                    LOG.error("Could not create view ", e);
+                } finally {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                }
+            }
+
+            LOG.debug("Views created, go for indexes");
+        } catch (Exception e) {
+            LOG.error("While creating views", e);
+        }
+    }
+
+    private void createIndexes(Connection conn) {
+        LOG.debug("Creating indexes");
+
+        InputStream indexesStream = getClass().getResourceAsStream(INDEXES_FILE);
+        Properties indexes = new Properties();
+        try {
+            indexes.loadFromXML(indexesStream);
+        } catch (Exception e) {
+            throw new RuntimeException("Error loading properties from stream", e);
+        }
+        close(indexesStream);
+
+        for (String idx : indexes.stringPropertyNames()) {
+            LOG.debug("Creating index {}", indexes.get(idx).toString());
+            PreparedStatement statement = null;
+            try {
+                final String updateIndexed = indexes.get(idx).toString();
+                statement = conn.prepareStatement(updateIndexed);
+                statement.executeUpdate();
+            } catch (SQLException e) {
+                LOG.error("Could not create index ", e);
+            } finally {
+                closeStatement(statement);
+            }
+        }
+    }
+
+    private void deleteActivitiProperties(Connection conn) {
+        PreparedStatement statement = null;
+        try {
+            statement = conn.prepareStatement("DELETE FROM ACT_GE_PROPERTY");
+            statement.executeUpdate();
+        } catch (SQLException e) {
+            LOG.error("Error during ACT_GE_PROPERTY delete rows", e);
+        } finally {
+            closeStatement(statement);
+        }
+    }
+
+    private void loadDefaultContent() {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        try {
+            SAXParser parser = factory.newSAXParser();
+            parser.parse(getClass().getResourceAsStream(CONTENT_FILE), importExport);
+            LOG.debug("Default content successfully loaded");
+        } catch (Exception e) {
+            LOG.error("While loading default content", e);
+        }
+    }
+
+    private void closeResultSet(ResultSet resultSet) {
+        try {
+            if (resultSet != null) {
+                resultSet.close();
+            }
+        } catch (SQLException e) {
+            LOG.error("While closing SQL result set", e);
+        }
+    }
+
+    private void closeStatement(PreparedStatement statement) {
+        if (statement != null) {
+            try {
+                statement.close();
+            } catch (SQLException e) {
+                LOG.error("Error closing SQL statement", e);
+            }
+        }
+    }
+
+    private void closeConnection(Connection conn) {
+        try {
+            conn.close();
+        } catch (SQLException e) {
+            LOG.error("Error closing SQL connection", e);
+        } finally {
+            DataSourceUtils.releaseConnection(conn, dataSource);
+        }
+    }
+    
+    private void close(Closeable closeable) {
+        if (closeable != null) {
+            try {
+                closeable.close();
+            } catch (Throwable t) {
+                LOG.error("Error closing closeable", t);
+            }
+        }
+    }
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ContentLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/ContentLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.policy;
+
+import java.util.regex.Pattern;
+
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.types.AccountPolicySpec;
+import org.apache.syncope.types.PolicyType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AccountPolicyEnforcer extends PolicyEnforcer<AccountPolicySpec, SyncopeUser> {
+
+    private static final Pattern PATTERN = Pattern.compile("[a-zA-Z0-9-_@. ]+");
+
+    private static final Pattern LCPATTERN = Pattern.compile("[a-z0-9-_@. ]+");
+
+    private static final Pattern UCPATTERN = Pattern.compile("[A-Z0-9-_@. ]+");
+    
+    @Autowired(required=false)
+    UserSuspender userSuspender;
+
+    /* (non-Javadoc)
+     * @see AccountPolicyEnforcer#enforce(AccountPolicySpec, PolicyType, SyncopeUser)
+     */
+    @Override
+    public void enforce(final AccountPolicySpec policy, final PolicyType type, final SyncopeUser user)
+            throws AccountPolicyException, PolicyEnforceException {
+
+        if (user.getUsername() == null) {
+            throw new PolicyEnforceException("Invalid account");
+        }
+
+        if (policy == null) {
+            throw new PolicyEnforceException("Invalid policy");
+        }
+
+        // check min length
+        if (policy.getMinLength() > 0 && policy.getMinLength() > user.getUsername().length()) {
+            throw new AccountPolicyException("Username too short");
+        }
+
+        // check max length
+        if (policy.getMaxLength() > 0 && policy.getMaxLength() < user.getUsername().length()) {
+            throw new AccountPolicyException("Username too long");
+        }
+
+        // check words not permitted
+        for (String word : policy.getWordsNotPermitted()) {
+            if (user.getUsername().contains(word)) {
+                throw new AccountPolicyException("Used word(s) not permitted");
+            }
+        }
+
+        // check syntax
+        if ((policy.isAllLowerCase() && !LCPATTERN.matcher(user.getUsername()).matches())
+                || (policy.isAllUpperCase() && !UCPATTERN.matcher(user.getUsername()).matches())
+                || !PATTERN.matcher(user.getUsername()).matches()) {
+            throw new AccountPolicyException("Invalid username syntax");
+        }
+
+        // check prefix
+        for (String prefix : policy.getPrefixesNotPermitted()) {
+            if (user.getUsername().startsWith(prefix)) {
+                throw new AccountPolicyException("Prefix not permitted");
+            }
+        }
+
+        // check suffix
+        for (String suffix : policy.getSuffixesNotPermitted()) {
+            if (user.getUsername().endsWith(suffix)) {
+                throw new AccountPolicyException("Suffix not permitted");
+            }
+        }
+
+        // check for subsequent failed logins
+        if (user.getFailedLogins() != null && policy.getPermittedLoginRetries() > 0
+                && user.getFailedLogins() > policy.getPermittedLoginRetries() && !user.getSuspended()) {
+            userSuspender.suspend(policy, user);
+        }
+    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.policy;
+
+import org.apache.syncope.types.PasswordPolicySpec;
+import org.apache.syncope.types.PolicyType;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PasswordPolicyEnforcer extends PolicyEnforcer<PasswordPolicySpec, String> {
+
+    /* (non-Javadoc)
+	 * @see org.apache.syncope.core.policy.PasswordPolicyEnforcer#enforce(org.apache.syncope.types.PasswordPolicySpec, org.apache.syncope.types.PolicyType, java.lang.String)
+	 */
+	@Override
+    public void enforce(final PasswordPolicySpec policy, final PolicyType type, final String password)
+            throws PasswordPolicyException, PolicyEnforceException {
+
+        if (password == null) {
+            throw new PolicyEnforceException("Invalid password");
+        }
+
+        if (policy == null) {
+            throw new PolicyEnforceException("Invalid policy");
+        }
+
+        // check length
+        if (policy.getMinLength() > 0 && policy.getMinLength() > password.length()) {
+            throw new PasswordPolicyException("Password too short");
+        }
+
+        if (policy.getMaxLength() > 0 && policy.getMaxLength() < password.length()) {
+            throw new PasswordPolicyException("Password too long");
+        }
+
+        // check words not permitted
+        for (String word : policy.getWordsNotPermitted()) {
+            if (password.contains(word)) {
+                throw new PasswordPolicyException("Used word(s) not permitted");
+            }
+        }
+
+        // check digits occurrence
+        if (policy.isDigitRequired() && !checkForDigit(password)) {
+            throw new PasswordPolicyException("Password must contain digit(s)");
+        }
+
+        // check lowercase alphabetic characters occurrence
+        if (policy.isLowercaseRequired() && !checkForLowercase(password)) {
+            throw new PasswordPolicyException("Password must contain lowercase alphabetic character(s)");
+        }
+
+        // check uppercase alphabetic characters occurrence
+        if (policy.isUppercaseRequired() && !checkForUppercase(password)) {
+            throw new PasswordPolicyException("Password must contain uppercase alphabetic character(s)");
+        }
+
+        // check prefix
+        for (String prefix : policy.getPrefixesNotPermitted()) {
+            if (password.startsWith(prefix)) {
+                throw new PasswordPolicyException("Prefix not permitted");
+            }
+        }
+
+        // check suffix
+        for (String suffix : policy.getSuffixesNotPermitted()) {
+            if (password.endsWith(suffix)) {
+                throw new PasswordPolicyException("Suffix not permitted");
+            }
+        }
+
+        // check digit first occurrence
+        if (policy.isMustStartWithDigit() && !checkForFirstDigit(password)) {
+            throw new PasswordPolicyException("Password must start with a digit");
+        }
+
+        if (policy.isMustntStartWithDigit() && checkForFirstDigit(password)) {
+            throw new PasswordPolicyException("Password mustn't start with a digit");
+        }
+
+        // check digit last occurrence
+        if (policy.isMustEndWithDigit() && !checkForLastDigit(password)) {
+            throw new PasswordPolicyException("Password must end with a digit");
+        }
+
+        if (policy.isMustntEndWithDigit() && checkForLastDigit(password)) {
+            throw new PasswordPolicyException("Password mustn't end with a digit");
+        }
+
+        // check alphanumeric characters occurence
+        if (policy.isAlphanumericRequired() && !checkForAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password must contain alphanumeric character(s)");
+        }
+
+        // check non alphanumeric characters occurence
+        if (policy.isNonAlphanumericRequired() && !checkForNonAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password must contain non-alphanumeric character(s)");
+        }
+
+        // check alphanumeric character first occurrence
+        if (policy.isMustStartWithAlpha() && !checkForFirstAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password must start with an alphanumeric character");
+        }
+
+        if (policy.isMustntStartWithAlpha() && checkForFirstAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password mustn't start with an alphanumeric character");
+        }
+
+        // check alphanumeric character last occurrence
+        if (policy.isMustEndWithAlpha() && !checkForLastAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password must end with an alphanumeric character");
+        }
+
+        if (policy.isMustntEndWithAlpha() && checkForLastAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password mustn't end with an alphanumeric character");
+        }
+
+        // check non alphanumeric character first occurrence
+        if (policy.isMustStartWithNonAlpha() && !checkForFirstNonAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password must start with a non-alphanumeric character");
+        }
+
+        if (policy.isMustntStartWithNonAlpha() && checkForFirstNonAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password mustn't start with a non-alphanumeric character");
+        }
+
+        // check non alphanumeric character last occurrence
+        if (policy.isMustEndWithNonAlpha() && !checkForLastNonAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password must end with a non-alphanumeric character");
+        }
+
+        if (policy.isMustntEndWithNonAlpha() && checkForLastNonAlphanumeric(password)) {
+            throw new PasswordPolicyException("Password mustn't end with a non-alphanumeric character");
+        }
+    }
+
+    private boolean checkForDigit(final String str) {
+        return PolicyPattern.DIGIT.matcher(str).matches();
+    }
+
+    private boolean checkForLowercase(final String str) {
+        return PolicyPattern.ALPHA_LOWERCASE.matcher(str).matches();
+    }
+
+    private boolean checkForUppercase(final String str) {
+        return PolicyPattern.ALPHA_UPPERCASE.matcher(str).matches();
+    }
+
+    private boolean checkForFirstDigit(final String str) {
+        return PolicyPattern.FIRST_DIGIT.matcher(str).matches();
+    }
+
+    private boolean checkForLastDigit(final String str) {
+        return PolicyPattern.LAST_DIGIT.matcher(str).matches();
+    }
+
+    private boolean checkForAlphanumeric(final String str) {
+        return PolicyPattern.ALPHANUMERIC.matcher(str).matches();
+    }
+
+    private boolean checkForFirstAlphanumeric(final String str) {
+        return PolicyPattern.FIRST_ALPHANUMERIC.matcher(str).matches();
+    }
+
+    private boolean checkForLastAlphanumeric(final String str) {
+        return PolicyPattern.LAST_ALPHANUMERIC.matcher(str).matches();
+    }
+
+    private boolean checkForNonAlphanumeric(final String str) {
+        return PolicyPattern.NON_ALPHANUMERIC.matcher(str).matches();
+    }
+
+    private boolean checkForFirstNonAlphanumeric(final String str) {
+        return PolicyPattern.FIRST_NON_ALPHANUMERIC.matcher(str).matches();
+    }
+
+    private boolean checkForLastNonAlphanumeric(final String str) {
+        return PolicyPattern.LAST_NON_ALPHANUMERIC.matcher(str).matches();
+    }
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/UserSuspender.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/UserSuspender.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/UserSuspender.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/UserSuspender.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.policy;
+
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.types.AccountPolicySpec;
+
+public interface UserSuspender {
+    void suspend(final AccountPolicySpec policy, final SyncopeUser user);
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/UserSuspender.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/ActivitiDetector.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/ActivitiDetector.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/ActivitiDetector.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/ActivitiDetector.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.workflow;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.syncope.core.persistence.dao.impl.ContentLoader;
+import org.apache.syncope.core.workflow.user.activiti.ActivitiUserWorkflowAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ActivitiDetector {
+    private static final Logger LOG = LoggerFactory.getLogger(ActivitiDetector.class);
+    private static String uwfAdapterClassName;
+    private static String rwfAdapterClassName;
+
+    static {
+        try {
+            initWFAdapterClassNames();
+        } catch (IOException e) {
+            LOG.error("Could not init uwfAdapterClassName", e);
+        }
+    }
+
+    /**
+     * Read classpath:/workflow.properties in order to determine the configured workflow adapter class name.
+     *
+     * @throws IOException if anything goes wrong
+     */
+    private static void initWFAdapterClassNames() throws IOException {
+        Properties props = new java.util.Properties();
+        InputStream propStream = null;
+        try {
+            propStream = ContentLoader.class.getResourceAsStream("/workflow.properties");
+            props.load(propStream);
+            uwfAdapterClassName = props.getProperty("uwfAdapter");
+            rwfAdapterClassName = props.getProperty("rwfAdapter");
+        } catch (Exception e) {
+            LOG.error("Could not load workflow.properties", e);
+        } finally {
+            if (propStream != null) {
+                propStream.close();
+            }
+        }
+    }
+
+    /**
+     * Check if the configured user workflow adapter is Activiti's.
+     *
+     * @return whether Activiti is configured for user workflow or not
+     */
+    public static boolean isActivitiEnabledForUsers() {
+        return uwfAdapterClassName != null && uwfAdapterClassName.equals(ActivitiUserWorkflowAdapter.class.getName());
+    }
+    
+    /**
+     * Check if the configured role workflow adapter is Activiti's.
+     *
+     * @return whether Activiti is configured for role workflow or not
+     */
+    public static boolean isActivitiEnabledForRoles() {
+        // ActivitiRoleWorkflowAdapter hasn't been developed (yet) as part of SYNCOPE-173 
+        //return rwfAdapterClassName != null && rwfAdapterClassName.equals(ActivitiRoleWorkflowAdapter.class.getName());
+        return false;
+    }
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/ActivitiDetector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowAdapter.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowAdapter.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowAdapter.java Mon Jan 14 18:21:24 2013
@@ -33,7 +33,7 @@ public interface WorkflowAdapter {
      * @return null if no init is needed or the WorkflowLoader class for handling initialization
      * @see org.apache.syncope.core.init.SpringContextInitializer
      */
-    Class<? extends WorkflowLoader> getLoaderClass();
+    Class<? extends WorkflowInstanceLoader> getLoaderClass();
 
     /**
      * Get workflow definition.

Copied: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowInstanceLoader.java (from r1432115, syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowLoader.java)
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowInstanceLoader.java?p2=syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowInstanceLoader.java&p1=syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowLoader.java&r1=1432115&r2=1433021&rev=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowLoader.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowInstanceLoader.java Mon Jan 14 18:21:24 2013
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.core.workflow;
 
-public interface WorkflowLoader {
+public interface WorkflowInstanceLoader {
 
     void load();
 }

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowUserSuspender.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowUserSuspender.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowUserSuspender.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowUserSuspender.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.workflow;
+
+import java.util.List;
+import java.util.Map;
+import java.util.AbstractMap.SimpleEntry;
+
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.core.persistence.beans.PropagationTask;
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.policy.UserSuspender;
+import org.apache.syncope.core.propagation.PropagationManager;
+import org.apache.syncope.core.propagation.PropagationTaskExecutor;
+import org.apache.syncope.core.rest.data.UserDataBinder;
+import org.apache.syncope.core.workflow.user.UserWorkflowAdapter;
+import org.apache.syncope.types.AccountPolicySpec;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowUserSuspender implements UserSuspender {
+    private static final Logger LOG = LoggerFactory.getLogger(WorkflowUserSuspender.class);
+
+    @Autowired
+    private UserWorkflowAdapter uwfAdapter;
+
+    @Autowired
+    private PropagationManager propagationManager;
+
+    @Autowired
+    private PropagationTaskExecutor taskExecutor;
+
+    @Autowired
+    private UserDataBinder userDataBinder;
+
+    @Override
+    public void suspend(AccountPolicySpec policy, SyncopeUser user) {
+        try {
+            LOG.debug("User {}:{} is over to max failed logins", user.getId(), user.getUsername());
+
+            // reduce failed logins number to avoid multiple request
+            user.setFailedLogins(user.getFailedLogins() - 1);
+
+            // disable user
+            final WorkflowResult<Long> updated = uwfAdapter.suspend(user);
+
+            // propagate suspension if and only if it is required by policy
+            if (policy.isPropagateSuspension()) {
+                final List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
+                        new WorkflowResult<Map.Entry<Long, Boolean>>(
+                        new SimpleEntry<Long, Boolean>(updated.getResult(), Boolean.FALSE),
+                        updated.getPropByRes(), updated.getPerformedTasks()));
+
+                taskExecutor.execute(tasks);
+            }
+
+            if (LOG.isDebugEnabled()) {
+                final UserTO savedTO = userDataBinder.getUserTO(updated.getResult());
+                LOG.debug("About to return suspended user\n{}", savedTO);
+            }
+        } catch (Exception e) {
+            LOG.error("Error during user suspension", e);
+        }    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/WorkflowUserSuspender.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/role/AbstractRoleWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/role/AbstractRoleWorkflowAdapter.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/role/AbstractRoleWorkflowAdapter.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/role/AbstractRoleWorkflowAdapter.java Mon Jan 14 18:21:24 2013
@@ -25,7 +25,7 @@ import org.apache.syncope.core.rest.cont
 import org.apache.syncope.core.rest.data.RoleDataBinder;
 import org.apache.syncope.core.util.NotFoundException;
 import org.apache.syncope.core.workflow.WorkflowException;
-import org.apache.syncope.core.workflow.WorkflowLoader;
+import org.apache.syncope.core.workflow.WorkflowInstanceLoader;
 import org.apache.syncope.core.workflow.WorkflowResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -40,7 +40,7 @@ public abstract class AbstractRoleWorkfl
     protected RoleDAO roleDAO;
 
     @Override
-    public Class<? extends WorkflowLoader> getLoaderClass() {
+    public Class<? extends WorkflowInstanceLoader> getLoaderClass() {
         return null;
     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/AbstractUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/AbstractUserWorkflowAdapter.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/AbstractUserWorkflowAdapter.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/AbstractUserWorkflowAdapter.java Mon Jan 14 18:21:24 2013
@@ -28,7 +28,7 @@ import org.apache.syncope.core.rest.cont
 import org.apache.syncope.core.rest.data.UserDataBinder;
 import org.apache.syncope.core.util.NotFoundException;
 import org.apache.syncope.core.workflow.WorkflowException;
-import org.apache.syncope.core.workflow.WorkflowLoader;
+import org.apache.syncope.core.workflow.WorkflowInstanceLoader;
 import org.apache.syncope.core.workflow.WorkflowResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -43,7 +43,7 @@ public abstract class AbstractUserWorkfl
     protected UserDAO userDAO;
 
     @Override
-    public Class<? extends WorkflowLoader> getLoaderClass() {
+    public Class<? extends WorkflowInstanceLoader> getLoaderClass() {
         return null;
     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java Mon Jan 14 18:21:24 2013
@@ -64,7 +64,7 @@ import org.apache.syncope.core.propagati
 import org.apache.syncope.core.rest.controller.UnauthorizedRoleException;
 import org.apache.syncope.core.util.NotFoundException;
 import org.apache.syncope.core.workflow.WorkflowException;
-import org.apache.syncope.core.workflow.WorkflowLoader;
+import org.apache.syncope.core.workflow.WorkflowInstanceLoader;
 import org.apache.syncope.core.workflow.WorkflowResult;
 import org.apache.syncope.core.workflow.user.AbstractUserWorkflowAdapter;
 import org.apache.syncope.types.ResourceOperation;
@@ -136,7 +136,7 @@ public class ActivitiUserWorkflowAdapter
     private RepositoryService repositoryService;
 
     @Override
-    public Class<? extends WorkflowLoader> getLoaderClass() {
+    public Class<? extends WorkflowInstanceLoader> getLoaderClass() {
         return ActivitiWorkflowLoader.class;
     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiWorkflowLoader.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiWorkflowLoader.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiWorkflowLoader.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiWorkflowLoader.java Mon Jan 14 18:21:24 2013
@@ -23,12 +23,12 @@ import java.io.InputStream;
 import java.util.List;
 import org.activiti.engine.RepositoryService;
 import org.activiti.engine.repository.ProcessDefinition;
-import org.apache.syncope.core.workflow.WorkflowLoader;
+import org.apache.syncope.core.workflow.WorkflowInstanceLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
-public class ActivitiWorkflowLoader implements WorkflowLoader {
+public class ActivitiWorkflowLoader implements WorkflowInstanceLoader {
 
     private static final Logger LOG = LoggerFactory.getLogger(ActivitiWorkflowLoader.class);
 

Modified: syncope/trunk/core/src/main/resources/persistenceContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/persistenceContext.xml?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/persistenceContext.xml (original)
+++ syncope/trunk/core/src/main/resources/persistenceContext.xml Mon Jan 14 18:21:24 2013
@@ -36,9 +36,8 @@ under the License.
 
   <context:annotation-config/>
   <context:component-scan base-package="org.apache.syncope.core.persistence"/>
-  <context:component-scan base-package="org.apache.syncope.core.rest.data"/>
+  <context:component-scan base-package="org.apache.syncope.core.util"/>
   <context:component-scan base-package="org.apache.syncope.core.policy"/>
-  <context:component-scan base-package="org.apache.syncope.core.policy.impl"/>
 
   <aop:aspectj-autoproxy/>
 

Modified: syncope/trunk/core/src/main/resources/syncopeContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/syncopeContext.xml?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/syncopeContext.xml (original)
+++ syncope/trunk/core/src/main/resources/syncopeContext.xml Mon Jan 14 18:21:24 2013
@@ -41,8 +41,9 @@ under the License.
 
   <context:component-scan base-package="org.apache.syncope.core.init"/>
   <context:component-scan base-package="org.apache.syncope.core.audit"/>
-  <context:component-scan base-package="org.apache.syncope.core.util"/>
   <context:component-scan base-package="org.apache.syncope.core.connid"/>
+  <context:component-scan base-package="org.apache.syncope.core.rest.data"/>
+  <context:component-scan base-package="org.apache.syncope.core.workflow"/>
 
   <bean id="nonJPAdbInitializer" class="org.springframework.jdbc.datasource.init.DataSourceInitializer">
     <property name="dataSource" ref="dataSource"/>

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java Mon Jan 14 18:21:24 2013
@@ -22,8 +22,9 @@ import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.apache.syncope.core.AbstractTest;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
-import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
 import org.apache.syncope.core.persistence.dao.UserDAO;
 import org.apache.syncope.core.policy.PolicyPattern;
 import org.apache.syncope.core.util.IncompatiblePolicyException;
@@ -34,7 +35,7 @@ import org.springframework.beans.factory
 import org.springframework.transaction.annotation.Transactional;
 
 @Transactional
-public class PasswordGeneratorTest extends AbstractDAOTest {
+public class PasswordGeneratorTest extends AbstractTest {
 
     @Autowired
     private PasswordGenerator passwordGenerator;

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java Mon Jan 14 18:21:24 2013
@@ -31,8 +31,7 @@ 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:persistenceTestEnv.xml"})
 public abstract class AbstractDAOTest {
 
     /**

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttributableSearchTest.java Mon Jan 14 18:21:24 2013
@@ -41,8 +41,7 @@ import org.apache.syncope.core.util.Enti
 import org.apache.syncope.types.AttributableType;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:syncopeContext.xml", "classpath:persistenceContext.xml",
-    "classpath:schedulingContext.xml", "classpath:workflowContext.xml"})
+@ContextConfiguration(locations = {"classpath:persistenceTestEnv.xml"})
 @Transactional
 public class AttributableSearchTest {
 

Added: 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=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java (added)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.dao;
+
+import org.apache.syncope.core.persistence.beans.ExternalResource;
+import org.apache.syncope.core.util.NotFoundException;
+
+public class DummyConnectorRegistry implements ConnectorRegistry {
+
+    @Override
+    public void registerConnector(ExternalResource resource)
+            throws NotFoundException {
+    }
+
+    @Override
+    public void unregisterConnector(String id) {
+    }
+
+}

Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DummyConnectorRegistry.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TestDbInitializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TestDbInitializer.java?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TestDbInitializer.java (added)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TestDbInitializer.java Mon Jan 14 18:21:24 2013
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.dao;
+
+import javax.servlet.ServletContext;
+
+import org.apache.syncope.core.persistence.dao.impl.ContentLoader;
+import org.apache.syncope.core.workflow.ActivitiDetector;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.ServletContextAware;
+
+/**
+ * Take care of all initializations needed by Syncope to run up and safe.
+ */
+@Component
+public class TestDbInitializer implements ServletContextAware, InitializingBean {
+    @Autowired
+    private ContentLoader contentLoader;
+
+    @Override
+    public void setServletContext(final ServletContext servletContext) {
+    }
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        contentLoader.load(ActivitiDetector.isActivitiEnabledForUsers());
+    }
+}
\ No newline at end of file

Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TestDbInitializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=1433021&r1=1433020&r2=1433021&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 Mon Jan 14 18:21:24 2013
@@ -42,9 +42,9 @@ import org.apache.syncope.client.to.Sync
 import org.apache.syncope.client.to.TaskExecTO;
 import org.apache.syncope.client.to.TaskTO;
 import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.core.init.SpringContextInitializer;
 import org.apache.syncope.core.sync.SyncJob;
 import org.apache.syncope.core.sync.TestSyncActions;
+import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.apache.syncope.types.IntMappingType;
 import org.apache.syncope.types.PropagationTaskExecStatus;
 import org.apache.syncope.types.TraceLevel;
@@ -267,7 +267,7 @@ public class TaskTestITCase extends Abst
         userTO = userService.read(userTO.getId());
         assertNotNull(userTO);
         assertEquals("test9", userTO.getUsername());
-        assertEquals(SpringContextInitializer.isActivitiEnabledForUsers()
+        assertEquals(ActivitiDetector.isActivitiEnabledForUsers()
                 ? "active"
                 : "created", userTO.getStatus());
         assertEquals("test9@syncope.apache.org", userTO.getAttributeMap().get("email").getValues().get(0));

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=1433021&r1=1433020&r2=1433021&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 Mon Jan 14 18:21:24 2013
@@ -44,8 +44,8 @@ import org.apache.syncope.client.to.Work
 import org.apache.syncope.client.util.AttributableOperations;
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.client.validation.SyncopeClientException;
-import org.apache.syncope.core.init.SpringContextInitializer;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.apache.syncope.types.AttributableType;
 import org.apache.syncope.types.CipherAlgorithm;
 import org.apache.syncope.types.PropagationTaskExecStatus;
@@ -562,7 +562,7 @@ public class UserTestITCase extends Abst
 
     @Test
     public void createWithReject() {
-        Assume.assumeTrue(SpringContextInitializer.isActivitiEnabledForUsers());
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
 
         UserTO userTO = getSampleTO("createWithReject@syncope.apache.org");
 
@@ -619,7 +619,7 @@ public class UserTestITCase extends Abst
 
     @Test
     public void createWithApproval() {
-        Assume.assumeTrue(SpringContextInitializer.isActivitiEnabledForUsers());
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
 
         JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
 
@@ -1053,7 +1053,7 @@ public class UserTestITCase extends Abst
 
     @Test
     public void createActivate() {
-        Assume.assumeTrue(SpringContextInitializer.isActivitiEnabledForUsers());
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
 
         UserTO userTO = getSampleTO("createActivate@syncope.apache.org");
 
@@ -1080,7 +1080,7 @@ public class UserTestITCase extends Abst
 
     @Test
     public void createActivateByUsername() {
-        Assume.assumeTrue(SpringContextInitializer.isActivitiEnabledForUsers());
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
 
         UserTO userTO = getSampleTO("createActivateByUsername@syncope.apache.org");
 
@@ -1117,7 +1117,7 @@ public class UserTestITCase extends Abst
         userTO = userService.create(userTO);
 
         assertNotNull(userTO);
-        assertEquals(SpringContextInitializer.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
+        assertEquals(ActivitiDetector.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
 
         userTO = userService.suspend(userTO.getId());
 
@@ -1141,7 +1141,7 @@ public class UserTestITCase extends Abst
         userTO = userService.create(userTO);
 
         assertNotNull(userTO);
-        assertEquals(SpringContextInitializer.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
+        assertEquals(ActivitiDetector.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
 
         userTO = userService.suspendByUsername(userTO.getUsername());
 
@@ -1174,7 +1174,7 @@ public class UserTestITCase extends Abst
         userTO = userService.create(userTO);
 
         assertNotNull(userTO);
-        assertEquals(SpringContextInitializer.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
+        assertEquals(ActivitiDetector.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
 
         String query = "?resourceNames=" + dbTable.getName() + "&resourceNames=" + ldap.getName()
                 + "&performLocally=true"; // check also performLocally

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java?rev=1433021&r1=1433020&r2=1433021&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java Mon Jan 14 18:21:24 2013
@@ -22,7 +22,7 @@ import static org.junit.Assert.*;
 
 import java.util.List;
 import org.apache.syncope.client.to.WorkflowDefinitionTO;
-import org.apache.syncope.core.init.SpringContextInitializer;
+import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.junit.Assume;
 import org.junit.Test;
 
@@ -46,7 +46,7 @@ public class WorkflowTestITCase extends 
 
     @Test//TODO TestCase needs to be extended
     public void testUpdateUserDefinition() {
-        Assume.assumeTrue(SpringContextInitializer.isActivitiEnabledForUsers());
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
 
         WorkflowDefinitionTO definition = workflowService.getDefinition(USER_TYPE);
         assertNotNull(definition);
@@ -58,7 +58,7 @@ public class WorkflowTestITCase extends 
 
     @Test//TODO TestCase needs to be extended
     public void testUpdateRoleDefinition() {
-        Assume.assumeTrue(SpringContextInitializer.isActivitiEnabledForRoles());
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForRoles());
 
         WorkflowDefinitionTO definition = workflowService.getDefinition(ROLE_TYPE);
         assertNotNull(definition);

Added: syncope/trunk/core/src/test/resources/persistenceTestEnv.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/persistenceTestEnv.xml?rev=1433021&view=auto
==============================================================================
--- syncope/trunk/core/src/test/resources/persistenceTestEnv.xml (added)
+++ syncope/trunk/core/src/test/resources/persistenceTestEnv.xml Mon Jan 14 18:21:24 2013
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+  license agreements. See the NOTICE file distributed with this work for additional 
+  information regarding copyright ownership. The ASF licenses this file to 
+  you under the Apache License, Version 2.0 (the "License"); you may not use 
+  this file except in compliance with the License. You may obtain a copy of 
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+  by applicable law or agreed to in writing, software distributed under the 
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+  OF ANY KIND, either express or implied. See the License for the specific 
+  language governing permissions and limitations under the License. -->
+  
+<!--  This should not end in *Context as it would then be picked up in the cargo start -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  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">
+
+  <bean class="org.apache.syncope.core.persistence.dao.TestDbInitializer"/>
+  <bean class="org.apache.syncope.core.persistence.dao.DummyConnectorRegistry"> 
+  </bean>
+  <bean class="org.apache.syncope.core.persistence.dao.impl.ContentLoader">
+  </bean>
+  
+  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+    <property name="locations">
+      <list>
+        <value>classpath:persistence.properties</value>
+        <value>classpath:security.properties</value>
+        <value>classpath:workflow.properties</value>
+      </list>
+    </property>
+    <property name="ignoreResourceNotFound" value="true" />
+    <property name="ignoreUnresolvablePlaceholders" value="true" />
+  </bean>
+
+  <bean id="nonJPAdbInitializer"
+    class="org.springframework.jdbc.datasource.init.DataSourceInitializer">
+    <property name="dataSource" ref="dataSource" />
+    <property name="enabled" value="true" />
+    <property name="databasePopulator">
+      <bean
+        class="org.springframework.jdbc.datasource.init.ResourceDatabasePopulator">
+        <property name="continueOnError" value="true" />
+        <property name="ignoreFailedDrops" value="true" />
+        <property name="sqlScriptEncoding" value="UTF-8" />
+        <property name="scripts">
+          <array>
+            <value type="org.springframework.core.io.Resource">
+              classpath:/quartz/${quartz.sql}
+            </value>
+            <value type="org.springframework.core.io.Resource">
+              classpath:/logback/${logback.sql}
+            </value>
+          </array>
+        </property>
+      </bean>
+    </property>
+  </bean>
+
+  <bean id="jexlEngine" class="org.apache.commons.jexl2.JexlEngine">
+    <property name="cache" value="512" />
+    <property name="lenient" value="true" />
+    <property name="silent" value="false" />
+  </bean>
+  <bean id="jexlUtil" class="org.apache.syncope.core.util.JexlUtil" />
+
+  <import resource="persistenceContext.xml" />
+</beans>

Propchange: syncope/trunk/core/src/test/resources/persistenceTestEnv.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message