-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a classpath: prefix if you want to load resources (features and s…
…tepdef scripts) from the classpath and not the file system. Should be a transparent change for JUnit users. See #312
- Loading branch information
1 parent
250a977
commit cdf1080
Showing
6 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cucumber.io; | ||
|
||
public class MultiLoader implements ResourceLoader { | ||
public static final String CLASSPATH_SCHEME = "classpath://"; | ||
|
||
private final ClasspathResourceLoader classpath; | ||
private final FileResourceLoader fs; | ||
|
||
public MultiLoader(ClassLoader classLoader) { | ||
classpath = new ClasspathResourceLoader(classLoader); | ||
fs = new FileResourceLoader(); | ||
} | ||
|
||
@Override | ||
public Iterable<Resource> resources(String path, String suffix) { | ||
if (path.startsWith(CLASSPATH_SCHEME)) { | ||
return classpath.resources(path.substring(CLASSPATH_SCHEME.length()), suffix); | ||
} else { | ||
return fs.resources(path, suffix); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters