[KEYCLOAK-19459] - Enabling ClientSearchTest to Dist.X

This commit is contained in:
Pedro Igor 2021-10-14 15:43:07 -03:00
parent 82e4f9a314
commit 27e74c41ff
2 changed files with 17 additions and 2 deletions

View file

@ -314,7 +314,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
Files.copy(zipStream, providersDir.toPath().resolve(archive.getName()), StandardCopyOption.REPLACE_EXISTING); 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) { if(isReaugmentation) {
forceReaugmentation = true; forceReaugmentation = true;
} }

View file

@ -27,10 +27,12 @@ import org.keycloak.models.ClientProvider;
import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher; import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude; 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.OnlineManagementClient;
import org.wildfly.extras.creaper.core.online.operations.admin.Administration; import org.wildfly.extras.creaper.core.online.operations.admin.Administration;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -43,7 +45,7 @@ import static org.keycloak.testsuite.arquillian.annotation.AuthServerContainerEx
/** /**
* @author Vaclav Muzikar <vmuzikar@redhat.com> * @author Vaclav Muzikar <vmuzikar@redhat.com>
*/ */
@AuthServerContainerExclude({REMOTE, QUARKUS}) @AuthServerContainerExclude({REMOTE})
public class ClientSearchTest extends AbstractClientTest { public class ClientSearchTest extends AbstractClientTest {
@ArquillianResource @ArquillianResource
protected ContainerController controller; protected ContainerController controller;
@ -151,6 +153,15 @@ public class ClientSearchTest extends AbstractClientTest {
String s = "\\\"" + String.join("\\\",\\\"", searchableAttributes) + "\\\""; String s = "\\\"" + String.join("\\\",\\\"", searchableAttributes) + "\\\"";
executeCli("/subsystem=keycloak-server/spi=client:add()", executeCli("/subsystem=keycloak-server/spi=client:add()",
"/subsystem=keycloak-server/spi=client/provider=jpa/:add(properties={searchableAttributes => \"[" + s + "]\"},enabled=true)"); "/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 { } else {
throw new RuntimeException("Don't know how to config"); throw new RuntimeException("Don't know how to config");
} }
@ -167,6 +178,10 @@ public class ClientSearchTest extends AbstractClientTest {
controller.start(suiteContext.getAuthServerInfo().getQualifier()); controller.start(suiteContext.getAuthServerInfo().getQualifier());
} else if (suiteContext.getAuthServerInfo().isJBossBased()) { } else if (suiteContext.getAuthServerInfo().isJBossBased()) {
executeCli("/subsystem=keycloak-server/spi=client:remove"); 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 { } else {
throw new RuntimeException("Don't know how to config"); throw new RuntimeException("Don't know how to config");
} }