syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/3] syncope git commit: [SYNCOPE-620] Added IT profiles for MySQL and PostgreSQL
Date Mon, 09 Feb 2015 16:20:35 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 61f6395a6 -> cc74bb6c4


[SYNCOPE-620] Added IT profiles for MySQL and PostgreSQL


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

Branch: refs/heads/2_0_X
Commit: 498eb7ecd43143100700326bc9af14bea7ff0436
Parents: 61f6395
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Fri Feb 6 18:45:23 2015 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Fri Feb 6 18:45:23 2015 +0100

----------------------------------------------------------------------
 syncope620/fit/server-reference/pom.xml         | 66 ++++++++++++++++++++
 .../main/resources/mysql/persistence.properties | 29 +++++++++
 .../resources/postgres/persistence.properties   | 28 +++++++++
 .../server/reference/ConfigurationITCase.java   | 39 +++++++++++-
 4 files changed, 160 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/498eb7ec/syncope620/fit/server-reference/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/fit/server-reference/pom.xml b/syncope620/fit/server-reference/pom.xml
index 852b0b6..034fe69 100644
--- a/syncope620/fit/server-reference/pom.xml
+++ b/syncope620/fit/server-reference/pom.xml
@@ -350,6 +350,72 @@ under the License.
   
   <profiles>
     <profile>
+      <id>postgres-it</id>
+
+      <properties>
+        <jdbcdriver.groupId>org.postgresql</jdbcdriver.groupId>
+        <jdbcdriver.artifactId>postgresql</jdbcdriver.artifactId>
+      </properties>
+
+      <dependencies>
+        <dependency>
+          <groupId>org.postgresql</groupId>
+          <artifactId>postgresql</artifactId>
+          <version>9.4-1200-jdbc41</version>
+          <scope>test</scope>
+        </dependency>
+      </dependencies>
+
+      <build>
+        <defaultGoal>clean verify</defaultGoal>
+
+        <resources>
+          <resource>
+            <directory>src/main/resources</directory>
+            <filtering>true</filtering>
+          </resource>
+          <resource>
+            <directory>src/main/resources/postgres</directory>
+            <filtering>true</filtering>
+          </resource>
+        </resources>
+      </build>
+    </profile>
+    
+    <profile>
+      <id>mysql-it</id>
+
+      <properties>
+        <jdbcdriver.groupId>mysql</jdbcdriver.groupId>
+        <jdbcdriver.artifactId>mysql-connector-java</jdbcdriver.artifactId>
+      </properties>
+
+      <dependencies>
+        <dependency>
+          <groupId>mysql</groupId>
+          <artifactId>mysql-connector-java</artifactId>
+          <version>5.1.34</version>
+          <scope>test</scope>
+        </dependency>
+      </dependencies>
+      
+      <build>
+        <defaultGoal>clean verify</defaultGoal>
+
+        <resources>
+          <resource>
+            <directory>src/main/resources</directory>
+            <filtering>true</filtering>
+          </resource>
+          <resource>
+            <directory>src/main/resources/mysql</directory>
+            <filtering>true</filtering>
+          </resource>
+        </resources>
+      </build>
+    </profile>
+    
+    <profile>
       <id>debug</id>
 
       <properties>

http://git-wip-us.apache.org/repos/asf/syncope/blob/498eb7ec/syncope620/fit/server-reference/src/main/resources/mysql/persistence.properties
----------------------------------------------------------------------
diff --git a/syncope620/fit/server-reference/src/main/resources/mysql/persistence.properties
b/syncope620/fit/server-reference/src/main/resources/mysql/persistence.properties
new file mode 100644
index 0000000..b5be6b7
--- /dev/null
+++ b/syncope620/fit/server-reference/src/main/resources/mysql/persistence.properties
@@ -0,0 +1,29 @@
+# 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.
+content.directory=${conf.directory}
+jpa.driverClassName=com.mysql.jdbc.Driver
+jpa.url=jdbc:mysql://localhost:3306/syncope?characterEncoding=UTF-8
+jpa.username=syncope
+jpa.password=syncope
+jpa.dialect=org.apache.openjpa.jdbc.sql.MySQLDictionary
+jpa.pool.validationQuery=SELECT 1
+#note: other connection pool settings can also be configured here, see persistenceContext.xml
+quartz.jobstore=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+quartz.scheduler.idleWaitTime=5000
+quartz.sql=tables_mysql.sql
+audit.sql=audit.sql
+database.schema=

