In order to use ant-style pattern matching with
Spring's ContextLoaderPlugin, the
ServletContextSimulator needs to implement
getResourcePaths(). Currently it does not:
[junit] ERROR - ContextLoaderPlugIn.init(228) |
Context initialization faile
d
[junit] java.lang.UnsupportedOperationException:
getResourcePaths operation
is not supported!
[junit] at
servletunit.ServletContextSimulator.getResourcePaths(ServletC
ontextSimulator.java:534)
[junit] at
org.springframework.web.context.support.ServletContextResourc
ePatternResolver.doRetrieveMatchingServletContextResources(ServletContextRe
sourc
ePatternResolver.java:100)
[junit] at
org.springframework.web.context.support.ServletContextResourc
ePatternResolver.doFindPathMatchingFileResources(ServletContextResourcePatt
ernRe
solver.java:79)
[junit] at
org.springframework.core.io.support.PathMatchingResourcePatte
rnResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.ja
va:22
8)
Here's how Spring implements it in its MockServletContext:
public Set getResourcePaths(String path) {
Resource resource =
this.resourceLoader.getResource(getResourceLocation(path));
try {
File file = resource.getFile();
String[] fileList = file.list();
String prefix = (path.endsWith("/") ? path : path +
"/");
Set resourcePaths = new HashSet(fileList.length);
for (int i = 0; i < fileList.length; i++) {
resourcePaths.add(prefix + fileList[i]);
}
return resourcePaths;
}
catch (IOException ex) {
logger.info("Couldn't get resource paths for " +
resource, ex);
return null;
}
}
A workaround is to specify each file individually in
the plugin settings.
Ben Speakmon
Interface (example)
None
Public
|
Date: 2007-11-06 08:12
|
|
Date: 2005-02-22 12:36 Logged In: NO |
|
Date: 2005-02-18 15:27 Logged In: YES |
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2007-11-06 08:12 | bspeakmon |
| resolution_id | None | 2007-11-06 08:12 | bspeakmon |
| assigned_to | nobody | 2007-11-06 08:12 | bspeakmon |
| close_date | - | 2007-11-06 08:12 | bspeakmon |
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use