SWF-992 Flow Id not properly calculated when using "classpath*:" style resources in base-path

This commit is contained in:
Scott Andrews
2008-12-15 18:25:53 +00:00
parent 974270591c
commit 7759789323
2 changed files with 10 additions and 0 deletions

View File

@@ -40,6 +40,8 @@ public class FlowDefinitionResourceFactory {
private static final String CLASSPATH_SCHEME = "classpath:";
private static final String CLASSPATH_STAR_SCHEME = "classpath*:";
private static final String SLASH = "/";
private ResourceLoader resourceLoader;
@@ -250,6 +252,8 @@ public class FlowDefinitionResourceFactory {
private String removeClasspathScheme(String basePath) {
if (basePath.startsWith(CLASSPATH_SCHEME)) {
return basePath.substring(CLASSPATH_SCHEME.length());
} else if (basePath.startsWith(CLASSPATH_STAR_SCHEME)) {
return basePath.substring(CLASSPATH_STAR_SCHEME.length());
} else {
return basePath;
}

View File

@@ -88,6 +88,12 @@ public class FlowDefinitionResourceFactoryTests extends TestCase {
assertEquals("sample", factory.getFlowId(resource));
}
public void testGetFlowIdClassPathStarResource() {
Resource resource = new ClassPathResource("org/springframework/webflow/sample/sample-flow.xml");
factory.setBasePath("classpath*:org/springframework/webflow/");
assertEquals("sample", factory.getFlowId(resource));
}
public void testGetFlowIdFileSystemResource() {
Resource resource = new FileSystemResource(
"/the/path/on/the/file/system/org/springframework/webflow/sample/sample-flow.xml");