Skip to content

Commit 77d0a92

Browse files
authored
Fix package relocation for standalone jar (#37)
- handlebars relocation matches wiremock standalone - added IntelliJ run configuration for docker - added markdown helper for docker test - added http file for docker test ## References #36 ## Submitter checklist - [ ] Recommended: Join [WireMock Slack](https://slack.wiremock.org/) to get any help in `#help-contributing` or a project-specific channel like `#wiremock-java` - [ ] The PR request is well described and justified, including the body and the references - [ ] The PR title represents the desired changelog entry - [ ] The repository's code style is followed (see the contributing guide) - [ ] Test coverage that demonstrates that the change works as expected - [ ] For new features, there's necessary documentation in this pull request or in a subsequent PR to [wiremock.org](https://github.com/wiremock/wiremock.org) <!-- Put an `x` into the [ ] to show you have filled the information. The template comes from https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md You can override it by creating .github/pull_request_template.md in your own repository -->
1 parent 04d1f10 commit 77d0a92

File tree

5 files changed

+101
-3
lines changed

5 files changed

+101
-3
lines changed

.run/WireMock Docker Test.run.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="WireMock Docker Test" type="docker-deploy" factoryName="docker-image" server-name="Docker">
3+
<deployment type="docker-image">
4+
<settings>
5+
<option name="imageTag" value="wiremock/wiremock:3x" />
6+
<option name="command" value="--global-response-templating --verbose" />
7+
<option name="containerName" value="wiremock-extension-state-test" />
8+
<option name="portBindings">
9+
<list>
10+
<DockerPortBindingImpl>
11+
<option name="containerPort" value="8080" />
12+
<option name="hostPort" value="8080" />
13+
</DockerPortBindingImpl>
14+
</list>
15+
</option>
16+
<option name="volumeBindings">
17+
<list>
18+
<DockerVolumeBindingImpl>
19+
<option name="containerPath" value="/var/wiremock/extensions" />
20+
<option name="hostPath" value="$PROJECT_DIR$/build/libs" />
21+
<option name="readOnly" value="true" />
22+
</DockerVolumeBindingImpl>
23+
<DockerVolumeBindingImpl>
24+
<option name="containerPath" value="/home/wiremock" />
25+
<option name="hostPath" value="$PROJECT_DIR$/src/test/resources/remoteloader/" />
26+
</DockerVolumeBindingImpl>
27+
</list>
28+
</option>
29+
</settings>
30+
</deployment>
31+
<method v="2" />
32+
</configuration>
33+
</component>

DEVELOPMENT.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Testing docker
2+
3+
Build and start the container:
4+
5+
```bash
6+
./gradlew clean build -x test
7+
```
8+
9+
```bash
10+
docker run -it --rm \
11+
-p 8080:8080 \
12+
--name wiremock \
13+
-v $PWD/build/libs:/var/wiremock/extensions \
14+
-v $PWD/src/test/resources/remoteloader:/home/wiremock \
15+
wiremock/wiremock:3x \
16+
--global-response-templating
17+
```

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ docker run -it --rm \
261261
-p 8080:8080 \
262262
--name wiremock \
263263
-v $PWD/extensions:/var/wiremock/extensions \
264-
wiremock/wiremock:3x
264+
wiremock/wiremock:3x \
265+
-- --global-response-templating
265266
```
266267

267268
## Record a state

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ shadowJar {
5656
from("shadowjar/resources") {}
5757
}
5858

59-
relocate "com.github.ben-manes.caffeine", 'wiremock.org.extensions.state.caffeine'
60-
relocate "com.github.jknack", 'wiremock.org.extensions.state.jknack'
59+
relocate "com.github.ben-manes.caffeine", 'wiremock.com.github.ben-manes.caffeine'
60+
relocate "com.github.jknack", 'wiremock.com.github.jknack'
6161

6262

6363
dependencies {

docker_container_test.http

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
### empty get
2+
3+
GET http://localhost:8080/queue/myqueue
4+
5+
> {%
6+
client.test("Request executed successfully", function () {
7+
const status = response.status;
8+
client.assert(status === 200, "expected response status 200 but received '" + status + "'");
9+
});
10+
client.test("Response content-type is json", function() {
11+
const type = response.contentType.mimeType;
12+
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
13+
});
14+
client.test("empty list is returned", function () {
15+
const item = response.body.item;
16+
client.assert(item === "no data", "response is not an empty list: '" + item + "'");
17+
});
18+
%}
19+
20+
### POST entry
21+
22+
POST http://localhost:8080/queue/myqueue/abdcef
23+
24+
> {%
25+
client.test("Request executed successfully", function () {
26+
client.assert(response.status === 200, "response status is not 200");
27+
});
28+
%}
29+
30+
### filled get
31+
32+
GET http://localhost:8080/queue/myqueue
33+
34+
> {%
35+
client.test("Request executed successfully", function () {
36+
const status = response.status;
37+
client.assert(status === 200, "expected response status 200 but received '" + status + "'");
38+
});
39+
client.test("Response content-type is json", function() {
40+
const type = response.contentType.mimeType;
41+
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
42+
});
43+
client.test("list with correct is returned", function () {
44+
const item = response.body.item;
45+
client.assert(item === 'abdcef', "response does not contain queue item but is: '" + item + "'");
46+
});
47+
%}

0 commit comments

Comments
 (0)