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).

This commit is contained in:
j2blake 2012-02-23 21:11:33 +00:00
parent c4091eaa1f
commit 24f5562626
2 changed files with 4 additions and 4 deletions

View file

@ -120,7 +120,7 @@ public class ObjectPropertyTemplateModel_PropertyListConfigTest extends
ctx = new ServletContextStub(); ctx = new ServletContextStub();
// create paths for all of the files in the temporary config directory. // 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. // add a path to match the hard-coded default path.
ctx.setRealPath("/config/listViewConfig-default.xml", ctx.setRealPath("/config/listViewConfig-default.xml",
ctx.getRealPath("/config/testConfig-default.xml")); ctx.getRealPath("/config/testConfig-default.xml"));

View file

@ -69,12 +69,12 @@ public class ServletContextStub implements ServletContext {
/** /**
* Call setRealPath for each of the files in this directory (non-recursive). * 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) { public void setRealPaths(String pathPrefix, File dir) {
for (File file : dir.listFiles()) { for (File file : dir.listFiles()) {
setRealPath(pathPrefix + "/" + file.getName(), setRealPath(pathPrefix + file.getName(), file.getPath());
file.getPath());
} }
} }