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 2015/01/15 15:27:00 UTC

[1/8] syncope git commit: [SYNCOPE-627] adding Camel integration test

Repository: syncope
Updated Branches:
  refs/heads/1_2_X 970c0d0ed -> 9ceb71a33
  refs/heads/2_0_X b015c443b -> 3dc03b231
  refs/heads/master 5e1fe6108 -> 7570a5fc8


[SYNCOPE-627] adding Camel integration test


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/f7554cad
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/f7554cad
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/f7554cad

Branch: refs/heads/2_0_X
Commit: f7554cadd5e80c379158aa9a291f2a978267c9ab
Parents: 25bb5c9
Author: giacomolm <gi...@hotmail.it>
Authored: Mon Jan 12 17:06:33 2015 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Mon Jan 12 17:06:33 2015 +0100

----------------------------------------------------------------------
 core/pom.xml                                    |   4 +
 .../apache/syncope/core/rest/AbstractTest.java  |   4 +
 .../syncope/core/rest/CamelTestITCase.java      | 161 +++++++++++++++++++
 pom.xml                                         |   9 +-
 4 files changed, 176 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/f7554cad/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 1628184..f2cfbb7 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -127,6 +127,10 @@ under the License.
       <artifactId>camel-spring</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-script</artifactId>
+    </dependency>    
+    <dependency>
       <groupId>javax.xml.bind</groupId>
       <artifactId>jaxb-api</artifactId>
       <version>2.2.7</version>

http://git-wip-us.apache.org/repos/asf/syncope/blob/f7554cad/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java b/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
index 785734d..13cc27b 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
@@ -47,6 +47,7 @@ import org.apache.syncope.common.services.PolicyService;
 import org.apache.syncope.common.services.ReportService;
 import org.apache.syncope.common.services.ResourceService;
 import org.apache.syncope.common.services.RoleService;
+import org.apache.syncope.common.services.RouteService;
 import org.apache.syncope.common.services.SchemaService;
 import org.apache.syncope.common.services.SecurityQuestionService;
 import org.apache.syncope.common.services.TaskService;
