Skip to content
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

YAML config can be loaded from sub includes, thus reduces the main YAML size #152

Merged
merged 2 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
org.gradle.daemon=true
org.gradle.workers.max=2
org.gradle.parallel=true
configureondemand=true
jettyVersion=9.4.36.v20210114
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

public class StubsAdminPortalsTest {

private static final int STUBS_PORT = SpringSocketUtils.findAvailableTcpPort(49152, 65535);
private static final int STUBS_SSL_PORT = SpringSocketUtils.findAvailableTcpPort(49152, 65535);
private static final int ADMIN_PORT = SpringSocketUtils.findAvailableTcpPort(49152, 65535);
private static final int STUBS_PORT = SpringSocketUtils.findAvailableTcpPort(9152, 65535);
private static final int STUBS_SSL_PORT = SpringSocketUtils.findAvailableTcpPort(9152, 65535);
private static final int ADMIN_PORT = SpringSocketUtils.findAvailableTcpPort(9152, 65535);

private static final String STUBS_URL = String.format("http://localhost:%s", STUBS_PORT);
private static final String ADMIN_URL = String.format("http://localhost:%s", ADMIN_PORT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
public class StubsPortalTest {

private static final int STUBS_PORT = 5892;
private static final int STUBS_SSL_PORT = SpringSocketUtils.findAvailableTcpPort(49152, 65535);
private static final int ADMIN_PORT = SpringSocketUtils.findAvailableTcpPort(49152, 65535);
private static final int STUBS_SSL_PORT = SpringSocketUtils.findAvailableTcpPort(9152, 65535);
private static final int ADMIN_PORT = SpringSocketUtils.findAvailableTcpPort(9152, 65535);

private static final String STUBS_URL = String.format("http://localhost:%s", STUBS_PORT);
private static final String ADMIN_URL = String.format("http://localhost:%s", ADMIN_PORT);
Expand Down
217 changes: 217 additions & 0 deletions src/functional-test/resources/yaml/service-1-stubs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
- request:
method:
- GET
- POST
- PUT
url: ^/resources/asn/.*$

response:
status: 200
body: >
{"status": "ASN found!"}
headers:
content-type: application/json


- request:
method:
- GET
- POST
- PUT
url: /this/stub/should/always/be/second/in/this/file

response:
status: 200
body: OK
headers:
content-type: application/json


- request:
method: [GET, POST, PUT]
url: ^/[a-z]{3}-[a-z]{3}/[0-9]{2}/[A-Z]{2}/[a-z0-9]+\?paramOne=[a-zA-Z]{3,8}&paramTwo=[a-zA-Z]{3,8}$

response:
status: 200
body: >
{"status": "The regex with query params works!"}
headers:
content-type: application/json

- request:
method: GET
url: ^/[a-z]{3}-[a-z]{3}/[0-9]{2}/[A-Z]{2}/[a-z0-9]+$

response:
status: 200
body: >
{"status": "The regex works!"}
headers:
content-type: application/json

- request:
method: GET
url: /entity.find.again
query:
type_name: user
client_id: id
client_secret: secret
attributes: '[id,uuid,created,lastUpdated,displayName,email,givenName,familyName]'

response:
status: 200
body: >
{"status": "hello world"}
headers:
content-type: application/json

- request:
method: GET
url: /entity.find
query:
type_name: user
client_id: id
client_secret: secret
attributes: '["id","uuid","created","lastUpdated","displayName","email","givenName","familyName"]'

response:
status: 200
body: >
{"status": "hello world"}
headers:
content-type: application/json


- request:
method: GET
url: /entity.find.single.quote
query:
type_name: user
client_id: id
client_secret: secret
attributes: "['id','uuid','created','lastUpdated','displayName','email','givenName','familyName']"

response:
status: 200
body: >
{"status": "hello world with single quote"}
headers:
content-type: application/json

- request:
method: GET
url: /entity.find.spaces.within
query:
key: "stalin and truman are best buddies"

response:
status: 200
body: >
{"status": "hello world with spaces within values"}
headers:
content-type: application/json


- request:
method: GET
url: /entity.find.single.quote.spaces.within
query:
key: "['stalin and truman','are best friends']"

response:
status: 200
body: >
{"status": "hello world with single quote and spaces within"}
headers:
content-type: application/json


- request:
method: GET
url: /pdf/hello-world

response:
headers:
content-type: application/pdf
content-disposition: attachment; filename=hello-world.pdf
pragma: no-cache
status: 200
file: ../binary/hello-world.pdf

- request:
method: GET
url: /invoice
query:
status: active
type: full
response:
headers:
content-type: application/json
pragma: no-cache
status: 200
file: ../json/response.json


- request:
method: PUT
url: /invoice/123
headers:
content-type: application/json
post: >
{"name": "milk", "description": "full", "department": "savoury"}

response:
headers:
content-type: application/json
pragma: no-cache
status: 200
body: >
{"id": "123", "status": "updated"}

- request:
method: POST
url: /invoice/new
headers:
content-type: application/json
post: >
{"name": "chocolate", "description": "full", "department": "savoury"}

response:
headers:
content-type: application/json
pragma: no-cache
status: 201
body: >
{"id": "456", "status": "created"}


- request:
method: POST
url: /post-body-as-json
headers:
content-type: application/json
post: >
{"userId":"19","requestId":"(.*)","transactionDate":"(.*)","transactionTime":"(.*)"}

response:
headers:
content-type: application/json
status: 200
body: >
{"requestId": "<%post.1%>", "transactionDate": "<%post.2%>", "transactionTime": "<%post.3%>"}

- request:
method: POST
url: /post-body-as-json-2
headers:
content-type: application/json
post: >
{"objects": [{"key": "value"}, {"key": "value"}, {"key": {"key": "(.*)"}}]}

response:
headers:
content-type: application/json
status: 200
body: >
{"internalKey": "<%post.1%>"}

Loading