-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support filename template #2136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a related GitHub issue? Would be nice to have it or some description in the pull request as https://github.com/wiremock/wiremock/blob/master/CONTRIBUTING.md#before-opening-a-pr recommends.
Bonus points for a documentation update too.
src/main/java/com/github/tomakehurst/wiremock/core/WireMockConfiguration.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/tomakehurst/wiremock/standalone/CommandLineOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/tomakehurst/wiremock/common/filemaker/FilenameMaker.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/tomakehurst/wiremock/core/WireMockConfiguration.java
Outdated
Show resolved
Hide resolved
… and replace with FilenameMaker
src/test/java/com/github/tomakehurst/wiremock/common/SafeNamesTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/github/tomakehurst/wiremock/common/FilenameMakerTest.java
Outdated
Show resolved
Hide resolved
When I try running it standalone and creating a persistent stub I get an NPE thrown. I'll push a failing test for this + the name logic to your branch. |
private static final String NAME_TEMPLATE = "{{{name}}}-"; | ||
private static final Pattern NON_ALPHANUMERIC = Pattern.compile("[^\\w-.]"); | ||
private static final String DEFAULT_EXTENSION = ".json"; | ||
private static final String POINT = "."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe DOT
is more commonly used in this context.
…an prefixed. Wrapped the stub mapping into a model used for filename templates in order to normalise the URL and simplify access to common attributes.
In scope of this PR implemented:
CommandLineOptions
andWireMockConfiguration
;SafeFilename
util class. Replaced with newFilenameMaker
class which based on filename template;