SWF-992 Flow Id not properly calculated when using "classpath*:" style resources in base-path
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user