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/04/12 10:10:58 UTC

[syncope] branch master updated: Upgrading H2

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 2cb9a06118 Upgrading H2
2cb9a06118 is described below

commit 2cb9a06118c3018102a54b1389bfc8bae3b9a604
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Tue Apr 12 12:10:48 2022 +0200

    Upgrading H2
---
 .../syncope/core/persistence/jpa/entity/JPAAnyAbout.java |  3 ++-
 .../src/main/resources/domains/MasterContent.xml         |  2 +-
 .../src/test/resources/domains/MasterContent.xml         |  4 ++--
 .../src/test/resources/domains/TwoContent.xml            |  2 +-
 .../syncope/fit/buildtools/cxf/ProvisioningImpl.java     | 16 ++++++++--------
 fit/build-tools/src/main/resources/testdb.sql            |  4 ++--
 .../java/org/apache/syncope/fit/core/PullTaskITCase.java |  4 +---
 pom.xml                                                  |  2 +-
 8 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyAbout.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyAbout.java
index 3806b8cbfb..1274d3e856 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyAbout.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyAbout.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.persistence.jpa.entity;
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Lob;
 import javax.persistence.ManyToOne;
@@ -42,6 +43,7 @@ public class JPAAnyAbout extends AbstractGeneratedKeyEntity implements AnyAbout
     @ManyToOne
     private JPAAnyType anyType;
 
+    @Column(name = "anyType_filter")
     @Lob
     private String filter;
 
@@ -76,5 +78,4 @@ public class JPAAnyAbout extends AbstractGeneratedKeyEntity implements AnyAbout
     public void set(final String filter) {
         this.filter = filter;
     }
-
 }
diff --git a/core/persistence-jpa/src/main/resources/domains/MasterContent.xml b/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
index bdc02aecec..702837b6a6 100644
--- a/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
@@ -96,7 +96,7 @@ we are happy to inform you that the password request was successfully executed f
   <Notification id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" active="1" recipientAttrName="email" selfAsRecipient="1" 
                 sender="admin@syncope.apache.org" subject="Password Reset request" template_id="requestPasswordReset" 
                 traceLevel="FAILURES"/> 
-  <AnyAbout id="a328f2e6-25e9-4cc1-badf-7425d7be4b39" anyType_id="USER" notification_id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" filter="token!=$null"/>
+  <AnyAbout id="a328f2e6-25e9-4cc1-badf-7425d7be4b39" anyType_id="USER" notification_id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" anyType_filter="token!=$null"/>
   <Notification_events notification_id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" event="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
   
   <Notification id="bef0c250-e8a7-4848-bb63-2564fc409ce2" active="1" recipientAttrName="email" selfAsRecipient="1" 
diff --git a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
index 817ce372de..05caca9153 100644
--- a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
@@ -1372,7 +1372,7 @@ $$ }&#10;
   <Notification id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" active="1" recipientAttrName="email" selfAsRecipient="1" 
                 sender="admin@syncope.apache.org" subject="Password Reset request" template_id="requestPasswordReset" 
                 traceLevel="FAILURES"/> 
-  <AnyAbout id="a328f2e6-25e9-4cc1-badf-7425d7be4b39" anyType_id="USER" notification_id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" filter="token!=$null"/>
+  <AnyAbout id="a328f2e6-25e9-4cc1-badf-7425d7be4b39" anyType_id="USER" notification_id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" anyType_filter="token!=$null"/>
   <Notification_events notification_id="e00945b5-1184-4d43-8e45-4318a8dcdfd4" event="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
   <Task DTYPE="NotificationTask" id="e1e520f0-2cbd-4e11-9a89-ea58a0f957e7" notification_id="e00945b5-1184-4d43-8e45-4318a8dcdfd4"
         sender="admin@prova.org" subject="Notification for SYNCOPE-81" executed="0"
@@ -1388,7 +1388,7 @@ $$ }&#10;
                 traceLevel="FAILURES"
                 recipientsFIQL="$groups==7"
                 recipientAttrName="email" active="1"/>
-  <AnyAbout id="2e2ee845-2abf-43c6-b543-49243a84e2f1" anyType_id="USER" notification_id="9e2b911c-25de-4c77-bcea-b86ed9451050" filter="fullname==*o*;fullname==*i*"/>
+  <AnyAbout id="2e2ee845-2abf-43c6-b543-49243a84e2f1" anyType_id="USER" notification_id="9e2b911c-25de-4c77-bcea-b86ed9451050" anyType_filter="fullname==*o*;fullname==*i*"/>
   <Notification_events notification_id="9e2b911c-25de-4c77-bcea-b86ed9451050" event="[CUSTOM]:[]:[]:[unexisting1]:[FAILURE]"/>
   <Notification_events notification_id="9e2b911c-25de-4c77-bcea-b86ed9451050" event="[CUSTOM]:[]:[]:[unexisting2]:[SUCCESS]"/>
 
diff --git a/core/persistence-jpa/src/test/resources/domains/TwoContent.xml b/core/persistence-jpa/src/test/resources/domains/TwoContent.xml
index 4b7e58f6ef..5d5db89062 100644
--- a/core/persistence-jpa/src/test/resources/domains/TwoContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/TwoContent.xml
@@ -86,7 +86,7 @@ we are happy to inform you that the password request was successfully executed f
   <Notification id="c74b4616-9c63-4350-b4bf-ae0077b1ae6a" active="1" recipientAttrName="email" selfAsRecipient="1" 
                 sender="admin@syncope.apache.org" subject="Password Reset request" template_id="requestPasswordReset" 
                 traceLevel="FAILURES"/> 