@@ -173,6 +174,8 @@ public abstract class AbstractTest {
     protected static PolicyService policyService;
 
     protected static SecurityQuestionService securityQuestionService;
+    
+    protected static RouteService routeService;
 
     @Autowired
     protected DataSource testDataSource;
@@ -223,6 +226,7 @@ public abstract class AbstractTest {
         notificationService = adminClient.getService(NotificationService.class);
         schemaService = adminClient.getService(SchemaService.class);
         securityQuestionService = adminClient.getService(SecurityQuestionService.class);
+        routeService = adminClient.getService(RouteService.class);
     }
 
     protected static String getUUIDString() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/f7554cad/core/src/test/java/org/apache/syncope/core/rest/CamelTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/CamelTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/CamelTestITCase.java
new file mode 100644
index 0000000..57e010c
--- /dev/null
+++ b/core/src/test/java/org/apache/syncope/core/rest/CamelTestITCase.java
@@ -0,0 +1,161 @@
+/*
+ * 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.rest;
+
+import static org.apache.syncope.core.rest.AbstractTest.adminClient;
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+import org.apache.syncope.common.to.RouteTO;
+import org.apache.syncope.common.to.SchemaTO;
+import org.apache.syncope.common.to.UserTO;
+import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.AttributeSchemaType;
+import org.apache.syncope.common.types.SchemaType;
+import org.apache.syncope.common.types.SubjectType;
+import org.apache.syncope.core.provisioning.camel.CamelDetector;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.JVM)
+public class CamelTestITCase extends AbstractTest{
+    
+    @Test
+    public void isCamelEnabled(){
+        assertEquals(CamelDetector.isCamelEnabledForUsers(),
+                adminClient.isCamelEnabledFor(SubjectType.USER));
+        
+        assertEquals(CamelDetector.isCamelEnabledForRoles(),
+                adminClient.isCamelEnabledFor(SubjectType.ROLE));
+    }
+    
+    @Test
+    public void userRoutes() {
+        List<RouteTO> userRoutes = routeService.getRoutes(SubjectType.USER);
+        Assert.assertNotNull(userRoutes);
+        Assert.assertEquals(15, userRoutes.size());
+        for(int i=0; i<userRoutes.size(); i++){
+            Assert.assertNotNull(userRoutes.get(i).getRouteContent());
+        }
+    }
+    
+    @Test
+    public void roleRoutes() {
+        List<RouteTO> roleRoutes = routeService.getRoutes(SubjectType.ROLE);
+        Assert.assertNotNull(roleRoutes);
+        Assert.assertEquals(7, roleRoutes.size());
+        for(int i=0; i<roleRoutes.size(); i++){
+            Assert.assertNotNull(roleRoutes.get(i).getRouteContent());
+        }
+    }
+   
+    
+    public RouteTO updateRoute(Long id, String content){
+        RouteTO route = routeService.getRoute(SubjectType.USER, id);
+        route.setRouteContent(content);
+        routeService.importRoute(SubjectType.USER, route.getId(), route);
+        //getting new route definition
+        return routeService.getRoute(SubjectType.USER, id);        
+    }
+    
+    @Test
+    public void updateRoute(){
+        RouteTO oldRoute = routeService.getRoute(SubjectType.USER, new Long(0));
+        String routeContent =   "<route id=\"createUser\">\n" +
+                                "  <from uri=\"direct:createUser\"/>\n" +
+                                "  <setProperty propertyName=\"actual\">\n" +
+                                "    <simple>${body}</simple>\n" +
+                                "  </setProperty>\n" +
+                                "  <doTry>\n" +
+                                "    <bean ref=\"uwfAdapter\" method=\"create(${body},${property.disablePwdPolicyCheck},\n" +
+                                "                             ${property.enabled},${property.storePassword})\"/>\n" +
+                                "    <process ref=\"defaultUserCreatePropagation\" />\n" +
+                                "    <to uri=\"direct:createPort\"/>\n" +
+                                "    <to uri=\"log:myLog\"/>\n" +
+                                "    <doCatch>        \n" +
+                                "      <exception>java.lang.RuntimeException</exception>\n" +
+                                "      <handled>\n" +
+                                "        <constant>false</constant>\n" +
+                                "      </handled>\n" +
+                                "      <to uri=\"direct:createPort\"/>\n" +
+                                "    </doCatch>\n" +
+                                "  </doTry>\n" +
+                                "</route>";
+        RouteTO route =  updateRoute(new Long(0), routeContent);
+        assertEquals(routeContent, route.getRouteContent());
+        
+        updateRoute(oldRoute.getId(), oldRoute.getRouteContent());
+    }
+    
+    @Test
+    public void checkRouteUpdate(){
+        //Getting original route content
+        RouteTO oldRoute = routeService.getRoute(SubjectType.USER, new Long(0));
+        //updating route content including new attribute management
+        String routeContent =   "<route id=\"createUser\">\n" +
+                                "  <from uri=\"direct:createUser\"/>\n" +
+                                "  <setProperty propertyName=\"actual\">\n" +
+                                "    <simple>${body}</simple>\n" +
+                                "  </setProperty>\n" +                                
+                                "  <setBody>\n"+
+                                "   <groovy>\n"+
+                                "       request.body.getAttrs().get(3).getValues().set(0,\"true\")\n"+
+                                "       return request.body\n"+
+                                "   </groovy>\n"+
+                                "  </setBody>\n"+
+                                "  <doTry>\n" +
+                                "      <bean ref=\"uwfAdapter\" method=\"create(${body},${property.disablePwdPolicyCheck},\n" +
+                                "                            ${property.enabled},${property.storePassword})\"/>\n" +
+                                "      <process ref=\"defaultUserCreatePropagation\" />\n" +
+                                "      <to uri=\"direct:createPort\"/>\n" +
+                                "      <doCatch>        \n" +
+                                "      <exception>java.lang.RuntimeException</exception>\n" +
+                                "          <handled>\n" +
+                                "           <constant>false</constant>\n" +
+                                "          </handled>\n" +
+                                "      <to uri=\"direct:createPort\"/>\n" +
+                                "      </doCatch>\n" +
+                                "   </doTry>\n" +                                
+                                "</route>";
+        updateRoute(new Long(0), routeContent);
+        //creating new schema attribute for user
+        SchemaTO schemaTO = new SchemaTO();
+        schemaTO.setName("camelAttribute");
+        schemaTO.setType(AttributeSchemaType.String);       
+        createSchema(AttributableType.USER, SchemaType.NORMAL, schemaTO);
+        
+        UserTO userTO = new UserTO();
+        String userId = getUUIDString() + "camelUser@syncope.apache.org";
+        userTO.setUsername(userId);
+        userTO.setPassword("password");
+        userTO.getAttrs().add(attributeTO("userId", userId));
+        userTO.getAttrs().add(attributeTO("fullname", userId));
+        userTO.getAttrs().add(attributeTO("surname", userId));
+        userTO.getAttrs().add(attributeTO("camelAttribute", "false"));
+
+        userTO = createUser(userTO);        
+        Assert.assertNotNull(userTO);
+        assertEquals("true",userTO.getAttrs().get(3).getValues().get(0));
+        
+        updateRoute(oldRoute.getId(), oldRoute.getRouteContent());
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f7554cad/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 772fa35..bb2ac10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -726,8 +726,13 @@ under the License.
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
-       <artifactId>camel-spring</artifactId>
-       <version>${camel.version}</version>
+        <artifactId>camel-spring</artifactId>
+        <version>${camel.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-script</artifactId>
+        <version>${camel.version}</version>
       </dependency>
       <!-- /Camel -->
 


[2/8] syncope git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/syncope

Posted by il...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/syncope


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/5e1fe610
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/5e1fe610
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/5e1fe610

Branch: refs/heads/2_0_X
Commit: 5e1fe61082c668b22deb4ea140f7641d41ebdeaa
Parents: f7554ca 876e979
Author: giacomolm <gi...@hotmail.it>
Authored: Mon Jan 12 17:06:41 2015 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Mon Jan 12 17:06:41 2015 +0100

----------------------------------------------------------------------
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/5e1fe610/pom.xml
----------------------------------------------------------------------


[6/8] syncope git commit: Merge branch '1_2_X'

Posted by il...@apache.org.
Merge branch '1_2_X'


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7570a5fc
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7570a5fc
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7570a5fc

Branch: refs/heads/master
Commit: 7570a5fc8c41bef10145c660f8b569176ebb3775
Parents: 5e1fe61 9ceb71a
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jan 15 15:26:17 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jan 15 15:26:17 2015 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/7570a5fc/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 1ac38d3,86fff48..0ad592f
--- a/pom.xml
+++ b/pom.xml
@@@ -335,12 -336,11 +335,12 @@@ under the License
      <activiti.version>5.16.4</activiti.version>
  
      <aspectj.version>1.8.4</aspectj.version>
 -
 -    <cxf.version>3.0.3</cxf.version>	
 +    
 +    <cxf.version>3.0.3</cxf.version>
 +    <camel.version>2.14.1</camel.version>	
      <spring.version>4.0.9.RELEASE</spring.version>
      <spring-security.version>3.2.5.RELEASE</spring-security.version>
-     <jackson.version>2.4.4</jackson.version>
+     <jackson.version>2.4.5</jackson.version>
      <velocity.version>1.7</velocity.version>
      <velocitytools.version>2.0</velocitytools.version>
      <quartz.version>2.2.1</quartz.version>


[7/8] syncope git commit: Merge branch '1_2_X'

Posted by il...@apache.org.
Merge branch '1_2_X'


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7570a5fc
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7570a5fc
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7570a5fc

Branch: refs/heads/2_0_X
Commit: 7570a5fc8c41bef10145c660f8b569176ebb3775
Parents: 5e1fe61 9ceb71a
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jan 15 15:26:17 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jan 15 15:26:17 2015 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/7570a5fc/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 1ac38d3,86fff48..0ad592f
--- a/pom.xml
+++ b/pom.xml
@@@ -335,12 -336,11 +335,12 @@@ under the License
      <activiti.version>5.16.4</activiti.version>
  
      <aspectj.version>1.8.4</aspectj.version>
 -
 -    <cxf.version>3.0.3</cxf.version>	
 +    
 +    <cxf.version>3.0.3</cxf.version>
 +    <camel.version>2.14.1</camel.version>	
      <spring.version>4.0.9.RELEASE</spring.version>
      <spring-security.version>3.2.5.RELEASE</spring-security.version>
-     <jackson.version>2.4.4</jackson.version>
+     <jackson.version>2.4.5</jackson.version>
      <velocity.version>1.7</velocity.version>
      <velocitytools.version>2.0</velocitytools.version>
      <quartz.version>2.2.1</quartz.version>


[5/8] syncope git commit: Upgrading Jackson

Posted by il...@apache.org.
Upgrading Jackson


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/9ceb71a3
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/9ceb71a3
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/9ceb71a3

Branch: refs/heads/master
Commit: 9ceb71a33c0f2a64f5f180ca11a8cfd85fad1383
Parents: 970c0d0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jan 15 15:26:01 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jan 15 15:26:01 2015 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/9ceb71a3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index abc00b8..86fff48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -340,7 +340,7 @@ under the License.
     <cxf.version>3.0.3</cxf.version>	
     <spring.version>4.0.9.RELEASE</spring.version>
     <spring-security.version>3.2.5.RELEASE</spring-security.version>
-    <jackson.version>2.4.4</jackson.version>
+    <jackson.version>2.4.5</jackson.version>
     <velocity.version>1.7</velocity.version>
     <velocitytools.version>2.0</velocitytools.version>
     <quartz.version>2.2.1</quartz.version>


[8/8] syncope git commit: Merge branch 'master' into 2_0_X

Posted by il...@apache.org.
Merge branch 'master' into 2_0_X


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3dc03b23
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3dc03b23
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3dc03b23

Branch: refs/heads/2_0_X
Commit: 3dc03b23110dc45746ca5d69c3a63e991eb613f1
Parents: b015c44 7570a5f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jan 15 15:26:31 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jan 15 15:26:31 2015 +0100

----------------------------------------------------------------------
 core/pom.xml                                    |   4 +
 .../apache/syncope/core/rest/AbstractTest.java  |   4 +
 .../syncope/core/rest/CamelTestITCase.java      | 161 +++++++++++++++++++
 pom.xml                                         |  11 +-
 4 files changed, 177 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/3dc03b23/core/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/syncope/blob/3dc03b23/pom.xml
----------------------------------------------------------------------


[4/8] syncope git commit: Upgrading Jackson

Posted by il...@apache.org.
Upgrading Jackson


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/9ceb71a3
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/9ceb71a3
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/9ceb71a3

Branch: refs/heads/2_0_X
Commit: 9ceb71a33c0f2a64f5f180ca11a8cfd85fad1383
Parents: 970c0d0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jan 15 15:26:01 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jan 15 15:26:01 2015 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/9ceb71a3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index abc00b8..86fff48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -340,7 +340,7 @@ under the License.
     <cxf.version>3.0.3</cxf.version>	
     <spring.version>4.0.9.RELEASE</spring.version>
     <spring-security.version>3.2.5.RELEASE</spring-security.version>
-    <jackson.version>2.4.4</jackson.version>
+    <jackson.version>2.4.5</jackson.version>
     <velocity.version>1.7</velocity.version>
     <velocitytools.version>2.0</velocitytools.version>
     <quartz.version>2.2.1</quartz.version>


[3/8] syncope git commit: Upgrading Jackson

Posted by il...@apache.org.
Upgrading Jackson


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/9ceb71a3
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/9ceb71a3
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/9ceb71a3

Branch: refs/heads/1_2_X
Commit: 9ceb71a33c0f2a64f5f180ca11a8cfd85fad1383
Parents: 970c0d0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jan 15 15:26:01 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jan 15 15:26:01 2015 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/9ceb71a3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index abc00b8..86fff48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -340,7 +340,7 @@ under the License.
     <cxf.version>3.0.3</cxf.version>	
     <spring.version>4.0.9.RELEASE</spring.version>
     <spring-security.version>3.2.5.RELEASE</spring-security.version>
-    <jackson.version>2.4.4</jackson.version>
+    <jackson.version>2.4.5</jackson.version>
     <velocity.version>1.7</velocity.version>
     <velocitytools.version>2.0</velocitytools.version>
     <quartz.version>2.2.1</quartz.version>