From 24f556262610a62dad334c780dff645011a2f24a Mon Sep 17 00:00:00 2001 From: j2blake Date: Thu, 23 Feb 2012 21:11:33 +0000 Subject: [PATCH] NIHVIVO-3628 Tweak the arguments to ServletContextStub.setRealPaths, so the entire prefix is provided and the method doesn't need to insert a file separator (which may be system-dependent). --- .../ObjectPropertyTemplateModel_PropertyListConfigTest.java | 2 +- webapp/test/stubs/javax/servlet/ServletContextStub.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java index ec406d561..cf405b7b0 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java @@ -120,7 +120,7 @@ public class ObjectPropertyTemplateModel_PropertyListConfigTest extends ctx = new ServletContextStub(); // create paths for all of the files in the temporary config directory. - ctx.setRealPaths("/config", configDir); + ctx.setRealPaths("/config/", configDir); // add a path to match the hard-coded default path. ctx.setRealPath("/config/listViewConfig-default.xml", ctx.getRealPath("/config/testConfig-default.xml")); diff --git a/webapp/test/stubs/javax/servlet/ServletContextStub.java b/webapp/test/stubs/javax/servlet/ServletContextStub.java index b8269ec60..608289997 100644 --- a/webapp/test/stubs/javax/servlet/ServletContextStub.java +++ b/webapp/test/stubs/javax/servlet/ServletContextStub.java @@ -69,12 +69,12 @@ public class ServletContextStub implements ServletContext { /** * Call setRealPath for each of the files in this directory (non-recursive). - * Use the prefix, a separator, and the filename as the path. + * The prefix is the "pretend" location that we're mapping these files to, + * e.g. "/config/". Use the prefix and the filename as the path. */ public void setRealPaths(String pathPrefix, File dir) { for (File file : dir.listFiles()) { - setRealPath(pathPrefix + "/" + file.getName(), - file.getPath()); + setRealPath(pathPrefix + file.getName(), file.getPath()); } }