-  <AnyAbout id="0d4e37a1-a4f4-4865-afcb-4be01da3da53" anyType_id="USER" notification_id="c74b4616-9c63-4350-b4bf-ae0077b1ae6a" filter="token!=$null"/>
+  <AnyAbout id="0d4e37a1-a4f4-4865-afcb-4be01da3da53" anyType_id="USER" notification_id="c74b4616-9c63-4350-b4bf-ae0077b1ae6a" anyType_filter="token!=$null"/>
   <Notification_events notification_id="c74b4616-9c63-4350-b4bf-ae0077b1ae6a" event="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
   
   <Notification id="71769807-7f74-4dc3-ba61-e4a7a00eb8ad" active="1" recipientAttrName="email" selfAsRecipient="1" 
diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
index e22f2109a8..5c08e88ab5 100644
--- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
+++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
@@ -64,10 +64,10 @@ public class ProvisioningImpl implements Provisioning {
         try {
             conn = DataSourceUtils.getConnection(dataSource);
 
-            try (PreparedStatement statement = conn.prepareStatement("DELETE FROM user WHERE userId=?")) {
+            try (PreparedStatement statement = conn.prepareStatement("DELETE FROM testuser WHERE userId=?")) {
                 statement.setString(1, accountid);
 
-                String query = "DELETE FROM user WHERE userId='" + accountid + "';";
+                String query = "DELETE FROM testuser WHERE userId='" + accountid + "';";
                 LOG.debug("Execute query: " + query);
 
                 statement.executeUpdate();
@@ -156,9 +156,9 @@ public class ProvisioningImpl implements Provisioning {
 
             if (set.length() > 0) {
                 try (PreparedStatement statement =
-                        conn.prepareStatement("UPDATE user SET " + set.toString() + " WHERE userId=?")) {
+                        conn.prepareStatement("UPDATE testuser SET " + set.toString() + " WHERE userId=?")) {
                     statement.setString(1, accountid);
-                    String query = "UPDATE user SET " + set.toString() + " WHERE userId='" + accountid + "';";
+                    String query = "UPDATE testuser SET " + set.toString() + " WHERE userId='" + accountid + "';";
                     LOG.debug("Execute query: " + query);
 
                     statement.executeUpdate();
@@ -183,7 +183,7 @@ public class ProvisioningImpl implements Provisioning {
         Connection conn = null;
         try {
 
-            String queryString = "SELECT * FROM user" + (Optional.ofNullable(query)
+            String queryString = "SELECT * FROM testuser" + (Optional.ofNullable(query)
                     .map(operand -> " WHERE " + operand.toString()).orElse(""));
 
             queryString = queryString.replaceAll("__NAME__", "userId").
@@ -295,7 +295,7 @@ public class ProvisioningImpl implements Provisioning {
                         }
                     }
                 }
-                query = "INSERT INTO user (" + keys.toString() + ") VALUES (" + values.toString() + ')';
+                query = "INSERT INTO testuser (" + keys.toString() + ") VALUES (" + values.toString() + ')';
                 LOG.debug("Execute query: " + query);
                 statement.executeUpdate(query);
             }
@@ -338,10 +338,10 @@ public class ProvisioningImpl implements Provisioning {
         try {
             conn = DataSourceUtils.getConnection(dataSource);
             PreparedStatement statement =
-                    conn.prepareStatement("SELECT userId FROM user WHERE userId=?");
+                    conn.prepareStatement("SELECT userId FROM testuser WHERE userId=?");
             statement.setString(1, username);
 
-            final String query = "SELECT userId FROM user WHERE userId='" + username + "';";
+            final String query = "SELECT userId FROM testuser WHERE userId='" + username + "';";
 
             LOG.debug("Execute query: " + query);
 
diff --git a/fit/build-tools/src/main/resources/testdb.sql b/fit/build-tools/src/main/resources/testdb.sql
index 5ad534128d..c14847122b 100644
--- a/fit/build-tools/src/main/resources/testdb.sql
+++ b/fit/build-tools/src/main/resources/testdb.sql
@@ -36,7 +36,7 @@ INSERT INTO test2 VALUES ('verdi', 'password321', 'true');
 
 DROP TABLE testpull IF EXISTS;
 CREATE TABLE testpull (
-id CHAR(36) PRIMARY KEY,
+id VARCHAR(36) PRIMARY KEY,
 username VARCHAR(80),
 surname VARCHAR(80),
 mustChangePassword BOOLEAN,
@@ -51,7 +51,7 @@ location VARCHAR(80),
 deleted BOOLEAN DEFAULT FALSE,
 lastModification TIMESTAMP);
 
-CREATE TABLE user (
+CREATE TABLE testuser (
 capsId INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY,
 userId VARCHAR(30) NOT NULL,
 password VARCHAR(255) NOT NULL,
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index f67a0b746e..6d108df7f7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -49,7 +49,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.BasicAttribute;
-import javax.sql.DataSource;
 import javax.ws.rs.core.Response;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.SerializationUtils;
@@ -1048,8 +1047,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         assertEquals(1, executed.getExecutions().size());
 
         // asser for just one match
-        assertTrue(executed.getExecutions().get(0).getMessage().contains("[updated/failures]: 1/0"),
-                () -> executed.getExecutions().get(0).getMessage().substring(0, 55) + "...");
+        assertTrue(executed.getExecutions().get(0).getMessage().contains("[updated/failures]: 1/0"));
     }
 
     @Test
diff --git a/pom.xml b/pom.xml
index f590285582..6e547d801d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -449,7 +449,7 @@ under the License.
     <cas.version>6.5.2</cas.version>
     <cas-client.version>3.6.4</cas-client.version>
 
-    <h2.version>1.4.200</h2.version>
+    <h2.version>2.1.212</h2.version>
 
     <swagger-core.version>2.1.13</swagger-core.version>
     <swagger-ui.version>4.10.3</swagger-ui.version>