http://git-wip-us.apache.org/repos/asf/syncope/blob/498eb7ec/syncope620/fit/server-reference/src/main/resources/postgres/persistence.properties
----------------------------------------------------------------------
diff --git a/syncope620/fit/server-reference/src/main/resources/postgres/persistence.properties
b/syncope620/fit/server-reference/src/main/resources/postgres/persistence.properties
new file mode 100644
index 0000000..664afd0
--- /dev/null
+++ b/syncope620/fit/server-reference/src/main/resources/postgres/persistence.properties
@@ -0,0 +1,28 @@
+# 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.
+content.directory=${conf.directory}
+jpa.driverClassName=org.postgresql.Driver
+jpa.url=jdbc:postgresql://localhost:5432/syncope
+jpa.username=syncope
+jpa.password=syncope
+jpa.dialect=org.apache.openjpa.jdbc.sql.PostgresDictionary
+jpa.pool.validationQuery=SELECT 1
+#note: other connection pool settings can also be configured here, see persistenceContext.xml
+quartz.jobstore=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
+quartz.sql=tables_postgres.sql
+audit.sql=audit.sql
+database.schema=

http://git-wip-us.apache.org/repos/asf/syncope/blob/498eb7ec/syncope620/fit/server-reference/src/test/java/org/apache/syncope/fit/server/reference/ConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/syncope620/fit/server-reference/src/test/java/org/apache/syncope/fit/server/reference/ConfigurationITCase.java
b/syncope620/fit/server-reference/src/test/java/org/apache/syncope/fit/server/reference/ConfigurationITCase.java
index 0945c90..8d2d0fb 100644
--- a/syncope620/fit/server-reference/src/test/java/org/apache/syncope/fit/server/reference/ConfigurationITCase.java
+++ b/syncope620/fit/server-reference/src/test/java/org/apache/syncope/fit/server/reference/ConfigurationITCase.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.fit.server.reference;
 
+import static org.apache.commons.lang3.StringUtils.isEmpty;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -27,10 +28,13 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.SyncopeConstants;
@@ -152,6 +156,37 @@ public class ConfigurationITCase extends AbstractITCase {
         }
     }
 
+    private static String[] substringsBetween(final String str, final String open, final
String close) {
+        if (str == null || isEmpty(open) || isEmpty(close)) {
+            return null;
+        }
+        final int strLen = str.length();
+        if (strLen == 0) {
+            return ArrayUtils.EMPTY_STRING_ARRAY;
+        }
+        final int closeLen = close.length();
+        final int openLen = open.length();
+        final List<String> list = new ArrayList<>();
+        int pos = 0;
+        while (pos < strLen - closeLen) {
+            int start = StringUtils.indexOfIgnoreCase(str, open, pos);
+            if (start < 0) {
+                break;
+            }
+            start += openLen;
+            final int end = StringUtils.indexOfIgnoreCase(str, close, start);
+            if (end < 0) {
+                break;
+            }
+            list.add(str.substring(start, end));
+            pos = end + closeLen;
+        }
+        if (list.isEmpty()) {
+            return null;
+        }
+        return list.toArray(new String[list.size()]);
+    }
+
     @Test
     public void issueSYNCOPE629() throws IOException {
         PlainSchemaTO membershipKey = new PlainSchemaTO();
@@ -184,7 +219,7 @@ public class ConfigurationITCase extends AbstractITCase {
             assertFalse(configExport.isEmpty());
             assertTrue(configExport.length() > 1000);
 
-            String[] result = StringUtils.substringsBetween(configExport, "<RPLAINATTRTEMPLATE",
"/>");
+            String[] result = substringsBetween(configExport, "<RPLAINATTRTEMPLATE", "/>");
             assertNotNull(result);
             boolean rattrExists = false;
             for (String entry : result) {
@@ -194,7 +229,7 @@ public class ConfigurationITCase extends AbstractITCase {
             }
             assertTrue(rattrExists);
 
-            result = StringUtils.substringsBetween(configExport, "<MPLAINATTRTEMPLATE",
"/>");
+            result = substringsBetween(configExport, "<MPLAINATTRTEMPLATE", "/>");
             assertNotNull(result);
             boolean mattrExists = false;
             for (String entry : result) {


Mime
View raw message