Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,23 @@ import static org.mockserver.model.JsonPathBody.jsonPath

class Bidder extends NetworkScaffolding {

private static final String AUCTION_ENDPOINT = "/auction"

Bidder(MockServerContainer mockServerContainer) {
super(mockServerContainer, AUCTION_ENDPOINT)
Bidder(MockServerContainer mockServerContainer, String endpoint = "/auction") {
super(mockServerContainer, endpoint)
}

@Override
protected HttpRequest getRequest(String bidRequestId) {
request().withPath(AUCTION_ENDPOINT)
request().withPath(endpoint)
.withBody(jsonPath("\$[?(@.id == '$bidRequestId')]"))
}

@Override
protected HttpRequest getRequest() {
request().withPath(AUCTION_ENDPOINT)
request().withPath(endpoint)
}

HttpRequest getRequest(String bidRequestId, String requestMatchPath) {
request().withPath(AUCTION_ENDPOINT)
request().withPath(endpoint)
.withBody(jsonPath("\$[?(@.$requestMatchPath == '$bidRequestId')]"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.prebid.server.functional.model.response.auction.Prebid
import org.prebid.server.functional.model.response.auction.SeatBid
import org.prebid.server.functional.service.PrebidServerException
import org.prebid.server.functional.service.PrebidServerService
import org.prebid.server.functional.testcontainers.scaffolding.Bidder
import org.prebid.server.functional.util.PBSUtils

import java.math.RoundingMode
Expand Down Expand Up @@ -1613,9 +1614,11 @@ class TargetingSpec extends BaseSpec {

def "PBS should assign bid ranks across all seatbids combined when the request contains imps with multiple bidders"() {
given: "PBS config with openX bidder"
def endpoint = '/openx-auction'
def pbsConfig = ["adapters.openx.enabled" : "true",
"adapters.openx.endpoint": "$networkServiceContainer.rootUri/auction".toString()]
"adapters.openx.endpoint": "$networkServiceContainer.rootUri$endpoint".toString()]
def prebidServerService = pbsServiceFactory.getService(pbsConfig)
def openxBidder = new Bidder(networkServiceContainer, endpoint)

and: "Bid request with multiple bidders"
def bidRequest = BidRequest.getDefaultBidRequest().tap {
Expand All @@ -1640,12 +1643,15 @@ class TargetingSpec extends BaseSpec {
it.dealid = PBSUtils.randomNumber
it.price = bidPrice
}
def bidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap {
it.seatbid = [new SeatBid(bid: [genericBid], seat: GENERIC),
new SeatBid(bid: [openxBid], seat: OPENX)]
def bidResponseGeneric = BidResponse.getDefaultBidResponse(bidRequest).tap {
it.seatbid = [new SeatBid(bid: [genericBid], seat: GENERIC)]
}
def bidResponseOpenx = BidResponse.getDefaultBidResponse(bidRequest).tap {
it.seatbid = [new SeatBid(bid: [openxBid], seat: OPENX)]
}
and: "Set bidder response"
bidder.setResponse(bidRequest.id, bidResponse)
bidder.setResponse(bidRequest.id, bidResponseGeneric)
openxBidder.setResponse(bidRequest.id, bidResponseOpenx)

when: "PBS processes auction request"
def response = prebidServerService.sendAuctionRequest(bidRequest)
Expand All @@ -1654,8 +1660,9 @@ class TargetingSpec extends BaseSpec {
assert response.seatbid.findAll { it.seat == OPENX }.bid.ext.prebid.rank.flatten() == [MAIN_RANK]
assert response.seatbid.findAll { it.seat == GENERIC }.bid.ext.prebid.rank.flatten() == [SUBORDINATE_RANK]

cleanup: "Stop and remove pbs container"
cleanup: "Stop and remove pbs container and bidder response"
pbsServiceFactory.removeContainer(pbsConfig)
openxBidder.reset()
}

def "PBS should assign bid ranks for each imp separately when request has multiple imps and multiBid is configured"() {
Expand Down
Loading