diff --git a/terasoluna-gfw-functionaltest-env/configs/interstage11-oracle/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/interstage11-oracle/resources/META-INF/spring/application-env.properties index ab58063ee..abb0c9d29 100644 --- a/terasoluna-gfw-functionaltest-env/configs/interstage11-oracle/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/interstage11-oracle/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=interstage +application.server.version=11 diff --git a/terasoluna-gfw-functionaltest-env/configs/jboss-postgresql/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/jboss-postgresql/resources/META-INF/spring/application-env.properties index ab58063ee..ac3d8ccf7 100644 --- a/terasoluna-gfw-functionaltest-env/configs/jboss-postgresql/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/jboss-postgresql/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=jboss +application.server.version=6 diff --git a/terasoluna-gfw-functionaltest-env/configs/jboss7-postgresql/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/jboss7-postgresql/resources/META-INF/spring/application-env.properties index ab58063ee..e904ac872 100644 --- a/terasoluna-gfw-functionaltest-env/configs/jboss7-postgresql/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/jboss7-postgresql/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=jboss +application.server.version=7 diff --git a/terasoluna-gfw-functionaltest-env/configs/tomcat-oracle/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/tomcat-oracle/resources/META-INF/spring/application-env.properties index ab58063ee..a98368b3b 100644 --- a/terasoluna-gfw-functionaltest-env/configs/tomcat-oracle/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/tomcat-oracle/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=tomcat +application.server.version=7 diff --git a/terasoluna-gfw-functionaltest-env/configs/tomcat-postgresql/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/tomcat-postgresql/resources/META-INF/spring/application-env.properties index ab58063ee..a98368b3b 100644 --- a/terasoluna-gfw-functionaltest-env/configs/tomcat-postgresql/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/tomcat-postgresql/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=tomcat +application.server.version=7 diff --git a/terasoluna-gfw-functionaltest-env/configs/tomcat8-oracle/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/tomcat8-oracle/resources/META-INF/spring/application-env.properties index ab58063ee..8d85c684c 100644 --- a/terasoluna-gfw-functionaltest-env/configs/tomcat8-oracle/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/tomcat8-oracle/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=tomcat +application.server.version=8.0 diff --git a/terasoluna-gfw-functionaltest-env/configs/tomcat8-postgresql/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/tomcat8-postgresql/resources/META-INF/spring/application-env.properties index ab58063ee..8d85c684c 100644 --- a/terasoluna-gfw-functionaltest-env/configs/tomcat8-postgresql/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/tomcat8-postgresql/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=tomcat +application.server.version=8.0 diff --git a/terasoluna-gfw-functionaltest-env/configs/tomcat85-oracle/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/tomcat85-oracle/resources/META-INF/spring/application-env.properties index ab58063ee..a3a6cb2e7 100644 --- a/terasoluna-gfw-functionaltest-env/configs/tomcat85-oracle/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/tomcat85-oracle/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=tomcat +application.server.version=8.5 diff --git a/terasoluna-gfw-functionaltest-env/configs/tomcat85-postgresql/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/tomcat85-postgresql/resources/META-INF/spring/application-env.properties index ab58063ee..a3a6cb2e7 100644 --- a/terasoluna-gfw-functionaltest-env/configs/tomcat85-postgresql/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/tomcat85-postgresql/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=tomcat +application.server.version=8.5 diff --git a/terasoluna-gfw-functionaltest-env/configs/weblogic-oracle/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/weblogic-oracle/resources/META-INF/spring/application-env.properties index edf2de0c9..228c8a5e7 100644 --- a/terasoluna-gfw-functionaltest-env/configs/weblogic-oracle/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/weblogic-oracle/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=weblogic +application.server.version=12 diff --git a/terasoluna-gfw-functionaltest-env/configs/webotx-oracle/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/webotx-oracle/resources/META-INF/spring/application-env.properties index ab58063ee..a2ceb3723 100644 --- a/terasoluna-gfw-functionaltest-env/configs/webotx-oracle/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/webotx-oracle/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +application.server.name=webotx +application.server.version=9 diff --git a/terasoluna-gfw-functionaltest-env/configs/webspherelp-db2/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/webspherelp-db2/resources/META-INF/spring/application-env.properties index e1e50a52e..3e2502c83 100644 --- a/terasoluna-gfw-functionaltest-env/configs/webspherelp-db2/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/webspherelp-db2/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=System Error... +application.server.name=webspherelp +application.server.version=16 diff --git a/terasoluna-gfw-functionaltest-env/configs/webspheretr-db2/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/configs/webspheretr-db2/resources/META-INF/spring/application-env.properties index e1e50a52e..74eccbd51 100644 --- a/terasoluna-gfw-functionaltest-env/configs/webspheretr-db2/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/configs/webspheretr-db2/resources/META-INF/spring/application-env.properties @@ -1,2 +1,4 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=System Error... +application.server.name=webspheretr +application.server.version=9 diff --git a/terasoluna-gfw-functionaltest-env/src/main/resources/META-INF/spring/application-env.properties b/terasoluna-gfw-functionaltest-env/src/main/resources/META-INF/spring/application-env.properties index ab58063ee..878a8a318 100644 --- a/terasoluna-gfw-functionaltest-env/src/main/resources/META-INF/spring/application-env.properties +++ b/terasoluna-gfw-functionaltest-env/src/main/resources/META-INF/spring/application-env.properties @@ -1,2 +1,7 @@ app.redirect.allowed.externalUrl=http://terasolunaorg.github.io app.redirect.pageTitle.404Error=Page Not Found +## application server name and version properties are used in order to +## change the assertions in test which depends on application server. +## when the new profile is added, set appropriate values. +application.server.name=tomcat +application.server.version=8.0 diff --git a/terasoluna-gfw-functionaltest-selenium/src/test/java/org/terasoluna/gfw/functionaltest/app/ApServerName.java b/terasoluna-gfw-functionaltest-selenium/src/test/java/org/terasoluna/gfw/functionaltest/app/ApServerName.java new file mode 100644 index 000000000..ab14d56b7 --- /dev/null +++ b/terasoluna-gfw-functionaltest-selenium/src/test/java/org/terasoluna/gfw/functionaltest/app/ApServerName.java @@ -0,0 +1,12 @@ +package org.terasoluna.gfw.functionaltest.app; + +/** + * Enumeration class for identifying application server. + *

