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/03/05 15:42:42 UTC

svn commit: r1452817 - in /syncope/trunk: ./ core/ core/src/main/java/org/apache/syncope/core/sync/impl/ core/src/main/java/org/apache/syncope/core/util/ core/src/main/java/org/apache/syncope/core/workflow/user/ core/src/test/java/org/apache/syncope/co...

Author: ilgrosso
Date: Tue Mar  5 14:42:42 2013
New Revision: 1452817

URL: http://svn.apache.org/r1452817
Log:
[SYNCOPE-330] #resolve

Added:
    syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl   (with props)
Modified:
    syncope/trunk/core/pom.xml
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
    syncope/trunk/pom.xml

Modified: syncope/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/pom.xml?rev=1452817&r1=1452816&r2=1452817&view=diff
==============================================================================
--- syncope/trunk/core/pom.xml (original)
+++ syncope/trunk/core/pom.xml Tue Mar  5 14:42:42 2013
@@ -234,6 +234,10 @@ under the License.
       <groupId>org.apache.avalon.framework</groupId>
       <artifactId>avalon-framework-impl</artifactId>
     </dependency>
+    <dependency>
+      <groupId>xalan</groupId>
+      <artifactId>xalan</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId> 
@@ -877,6 +881,42 @@ under the License.
       <build>
         <defaultGoal>clean verify</defaultGoal>
         
+        <plugins>
+          <!-- Strip Activiti-related entries from content.xml -->
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>xml-maven-plugin</artifactId>
+            <inherited>true</inherited>
+            <executions>
+              <execution>
+                <phase>process-test-resources</phase>
+                <goals>
+                  <goal>transform</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <forceCreation>true</forceCreation>
+              <transformationSets>
+                <transformationSet>
+                  <dir>${project.build.directory}/test-classes</dir>
+                  <includes>
+                    <include>content.xml</include>
+                  </includes>
+                  <outputDir>${project.build.directory}/test-classes/</outputDir>
+                  <stylesheet>${basedir}/src/test/resources/noopworkflow/stripActivitiFromContent.xsl</stylesheet>
+                  <outputProperties>
+                    <outputProperty>
+                      <name>indent</name>
+                      <value>yes</value>
+                    </outputProperty>
+                  </outputProperties>
+                </transformationSet>
+              </transformationSets>
+            </configuration>
+          </plugin>
+        </plugins>
+        
         <testResources>
           <testResource>
             <directory>src/test/resources</directory>
@@ -889,6 +929,10 @@ under the License.
           <testResource>
             <directory>src/test/resources/noopworkflow</directory>
             <filtering>true</filtering>
+            <includes>
+              <include>workflowContext.xml</include>
+              <include>workflow.properties</include>
+            </includes>
           </testResource>
         </testResources>
       </build>

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java?rev=1452817&r1=1452816&r2=1452817&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java Tue Mar  5 14:42:42 2013
@@ -346,8 +346,9 @@ public class SyncopeSyncResultHandler im
 
         final Map<String, Attribute> extValues = new HashMap<String, Attribute>();
 
