From 27e74c41fff7bb95b0645d014ae61f029e031c3b Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Thu, 14 Oct 2021 15:43:07 -0300 Subject: [PATCH] [KEYCLOAK-19459] - Enabling ClientSearchTest to Dist.X --- ...eycloakQuarkusServerDeployableContainer.java | 2 +- .../admin/client/ClientSearchTest.java | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java index aa71147567..85b9e6176a 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java @@ -314,7 +314,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta Files.copy(zipStream, providersDir.toPath().resolve(archive.getName()), StandardCopyOption.REPLACE_EXISTING); } - private void restartServer(boolean isReaugmentation) throws Exception { + public void restartServer(boolean isReaugmentation) throws Exception { if(isReaugmentation) { forceReaugmentation = true; } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/ClientSearchTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/ClientSearchTest.java index f7e2fd49eb..238b324e28 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/ClientSearchTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/ClientSearchTest.java @@ -27,10 +27,12 @@ import org.keycloak.models.ClientProvider; import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.testsuite.arquillian.AuthServerTestEnricher; import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude; +import org.keycloak.testsuite.arquillian.containers.KeycloakQuarkusServerDeployableContainer; import org.wildfly.extras.creaper.core.online.OnlineManagementClient; import org.wildfly.extras.creaper.core.online.operations.admin.Administration; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.stream.Collectors; @@ -43,7 +45,7 @@ import static org.keycloak.testsuite.arquillian.annotation.AuthServerContainerEx /** * @author Vaclav Muzikar */ -@AuthServerContainerExclude({REMOTE, QUARKUS}) +@AuthServerContainerExclude({REMOTE}) public class ClientSearchTest extends AbstractClientTest { @ArquillianResource protected ContainerController controller; @@ -151,6 +153,15 @@ public class ClientSearchTest extends AbstractClientTest { String s = "\\\"" + String.join("\\\",\\\"", searchableAttributes) + "\\\""; executeCli("/subsystem=keycloak-server/spi=client:add()", "/subsystem=keycloak-server/spi=client/provider=jpa/:add(properties={searchableAttributes => \"[" + s + "]\"},enabled=true)"); + } else if(suiteContext.getAuthServerInfo().isQuarkus()) { + searchableAttributes = Arrays.stream(searchableAttributes) + .map(a -> a.replace(" ", "\\ ").replace("\"", "\\\\\\\"")) + .toArray(String[]::new); + String s = String.join(",",searchableAttributes); + controller.stop(suiteContext.getAuthServerInfo().getQualifier()); + KeycloakQuarkusServerDeployableContainer container = (KeycloakQuarkusServerDeployableContainer)suiteContext.getAuthServerInfo().getArquillianContainer().getDeployableContainer(); + container.setRuntimeProperties(Collections.singletonList("--spi-client-jpa-searchable-attributes=\""+ s + "\"")); + controller.start(suiteContext.getAuthServerInfo().getQualifier()); } else { throw new RuntimeException("Don't know how to config"); } @@ -167,6 +178,10 @@ public class ClientSearchTest extends AbstractClientTest { controller.start(suiteContext.getAuthServerInfo().getQualifier()); } else if (suiteContext.getAuthServerInfo().isJBossBased()) { executeCli("/subsystem=keycloak-server/spi=client:remove"); + } else if(suiteContext.getAuthServerInfo().isQuarkus()) { + KeycloakQuarkusServerDeployableContainer container = (KeycloakQuarkusServerDeployableContainer)suiteContext.getAuthServerInfo().getArquillianContainer().getDeployableContainer(); + container.setRuntimeProperties(Collections.emptyList()); + container.restartServer(false); } else { throw new RuntimeException("Don't know how to config"); }