From 20fc430be0a7f1a5765dbd067a1dffe3da3cb2dc Mon Sep 17 00:00:00 2001 From: mposolda Date: Tue, 27 Apr 2021 18:21:33 +0200 Subject: [PATCH] KEYCLOAK-17874 Server cannot be started with oracle19cRAC --- .../resources/META-INF/jpa-changelog-13.0.0.xml | 7 ++++++- .../AbstractJsonFileImportMigrationTest.java | 5 ++++- .../migration/AbstractMigrationTest.java | 17 ++++++++++++++--- .../JsonFileImport198MigrationTest.java | 2 +- .../JsonFileImport255MigrationTest.java | 2 +- .../JsonFileImport343MigrationTest.java | 2 +- .../JsonFileImport483MigrationTest.java | 2 +- .../JsonFileImport903MigrationTest.java | 2 +- .../testsuite/migration/MigrationTest.java | 10 +++++----- .../migration-realm-3.4.3.Final.json | 3 ++- .../migration-realm-4.8.3.Final.json | 3 ++- .../migration-test/migration-realm-9.0.3.json | 4 +++- 12 files changed, 41 insertions(+), 18 deletions(-) diff --git a/model/jpa/src/main/resources/META-INF/jpa-changelog-13.0.0.xml b/model/jpa/src/main/resources/META-INF/jpa-changelog-13.0.0.xml index 5480086610..fbad156d7a 100644 --- a/model/jpa/src/main/resources/META-INF/jpa-changelog-13.0.0.xml +++ b/model/jpa/src/main/resources/META-INF/jpa-changelog-13.0.0.xml @@ -79,7 +79,12 @@ - + + + + UPDATE REALM_ATTRIBUTE SET VALUE_NEW = VALUE, VALUE = NULL + + diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractJsonFileImportMigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractJsonFileImportMigrationTest.java index a199cbbcd9..010ca0ecc0 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractJsonFileImportMigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractJsonFileImportMigrationTest.java @@ -48,9 +48,12 @@ public abstract class AbstractJsonFileImportMigrationTest extends AbstractMigrat } @Override - protected void testMigrationTo13_0_0() { + protected void testMigrationTo13_0_0(boolean testRealmAttributesMigration) { testDefaultRoles(migrationRealm); testDefaultRolesNameWhenTaken(); + if (testRealmAttributesMigration) { + testRealmAttributesMigration(); + } } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractMigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractMigrationTest.java index 418b562e70..077cac50aa 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractMigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractMigrationTest.java @@ -292,11 +292,14 @@ public abstract class AbstractMigrationTest extends AbstractKeycloakTest { testDeleteAccount(migrationRealm); } - protected void testMigrationTo13_0_0() { + protected void testMigrationTo13_0_0(boolean testRealmAttributesMigration) { testDefaultRoles(masterRealm); testDefaultRoles(migrationRealm); testDefaultRolesNameWhenTaken(); + if (testRealmAttributesMigration) { + testRealmAttributesMigration(); + } } protected void testDeleteAccount(RealmResource realm) { @@ -912,9 +915,11 @@ public abstract class AbstractMigrationTest extends AbstractKeycloakTest { protected void testMigrationTo9_x() { testMigrationTo9_0_0(); } - protected void testMigrationTo12_x() { + + // Realm attributes supported since Keycloak 3 + protected void testMigrationTo12_x(boolean testRealmAttributesMigration) { testMigrationTo12_0_0(); - testMigrationTo13_0_0(); + testMigrationTo13_0_0(testRealmAttributesMigration); } protected void testMigrationTo7_x(boolean supportedAuthzServices) { @@ -955,4 +960,10 @@ public abstract class AbstractMigrationTest extends AbstractKeycloakTest { // 'default-roles-migration2' name is used, we test that 'default-roles-migration2-1' is created instead assertThat(migrationRealm2.toRepresentation().getDefaultRole().getName(), equalTo("default-roles-migration2-1")); } + + protected void testRealmAttributesMigration() { + log.info("testing realm attributes migration"); + Map realmAttributes = migrationRealm.toRepresentation().getAttributes(); + assertEquals("custom_value", realmAttributes.get("custom_attribute")); + } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport198MigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport198MigrationTest.java index 3f4b39a38c..56998cbb94 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport198MigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport198MigrationTest.java @@ -70,7 +70,7 @@ public class JsonFileImport198MigrationTest extends AbstractJsonFileImportMigrat testMigrationTo7_x(false); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(false); } @Override diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport255MigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport255MigrationTest.java index 2075b0eb9f..966d766f80 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport255MigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport255MigrationTest.java @@ -64,7 +64,7 @@ public class JsonFileImport255MigrationTest extends AbstractJsonFileImportMigrat testMigrationTo7_x(true); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(false); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport343MigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport343MigrationTest.java index 5ea4c70f09..167080e7a0 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport343MigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport343MigrationTest.java @@ -63,7 +63,7 @@ public class JsonFileImport343MigrationTest extends AbstractJsonFileImportMigrat testMigrationTo7_x(true); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(true); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport483MigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport483MigrationTest.java index 9ab4ef34f8..c27e7e5f4b 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport483MigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport483MigrationTest.java @@ -56,7 +56,7 @@ public class JsonFileImport483MigrationTest extends AbstractJsonFileImportMigrat testMigrationTo7_x(true); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(true); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport903MigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport903MigrationTest.java index 26b8fb7ab9..0fb0365c4f 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport903MigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport903MigrationTest.java @@ -51,7 +51,7 @@ public class JsonFileImport903MigrationTest extends AbstractJsonFileImportMigrat @Test public void migration9_0_3Test() throws Exception { checkRealmsImported(); - testMigrationTo12_x(); + testMigrationTo12_x(true); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java index 9f2bcd6b4a..53ee876e94 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java @@ -61,7 +61,7 @@ public class MigrationTest extends AbstractMigrationTest { @Migration(versionFrom = "9.") public void migration9_xTest() throws Exception { testMigratedData(false); - testMigrationTo12_x(); + testMigrationTo12_x(true); // Always test offline-token login during migration test testOfflineTokenLogin(); @@ -76,7 +76,7 @@ public class MigrationTest extends AbstractMigrationTest { testMigrationTo7_x(true); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(true); // Always test offline-token login during migration test testOfflineTokenLogin(); @@ -92,7 +92,7 @@ public class MigrationTest extends AbstractMigrationTest { testMigrationTo7_x(true); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(true); // Always test offline-token login during migration test testOfflineTokenLogin(); @@ -109,7 +109,7 @@ public class MigrationTest extends AbstractMigrationTest { testMigrationTo7_x(true); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(false); // Always test offline-token login during migration test testOfflineTokenLogin(); @@ -127,7 +127,7 @@ public class MigrationTest extends AbstractMigrationTest { testMigrationTo7_x(false); testMigrationTo8_x(); testMigrationTo9_x(); - testMigrationTo12_x(); + testMigrationTo12_x(false); // Always test offline-token login during migration test testOfflineTokenLogin(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-3.4.3.Final.json b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-3.4.3.Final.json index 46e66eb3db..f757a3b2b1 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-3.4.3.Final.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-3.4.3.Final.json @@ -1630,7 +1630,8 @@ "actionTokenGeneratedByAdminLifespan" : "43200", "bruteForceProtected" : "false", "_browser_header.contentSecurityPolicy" : "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", - "waitIncrementSeconds" : "60" + "waitIncrementSeconds" : "60", + "custom_attribute": "custom_value" }, "keycloakVersion" : "7.2.0.GA" }, { diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-4.8.3.Final.json b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-4.8.3.Final.json index ac350b1e96..185a95a750 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-4.8.3.Final.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-4.8.3.Final.json @@ -1526,7 +1526,8 @@ "bruteForceProtected" : "false", "_browser_header.contentSecurityPolicy" : "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", "waitIncrementSeconds" : "60", - "offlineSessionMaxLifespanEnabled" : "false" + "offlineSessionMaxLifespanEnabled" : "false", + "custom_attribute": "custom_value" }, "keycloakVersion" : "4.8.3.Final", "userManagedAccessAllowed" : false diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-9.0.3.json b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-9.0.3.json index 8013ccefea..bafb31c45b 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-9.0.3.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-9.0.3.json @@ -1705,7 +1705,9 @@ "resetCredentialsFlow" : "reset credentials", "clientAuthenticationFlow" : "clients", "dockerAuthenticationFlow" : "docker auth", - "attributes" : { }, + "attributes" : { + "custom_attribute": "custom_value" + }, "keycloakVersion" : "9.0.3", "userManagedAccessAllowed" : false }, {