keycloak-aplcache
Changes
testsuite/tomcat7/pom.xml 2(+1 -1)
Details
testsuite/tomcat7/pom.xml 2(+1 -1)
diff --git a/testsuite/tomcat7/pom.xml b/testsuite/tomcat7/pom.xml
index f667d87..f53a489 100755
--- a/testsuite/tomcat7/pom.xml
+++ b/testsuite/tomcat7/pom.xml
@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>keycloak-testsuite-tomcat7</artifactId>
- <name>Keycloak Tomcat 7Integration TestSuite</name>
+ <name>Keycloak Tomcat 7 Integration TestSuite</name>
<description />
<dependencies>
diff --git a/testsuite/tomcat7/src/test/java/org/keycloak/testsuite/Tomcat7Test.java b/testsuite/tomcat7/src/test/java/org/keycloak/testsuite/Tomcat7Test.java
index e0603fc..791e0d3 100755
--- a/testsuite/tomcat7/src/test/java/org/keycloak/testsuite/Tomcat7Test.java
+++ b/testsuite/tomcat7/src/test/java/org/keycloak/testsuite/Tomcat7Test.java
@@ -60,6 +60,7 @@ import java.io.OutputStream;
import java.net.URL;
import java.security.Principal;
import java.util.Map;
+import java.util.regex.Matcher;
/**
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
@@ -106,12 +107,11 @@ public class Tomcat7Test {
@BeforeClass
public static void initTomcat() throws Exception {
-
- String webappDirLocation = "src/test/resources/tomcat-test/webapp/";
URL dir = Tomcat7Test.class.getResource("/tomcat-test/webapp/META-INF/context.xml");
File webappDir = new File(dir.getFile()).getParentFile().getParentFile();
tomcat = new Tomcat();
-
+ String baseDir = getBaseDirectory();
+ tomcat.setBaseDir(baseDir);
tomcat.setPort(8080);
tomcat.addWebapp("/customer-portal", webappDir.toString());
@@ -167,7 +167,24 @@ public class Tomcat7Test {
}
+ private static String getBaseDirectory() {
+ String dirPath = null;
+ String relativeDirPath = "testsuite" + File.separator + "tomcat7" + File.separator + "target";
+
+ if (System.getProperties().containsKey("maven.home")) {
+ dirPath = System.getProperty("user.dir").replaceFirst("testsuite.tomcat7.*", Matcher.quoteReplacement(relativeDirPath));
+ } else {
+ for (String c : System.getProperty("java.class.path").split(File.pathSeparator)) {
+ if (c.contains(File.separator + "testsuite" + File.separator + "tomcat7")) {
+ dirPath = c.replaceFirst("testsuite.tomcat7.*", Matcher.quoteReplacement(relativeDirPath));
+ break;
+ }
+ }
+ }
+ String absolutePath = new File(dirPath).getAbsolutePath();
+ return absolutePath;
+ }