Skip to content

Commit

Permalink
Add WireMock
Browse files Browse the repository at this point in the history
  • Loading branch information
banterCZ committed Jul 25, 2022
1 parent 0bc098c commit 6f128ef
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 0 deletions.
19 changes: 19 additions & 0 deletions enrollment-server-onboarding-adapter-mock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Onboarding Adapter Mock

Mock of onboarding adapter using [WireMock].

## Run

**NOTE**: Before the first usage of the standalone [WireMock] please execute the following command:

```bash
mvn clean package
```

You can start [WireMock] using the predefined script:

```bash
./bin/wiremock.sh
```

[WireMock]: https://wiremock.org/docs/)
10 changes: 10 additions & 0 deletions enrollment-server-onboarding-adapter-mock/bin/wiremock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

mydir=`dirname $0`
cd $mydir/..

java -jar target/dependency/wiremock-jre8-standalone.jar \
--port 8090 \
--root-dir "src/test/wiremock" \
--verbose \
--global-response-templating
64 changes: 64 additions & 0 deletions enrollment-server-onboarding-adapter-mock/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ PowerAuth Enrollment Server
~ Copyright (C) 2022 Wultra s.r.o.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published
~ by the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
</parent>

<artifactId>enrollment-server-onboarding-adapter-mock</artifactId>
<name>enrollment-server-onboarding-adapter-mock</name>
<description>Onboarding adapter mock for enrollment server.</description>

<properties>
<wiremock.version>2.33.2</wiremock.version>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-wiremock</id>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>${wiremock.version}</version>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"result": "OK",
"info": {
"aggregationResult": true,
"mdcCheck": true,
"documentsAccepted": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"consentText": "<html><body><h1>Lorem ipsum</h1>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam posuere lacus quis dolor. Nullam feugiat, turpis at pulvinar vulputate, erat libero tristique tellus, nec bibendum odio risus sit amet ante. Nullam at arcu a est sollicitudin euismod. Aliquam in lorem sit amet leo accumsan lacinia. Duis condimentum augue id magna semper rutrum. Sed convallis magna eu sem. Pellentesque arcu. Phasellus faucibus molestie nisl. Maecenas fermentum, sem in pharetra pellentesque, velit turpis volutpat ante, in pharetra metus odio a lectus. Nullam feugiat, turpis at pulvinar vulputate, erat libero tristique tellus, nec bibendum odio risus sit amet ante. Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</body></html>"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"otpSent": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"userId": "mockuser_{{jsonPath request.body '$.identification.clientNumber'}}",
"consentRequired": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"request": {
"method": "POST",
"url": "/client/evaluate"
},
"response": {
"status": 200,
"bodyFileName": "body-client-evaluate.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"request": {
"method": "POST",
"url": "/consent/storage"
},
"response": {
"status": 200,
"bodyFileName": "body-consent-storage.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"request": {
"method": "POST",
"url": "/consent/text"
},
"response": {
"status": 200,
"bodyFileName": "body-consent-text.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"request": {
"method": "POST",
"url": "/otp/send"
},
"response": {
"status": 200,
"bodyFileName": "body-otp-send.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"request": {
"method": "POST",
"url": "/user/lookup"
},
"response": {
"status": 200,
"bodyFileName": "body-user-lookup.json"
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<module>enrollment-server-api-model</module>
<module>enrollment-server</module>
<module>enrollment-server-onboarding</module>
<module>enrollment-server-onboarding-adapter-mock</module>
<module>enrollment-server-onboarding-api-model</module>
<module>enrollment-server-onboarding-common</module>
</modules>
Expand Down

0 comments on commit 6f128ef

Please sign in to comment.