-
Notifications
You must be signed in to change notification settings - Fork 228
Test: Replaceing mock server with wiremock #4390
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
Open
marki1an
wants to merge
9
commits into
master
Choose a base branch
from
replaceing-mock-server-with-wire-mock
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+409
−474
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
45578cc
Initial commit
marki1an d6a5c09
WIP: Initial commit with replaced mock server on WireMock
marki1an eedeb47
WIP: Cleanup
marki1an 2d99ddb
WIP: launchContainers to false
marki1an a6a8efe
WIP: Add HttStatusCode and remove mockserver dependency
marki1an 822deb7
Few update
marki1an e6c4730
Merge remote-tracking branch 'origin/master' into replaceing-mock-ser…
marki1an db22af7
Update after review
marki1an 67cfb83
Update after review
marki1an File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/test/groovy/org/prebid/server/functional/model/ResponseModel.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| package org.prebid.server.functional.model | ||
|
|
||
| /** | ||
| * This marker interface should limit the possible values used by the MockServerClientWrapper. | ||
| * This marker interface should limit the possible values used by the WireMockClientWrapper. | ||
| */ | ||
| interface ResponseModel {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
...oovy/org/prebid/server/functional/testcontainers/container/NetworkServiceContainer.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 13 additions & 16 deletions
29
.../groovy/org/prebid/server/functional/testcontainers/scaffolding/CurrencyConversion.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,39 @@ | ||
| package org.prebid.server.functional.testcontainers.scaffolding | ||
|
|
||
| import org.mockserver.model.HttpRequest | ||
| import com.github.tomakehurst.wiremock.matching.RequestPattern | ||
| import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder | ||
| import org.prebid.server.functional.model.mock.services.currencyconversion.CurrencyConversionRatesResponse | ||
| import org.testcontainers.containers.MockServerContainer | ||
| import org.prebid.server.functional.testcontainers.container.NetworkServiceContainer | ||
|
|
||
| import static org.mockserver.model.HttpRequest.request | ||
| import static org.mockserver.model.HttpResponse.response | ||
| import static org.mockserver.model.HttpStatusCode.OK_200 | ||
| import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor | ||
| import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo | ||
| import static org.prebid.server.functional.util.CurrencyUtil.DEFAULT_CURRENCY_RATES | ||
|
|
||
| class CurrencyConversion extends NetworkScaffolding { | ||
|
|
||
| static final String CURRENCY_ENDPOINT_PATH = "/currency" | ||
| private static final CurrencyConversionRatesResponse DEFAULT_RATES_RESPONSE = CurrencyConversionRatesResponse.getDefaultCurrencyConversionRatesResponse(DEFAULT_CURRENCY_RATES) | ||
|
|
||
| CurrencyConversion(MockServerContainer mockServerContainer) { | ||
| super(mockServerContainer, CURRENCY_ENDPOINT_PATH) | ||
| CurrencyConversion(NetworkServiceContainer wireMockContainer) { | ||
| super(wireMockContainer, CURRENCY_ENDPOINT_PATH) | ||
| } | ||
|
|
||
| void setCurrencyConversionRatesResponse(CurrencyConversionRatesResponse conversionRatesResponse = DEFAULT_RATES_RESPONSE) { | ||
| setResponse(request, conversionRatesResponse) | ||
| setResponse(getRequest(), conversionRatesResponse) | ||
| } | ||
|
|
||
| @Override | ||
| void setResponse() { | ||
| mockServerClient.when(request().withPath(endpoint)) | ||
| .respond(response().withStatusCode(OK_200.code())) | ||
| throw new UnsupportedOperationException() | ||
| } | ||
|
|
||
| @Override | ||
| protected HttpRequest getRequest(String ignored) { | ||
| request().withMethod("GET") | ||
| .withPath(CURRENCY_ENDPOINT_PATH) | ||
| protected RequestPattern getRequest() { | ||
| getRequestedFor(urlEqualTo(CURRENCY_ENDPOINT_PATH)).build() | ||
| } | ||
|
|
||
| @Override | ||
| protected HttpRequest getRequest() { | ||
| request().withMethod("GET") | ||
| .withPath(CURRENCY_ENDPOINT_PATH) | ||
| protected RequestPatternBuilder getRequest(String value) { | ||
| throw new UnsupportedOperationException() | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.