+ * If application server name is not set in application.env.properties,
+ * UNKNOWN is set. + *

+ */ +public enum ApServerName { + UNKNOWN, INTERSTAGE, JBOSS, TOMCAT, WEBLOGIC, WEBOTX, WEBSPHERELP, WEBSPHERETR +} diff --git a/terasoluna-gfw-functionaltest-selenium/src/test/java/org/terasoluna/gfw/functionaltest/app/WebDriverOperations.java b/terasoluna-gfw-functionaltest-selenium/src/test/java/org/terasoluna/gfw/functionaltest/app/WebDriverOperations.java index 32532f50e..da78fc4f9 100644 --- a/terasoluna-gfw-functionaltest-selenium/src/test/java/org/terasoluna/gfw/functionaltest/app/WebDriverOperations.java +++ b/terasoluna-gfw-functionaltest-selenium/src/test/java/org/terasoluna/gfw/functionaltest/app/WebDriverOperations.java @@ -20,6 +20,8 @@ import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Class that provides a (logic for WebDriver) browser operation. @@ -30,6 +32,8 @@ public class WebDriverOperations { protected long defaultTimeoutSecForImplicitlyWait = 5; + private static final Logger logger = LoggerFactory.getLogger(WebDriverOperations.class); + public WebDriverOperations(WebDriver webDriver) { this.webDriver = webDriver; } @@ -43,6 +47,15 @@ public void setDefaultTimeoutForImplicitlyWait( this.defaultTimeoutSecForImplicitlyWait = defaultTimeoutSecForImplicitlyWait; } + /** + * Get the text (display value) set for the specified element. + * @param by Identifier to look for elements + * @return And returns the text (display value) + */ + public String getText(By by) { + return webDriver.findElement(by).getText(); + } + /** * Check the specified element exists. * @param by Identifier to look for elements @@ -76,4 +89,27 @@ public void setDefaultTimeoutForImplicitlyWait() { public void setTimeoutForImplicitlyWait(long timeout, TimeUnit timeUnit) { webDriver.manage().timeouts().implicitlyWait(timeout, timeUnit); } + + /** + * Get application server name. + * @return application server name + */ + public ApServerName getApServerName() { + String serverName = getText(By.id("apServerName")).toUpperCase(); + try { + return ApServerName.valueOf(serverName); + } catch (IllegalArgumentException e) { + logger.warn("Unkown application server name:{} is detected.", serverName); + // If server name not defined in the ApServerName class, set it to UNKNOWN. + return ApServerName.UNKNOWN; + } + } + + /** + * Get application server version. + * @return application server version + */ + public String getApServerVersion() { + return getText(By.id("apServerVersion")); + } } diff --git a/terasoluna-gfw-functionaltest-web/src/main/java/org/terasoluna/gfw/functionaltest/config/PropertySourceConfig.java b/terasoluna-gfw-functionaltest-web/src/main/java/org/terasoluna/gfw/functionaltest/config/PropertySourceConfig.java new file mode 100644 index 000000000..60db27667 --- /dev/null +++ b/terasoluna-gfw-functionaltest-web/src/main/java/org/terasoluna/gfw/functionaltest/config/PropertySourceConfig.java @@ -0,0 +1,15 @@ +package org.terasoluna.gfw.functionaltest.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +/** + * Class that registers the value defined in application-env.properties of each profile in environment. + *

+ * Passes application server information to WebDriver through JSP so that asserts can be changed for each application server. + *

+ */ +@Configuration +@PropertySource("classpath:/META-INF/spring/application-env.properties") +public class PropertySourceConfig { +} diff --git a/terasoluna-gfw-functionaltest-web/src/main/resources/META-INF/spring/applicationContext.xml b/terasoluna-gfw-functionaltest-web/src/main/resources/META-INF/spring/applicationContext.xml index 6b4e3c076..bf86f72de 100644 --- a/terasoluna-gfw-functionaltest-web/src/main/resources/META-INF/spring/applicationContext.xml +++ b/terasoluna-gfw-functionaltest-web/src/main/resources/META-INF/spring/applicationContext.xml @@ -103,4 +103,6 @@ + + diff --git a/terasoluna-gfw-functionaltest-web/src/main/webapp/WEB-INF/views/layout/template.jsp b/terasoluna-gfw-functionaltest-web/src/main/webapp/WEB-INF/views/layout/template.jsp index 021dd9eb4..09fca52c9 100644 --- a/terasoluna-gfw-functionaltest-web/src/main/webapp/WEB-INF/views/layout/template.jsp +++ b/terasoluna-gfw-functionaltest-web/src/main/webapp/WEB-INF/views/layout/template.jsp @@ -26,6 +26,11 @@
+

+ Application Server : + + +

(X-Track:${f:h(requestScope["X-Track"])})