From c3e4f220c6d9e9f130abdec822115d5f24c4d86c Mon Sep 17 00:00:00 2001 From: Lukas Hanusovsky Date: Fri, 27 Mar 2026 09:10:54 +0100 Subject: [PATCH] Migration Tool - Updating MigrateTest. Signed-off-by: Lukas Hanusovsky --- .../org/keycloak/test/migration/MigrateTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/migration-util/src/main/java/org/keycloak/test/migration/MigrateTest.java b/tests/migration-util/src/main/java/org/keycloak/test/migration/MigrateTest.java index 149b0c3e24e8..ccb82ede2046 100644 --- a/tests/migration-util/src/main/java/org/keycloak/test/migration/MigrateTest.java +++ b/tests/migration-util/src/main/java/org/keycloak/test/migration/MigrateTest.java @@ -38,6 +38,7 @@ public class MigrateTest { Path rootPath = getRootPath(); Path oldTestsuitePath = rootPath.resolve("testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite").toAbsolutePath(); Path newBaseTestPath = rootPath.resolve("tests/base/src/test/java/org/keycloak/tests").toAbsolutePath(); + Path newWebAuthnTestPath = rootPath.resolve("tests/webauthn/src/test/java/org/keycloak/tests").toAbsolutePath(); public static void main(String[] args) throws Exception { MigrateTest migrateTest = new MigrateTest(); @@ -54,11 +55,12 @@ public void migrate(String test) throws Exception { testPath = getOldTestsuitePath(testPath); } - Path destinationPath = getDestination(testPath); + boolean hasWebAuthnPath = testPath.startsWith(oldTestsuitePath + "/webauthn"); + Path destinationPath = getDestination(testPath, hasWebAuthnPath); System.out.println("Root: " + rootPath); System.out.println("Old tests: " + oldTestsuitePath); - System.out.println("Migrated tests: " + newBaseTestPath); + System.out.println("Migrated tests: " + (hasWebAuthnPath ? newWebAuthnTestPath : newBaseTestPath)); System.out.println(); System.out.println("Migrating test: " + testPath); System.out.println("To: " + destinationPath); @@ -120,8 +122,8 @@ private void validatePaths(Path testPath, Path destinationPath) throws IOExcepti throw new RuntimeException("Test file not found"); } - if (!destinationPath.startsWith(newBaseTestPath.toString())) { - throw new RuntimeException("Can only migrate tests to " + newBaseTestPath); + if (!destinationPath.startsWith(newBaseTestPath.toString()) && !destinationPath.startsWith(newWebAuthnTestPath.toString())) { + throw new RuntimeException("Can only migrate tests to " + newBaseTestPath + "or to " + newBaseTestPath); } Path destinationDir = destinationPath.resolve(".."); @@ -131,8 +133,9 @@ private void validatePaths(Path testPath, Path destinationPath) throws IOExcepti } } - private Path getDestination(Path testPath) { - return Path.of(testPath.toString().replace(oldTestsuitePath.toString(), newBaseTestPath.toString())); + private Path getDestination(Path testPath, boolean hasWebAuthnPath) { + return Path.of(testPath.toString().replace(oldTestsuitePath.toString(), + hasWebAuthnPath ? newWebAuthnTestPath.toString() : newBaseTestPath.toString())); } private List readFileToList(Path path) throws IOException {