You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by ma...@apache.org on 2015/11/19 18:06:51 UTC

[1/3] syncope git commit: Integration test, SYNCOPE-727

Repository: syncope
Updated Branches:
  refs/heads/master 24e414446 -> 9b033aa1b


Integration test, SYNCOPE-727


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

Branch: refs/heads/master
Commit: 9b033aa1be51f0d7b37d46434803b1f12f942c72
Parents: 7326955
Author: massi <ma...@tirasa.net>
Authored: Thu Nov 19 18:06:13 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Thu Nov 19 18:06:33 2015 +0100

----------------------------------------------------------------------
 fit/core-reference/pom.xml                      |  21 +++
 .../syncope/fit/core/reference/CLIITCase.java   | 127 ++++++++++++++++++
 .../src/test/resources/log4j2.xml               | 133 +++++++++++++++++++
 3 files changed, 281 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/9b033aa1/fit/core-reference/pom.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/pom.xml b/fit/core-reference/pom.xml
index 3d8af35..fb98efe 100644
--- a/fit/core-reference/pom.xml
+++ b/fit/core-reference/pom.xml
@@ -38,6 +38,7 @@ under the License.
     <jdbcdriver.artifactId>h2</jdbcdriver.artifactId>
     
     <rootpom.basedir>${basedir}/../..</rootpom.basedir>
+    <work.dir>${project.build.directory}/cli-test</work.dir>
   </properties>
 
   <dependencies>
@@ -152,6 +153,26 @@ under the License.
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>cli-test</id>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <phase>pre-integration-test</phase>
+            <configuration>
+              <target>
+                <mkdir dir="${work.dir}" />
+                <unzip src="../../client/cli/target/syncope-client-cli-${project.version}.zip" dest="${work.dir}"/>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
         <inherited>true</inherited>
         <configuration>

