Skip to content

Support classpath resource for custom test source in dynamic tests #1467

@sbrannen

Description

@sbrannen

Background

In conjunction with #1178, support was added for creating a UriSource from a URI supplied for a dynamic container or dynamic test.

In addition, the new UriSource.from(URI) static factory method currently supports creation of a FileSource or DirectorySource if the supplied URI represents a file or directory in the local filesystem. Otherwise, a DefaultUriSource is created by the factory.

Proposal

Introduce support for URIs that have a classpath scheme (e.g., classpath:tests/script.js?line=23&column=42). UriSource.from(URI) could then create a ClasspathResourceSource.

Note that ClasspathResourceSource does not implement UriSource; however, we could potentially refactor ClasspathResourceSource so that it implements UriSource where the implementation of getUri() would return the value returned by ClasspathResourceSource.getClasspathResourceName() prepended with classpath: (if not already present) and appended with the FilePosition converted to a proper query string (if the FilePosition is present).

Related Issues

Deliverables

  • Add support for creating a ClasspathResourceSource for a dynamic test if the custom test source URI uses the classpath scheme.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions