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 2022/02/09 13:50:03 UTC

[syncope] branch master updated: Enabling GH actions for Oracle DB (#311)

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/master by this push:
     new 892e5bb  Enabling GH actions for Oracle DB (#311)
892e5bb is described below

commit 892e5bba130e2c6dcc7e5a6a4a123e46ba9440b3
Author: Francesco Chicchiriccò <il...@users.noreply.github.com>
AuthorDate: Wed Feb 9 14:49:54 2022 +0100

    Enabling GH actions for Oracle DB (#311)
---
 .github/workflows/oracle.yml                       | 47 ++++++++++++++++++++++
 .../java/job/report/AuditReportlet.java            |  7 +++-
 fit/core-reference/pom.xml                         | 23 +++++------
 .../src/main/resources/core-oracle.properties      |  2 +-
 .../src/main/resources/oracle/init.sql             | 43 --------------------
 .../apache/syncope/fit/core/UserSelfITCase.java    |  7 +---
 6 files changed, 64 insertions(+), 65 deletions(-)

diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml
new file mode 100644
index 0000000..8c24770
--- /dev/null
+++ b/.github/workflows/oracle.yml
@@ -0,0 +1,47 @@
+# 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
+name: "Oracle"
+
+on:
+  push:
+    branches: ['master', 'pr-*']
+  pull_request:
+    # The branches below must be a subset of the branches above
+    branches: [master]
+  schedule:
+    - cron: '0 13 * * 4'
+
+jobs:
+  Oracle:
+    runs-on: ubuntu-latest
+
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v2
+    - name: Setup Java JDK
+      uses: actions/setup-java@v1.4.3
+      with:
+        java-version: 11
+    - uses: actions/cache@v2.1.1
+      with:
+        path: ~/.m2
+        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+        restore-keys: ${{ runner.os }}-m2
+    - name: Build
+      run: mvn -U -T 1C -P 'skipTests,all'
+    - name: 'Integration Tests: Oracle'
+      run: mvn -f fit/core-reference/pom.xml -P oracle-it -Dinvoker.streamLogs=true -Dmodernizer.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
index beccfc0..1d51975 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
@@ -111,8 +111,11 @@ public class AuditReportlet extends AbstractReportlet {
             }
 
             handler.startElement("", "", "throwable", null);
-            char[] throwable = row.get("THROWABLE").toString().toCharArray();
-            handler.characters(throwable, 0, throwable.length);
+            Object throwableValue = row.get("THROWABLE");
+            if (throwableValue != null) {
+                char[] throwable = throwableValue.toString().toCharArray();
+                handler.characters(throwable, 0, throwable.length);
+            }
             handler.endElement("", "", "throwable");
 
             handler.endElement("", "", "event");
diff --git a/fit/core-reference/pom.xml b/fit/core-reference/pom.xml
index b3dc72d..4f645fc 100644
--- a/fit/core-reference/pom.xml
+++ b/fit/core-reference/pom.xml
@@ -1140,10 +1140,10 @@ under the License.
         </plugins>
       </build>
     </profile>
-    
+
     <profile>
       <id>oracle-it</id>
-      
+
       <properties>
         <jdbcdriver.groupId>com.oracle.database.jdbc</jdbcdriver.groupId>
         <jdbcdriver.artifactId>ojdbc11</jdbcdriver.artifactId>
@@ -1183,22 +1183,17 @@ under the License.
               <images>
                 <image>
                   <alias>oracle</alias>
-                  <name>oracleinanutshell/oracle-xe-11g:latest</name>
+                  <name>gvenzl/oracle-xe:18-slim</name>
                   <run>
                     <env>
-                      <ORACLE_ALLOW_REMOTE>true</ORACLE_ALLOW_REMOTE>
-                      <ORACLE_ENABLE_XDB>true</ORACLE_ENABLE_XDB>
-                      <ORACLE_DISABLE_ASYNCH_IO>true</ORACLE_DISABLE_ASYNCH_IO>
+                      <ORACLE_PASSWORD>password</ORACLE_PASSWORD>
+                      <APP_USER>syncope</APP_USER>
+                      <APP_USER_PASSWORD>syncope</APP_USER_PASSWORD>
                     </env>
                     <wait>
-                      <log>Disconnected from Oracle Database 11g Express Edition</log>
+                      <log>DATABASE IS READY TO USE</log>
                       <time>120000</time>
-                    </wait>                
-                    <volumes>
-                      <bind>
-                        <volume>${project.build.outputDirectory}/oracle/:/docker-entrypoint-initdb.d/</volume>
-                      </bind>
-                    </volumes>
+                    </wait>
                   </run>
                 </image>
               </images>
@@ -1228,7 +1223,7 @@ under the License.
               </execution>
             </executions>
           </plugin>
-          
+
           <plugin>
             <groupId>org.codehaus.cargo</groupId>
             <artifactId>cargo-maven3-plugin</artifactId>
diff --git a/fit/core-reference/src/main/resources/core-oracle.properties b/fit/core-reference/src/main/resources/core-oracle.properties
index 2d40afa..2ddf772 100644
--- a/fit/core-reference/src/main/resources/core-oracle.properties
+++ b/fit/core-reference/src/main/resources/core-oracle.properties
@@ -17,7 +17,7 @@
 
 persistence.domain[0].key=Master
 persistence.domain[0].jdbcDriver=oracle.jdbc.OracleDriver
-persistence.domain[0].jdbcURL=jdbc:oracle:thin:@${DB_CONTAINER_IP}:1521:XE
+persistence.domain[0].jdbcURL=jdbc:oracle:thin:@${DB_CONTAINER_IP}:1521/XEPDB1
 persistence.domain[0].schema=SYNCOPE
 persistence.domain[0].dbUsername=syncope
 persistence.domain[0].dbPassword=syncope
diff --git a/fit/core-reference/src/main/resources/oracle/init.sql b/fit/core-reference/src/main/resources/oracle/init.sql
deleted file mode 100644
index e45677a..0000000
--- a/fit/core-reference/src/main/resources/oracle/init.sql
+++ /dev/null
@@ -1,43 +0,0 @@
--- 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.
-
-CREATE TABLESPACE SYNCOPE
-  DATAFILE 'SYNCOPE.dat'
-  SIZE 10M AUTOEXTEND on;
-
-CREATE TEMPORARY TABLESPACE SYNCOPE_TEMP
-  TEMPFILE 'SYNCOPE_TEMP.dat'
-  SIZE 5M AUTOEXTEND on;
-
-CREATE USER syncope
-  IDENTIFIED BY syncope
-  DEFAULT TABLESPACE SYNCOPE
-  TEMPORARY TABLESPACE SYNCOPE_TEMP
-  QUOTA 256M on SYNCOPE;
-
-GRANT create session TO syncope;
-GRANT create table TO syncope;
-GRANT create view TO syncope;
-GRANT create any trigger TO syncope;
-GRANT create any procedure TO syncope;
-GRANT create sequence TO syncope;
-GRANT create synonym TO syncope;
-
-CREATE DATABASE syncope
-  CHARACTER SET US7ASCII
-  DEFAULT TABLESPACE SYNCOPE
-  DEFAULT TEMPORARY TABLESPACE SYNCOPE_TEMP
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java
index 1ad768d..687d281 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java
@@ -329,9 +329,6 @@ public class UserSelfITCase extends AbstractITCase {
         UserTO read = authClient.self().getRight();
         assertNotNull(read);
 
-        // SYNCOPE-1293:get users with token not null before requesting password reset
-        PagedResult<UserTO> before = userService.search(new AnyQuery.Builder().fiql("token!=$null").build());
-
         // 3. request password reset (as anonymous) providing the expected security answer
         SyncopeClient anonClient = clientFactory.create();
         try {
@@ -350,8 +347,8 @@ public class UserSelfITCase extends AbstractITCase {
                 // ignore
             }
         }
-        PagedResult<UserTO> after = userService.search(new AnyQuery.Builder().fiql("token!=$null").build());
-        assertEquals(before.getTotalCount() + 1, after.getTotalCount());
+        PagedResult<UserTO> tokenized = userService.search(new AnyQuery.Builder().fiql("token!=$null").build());
+        assertTrue(tokenized.getResult().stream().anyMatch(u -> user.getUsername().equals(u.getUsername())));
 
         // 4. get token (normally sent via e-mail, now reading as admin)
         String token = userService.read(read.getKey()).getToken();