KEYCLOAK-5300 Fix Wildfly 10 SAML cluster tests
This commit is contained in:
parent
31be564fa3
commit
a2ccf4efa3
6 changed files with 17 additions and 5 deletions
|
@ -25,6 +25,7 @@ import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.getAppServerQualifier;
|
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.getAppServerQualifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,9 +52,15 @@ public class DeploymentTargetModifier extends AnnotationDeploymentScenarioGenera
|
||||||
|
|
||||||
if (appServerQualifier != null && !appServerQualifier.isEmpty()) {
|
if (appServerQualifier != null && !appServerQualifier.isEmpty()) {
|
||||||
for (DeploymentDescription deployment : deployments) {
|
for (DeploymentDescription deployment : deployments) {
|
||||||
if (deployment.getTarget() == null || !deployment.getTarget().getName().startsWith(appServerQualifier)) {
|
final boolean containerMatches = deployment.getTarget() != null && deployment.getTarget().getName().startsWith(appServerQualifier);
|
||||||
|
|
||||||
|
if (deployment.getTarget() == null || Objects.equals(deployment.getTarget().getName(), "_DEFAULT_")) {
|
||||||
log.debug("Setting target container for " + deployment.getName() + ": " + appServerQualifier);
|
log.debug("Setting target container for " + deployment.getName() + ": " + appServerQualifier);
|
||||||
deployment.setTarget(new TargetDescription(appServerQualifier));
|
deployment.setTarget(new TargetDescription(appServerQualifier));
|
||||||
|
} else if (! containerMatches) {
|
||||||
|
throw new RuntimeException("Inconsistency found: target container for " + deployment.getName()
|
||||||
|
+ " is set to " + deployment.getTarget().getName()
|
||||||
|
+ " but the test class targets " + appServerQualifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class HtmlUnitScreenshots {
|
||||||
public void configureExtension(@Observes ScreenshooterExtensionConfigured event) {
|
public void configureExtension(@Observes ScreenshooterExtensionConfigured event) {
|
||||||
ScreenshooterConfiguration conf = configuration.get();
|
ScreenshooterConfiguration conf = configuration.get();
|
||||||
|
|
||||||
if (System.getProperty("browser").equals("htmlUnit")) {
|
if (System.getProperty("browser", "htmlUnit").equals("htmlUnit")) {
|
||||||
conf.setProperty("takeWhenTestFailed", "false");
|
conf.setProperty("takeWhenTestFailed", "false");
|
||||||
log.info("Screenshots disabled as htmlUnit is used");
|
log.info("Screenshots disabled as htmlUnit is used");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
|
||||||
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
|
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
|
||||||
|
|
||||||
|
@ -74,7 +75,10 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest {
|
||||||
String webInfPath = baseSAMLPath + name + "/WEB-INF/";
|
String webInfPath = baseSAMLPath + name + "/WEB-INF/";
|
||||||
|
|
||||||
URL keycloakSAMLConfig = AbstractServletsAdapterTest.class.getResource(webInfPath + "keycloak-saml.xml");
|
URL keycloakSAMLConfig = AbstractServletsAdapterTest.class.getResource(webInfPath + "keycloak-saml.xml");
|
||||||
|
Assert.assertNotNull("keycloak-saml.xml should be in " + webInfPath, keycloakSAMLConfig);
|
||||||
|
|
||||||
URL webXML = AbstractServletsAdapterTest.class.getResource(baseSAMLPath + webXMLPath);
|
URL webXML = AbstractServletsAdapterTest.class.getResource(baseSAMLPath + webXMLPath);
|
||||||
|
Assert.assertNotNull("web.xml should be in " + baseSAMLPath + webXMLPath, keycloakSAMLConfig);
|
||||||
|
|
||||||
WebArchive deployment = ShrinkWrap.create(WebArchive.class, name + ".war")
|
WebArchive deployment = ShrinkWrap.create(WebArchive.class, name + ".war")
|
||||||
.addClasses(servletClasses)
|
.addClasses(servletClasses)
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.openqa.selenium.support.PageFactory;
|
||||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.keycloak.testsuite.AbstractAuthTest.createUserRepresentation;
|
||||||
import static org.keycloak.testsuite.admin.Users.setPasswordFor;
|
import static org.keycloak.testsuite.admin.Users.setPasswordFor;
|
||||||
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.getNearestSuperclassWithAnnotation;
|
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.getNearestSuperclassWithAnnotation;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<app.server>wildfly10</app.server>
|
<app.server>wildfly10</app.server>
|
||||||
|
<arquillian-wildfly-container.version>2.0.0.Final</arquillian-wildfly-container.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -40,13 +40,13 @@ import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlSer
|
||||||
@AppServerContainer("app-server-wildfly10")
|
@AppServerContainer("app-server-wildfly10")
|
||||||
public class Wildfly10SAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
|
public class Wildfly10SAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
|
||||||
|
|
||||||
@TargetsContainer(value = "app-server-wildfly-" + NODE_1_NAME)
|
@TargetsContainer(value = "app-server-wildfly10-" + NODE_1_NAME)
|
||||||
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME, managed = false)
|
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME, managed = false)
|
||||||
protected static WebArchive employee() {
|
protected static WebArchive employee() {
|
||||||
return samlServletDeployment(EmployeeServletDistributable.DEPLOYMENT_NAME, EmployeeServletDistributable.DEPLOYMENT_NAME + "/WEB-INF/web.xml", SendUsernameServlet.class);
|
return samlServletDeployment(EmployeeServletDistributable.DEPLOYMENT_NAME, EmployeeServletDistributable.DEPLOYMENT_NAME + "/WEB-INF/web.xml", SendUsernameServlet.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetsContainer(value = "app-server-wildfly-" + NODE_2_NAME)
|
@TargetsContainer(value = "app-server-wildfly10-" + NODE_2_NAME)
|
||||||
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME + "_2", managed = false)
|
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME + "_2", managed = false)
|
||||||
protected static WebArchive employee2() {
|
protected static WebArchive employee2() {
|
||||||
return employee();
|
return employee();
|
||||||
|
|
Loading…
Reference in a new issue