Skip to content

Commit

Permalink
minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ertekin, Veysi committed Mar 7, 2018
1 parent 0991a96 commit 69138df
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package casestudy.wiremock.remote.service.impl;

import org.springframework.stereotype.Service;
import casestudy.wiremock.remote.service.GreetingService;
import org.springframework.stereotype.Service;

@Service
public class GreetingServiceImpl implements GreetingService {
Expand All @@ -10,9 +10,10 @@ public class GreetingServiceImpl implements GreetingService {

@Override
public String sayHi(String name) {
if (name.length() % 2 == 0) {
return String.format(HI_MESSAGE_TEMPLATE, name);
} else
return String.format(HELLO_MESSAGE_TEMPLATE, name);
return String.format(findMatchedTemplate(name.length()), name);
}

private String findMatchedTemplate(int length) {
return length % 2 == 0 ? HI_MESSAGE_TEMPLATE : HELLO_MESSAGE_TEMPLATE;
}
}
2 changes: 1 addition & 1 deletion wiremock-demo/wiremock-standalone-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM openjdk:8-alpine

RUN apk --no-cache add curl

COPY wiremock-standalone-2.15.0.jar .
COPY wiremock-standalone-2.15.0.jar wiremock-standalone.jar
COPY start_wiremock.sh .

HEALTHCHECK CMD curl -f http://localhost:8080/__admin/mappings
Expand Down
2 changes: 1 addition & 1 deletion wiremock-demo/wiremock-standalone-base/start_wiremock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#

exec java -XX:+UseG1GC \
-jar wiremock-standalone-2.15.0.jar \
-jar wiremock-standalone.jar \
--port=${HTTP_PORT:-80} \
--https-port=${HTTPS_PORT:-443} \
`[ "$RECORD_MAPPINGS" = "true" ] && echo "--record-mappings" || echo "--no-request-journal"` \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"request": {
"urlPattern": "/hi/[tT][eE][sS][tT]",
"urlPattern": "/hi/(?i:test)",
"method": "GET"
},
"response": {
Expand Down

0 comments on commit 69138df

Please sign in to comment.