migration tests - minor fix
This commit is contained in:
parent
f922164a88
commit
2b6811a366
5 changed files with 55 additions and 39 deletions
|
@ -83,7 +83,7 @@ public class ApiUtil {
|
||||||
|
|
||||||
public static ClientResource findClientResourceByName(RealmResource realm, String name) {
|
public static ClientResource findClientResourceByName(RealmResource realm, String name) {
|
||||||
for (ClientRepresentation c : realm.clients().findAll()) {
|
for (ClientRepresentation c : realm.clients().findAll()) {
|
||||||
if (c.getName().equals(name)) {
|
if (name.equals(c.getName())) {
|
||||||
return realm.clients().get(c.getId());
|
return realm.clients().get(c.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ public class ApiUtil {
|
||||||
|
|
||||||
public static ClientResource findClientByClientId(RealmResource realm, String clientId) {
|
public static ClientResource findClientByClientId(RealmResource realm, String clientId) {
|
||||||
for (ClientRepresentation c : realm.clients().findAll()) {
|
for (ClientRepresentation c : realm.clients().findAll()) {
|
||||||
if (c.getClientId().equals(clientId)) {
|
if (clientId.equals(c.getClientId())) {
|
||||||
return realm.clients().get(c.getId());
|
return realm.clients().get(c.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
import org.keycloak.testsuite.AbstractAuthTest;
|
||||||
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.events.EventsListenerProviderFactory;
|
import org.keycloak.testsuite.events.EventsListenerProviderFactory;
|
||||||
import org.keycloak.testsuite.util.AdminEventPaths;
|
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
|
// returns UserRepresentation retrieved from server, with all fields, including id
|
||||||
protected UserRepresentation getFullUserRep(String userName) {
|
protected UserRepresentation getFullUserRep(String userName) {
|
||||||
|
// the search returns all users who has userName contained in their username.
|
||||||
List<UserRepresentation> results = testRealmResource().users().search(userName, null, null, null, null, null);
|
List<UserRepresentation> 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);
|
UserRepresentation result = null;
|
||||||
return results.get(0);
|
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) {
|
protected String createOidcClient(String name) {
|
||||||
|
|
|
@ -829,6 +829,7 @@
|
||||||
}, {
|
}, {
|
||||||
"id" : "d89c5b0f-bee6-4a97-86b1-118efa21e508",
|
"id" : "d89c5b0f-bee6-4a97-86b1-118efa21e508",
|
||||||
"clientId" : "master-test-client",
|
"clientId" : "master-test-client",
|
||||||
|
"name" : "master-test-client",
|
||||||
"surrogateAuthRequired" : false,
|
"surrogateAuthRequired" : false,
|
||||||
"enabled" : true,
|
"enabled" : true,
|
||||||
"clientAuthenticatorType" : "client-secret",
|
"clientAuthenticatorType" : "client-secret",
|
||||||
|
@ -1898,6 +1899,7 @@
|
||||||
}, {
|
}, {
|
||||||
"id" : "d8262b3f-02e4-409e-97fc-ee5532e0801e",
|
"id" : "d8262b3f-02e4-409e-97fc-ee5532e0801e",
|
||||||
"clientId" : "migration-test-client",
|
"clientId" : "migration-test-client",
|
||||||
|
"name" : "migration-test-client",
|
||||||
"surrogateAuthRequired" : false,
|
"surrogateAuthRequired" : false,
|
||||||
"enabled" : true,
|
"enabled" : true,
|
||||||
"clientAuthenticatorType" : "client-secret",
|
"clientAuthenticatorType" : "client-secret",
|
||||||
|
|
|
@ -933,6 +933,7 @@
|
||||||
}, {
|
}, {
|
||||||
"id" : "6268e266-346b-46ba-8408-fe17b5792b10",
|
"id" : "6268e266-346b-46ba-8408-fe17b5792b10",
|
||||||
"clientId" : "master-test-client",
|
"clientId" : "master-test-client",
|
||||||
|
"name" : "master-test-client",
|
||||||
"surrogateAuthRequired" : false,
|
"surrogateAuthRequired" : false,
|
||||||
"enabled" : true,
|
"enabled" : true,
|
||||||
"clientAuthenticatorType" : "client-secret",
|
"clientAuthenticatorType" : "client-secret",
|
||||||
|
@ -2085,6 +2086,7 @@
|
||||||
}, {
|
}, {
|
||||||
"id" : "f66de6ed-4fd8-47b6-a2db-85ab8ed88874",
|
"id" : "f66de6ed-4fd8-47b6-a2db-85ab8ed88874",
|
||||||
"clientId" : "migration-test-client",
|
"clientId" : "migration-test-client",
|
||||||
|
"name" : "migration-test-client",
|
||||||
"surrogateAuthRequired" : false,
|
"surrogateAuthRequired" : false,
|
||||||
"enabled" : true,
|
"enabled" : true,
|
||||||
"clientAuthenticatorType" : "client-secret",
|
"clientAuthenticatorType" : "client-secret",
|
||||||
|
|
|
@ -458,6 +458,9 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
|
@ -494,6 +497,7 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue