From 0df2525298fd6a0638b4d15d647e5d27b255182b Mon Sep 17 00:00:00 2001 From: mhajas Date: Mon, 2 May 2016 17:01:51 +0200 Subject: [PATCH] Fix ssl tests on EAP6 --- .../servers/app-server/jboss/common/security-eap6.xsl | 2 +- .../testsuite/arquillian/provider/URLProvider.java | 5 +++-- .../adapter/servlet/AbstractSAMLServletsAdapterTest.java | 7 +++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/testsuite/integration-arquillian/servers/app-server/jboss/common/security-eap6.xsl b/testsuite/integration-arquillian/servers/app-server/jboss/common/security-eap6.xsl index b389cd18ba..a902fcb2d3 100644 --- a/testsuite/integration-arquillian/servers/app-server/jboss/common/security-eap6.xsl +++ b/testsuite/integration-arquillian/servers/app-server/jboss/common/security-eap6.xsl @@ -17,7 +17,7 @@ diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/provider/URLProvider.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/provider/URLProvider.java index 424705ccd5..5631b6a03e 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/provider/URLProvider.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/provider/URLProvider.java @@ -24,6 +24,7 @@ import org.jboss.arquillian.core.api.annotation.Inject; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.logging.Logger; import org.jboss.logging.Logger.Level; +import org.keycloak.testsuite.arquillian.SuiteContext; import org.keycloak.testsuite.arquillian.TestContext; import org.keycloak.testsuite.arquillian.annotation.AppServerContext; import org.keycloak.testsuite.arquillian.annotation.AuthServerContext; @@ -33,7 +34,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.HashSet; import java.util.Set; -import org.keycloak.testsuite.arquillian.SuiteContext; public class URLProvider extends URLResourceProvider { @@ -83,7 +83,8 @@ public class URLProvider extends URLResourceProvider { for (Annotation a : qualifiers) { if (OperateOnDeployment.class.isAssignableFrom(a.annotationType())) { String port = appServerSslRequired ? System.getProperty("app.server.https.port", "8643"):System.getProperty("app.server.http.port", "8280"); - url = new URL(fixedUrl.toExternalForm().replace("8080", port) + "/" + ((OperateOnDeployment) a).value()); + String protocol = appServerSslRequired ? "https" : "http"; + url = new URL(fixedUrl.toExternalForm().replace("8080", port).replace("http", protocol) + ((OperateOnDeployment) a).value()); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java index 0034f36014..23c365f9bd 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java @@ -244,7 +244,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd salesPostPassiveServletPage.navigateTo(); waitUntilElement(By.xpath("//body")).text().not().contains("principal="); - assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("") || driver.getPageSource().contains("
"));
+        assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("") || driver.getPageSource().equals(""));
 
         salesPostSigEmailServletPage.navigateTo();
         assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
@@ -322,7 +322,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
 
         waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
         //Different 403 status page on EAP and Wildfly
-        assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("") || driver.getPageSource().contains("
"));
+        assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("") || driver.getPageSource().equals(""));
 
         assertSuccessfulLogin(salesPostServletPage, bburkeUser, testRealmSAMLPostLoginPage);
 
@@ -333,8 +333,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
 
         waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
         //Different 403 status page on EAP and Wildfly
-        assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("") || driver.getPageSource().contains("
"));
-
+        assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("") || driver.getPageSource().equals(""));
         assertForbiddenLogin(salesPostServletPage, "unauthorized", "password", testRealmSAMLPostLoginPage);
         assertForbidden(salesPostPassiveServletPage);