-        for (AbstractMappingItem item :
-                attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
+        for (AbstractMappingItem item
+                : attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
+
             extValues.put(item.getIntAttrName(), connObj.getAttributeByName(item.getExtAttrName()));
         }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java?rev=1452817&r1=1452816&r2=1452817&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java Tue Mar  5 14:42:42 2013
@@ -95,8 +95,6 @@ public class ImportExport extends Defaul
     private final static Map<String, Set<String>> COLUMNS_TO_BE_NULLIFIED =
             Collections.singletonMap("SYNCOPEROLE", Collections.singleton("USEROWNER_ID"));
 
-    private String[] wfInitSQLStatements;
-
     private String readSchema() {
         String schema = null;
 
@@ -261,14 +259,8 @@ public class ImportExport extends Defaul
     public void startElement(final String uri, final String localName, final String qName, final Attributes atts)
             throws SAXException {
 
-        // skip root element and perform workflow init statements
+        // skip root element
         if (ROOT_ELEMENT.equals(qName)) {
-            if (wfInitSQLStatements != null) {
-                for (String wfInitSQLStmt : wfInitSQLStatements) {
-                    Query query = entityManager.createNativeQuery(wfInitSQLStmt);
-                    query.executeUpdate();
-                }
-            }
             return;
         }
 
@@ -381,7 +373,7 @@ public class ImportExport extends Defaul
         }
     }
 
-    private List<String> sortByForeignKeys(final Connection conn, final Set<String> tableNames, final String schema)
+    private List<String> sortByForeignKeys(final Connection conn, final Set<String> tableNames)
             throws SQLException {
 
         Set<MultiParentNode<String>> roots = new HashSet<MultiParentNode<String>>();
@@ -504,7 +496,7 @@ public class ImportExport extends Defaul
             LOG.debug("Tables to be exported {}", tableNames);
 
             // then sort tables based on foreign keys and dump
-            for (String tableName : sortByForeignKeys(conn, tableNames, schema)) {
+            for (String tableName : sortByForeignKeys(conn, tableNames)) {
                 try {
                     doExportTable(handler, conn, tableName, TABLES_TO_BE_FILTERED.get(tableName.toUpperCase()));
                 } catch (Exception e) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java?rev=1452817&r1=1452816&r2=1452817&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java Tue Mar  5 14:42:42 2013
@@ -78,6 +78,7 @@ public class NoOpUserWorkflowAdapter ext
                     ? "active"
                     : "suspended";
             propagateEnable = enabled;
+            user.setSuspended(!enabled);
         }
 
         user.setStatus(status);

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=1452817&r1=1452816&r2=1452817&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Tue Mar  5 14:42:42 2013
@@ -58,6 +58,7 @@ import org.apache.syncope.common.types.T
 import org.apache.syncope.core.sync.TestSyncActions;
 import org.apache.syncope.core.sync.TestSyncRule;
 import org.apache.syncope.core.sync.impl.SyncJob;
+import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
@@ -282,7 +283,7 @@ public class TaskTestITCase extends Abst
             UserTO userTO = userService.read(inUserTO.getId());
             assertNotNull(userTO);
             assertEquals("test9", userTO.getUsername());
-            assertEquals("active", userTO.getStatus());
+            assertEquals(ActivitiDetector.isActivitiEnabledForUsers() ? "active" : "created", userTO.getStatus());
             assertEquals("test9@syncope.apache.org", userTO.getAttributeMap().get("email").getValues().get(0));
             assertEquals("test9@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
             assertTrue(Integer.valueOf(userTO.getAttributeMap().get("fullname").getValues().get(0)) <= 10);

Added: syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl?rev=1452817&view=auto
==============================================================================
--- syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl (added)
+++ syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl Tue Mar  5 14:42:42 2013
@@ -0,0 +1,31 @@
+<?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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  
+  <xsl:template match="node()|@*|comment()">
+    <xsl:if test="not(starts-with(local-name(), 'ACT_'))">
+      <xsl:copy>
+        <xsl:apply-templates select="@*|node()"/>
+      </xsl:copy>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>

Propchange: syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: syncope/trunk/core/src/test/resources/noopworkflow/stripActivitiFromContent.xsl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: syncope/trunk/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/pom.xml?rev=1452817&r1=1452816&r2=1452817&view=diff
==============================================================================
--- syncope/trunk/pom.xml (original)
+++ syncope/trunk/pom.xml Tue Mar  5 14:42:42 2013
@@ -668,6 +668,10 @@ under the License.
             <groupId>org.apache.avalon.framework</groupId>
             <artifactId>avalon-framework-impl</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>            
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
@@ -680,7 +684,12 @@ under the License.
         <artifactId>avalon-framework-impl</artifactId>
         <version>4.3.1</version>
       </dependency>
-        
+      <dependency>
+        <groupId>xalan</groupId>
+        <artifactId>xalan</artifactId>
+        <version>2.7.1</version>
+      </dependency>
+
       <!-- Wicket -->
       <dependency>
         <groupId>org.apache.wicket</groupId>
@@ -874,6 +883,13 @@ under the License.
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>xml-maven-plugin</artifactId>
           <version>1.0</version>
+          <dependencies>
+            <dependency>
+              <groupId>xalan</groupId>
+              <artifactId>xalan</artifactId>
+              <version>2.7.1</version>              
+            </dependency>
+          </dependencies>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>