diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/BidResponsePrebid.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/BidResponsePrebid.groovy index aee9daf7783..77cb8274e38 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/BidResponsePrebid.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/BidResponsePrebid.groovy @@ -10,7 +10,6 @@ class BidResponsePrebid { Long auctionTimeStamp Map passThrough - ExtBidResponseFledge fledge ExtModule modules AnalyticsPrebid analytics } diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/ExtBidResponseFledge.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/ExtBidResponseFledge.groovy deleted file mode 100644 index 0da143b94ba..00000000000 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/ExtBidResponseFledge.groovy +++ /dev/null @@ -1,12 +0,0 @@ -package org.prebid.server.functional.model.response.auction - -import com.fasterxml.jackson.databind.PropertyNamingStrategies -import com.fasterxml.jackson.databind.annotation.JsonNaming -import groovy.transform.ToString - -@ToString(includeNames = true, ignoreNulls = true) -@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) -class ExtBidResponseFledge { - - List auctionConfigs -} diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/FledgeAuctionConfig.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/FledgeAuctionConfig.groovy deleted file mode 100644 index 9864610ec20..00000000000 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/FledgeAuctionConfig.groovy +++ /dev/null @@ -1,15 +0,0 @@ -package org.prebid.server.functional.model.response.auction - -import com.fasterxml.jackson.databind.PropertyNamingStrategies -import com.fasterxml.jackson.databind.annotation.JsonNaming -import groovy.transform.ToString - -@ToString(includeNames = true, ignoreNulls = true) -@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) -class FledgeAuctionConfig { - - String impId - String bidder - String adapter - Map config -} diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy index b5d5289d5a6..c116681e406 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy @@ -8,8 +8,6 @@ import static org.prebid.server.functional.model.bidder.BidderName.OPENX @ToString(includeNames = true, ignoreNulls = true) class OpenxBidResponse extends BidResponse { - OpenxBidResponseExt ext - static OpenxBidResponse getDefaultBidResponse(BidRequest bidRequest) { def openxBidResponse = new OpenxBidResponse(id: bidRequest.id) def bids = Bid.getDefaultBids(bidRequest.imp) diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponseExt.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponseExt.groovy deleted file mode 100644 index d373d2e73d6..00000000000 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponseExt.groovy +++ /dev/null @@ -1,11 +0,0 @@ -package org.prebid.server.functional.model.response.auction - -import com.fasterxml.jackson.annotation.JsonProperty -import groovy.transform.ToString - -@ToString(includeNames = true, ignoreNulls = true) -class OpenxBidResponseExt extends BidResponseExt { - - @JsonProperty("fledge_auction_configs") - Map fledgeAuctionConfigs -} diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy index 220585f008f..1a3af43c22d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy @@ -9,7 +9,6 @@ import org.prebid.server.functional.model.db.StoredRequest import org.prebid.server.functional.model.request.amp.AmpRequest import org.prebid.server.functional.model.request.auction.Adrino import org.prebid.server.functional.model.request.auction.Amx -import org.prebid.server.functional.model.request.auction.AuctionEnvironment import org.prebid.server.functional.model.request.auction.Banner import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.Device @@ -882,7 +881,6 @@ class BidderParamsSpec extends BaseSpec { prebid.bidder.generic = null prebid.adUnitCode = PBSUtils.randomString generic = new Generic() - auctionEnvironment = PBSUtils.getRandomEnum(AuctionEnvironment, [AuctionEnvironment.SERVER_ORCHESTRATED, AuctionEnvironment.UNKNOWN]) all = PBSUtils.randomNumber context = new ImpExtContext(data: new ImpExtContextData()) data = new ImpExtContextData(pbAdSlot: PBSUtils.randomString) @@ -1292,26 +1290,6 @@ class BidderParamsSpec extends BaseSpec { requestedAuctionEnvironment << [SERVER_ORCHESTRATED, UNKNOWN] } - def "PBS shouldn't change auction environment in imp.ext.igs when it is present in both imp.ext and imp.ext.igs"() { - given: "Default bid request with populated imp.ext" - def extAuctionEnv = PBSUtils.getRandomEnum(AuctionEnvironment, [SERVER_ORCHESTRATED, UNKNOWN]) - def extIgsAuctionEnv = PBSUtils.getRandomEnum(AuctionEnvironment, [SERVER_ORCHESTRATED, UNKNOWN]) - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.tap { - auctionEnvironment = extAuctionEnv - interestGroupAuctionSupports = new InterestGroupAuctionSupport(auctionEnvironment: extIgsAuctionEnv) - } - } - - when: "PBS processes auction request" - defaultPbsService.sendAuctionRequest(bidRequest) - - then: "Bidder request should imp[].{ae/ext.igs.ae} same value as requested" - def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest.imp[0].ext.auctionEnvironment == extAuctionEnv - assert bidderRequest.imp[0].ext.interestGroupAuctionSupports.auctionEnvironment == extIgsAuctionEnv - } - def "PBS should reject alias bidders when bidder params from request doesn't satisfy own json-schema"() { given: "Default bid request" def bidRequest = BidRequest.defaultBidRequest.tap { diff --git a/src/test/groovy/org/prebid/server/functional/tests/bidder/openx/OpenxSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/bidder/openx/OpenxSpec.groovy deleted file mode 100644 index 97a0015cea5..00000000000 --- a/src/test/groovy/org/prebid/server/functional/tests/bidder/openx/OpenxSpec.groovy +++ /dev/null @@ -1,581 +0,0 @@ -package org.prebid.server.functional.tests.bidder.openx - -import org.prebid.server.functional.model.Currency -import org.prebid.server.functional.model.bidder.Openx -import org.prebid.server.functional.model.config.AccountAuctionConfig -import org.prebid.server.functional.model.config.AccountConfig -import org.prebid.server.functional.model.db.Account -import org.prebid.server.functional.model.request.auction.AuctionEnvironment -import org.prebid.server.functional.model.request.auction.BidRequest -import org.prebid.server.functional.model.request.auction.InterestGroupAuctionSupport -import org.prebid.server.functional.model.request.auction.PaaFormat -import org.prebid.server.functional.model.response.auction.InterestGroupAuctionBuyer -import org.prebid.server.functional.model.response.auction.InterestGroupAuctionBuyerExt -import org.prebid.server.functional.model.response.auction.InterestGroupAuctionIntent -import org.prebid.server.functional.model.response.auction.InterestGroupAuctionSeller -import org.prebid.server.functional.model.response.auction.OpenxBidResponse -import org.prebid.server.functional.model.response.auction.OpenxBidResponseExt -import org.prebid.server.functional.service.PrebidServerException -import org.prebid.server.functional.service.PrebidServerService -import org.prebid.server.functional.tests.BaseSpec -import org.prebid.server.functional.util.PBSUtils -import spock.lang.Shared - -import java.time.Instant - -import static org.prebid.server.functional.model.bidder.BidderName.OPENX -import static org.prebid.server.functional.model.bidder.BidderName.OPENX_ALIAS -import static org.prebid.server.functional.model.bidder.BidderName.WILDCARD -import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.DEVICE_ORCHESTRATED -import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.NOT_SUPPORTED -import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.SERVER_ORCHESTRATED -import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.UNKNOWN -import static org.prebid.server.functional.model.request.auction.PaaFormat.IAB -import static org.prebid.server.functional.model.request.auction.PaaFormat.ORIGINAL -import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID -import static org.prebid.server.functional.testcontainers.Dependencies.networkServiceContainer - -class OpenxSpec extends BaseSpec { - - private static final Map OPENX_CONFIG = ["adapters.openx.enabled" : "true", - "adapters.openx.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - private static final Map OPENX_ALIAS_CONFIG = ["adapters.openx.aliases.openxalias.enabled" : "true", - "adapters.openx.aliases.openxalias.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - - @Shared - PrebidServerService pbsService = pbsServiceFactory.getService(OPENX_CONFIG) - - @Override - def cleanupSpec() { - pbsServiceFactory.removeContainer(OPENX_CONFIG) - pbsServiceFactory.removeContainer(OPENX_CONFIG + OPENX_ALIAS_CONFIG) - } - - def "PBS should populate fledge config by default when bid response with fledge"() { - given: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - } - - and: "Default bid response with fledge config" - def impId = bidRequest.imp[0].id - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response should contain fledge config" - def auctionConfigs = response.ext?.prebid?.fledge?.auctionConfigs - assert auctionConfigs?.size() == 1 - assert auctionConfigs[0].impId == impId - assert auctionConfigs[0].bidder == bidResponse.seatbid[0].seat.value - assert auctionConfigs[0].adapter == bidResponse.seatbid[0].seat.value - assert auctionConfigs[0].config == fledgeConfig - - and: "PBS response shouldn't contain igb config" - assert !response.ext?.interestGroupAuctionIntent?.interestGroupAuctionBuyer - - and: "PBS response shouldn't contain igs config" - assert !response.ext?.interestGroupAuctionIntent?.interestGroupAuctionSeller - } - - def "PBS should populate fledge config when bid response with fledge and ext.prebid.paaFormat = ORIGINAL"() { - given: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - ext.prebid.paaFormat = ORIGINAL - } - - and: "Default bid response with fledge config" - def impId = bidRequest.imp[0].id - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response should contain fledge config" - def auctionConfigs = response.ext?.prebid?.fledge?.auctionConfigs - assert auctionConfigs?.size() == 1 - assert auctionConfigs[0].impId == impId - assert auctionConfigs[0].bidder == bidResponse.seatbid[0].seat.value - assert auctionConfigs[0].adapter == bidResponse.seatbid[0].seat.value - assert auctionConfigs[0].config == fledgeConfig - - and: "PBS response shouldn't contain igb config" - assert !response.ext?.interestGroupAuctionIntent?.interestGroupAuctionBuyer - - and: "PBS response shouldn't contain igs config" - assert !response.ext?.interestGroupAuctionIntent?.interestGroupAuctionSeller - } - - def "PBS should take precedence request paa format over account value when both specified"() { - given: "Default bid request with openx" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - ext.prebid.paaFormat = IAB - } - - and: "Default bid response with fledge config" - def impId = bidRequest.imp[0].id - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - and: "Save account in the DB" - def accountConfig = new AccountConfig(auction: new AccountAuctionConfig(paaformat: ORIGINAL)) - def account = new Account(uuid: bidRequest.site.publisher.id, config: accountConfig) - accountDao.save(account) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response shouldn't contain fledge config" - assert !response.ext?.prebid?.fledge?.auctionConfigs - - and: "PBS response should contain igs config" - def interestGroupAuctionSeller = response.ext.interestGroupAuctionIntent[0].interestGroupAuctionSeller[0] - assert interestGroupAuctionSeller.impId == impId - assert interestGroupAuctionSeller.config == fledgeConfig - assert interestGroupAuctionSeller.ext.bidder == bidResponse.seatbid[0].seat.value - assert interestGroupAuctionSeller.ext.adapter == bidResponse.seatbid[0].seat.value - - and: "PBS response shouldn't contain igb config" - assert !response.ext?.interestGroupAuctionIntent?[0]?.interestGroupAuctionBuyer - } - - def "PBS shouldn't populate fledge config when bid response with fledge and ext.prebid.paaFormat = IAB"() { - given: "Default basic BidRequest without ae" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = NOT_SUPPORTED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - ext.prebid.paaFormat = IAB - } - - and: "Default bid response" - def impId = bidRequest.imp[0].id - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): [(PBSUtils.randomString): PBSUtils.randomString]] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response shouldn't contain fledge config" - assert !response.ext.prebid.fledge - - and: "PBS response shouldn't contain igb config" - assert !response.ext?.interestGroupAuctionIntent?[0]?.interestGroupAuctionBuyer - - and: "PBS response should contain igs config" - def interestGroupAuctionSeller = response.ext.interestGroupAuctionIntent[0].interestGroupAuctionSeller[0] - assert interestGroupAuctionSeller.impId == impId - assert interestGroupAuctionSeller.config - assert interestGroupAuctionSeller.ext.bidder == bidResponse.seatbid[0].seat.value - assert interestGroupAuctionSeller.ext.adapter == bidResponse.seatbid[0].seat.value - } - - def "PBS shouldn't populate fledge config when bid response didn't return fledge config"() { - given: "Default basic BidRequest without ae" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - } - - and: "Default bid response" - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = null - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response shouldn't contain fledge config" - assert !response.ext.prebid.fledge - - and: "PBS response shouldn't contain igi config" - assert !response?.ext?.interestGroupAuctionIntent - } - - def "PBS should populate fledge and iab output config when bid response with fledge and paa formant IAB"() { - given: "Default bid request with openx" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - ext.prebid.paaFormat = requestPaaFormant - } - - and: "Default bid response with fledge config" - def impId = bidRequest.imp[0].id - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - and: "Save account in the DB" - def accountConfig = new AccountConfig(auction: new AccountAuctionConfig(paaformat: accountPaaFormat)) - def account = new Account(uuid: bidRequest.site.publisher.id, config: accountConfig) - accountDao.save(account) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response shouldn't contain fledge config" - assert !response.ext?.prebid?.fledge?.auctionConfigs - - and: "PBS response should contain igs config" - def interestGroupAuctionSeller = response.ext.interestGroupAuctionIntent[0].interestGroupAuctionSeller[0] - assert interestGroupAuctionSeller.impId == impId - assert interestGroupAuctionSeller.config == fledgeConfig - assert interestGroupAuctionSeller.ext.bidder == bidResponse.seatbid[0].seat.value - assert interestGroupAuctionSeller.ext.adapter == bidResponse.seatbid[0].seat.value - - and: "PBS response shouldn't contain igb config" - assert !response.ext?.interestGroupAuctionIntent?[0]?.interestGroupAuctionBuyer - - where: - accountPaaFormat | requestPaaFormant - IAB | IAB - null | IAB - IAB | null - } - - def "PBS should populate fledge config by default when bid response with fledge and requested aliases"() { - given: "PBS config with alias config" - def pbsService = pbsServiceFactory.getService(OPENX_CONFIG + OPENX_ALIAS_CONFIG) - - and: "Default basic BidRequest with ae and bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.generic = null - imp[0].ext.prebid.bidder.openxAlias = Openx.defaultOpenx - ext.prebid.aliases = [(OPENX_ALIAS.value): OPENX] - } - - and: "Default bid response with fledge config" - def impId = bidRequest.imp[0].id - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX_ALIAS).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response should contain fledge config" - def auctionConfigs = response.ext?.prebid?.fledge?.auctionConfigs - assert auctionConfigs?.size() == 1 - assert auctionConfigs[0].impId == impId - assert auctionConfigs[0].bidder == OPENX_ALIAS.value - assert auctionConfigs[0].adapter == OPENX_ALIAS.value - assert auctionConfigs[0].config == fledgeConfig - - and: "PBS response shouldn't contain igi config" - assert !response.ext?.interestGroupAuctionIntent - } - - def "PBS should populate iab config when bid response with fledge and requested aliases"() { - given: "PBS config" - def pbsService = pbsServiceFactory.getService(OPENX_CONFIG + OPENX_ALIAS_CONFIG) - - and: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.generic = null - imp[0].ext.prebid.bidder.openxAlias = Openx.defaultOpenx - ext.prebid.aliases = [(OPENX_ALIAS.value): OPENX] - ext.prebid.paaFormat = IAB - } - - and: "Default bid response with fledge config" - def impId = bidRequest.imp[0].id - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX_ALIAS).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response shouldn't contain fledge config" - assert !response.ext?.prebid?.fledge?.auctionConfigs - - and: "PBS response should contain igs config" - def interestGroupAuctionSeller = response.ext.interestGroupAuctionIntent[0].interestGroupAuctionSeller[0] - assert interestGroupAuctionSeller.impId == impId - assert interestGroupAuctionSeller.config == fledgeConfig - assert interestGroupAuctionSeller.ext.bidder == OPENX_ALIAS.value - assert interestGroupAuctionSeller.ext.adapter == OPENX_ALIAS.value - - and: "Response should contain seat" - assert response.seatbid[0].seat == OPENX_ALIAS - - and: "Response should contain seat" - assert response.seatbid[0].bid[0].ext.prebid.meta.adapterCode == OPENX_ALIAS - - and: "PBS response shouldn't contain igi config" - assert !response.ext?.interestGroupAuctionIntent?[0].interestGroupAuctionBuyer - } - - def "PBS should populate fledge config by default when bid response with fledge and imp mismatched"() { - given: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - } - - and: "Default bid response with fledge config" - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(fledgeImpId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response should contain fledge config" - def auctionConfigs = response.ext?.prebid?.fledge?.auctionConfigs - assert auctionConfigs?.size() == 1 - assert auctionConfigs[0].impId == fledgeImpId - assert auctionConfigs[0].bidder == bidResponse.seatbid[0].seat.value - assert auctionConfigs[0].adapter == bidResponse.seatbid[0].seat.value - assert auctionConfigs[0].config == fledgeConfig - - and: "PBS response shouldn't contain igi config" - assert !response.ext?.interestGroupAuctionIntent - - where: - fledgeImpId << [PBSUtils.randomString, PBSUtils.randomNumber as String, WILDCARD.value] - } - - def "PBS should log error and not populated fledge impId when bidder respond with not empty config, but an empty impid"() { - given: "Start time" - def startTime = Instant.now() - - and: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - ext.prebid.paaFormat = IAB - } - - and: "Default bid response with fledge config without imp" - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(""): fledgeConfig] as Map - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - and: "Flush metrics" - flushMetrics(pbsService) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response shouldn't contain fledge config" - assert !response.ext?.prebid?.fledge?.auctionConfigs - - and: "PBS response shouldn't contain igi config" - assert !response.ext?.interestGroupAuctionIntent - - and: "PBS log should contain error" - def logs = pbsService.getLogsByTime(startTime) - assert getLogsByText(logs, "ExtIgiIgs with absent impId from bidder: ${OPENX.value}") - - and: "Bid response should contain warning" - assert response.ext.warnings[PREBID]?.code == [999] - assert response.ext.warnings[PREBID]?.message == - ["ExtIgiIgs with absent impId from bidder: ${OPENX.value}" as String] - - and: "Alert.general metric should be updated" - def metrics = pbsService.sendCollectedMetricsRequest() - assert metrics[ALERT_GENERAL] == 1 - } - - def "PBS shouldn't populate fledge or igi config when bidder respond with igb"() { - given: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - } - - and: "Default bid response with igb config" - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX).tap { - ext = new OpenxBidResponseExt().tap { - interestGroupAuctionIntent = [new InterestGroupAuctionIntent( - interestGroupAuctionBuyer: [new InterestGroupAuctionBuyer( - origin: PBSUtils.randomString, - maxBid: PBSUtils.randomDecimal, - cur: PBSUtils.getRandomEnum(Currency), - pbs: [(PBSUtils.randomString): PBSUtils.randomString], - ext: new InterestGroupAuctionBuyerExt( - bidder: PBSUtils.randomString, - adapter: PBSUtils.randomString - ) - )]) - ] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response should contain fledge config" - assert !response.ext?.prebid?.fledge?.auctionConfigs - - and: "PBS response shouldn't contain igi config" - assert !response.ext?.interestGroupAuctionIntent - } - - def "PBS should throw error when requested unknown paa format"() { - given: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - ext.prebid.paaFormat = PaaFormat.INVALID - } - - and: "Default bid response with fledge config" - def impId = bidRequest.imp[0].id - def fledgeConfig = [(PBSUtils.randomString): PBSUtils.randomString] - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX).tap { - ext = new OpenxBidResponseExt().tap { - fledgeAuctionConfigs = [(impId): fledgeConfig] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) - - then: "Request should fail with error" - def exception = thrown(PrebidServerException) - assert exception.responseBody.startsWith("Invalid request format: Error decoding bidRequest: " + - "Cannot deserialize value of type `org.prebid.server.auction.model.PaaFormat` " + - "from String \"invalid\": not one of the values accepted for Enum class: [original, iab]") - } - - def "PBS shouldn't cause error when igs and igb empty array"() { - given: "Default basic BidRequest with ae and openx bidder" - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.auctionEnvironment = DEVICE_ORCHESTRATED - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - ext.prebid.paaFormat = paaFormat - } - - and: "Default bid response with igs config" - def bidResponse = OpenxBidResponse.getDefaultBidResponse(bidRequest, OPENX).tap { - ext = new OpenxBidResponseExt().tap { - interestGroupAuctionIntent = [new InterestGroupAuctionIntent( - interestGroupAuctionSeller: interestGroupAuctionSeller, - interestGroupAuctionBuyer: interestGroupAuctionBuyer - )] - } - } - - and: "Set bidder response" - bidder.setResponse(bidRequest.id, bidResponse) - - when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) - - then: "PBS response should contain fledge config" - assert !response.ext?.prebid?.fledge?.auctionConfigs - - and: "PBS response shouldn't contain igi config" - assert !response.ext?.interestGroupAuctionIntent - - where: - paaFormat | interestGroupAuctionSeller | interestGroupAuctionBuyer - IAB | [new InterestGroupAuctionSeller()] | [new InterestGroupAuctionBuyer()] - ORIGINAL | [] | [] - } - - def "PBS shouldn't change auction environment in imp.ext.igs and not emit a warning when it is present in both imp.ext and imp.ext.igs"() { - given: "Default bid request with populated imp.ext" - def extAuctionEnv = PBSUtils.getRandomEnum(AuctionEnvironment, [SERVER_ORCHESTRATED, UNKNOWN]) - def extIgsAuctionEnv = PBSUtils.getRandomEnum(AuctionEnvironment, [SERVER_ORCHESTRATED, UNKNOWN]) - def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].ext.prebid.bidder.openx = Openx.defaultOpenx - imp[0].ext.prebid.bidder.generic = null - imp[0].ext.tap { - auctionEnvironment = extAuctionEnv - interestGroupAuctionSupports = new InterestGroupAuctionSupport(auctionEnvironment: extIgsAuctionEnv) - } - } - - when: "PBS processes auction request" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) - - then: "Bidder request should imp[].{ae/ext.igs.ae} same value as requested" - def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest.imp[0].ext.auctionEnvironment == extAuctionEnv - assert bidderRequest.imp[0].ext.interestGroupAuctionSupports.auctionEnvironment == extIgsAuctionEnv - - and: "Response shouldn't contain errors" - assert !bidResponse.ext.errors - - and: "Response shouldn't contain warnings" - assert !bidResponse.ext.warnings - } -}