Conversation
| @@ -0,0 +1,18 @@ | |||
| package org.prebid.server.functional.model | |||
|
|
|||
| enum HttpStatusCode { | |||
There was a problem hiding this comment.
We can use org.apache.http.HttpStatus instead of our own codes
src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy
Show resolved
Hide resolved
|
|
||
| private static final String rfcEndpoint= "/stored-requests-rfc" | ||
| private static final HttpSettings httpSettings = new HttpSettings(networkServiceContainer) | ||
| private static final HttpSettings httpSettingsWithRFC = new HttpSettings(networkServiceContainer, rfcEndpoint) |
There was a problem hiding this comment.
should be: httpSettingsWithRfc
https://google.github.io/styleguide/javaguide.html#s5.3-camel-case
|
|
||
| def cleanupSpec() { | ||
| bidder.reset() | ||
| prebidCache.reset() |
There was a problem hiding this comment.
Is there a reason to remove it?
| request().withMethod("GET") | ||
| .withPath(endpoint) | ||
| protected RequestPatternBuilder getRequest(String bidRequestId) { | ||
| return null |
There was a problem hiding this comment.
Returning null here and in similar methods is a bad practice. We should either refactor this logic or throw UnsupportedOperationException to avoid potential NPEs
| List<Map<String, List<String>>> result = [] | ||
| requests.each { req -> | ||
| Map<String, List<String>> headersMap = [:] | ||
| req.headers.all().each { header -> | ||
| headersMap[header.key() as String] = header.values()*.toString() | ||
| } | ||
| result << headersMap | ||
| } | ||
|
|
||
| result |
There was a problem hiding this comment.
can simplify:
List<Map<String, List<String>>> getRecordedRequestsHeaders(RequestPatternBuilder builder) {
wireMockClient.find(builder).collect { req ->
req.headers.all().collectEntries { [it.key(), it.values()*.toString()] }
}
}
src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy
Show resolved
Hide resolved
| request().withMethod("GET") | ||
| .withPath(CURRENCY_ENDPOINT_PATH) | ||
| protected RequestPatternBuilder getRequest(String value) { | ||
| return null |
There was a problem hiding this comment.
throw new UnsupportedOperationException()
| headers.each { k, v -> | ||
| responseBuilder.withHeader(k, v) | ||
| } |
There was a problem hiding this comment.
headers.each { responseBuilder.withHeader(it.key, it.value) }
| headers.each { k, v -> | ||
| responseBuilder.withHeader(k, v) | ||
| } |
There was a problem hiding this comment.
headers.each { responseBuilder.withHeader(it.key, it.value) }
| .withBody(jsonPath("\$.puts[?(@.value.impid == '$impId')]")) | ||
| protected RequestPatternBuilder getRequest(String impId) { | ||
| postRequestedFor(urlEqualTo(CACHE_ENDPOINT)) | ||
| .withRequestBody(matchingJsonPath("\$.puts[?(@.value.impid == '" + impId + "')]")) |
There was a problem hiding this comment.
.withRequestBody(matchingJsonPath("$.puts[?(@.value.impid == '$impId')]"))
| encode(new PrebidCacheResponse(responses: cacheObjects)) | ||
| private static RequestPatternBuilder getXmlCacheRequest(String payload) { | ||
| postRequestedFor(urlEqualTo(CACHE_ENDPOINT)) | ||
| .withRequestBody(matchingJsonPath("\$.puts[?(@.value =~ /.*" + payload + ".*/)]")) |
There was a problem hiding this comment.
.withRequestBody(matchingJsonPath("$.puts[?(@.value =~ /.${payload}./)]"))
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check