From 8abffc78ee8eb9a31ea72bb240f3ed5b66f5dcde Mon Sep 17 00:00:00 2001 From: jeb228 Date: Thu, 26 Aug 2010 14:55:21 +0000 Subject: [PATCH] NIHVIVO-222 Selenium requires that the Base URL end in /, so the webapp name cannot be the last thing in the URL. Fix the logic. --- .../vitro/utilities/testrunner/ModelCleanerProperties.java | 3 ++- .../mannlib/vitro/utilities/testrunner/TomcatController.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/ModelCleanerProperties.java b/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/ModelCleanerProperties.java index c612e4fe1..4b7deb452 100644 --- a/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/ModelCleanerProperties.java +++ b/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/ModelCleanerProperties.java @@ -92,7 +92,8 @@ public class ModelCleanerProperties { String websiteUrl = getRequiredProperty(props, SeleniumRunnerParameters.PROP_WEBSITE_URL); String webappName = getRequiredProperty(props, PROP_VIVO_WEBAPP_NAME); - if (!websiteUrl.endsWith(webappName)) { + if ((!websiteUrl.endsWith(webappName)) + && (!websiteUrl.endsWith(webappName + "/"))) { throw new IllegalArgumentException("The " + PROP_VIVO_WEBAPP_NAME + " must be the last item in the " + SeleniumRunnerParameters.PROP_WEBSITE_URL); diff --git a/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/TomcatController.java b/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/TomcatController.java index fbb06f9ef..55e53207c 100644 --- a/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/TomcatController.java +++ b/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/TomcatController.java @@ -44,7 +44,8 @@ public class TomcatController { private String figureBaseUrl() { String url = parms.getWebsiteUrl(); - return url.substring(0, url.length() - webappName.length()); + int end = url.lastIndexOf(webappName); + return url.substring(0, end); } /**