http://git-wip-us.apache.org/repos/asf/syncope/blob/9b033aa1/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java
new file mode 100644
index 0000000..1f9c752
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java
@@ -0,0 +1,127 @@
+/*
+ * 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.fit.core.reference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.JVM)
+public class CLIITCase extends AbstractITCase {
+
+    private static final String LINUX_SCRIPT_DIR = "/target/cli-test/syncope-client-cli-2.0.0-SNAPSHOT";
+
+    private static final String LINUX_SCRIPT_FILENAME = "syncopeadm.sh";
+
+    private static ProcessBuilder processBuilder;
+
+    @BeforeClass
+    public static void install() {
+        try {
+            final File f = new File(".");
+            final File buildDirectory = new File(f.getCanonicalPath() + LINUX_SCRIPT_DIR);
+            processBuilder = new ProcessBuilder();
+            processBuilder.directory(buildDirectory);
+            final String[] command = {"/bin/bash", LINUX_SCRIPT_FILENAME, "install", "--setup-debug"};
+            processBuilder.command(command);
+            final Process process = processBuilder.start();
+            process.waitFor();
+            final File cliPropertiesFile = new File(buildDirectory + "/cli.properties");
+            assertTrue(cliPropertiesFile.exists());
+        } catch (final IOException | InterruptedException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    @Test
+    public void runScriptWithoutOptions() {
+        try {
+            final String[] command = {"/bin/bash", LINUX_SCRIPT_FILENAME};
+            processBuilder.command(command);
+            final Process process = processBuilder.start();
+            final String result = readScriptOutput(process.getInputStream());
+            assertTrue(result.startsWith("\nUsage: Main [options]"));
+            assertTrue(result.contains("entitlement --help"));
+            assertTrue(result.contains("group --help"));
+            process.destroy();
+        } catch (IOException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    @Test
+    public void entitlementCount() {
+        try {
+            final String[] command = {"/bin/bash", LINUX_SCRIPT_FILENAME, "entitlement", "--list"};
+            processBuilder.command(command);
+            final Process process = processBuilder.start();
+            final BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            int entitlementsNumber = 0;
+            String line;
+            while ((line = br.readLine()) != null) {
+                if (line.startsWith("-")) {
+                    entitlementsNumber++;
+                }
+            }
+            assertEquals(112, entitlementsNumber);
+        } catch (IOException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    @Test
+    public void connectorCount() {
+        try {
+            final String[] command = {"/bin/bash", LINUX_SCRIPT_FILENAME, "connector", "--list-bundles"};
+            processBuilder.command(command);
+            final Process process = processBuilder.start();
+            final BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            int bundlesNumber = 0;
+            String line;
+            while ((line = br.readLine()) != null) {
+                if (line.startsWith(" > BUNDLE NAME:")) {
+                    bundlesNumber++;
+                }
+            }
+            assertEquals(8, bundlesNumber);
+        } catch (IOException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    private static String readScriptOutput(final InputStream inputStream) throws IOException {
+        final BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
+        final StringBuilder resultBuilder = new StringBuilder();
+        String line;
+        while ((line = br.readLine()) != null) {
+            resultBuilder.append(line).append("\n");
+        }
+        return resultBuilder.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/9b033aa1/fit/core-reference/src/test/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/resources/log4j2.xml b/fit/core-reference/src/test/resources/log4j2.xml
new file mode 100644
index 0000000..4811c94
--- /dev/null
+++ b/fit/core-reference/src/test/resources/log4j2.xml
@@ -0,0 +1,133 @@
+<?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.
+-->
+<configuration status="WARN" shutdownHook="disable">
+
+  <appenders>
+    
+    <RollingRandomAccessFile name="main" fileName="${log.directory}/core.log"
+                             filePattern="${log.directory}/core-%d{yyyy-MM-dd}.log.gz"
+                             immediateFlush="false" append="true">
+      <PatternLayout>
+        <pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
+      </PatternLayout>
+      <Policies>
+        <TimeBasedTriggeringPolicy/>
+        <SizeBasedTriggeringPolicy size="250 MB"/>
+      </Policies>
+    </RollingRandomAccessFile>
+
+    <RollingRandomAccessFile name="persistence" fileName="${log.directory}/core-persistence.log"
+                             filePattern="${log.directory}/core-persistence-%d{yyyy-MM-dd}.log.gz"
+                             immediateFlush="false" append="true">
+      <PatternLayout>
+        <pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
+      </PatternLayout>
+      <Policies>
+        <TimeBasedTriggeringPolicy/>
+        <SizeBasedTriggeringPolicy size="250 MB"/>
+      </Policies>
+    </RollingRandomAccessFile>
+
+    <RollingRandomAccessFile name="rest" fileName="${log.directory}/core-rest.log"
+                             filePattern="${log.directory}/core-rest-%d{yyyy-MM-dd}.log.gz"
+                             immediateFlush="false" append="true">
+      <PatternLayout>
+        <pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
+      </PatternLayout>
+      <Policies>
+        <TimeBasedTriggeringPolicy/>
+        <SizeBasedTriggeringPolicy size="250 MB"/>
+      </Policies>
+    </RollingRandomAccessFile>
+
+    <RollingRandomAccessFile name="connid" fileName="${log.directory}/core-connid.log"
+                             filePattern="${log.directory}/core-connid-%d{yyyy-MM-dd}.log.gz"
+                             immediateFlush="false" append="true">
+      <PatternLayout>
+        <pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
+      </PatternLayout>
+      <Policies>
+        <TimeBasedTriggeringPolicy/>
+        <SizeBasedTriggeringPolicy size="250 MB"/>
+      </Policies>
+    </RollingRandomAccessFile>
+    
+  </appenders>
+  
+  <loggers>
+    
+    <asyncLogger name="org.apache.syncope.core.persistence" additivity="false" level="INFO">
+      <appender-ref ref="persistence"/>
+    </asyncLogger>
+    <asyncLogger name="org.springframework.orm" additivity="false" level="INFO">
+      <appender-ref ref="persistence"/>
+    </asyncLogger>
+    
+    <asyncLogger name="org.apache.syncope.core.rest" additivity="false" level="INFO">
+      <appender-ref ref="rest"/>
+    </asyncLogger>
+    <asyncLogger name="org.springframework.web" additivity="false" level="INFO">
+      <appender-ref ref="rest"/>
+    </asyncLogger>
+    <asyncLogger name="org.apache.http" additivity="false" level="INFO">
+      <appender-ref ref="rest"/>
+    </asyncLogger>
+    <asyncLogger name="org.apache.cxf" additivity="false" level="ERROR">
+      <appender-ref ref="rest"/>
+    </asyncLogger>
+    
+    <asyncLogger name="org.identityconnectors" additivity="false" level="DEBUG">
+      <appender-ref ref="connid"/>
+    </asyncLogger>
+    <asyncLogger name="net.tirasa.connid" additivity="false" level="DEBUG">
+      <appender-ref ref="connid"/>
+    </asyncLogger>
+    <asyncLogger name="org.apache.syncope.core.provisioning.api.ConnIdBundleManager" additivity="false" level="INFO">
+      <appender-ref ref="connid"/>
+    </asyncLogger>
+    
+    <asyncLogger name="org.apache.syncope" additivity="false" level="INFO">
+      <appender-ref ref="main"/>
+    </asyncLogger>
+    <asyncLogger name="org.apache.syncope.core.provisioning" additivity="false" level="INFO">
+      <appender-ref ref="main"/>
+    </asyncLogger>
+    <asyncLogger name="org.apache.syncope.core.logic" additivity="false" level="INFO">
+      <appender-ref ref="main"/>
+    </asyncLogger>
+    <asyncLogger name="org.springframework" additivity="false" level="INFO">
+      <appender-ref ref="main"/>
+    </asyncLogger>
+    <asyncLogger name="org.quartz" additivity="false" level="INFO">
+      <appender-ref ref="main"/>
+    </asyncLogger>
+    <asyncLogger name="org.activiti" additivity="false" level="ERROR">
+      <appender-ref ref="main"/>
+    </asyncLogger>
+    <asyncLogger name="org.apache.camel" additivity="false" level="ERROR">
+      <appender-ref ref="main"/>
+    </asyncLogger>
+    
+    <root level="INFO">
+      <appender-ref ref="main"/>
+    </root>
+    
+  </loggers>
+</configuration>


[2/3] syncope git commit: changed script permissions to executable

Posted by ma...@apache.org.
changed script permissions to executable


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

Branch: refs/heads/master
Commit: 73269550f5c4a9c68a0c9bd64e38b99cdb44ad5d
Parents: 6cd894a
Author: massi <ma...@tirasa.net>
Authored: Thu Nov 19 10:26:01 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Thu Nov 19 18:06:33 2015 +0100

----------------------------------------------------------------------
 client/cli/src/assemble/cli-zip.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/73269550/client/cli/src/assemble/cli-zip.xml
----------------------------------------------------------------------
diff --git a/client/cli/src/assemble/cli-zip.xml b/client/cli/src/assemble/cli-zip.xml
index f88a447..1e242a3 100644
--- a/client/cli/src/assemble/cli-zip.xml
+++ b/client/cli/src/assemble/cli-zip.xml
@@ -46,6 +46,7 @@ under the License.
         <include>syncopeadm.bat</include>
       </includes>
       <outputDirectory>${project.build.finalName}</outputDirectory>
+      <fileMode>0755</fileMode>
     </fileSet>
   </fileSets>
 
@@ -58,4 +59,4 @@ under the License.
     </dependencySet>
   </dependencySets>
   
-</assembly>
\ No newline at end of file
+</assembly>


[3/3] syncope git commit: changed question message

Posted by ma...@apache.org.
changed question message


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

Branch: refs/heads/master
Commit: 6cd894a4f319cfe9fcf3ce8c3cde3a99fe6e1c28
Parents: 24e4144
Author: massi <ma...@tirasa.net>
Authored: Tue Nov 17 17:15:27 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Thu Nov 19 18:06:33 2015 +0100

----------------------------------------------------------------------
 .../org/apache/syncope/client/cli/commands/user/UserList.java     | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/6cd894a4/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
index 42b5a23..881dc96 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
@@ -44,8 +44,7 @@ public class UserList extends AbstractUserCommand {
             try {
                 final Scanner scanIn = new Scanner(System.in);
                 System.out.println(
-                        "\nThis operation could be print a lot of information "
-                        + "on your screen. Do you want to continue? [yes/no]");
+                        "\nThis operation might produce very heavy output. Do you want to continue? [yes/no]");
                 final String answer = scanIn.nextLine();
                 if ("yes".equalsIgnoreCase(answer)) {
                     final PagedResult<UserTO> uResult = userSyncopeOperations.list();