diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ApiUtil.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ApiUtil.java index 50a5027248..97edc00361 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ApiUtil.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ApiUtil.java @@ -83,7 +83,7 @@ public class ApiUtil { public static ClientResource findClientResourceByName(RealmResource realm, String name) { for (ClientRepresentation c : realm.clients().findAll()) { - if (c.getName().equals(name)) { + if (name.equals(c.getName())) { return realm.clients().get(c.getId()); } } @@ -92,7 +92,7 @@ public class ApiUtil { public static ClientResource findClientByClientId(RealmResource realm, String clientId) { for (ClientRepresentation c : realm.clients().findAll()) { - if (c.getClientId().equals(clientId)) { + if (clientId.equals(c.getClientId())) { return realm.clients().get(c.getId()); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/AbstractClientTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/AbstractClientTest.java index 75818b2427..02a2cdb3d4 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/AbstractClientTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/AbstractClientTest.java @@ -27,6 +27,7 @@ import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.testsuite.AbstractAuthTest; +import org.keycloak.testsuite.Assert; import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.events.EventsListenerProviderFactory; import org.keycloak.testsuite.util.AdminEventPaths; @@ -70,9 +71,16 @@ public abstract class AbstractClientTest extends AbstractAuthTest { // returns UserRepresentation retrieved from server, with all fields, including id protected UserRepresentation getFullUserRep(String userName) { + // the search returns all users who has userName contained in their username. List results = testRealmResource().users().search(userName, null, null, null, null, null); - if (results.size() != 1) throw new RuntimeException("Did not find single user with username " + userName); - return results.get(0); + UserRepresentation result = null; + for (UserRepresentation user : results) { + if (userName.equals(user.getUsername())) { + result = user; + } + } + Assert.assertNotNull("Did not find user with username " + userName, result); + return result; } protected String createOidcClient(String name) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-1.9.8.Final.json b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-1.9.8.Final.json index 4194a95abf..ba783b4d99 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-1.9.8.Final.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-1.9.8.Final.json @@ -829,6 +829,7 @@ }, { "id" : "d89c5b0f-bee6-4a97-86b1-118efa21e508", "clientId" : "master-test-client", + "name" : "master-test-client", "surrogateAuthRequired" : false, "enabled" : true, "clientAuthenticatorType" : "client-secret", @@ -1898,6 +1899,7 @@ }, { "id" : "d8262b3f-02e4-409e-97fc-ee5532e0801e", "clientId" : "migration-test-client", + "name" : "migration-test-client", "surrogateAuthRequired" : false, "enabled" : true, "clientAuthenticatorType" : "client-secret", diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-2.2.1.Final.json b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-2.2.1.Final.json index 7011d1b504..db1c768f24 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-2.2.1.Final.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-2.2.1.Final.json @@ -933,6 +933,7 @@ }, { "id" : "6268e266-346b-46ba-8408-fe17b5792b10", "clientId" : "master-test-client", + "name" : "master-test-client", "surrogateAuthRequired" : false, "enabled" : true, "clientAuthenticatorType" : "client-secret", @@ -2085,6 +2086,7 @@ }, { "id" : "f66de6ed-4fd8-47b6-a2db-85ab8ed88874", "clientId" : "migration-test-client", + "name" : "migration-test-client", "surrogateAuthRequired" : false, "enabled" : true, "clientAuthenticatorType" : "client-secret", diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index ea63ca4bb1..4f4f42ddd6 100755 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -458,42 +458,46 @@ - - maven-dependency-plugin - - - unpack-migrated-auth-server-jboss - generate-resources - - unpack - - - - - org.keycloak.testsuite - integration-arquillian-migration-server - ${project.version} - zip - - - ${containers.home} - true - - - - - - maven-surefire-plugin - - - ${migrated.auth.server.version} - true - ${containers.home}/keycloak-${migrated.auth.server.version} - ${migration.import.props.previous} - - - + + + + maven-dependency-plugin + + + unpack-migrated-auth-server-jboss + generate-resources + + unpack + + + + + org.keycloak.testsuite + integration-arquillian-migration-server + ${project.version} + zip + + + ${containers.home} + true + + + + + + maven-surefire-plugin + + + ${migrated.auth.server.version} + true + ${containers.home}/keycloak-${migrated.auth.server.version} + ${migration.import.props.previous} + + + + +