diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/Banner.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/Banner.groovy index 32bd83365f9..97461b79d78 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/Banner.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/Banner.groovy @@ -10,7 +10,7 @@ class Banner { List format @JsonProperty("w") - Integer weight + Integer width @JsonProperty("h") Integer height List btype diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/Format.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/Format.groovy index 326ba14ed5d..67215776579 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/Format.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/Format.groovy @@ -10,26 +10,26 @@ import org.prebid.server.functional.util.PBSUtils class Format { @JsonProperty("w") - Integer weight + Integer width @JsonProperty("h") Integer height @JsonProperty("wratio") - Integer weightRatio + Integer widthRatio @JsonProperty("hratio") Integer heightRatio @JsonProperty("wmin") - Integer weightMin + Integer widthMin static Format getDefaultFormat() { new Format().tap { - weight = 300 + width = 300 height = 250 } } static Format getRandomFormat() { new Format().tap { - weight = PBSUtils.randomNumber + width = PBSUtils.randomNumber height = PBSUtils.randomNumber } } diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/Video.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/Video.groovy index a70ee05eac3..53e86c5ed28 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/Video.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/Video.groovy @@ -16,7 +16,7 @@ class Video { Integer poddur List protocols @JsonProperty("w") - Integer weight + Integer width @JsonProperty("h") Integer height Integer podid @@ -47,6 +47,6 @@ class Video { List podDeduplication static Video getDefaultVideo() { - new Video(mimes: ["video/mp4"], weight: 300, height: 200) + new Video(mimes: ["video/mp4"], width: 300, height: 200) } } diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/Bid.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/Bid.groovy index 18bc588d1d3..49beb80792f 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/Bid.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/Bid.groovy @@ -40,11 +40,11 @@ class Bid implements ObjectMapperWrapper { String langb String dealid @JsonProperty("w") - Integer weight + Integer width @JsonProperty("h") Integer height @JsonProperty("wratio") - Integer weightRatio + Integer widthRatio @JsonProperty("hratio") Integer heightRatio Integer exp @@ -65,7 +65,7 @@ class Bid implements ObjectMapperWrapper { price = imp.bidFloor != null ? imp.bidFloor : PBSUtils.getRandomPrice() crid = 1 height = imp.banner && imp.banner.format ? imp.banner.format.first().height : null - weight = imp.banner && imp.banner.format ? imp.banner.format.first().weight : null + width = imp.banner && imp.banner.format ? imp.banner.format.first().width : null if (imp.nativeObj || imp.video) { adm = new Adm(assets: [Asset.defaultAsset]) } diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy index 6a06a9f2e8a..052bcf2f69f 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy @@ -38,8 +38,7 @@ LIMIT 1 "settings.database.account-query" : DB_ACCOUNT_QUERY, "settings.database.stored-requests-query" : "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%) UNION ALL SELECT accountId, impId, impData, 'imp' as dataType FROM stored_imps WHERE impId IN (%IMP_ID_LIST%)", "settings.database.amp-stored-requests-query": "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%)", - "settings.database.stored-responses-query" : "SELECT resId, COALESCE(storedAuctionResponse, storedBidResponse) as responseData FROM stored_responses WHERE resId IN (%RESPONSE_ID_LIST%)", - 'settings.database.profiles-query' : "SELECT accountId, profileId, profile, mergePrecedence, type FROM profiles WHERE profileId in (%REQUEST_ID_LIST%, %IMP_ID_LIST%)" + "settings.database.stored-responses-query" : "SELECT resId, COALESCE(storedAuctionResponse, storedBidResponse) as responseData FROM stored_responses WHERE resId IN (%RESPONSE_ID_LIST%)" ].asImmutable() static Map getPubstackAnalyticsConfig(String scopeId) { diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy index fd89add53eb..05d6fcfa3d7 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy @@ -75,7 +75,7 @@ class Bidder extends NetworkScaffolding { def formatNode = it.get("banner") != null ? it.get("banner").get("format") : null new Imp(id: it.get("id").asText(), banner: formatNode != null - ? new Banner(format: [new Format(weight: formatNode.first().get("w").asInt(), height: formatNode.first().get("h").asInt())]) + ? new Banner(format: [new Format(width: formatNode.first().get("w").asInt(), height: formatNode.first().get("h").asInt())]) : null)} def bidRequest = new BidRequest(id: id, imp: imps) def response = BidResponse.getDefaultBidResponse(bidRequest) diff --git a/src/test/groovy/org/prebid/server/functional/tests/AmpSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/AmpSpec.groovy index fa72326fe7c..47e08555828 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/AmpSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/AmpSpec.groovy @@ -87,7 +87,7 @@ class AmpSpec extends BaseSpec { then: "Response should contain information from stored response" def price = storedAuctionResponse.bid[0].price assert response.targeting["hb_pb"] == getRoundedTargetingValueWithDownPrecision(price) - assert response.targeting["hb_size"] == "${storedAuctionResponse.bid[0].weight}x${storedAuctionResponse.bid[0].height}" + assert response.targeting["hb_size"] == "${storedAuctionResponse.bid[0].width}x${storedAuctionResponse.bid[0].height}" and: "PBS not send request to bidder" assert bidder.getRequestCount(ampStoredRequest.id) == 0 @@ -126,7 +126,7 @@ class AmpSpec extends BaseSpec { assert bidderRequest.site?.publisher?.id == ampRequest.account.toString() assert bidderRequest.imp[0]?.tagId == ampRequest.slot assert bidderRequest.imp[0]?.banner?.format*.height == [ampRequest.h, msH] - assert bidderRequest.imp[0]?.banner?.format*.weight == [ampRequest.w, msW] + assert bidderRequest.imp[0]?.banner?.format*.width == [ampRequest.w, msW] assert bidderRequest.regs?.gdpr == (ampRequest.gdprApplies ? 1 : 0) } @@ -154,7 +154,7 @@ class AmpSpec extends BaseSpec { def bidderRequest = bidder.getBidderRequest(ampStoredRequest.id) assert bidderRequest.imp[0]?.banner?.format*.height == [ampRequest.oh] - assert bidderRequest.imp[0]?.banner?.format*.weight == [ampRequest.ow] + assert bidderRequest.imp[0]?.banner?.format*.width == [ampRequest.ow] } def "PBS should take parameters from the stored request when it's not specified in the request"() { @@ -180,7 +180,7 @@ class AmpSpec extends BaseSpec { assert bidderRequest.site?.publisher?.id == ampStoredRequest.site.publisher.id assert !bidderRequest.imp[0]?.tagId assert bidderRequest.imp[0]?.banner?.format[0]?.height == ampStoredRequest.imp[0].banner.format[0].height - assert bidderRequest.imp[0]?.banner?.format[0]?.weight == ampStoredRequest.imp[0].banner.format[0].weight + assert bidderRequest.imp[0]?.banner?.format[0]?.width == ampStoredRequest.imp[0].banner.format[0].width assert bidderRequest.regs?.gdpr == ampStoredRequest.regs.gdpr } diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidderFormatSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidderFormatSpec.groovy index bd7d6abfafc..b47a2e47ddf 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidderFormatSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidderFormatSpec.groovy @@ -35,10 +35,10 @@ class BidderFormatSpec extends BaseSpec { @Shared private static final RANDOM_NUMBER = PBSUtils.randomNumber - def "PBS should successfully pass when banner.format weight and height is valid"() { + def "PBS should successfully pass when banner.format width and height is valid"() { given: "Default bid request with banner format" def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].banner.format = [new Format(weight: bannerFormatWeight, height: bannerFormatHeight)] + imp[0].banner.format = [new Format(width: bannerFormatWidth, height: bannerFormatHeight)] } when: "Requesting PBS auction" @@ -46,19 +46,19 @@ class BidderFormatSpec extends BaseSpec { then: "BidResponse should contain the same banner format as on request" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.imp[0]?.banner?.format[0].weight == bannerFormatWeight + assert bidderRequest?.imp[0]?.banner?.format[0].width == bannerFormatWidth assert bidderRequest?.imp[0]?.banner?.format[0].height == bannerFormatHeight where: - bannerFormatWeight | bannerFormatHeight + bannerFormatWidth | bannerFormatHeight 1 | 1 PBSUtils.randomNumber | PBSUtils.randomNumber } - def "PBS should unsuccessfully pass and throw error due to validation banner.format{w.h} when banner.format weight or height is invalid"() { + def "PBS should unsuccessfully pass and throw error due to validation banner.format{w.h} when banner.format width or height is invalid"() { given: "Default bid request with banner format" def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].banner.format = [new Format(weight: bannerFormatWeight, height: bannerFormatHeight)] + imp[0].banner.format = [new Format(width: bannerFormatWidth, height: bannerFormatHeight)] } when: "Requesting PBS auction" @@ -71,7 +71,7 @@ class BidderFormatSpec extends BaseSpec { "request.imp[0].banner.format[0] must define a valid \"h\" and \"w\" properties" where: - bannerFormatWeight | bannerFormatHeight + bannerFormatWidth | bannerFormatHeight 0 | PBSUtils.randomNumber PBSUtils.randomNumber | 0 null | PBSUtils.randomNumber @@ -80,10 +80,10 @@ class BidderFormatSpec extends BaseSpec { PBSUtils.randomNumber | PBSUtils.randomNegativeNumber } - def "PBS should unsuccessfully pass and throw error due to validation banner.format{w.h} when banner.format weight and height is invalid"() { + def "PBS should unsuccessfully pass and throw error due to validation banner.format{w.h} when banner.format width and height is invalid"() { given: "Default bid request with banner format" def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].banner.format = [new Format(weight: bannerFormatWeight, height: bannerFormatHeight)] + imp[0].banner.format = [new Format(width: bannerFormatWidth, height: bannerFormatHeight)] } when: "Requesting PBS auction" @@ -97,7 +97,7 @@ class BidderFormatSpec extends BaseSpec { "*or* {wmin, wratio, hratio} (for flexible sizes) to be non-zero positive" where: - bannerFormatWeight | bannerFormatHeight + bannerFormatWidth | bannerFormatHeight 0 | 0 0 | null 0 | PBSUtils.randomNegativeNumber @@ -106,10 +106,10 @@ class BidderFormatSpec extends BaseSpec { PBSUtils.randomNegativeNumber | PBSUtils.randomNegativeNumber } - def "PBS should successfully pass when banner weight and height is valid"() { + def "PBS should successfully pass when banner width and height is valid"() { given: "Default bid request with banner format" def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].banner = new Banner(weight: bannerFormatWeight, height: bannerFormatHeight) + imp[0].banner = new Banner(width: bannerFormatWidth, height: bannerFormatHeight) } when: "Requesting PBS auction" @@ -117,11 +117,11 @@ class BidderFormatSpec extends BaseSpec { then: "BidResponse should contain the same banner{w.h} as on request" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.imp[0]?.banner?.weight == bannerFormatWeight + assert bidderRequest?.imp[0]?.banner?.width == bannerFormatWidth assert bidderRequest?.imp[0]?.banner?.height == bannerFormatHeight where: - bannerFormatWeight | bannerFormatHeight + bannerFormatWidth | bannerFormatHeight 1 | 1 PBSUtils.randomNumber | PBSUtils.randomNumber } @@ -129,7 +129,7 @@ class BidderFormatSpec extends BaseSpec { def "PBS should unsuccessfully pass and throw error due to validation banner{w.h} when banner{w.h} is invalid"() { given: "Default bid request with banner{w.h}" def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].banner = new Banner(weight: bannerFormatWeight, height: bannerFormatHeight) + imp[0].banner = new Banner(width: bannerFormatWidth, height: bannerFormatHeight) } when: "Requesting PBS auction" @@ -142,7 +142,7 @@ class BidderFormatSpec extends BaseSpec { "request.imp[0].banner has no sizes. Define \"w\" and \"h\", or include \"format\" elements" where: - bannerFormatWeight | bannerFormatHeight + bannerFormatWidth | bannerFormatHeight 0 | 0 0 | PBSUtils.randomNumber PBSUtils.randomNumber | 0 @@ -162,7 +162,7 @@ class BidderFormatSpec extends BaseSpec { def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].tap { - banner = new Banner(format: [new Format(weight: RANDOM_NUMBER, height: RANDOM_NUMBER)]) + banner = new Banner(format: [new Format(width: RANDOM_NUMBER, height: RANDOM_NUMBER)]) ext.prebid.storedBidResponse = [new StoredBidResponse(id: storedResponseId, bidder: BidderName.GENERIC)] } } @@ -172,7 +172,7 @@ class BidderFormatSpec extends BaseSpec { def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { it.seatbid[0].bid[0].tap { it.id = storedBidId - it.weight = responseWeight + it.width = responseWidth it.height = responseHeight } } @@ -201,18 +201,18 @@ class BidderFormatSpec extends BaseSpec { "Warning: BidResponse validation `warn`: bidder `${GENERIC}` response triggers creative size " + "validation for bid ${storedBidId}, account=${bidRequest.accountId}, " + "referrer=${bidRequest.site.page}, max imp size='${RANDOM_NUMBER}x${RANDOM_NUMBER}', " + - "bid response size='${responseWeight}x${responseHeight}'" + "bid response size='${responseWidth}x${responseHeight}'" - and: "Bid response should contain weight and height from stored response" + and: "Bid response should contain width and height from stored response" def bid = bidResponse.seatbid[0].bid[0] - assert bid.weight == responseWeight + assert bid.width == responseWidth assert bid.height == responseHeight and: "PBs shouldn't perform a bidder request due to stored bid response" assert !bidder.getBidderRequests(bidRequest.id) where: - accountCretiveMaxSize | configCreativeMaxSize | responseWeight | responseHeight + accountCretiveMaxSize | configCreativeMaxSize | responseWidth | responseHeight null | WARN.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER + 1 null | WARN.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER null | WARN.value | RANDOM_NUMBER | RANDOM_NUMBER + 1 @@ -229,7 +229,7 @@ class BidderFormatSpec extends BaseSpec { def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].tap { - banner = new Banner(format: [new Format(weight: RANDOM_NUMBER, height: RANDOM_NUMBER)]) + banner = new Banner(format: [new Format(width: RANDOM_NUMBER, height: RANDOM_NUMBER)]) ext.prebid.storedBidResponse = [new StoredBidResponse(id: storedResponseId, bidder: BidderName.GENERIC)] } } @@ -237,7 +237,7 @@ class BidderFormatSpec extends BaseSpec { and: "Stored bid response with biggest W and H than in bidRequest in DB" def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { it.seatbid[0].bid[0].tap { - it.weight = responseWeight + it.width = responseWidth it.height = responseHeight } } @@ -261,16 +261,16 @@ class BidderFormatSpec extends BaseSpec { and: "Response should contain error" assert !bidResponse.ext?.errors - and: "Bid response should contain weight and height from stored response" + and: "Bid response should contain width and height from stored response" def bid = bidResponse.seatbid[0].bid[0] - assert bid.weight == responseWeight + assert bid.width == responseWidth assert bid.height == responseHeight and: "PBs shouldn't perform a bidder request due to stored bid response" assert !bidder.getBidderRequests(bidRequest.id) where: - accountCretiveMaxSizeSnakeCase | accountCretiveMaxSize | configCreativeMaxSize | responseWeight | responseHeight + accountCretiveMaxSizeSnakeCase | accountCretiveMaxSize | configCreativeMaxSize | responseWidth | responseHeight null | null | SKIP.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER + 1 null | null | SKIP.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER null | null | SKIP.value | RANDOM_NUMBER | RANDOM_NUMBER + 1 @@ -293,7 +293,7 @@ class BidderFormatSpec extends BaseSpec { def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].tap { - banner = new Banner(format: [new Format(weight: RANDOM_NUMBER, height: RANDOM_NUMBER)]) + banner = new Banner(format: [new Format(width: RANDOM_NUMBER, height: RANDOM_NUMBER)]) ext.prebid.storedBidResponse = [new StoredBidResponse(id: storedResponseId, bidder: BidderName.GENERIC)] } } @@ -303,7 +303,7 @@ class BidderFormatSpec extends BaseSpec { def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { it.seatbid[0].bid[0].tap { it.id = storedBidId - it.weight = responseWeight + it.width = responseWidth it.height = responseHeight } } @@ -332,7 +332,7 @@ class BidderFormatSpec extends BaseSpec { "Error: BidResponse validation `enforce`: bidder `${GENERIC.value}` response triggers creative size " + "validation for bid ${storedBidId}, account=${bidRequest.accountId}, " + "referrer=${bidRequest.site.page}, max imp size='${RANDOM_NUMBER}x${RANDOM_NUMBER}', " + - "bid response size='${responseWeight}x${responseHeight}'" + "bid response size='${responseWidth}x${responseHeight}'" and: "Pbs should discard seatBid due to validation" assert !bidResponse.seatbid @@ -341,7 +341,7 @@ class BidderFormatSpec extends BaseSpec { assert !bidder.getBidderRequests(bidRequest.id) where: - accountCretiveMaxSize | configCreativeMaxSize | responseWeight | responseHeight + accountCretiveMaxSize | configCreativeMaxSize | responseWidth | responseHeight null | ENFORCE.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER + 1 null | ENFORCE.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER null | ENFORCE.value | RANDOM_NUMBER | RANDOM_NUMBER + 1 @@ -358,7 +358,7 @@ class BidderFormatSpec extends BaseSpec { def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].tap { - banner = new Banner(format: [new Format(weight: RANDOM_NUMBER, height: RANDOM_NUMBER)]) + banner = new Banner(format: [new Format(width: RANDOM_NUMBER, height: RANDOM_NUMBER)]) ext.prebid.storedBidResponse = [new StoredBidResponse(id: storedResponseId, bidder: BidderName.GENERIC)] } } @@ -366,7 +366,7 @@ class BidderFormatSpec extends BaseSpec { and: "Stored bid response with biggest W and H than in bidRequest in DB" def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { it.seatbid[0].bid[0].tap { - weight = RANDOM_NUMBER + width = RANDOM_NUMBER height = RANDOM_NUMBER } } @@ -388,9 +388,9 @@ class BidderFormatSpec extends BaseSpec { and: "Response should contain error" assert !bidResponse.ext?.errors - and: "Bid response should contain weight and height from stored response" + and: "Bid response should contain width and height from stored response" def bid = bidResponse.seatbid[0].bid[0] - assert bid.weight == RANDOM_NUMBER + assert bid.width == RANDOM_NUMBER assert bid.height == RANDOM_NUMBER and: "PBs shouldn't perform a bidder request due to stored bid response" @@ -414,7 +414,7 @@ class BidderFormatSpec extends BaseSpec { def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.getDefaultVideoRequest().tap { imp[0].tap { - video = new Video(weight: RANDOM_NUMBER, height: RANDOM_NUMBER, mimes: [PBSUtils.randomString]) + video = new Video(width: RANDOM_NUMBER, height: RANDOM_NUMBER, mimes: [PBSUtils.randomString]) ext.prebid.storedBidResponse = [new StoredBidResponse(id: storedResponseId, bidder: BidderName.GENERIC)] } } @@ -422,7 +422,7 @@ class BidderFormatSpec extends BaseSpec { and: "Stored bid response with biggest W and H than in bidRequest in DB" def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { it.seatbid[0].bid[0].tap { - weight = responseWeight + width = responseWidth height = responseHeight } } @@ -451,7 +451,7 @@ class BidderFormatSpec extends BaseSpec { assert !bidder.getBidderRequests(bidRequest.id) where: - accountCretiveMaxSize | configCreativeMaxSize | responseWeight | responseHeight + accountCretiveMaxSize | configCreativeMaxSize | responseWidth | responseHeight null | ENFORCE.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER + 1 null | ENFORCE.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER null | ENFORCE.value | RANDOM_NUMBER | RANDOM_NUMBER + 1 @@ -480,7 +480,7 @@ class BidderFormatSpec extends BaseSpec { def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].tap { - banner = new Banner(format: [new Format(weight: RANDOM_NUMBER, height: RANDOM_NUMBER)]) + banner = new Banner(format: [new Format(width: RANDOM_NUMBER, height: RANDOM_NUMBER)]) ext.prebid.storedBidResponse = [new StoredBidResponse(id: storedResponseId, bidder: BidderName.GENERIC)] } } @@ -490,7 +490,7 @@ class BidderFormatSpec extends BaseSpec { def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { it.seatbid[0].bid[0].tap { it.id = storedBidId - it.weight = responseWeight + it.width = responseWidth it.height = responseHeight } } @@ -519,7 +519,7 @@ class BidderFormatSpec extends BaseSpec { "Error: BidResponse validation `enforce`: bidder `generic` response triggers creative size " + "validation for bid ${storedBidId}, account=${bidRequest.accountId}, " + "referrer=${bidRequest.site.page}, max imp size='${RANDOM_NUMBER}x${RANDOM_NUMBER}', " + - "bid response size='${responseWeight}x${responseHeight}'" + "bid response size='${responseWidth}x${responseHeight}'" and: "Pbs should discard seatBid due to validation" assert !bidResponse.seatbid @@ -528,7 +528,7 @@ class BidderFormatSpec extends BaseSpec { assert !bidder.getBidderRequests(bidRequest.id) where: - accountCretiveMaxSize | configCreativeMaxSize | responseWeight | responseHeight + accountCretiveMaxSize | configCreativeMaxSize | responseWidth | responseHeight ENFORCE | WARN.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER + 1 ENFORCE | WARN.value | RANDOM_NUMBER + 1 | RANDOM_NUMBER ENFORCE | WARN.value | RANDOM_NUMBER | RANDOM_NUMBER + 1 diff --git a/src/test/groovy/org/prebid/server/functional/tests/ProfileSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/ProfileSpec.groovy index f0c39cf4d73..c6d600d518c 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/ProfileSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/ProfileSpec.groovy @@ -6,8 +6,10 @@ import org.prebid.server.functional.model.config.AccountProfilesConfigs import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.db.StoredProfileImp import org.prebid.server.functional.model.db.StoredProfileRequest +import org.prebid.server.functional.model.db.StoredRequest import org.prebid.server.functional.model.db.StoredResponse import org.prebid.server.functional.model.filesystem.FileSystemAccountsConfig +import org.prebid.server.functional.model.request.amp.AmpRequest import org.prebid.server.functional.model.request.auction.App import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.Device @@ -68,6 +70,7 @@ class ProfileSpec extends BaseSpec { "WHERE profileId in (%REQUEST_ID_LIST%, %IMP_ID_LIST%)".toString()] private static final String LIMIT_ERROR_MESSAGE = 'Profiles exceeded the limit.' + private static final String CONFIG_ERROR_MESSAGE = 'Profiles storage not configured.' private static final String INVALID_REQUEST_PREFIX = 'Invalid request format: Error during processing profiles: ' private static final String NO_IMP_PROFILE_MESSAGE = "No imp profiles for ids [%s] were found" private static final String NO_REQUEST_PROFILE_MESSAGE = "No request profiles for ids [%s] were found" @@ -239,6 +242,89 @@ class ProfileSpec extends BaseSpec { } } + def "PBS should use request profile for amp request"() { + given: "Default AmpRequest" + def accountId = PBSUtils.randomNumber as String + def ampRequest = AmpRequest.defaultAmpRequest.tap { + it.account = accountId + } + + and: "Stored request with profile" + def requestProfile = RequestProfile.getProfile(accountId) + def ampStoredRequest = getRequestWithProfiles(accountId, [requestProfile]) + ampStoredRequest.setAccountId(ampRequest.account) + + and: "Default profile in database" + profileRequestDao.save(StoredProfileRequest.getProfile(requestProfile)) + + and: "Save storedRequest into DB" + def storedRequest = StoredRequest.getStoredRequest(ampRequest, ampStoredRequest) + storedRequestDao.save(storedRequest) + + when: "PBS processes amp request" + def response = pbsWithStoredProfiles.sendAmpRequest(ampRequest) + + then: "Response should not contain errors and warnings" + assert !response.ext?.errors + assert !response.ext?.warnings + + and: "Bidder request should contain data from profile" + verifyAll(bidder.getBidderRequest(ampStoredRequest.id)) { + it.site.id == requestProfile.body.site.id + it.site.name == requestProfile.body.site.name + it.site.domain == requestProfile.body.site.domain + it.site.cat == requestProfile.body.site.cat + it.site.sectionCat == requestProfile.body.site.sectionCat + it.site.pageCat == requestProfile.body.site.pageCat + it.site.page == requestProfile.body.site.page + it.site.ref == requestProfile.body.site.ref + it.site.search == requestProfile.body.site.search + it.site.keywords == requestProfile.body.site.keywords + it.site.ext.data == requestProfile.body.site.ext.data + + it.device.didsha1 == requestProfile.body.device.didsha1 + it.device.didmd5 == requestProfile.body.device.didmd5 + it.device.dpidsha1 == requestProfile.body.device.dpidsha1 + it.device.ifa == requestProfile.body.device.ifa + it.device.macsha1 == requestProfile.body.device.macsha1 + it.device.macmd5 == requestProfile.body.device.macmd5 + it.device.dpidmd5 == requestProfile.body.device.dpidmd5 + } + } + + def "PBS should use imp profile for amp request"() { + given: "Default AmpRequest" + def accountId = PBSUtils.randomNumber as String + def ampRequest = AmpRequest.defaultAmpRequest.tap { + it.account = accountId + } + + and: "Stored request with profile" + def impProfile = ImpProfile.getProfile(accountId) + def ampStoredRequest = getRequestWithProfiles(accountId, [impProfile]) + ampStoredRequest.setAccountId(ampRequest.account) + + and: "Default profile in database" + profileImpDao.save(StoredProfileImp.getProfile(impProfile)) + + and: "Save storedRequest into DB" + def storedRequest = StoredRequest.getStoredRequest(ampRequest, ampStoredRequest) + storedRequestDao.save(storedRequest) + + when: "PBS processes amp request" + def response = pbsWithStoredProfiles.sendAmpRequest(ampRequest) + + then: "Response should not contain errors and warnings" + assert !response.ext?.errors + assert !response.ext?.warnings + + and: "Bidder request imp should contain data from profile" + verifyAll(bidder.getBidderRequest(ampStoredRequest.id).imp) { + it.id == [impProfile.body.id] + it.banner == [impProfile.body.banner] + } + } + def "PBS should set merge strategy to default profile without error for request profile when merge strategy is empty in database"() { given: "Default bidRequest with request profile" def accountId = PBSUtils.randomNumber as String @@ -841,7 +927,6 @@ class ProfileSpec extends BaseSpec { setAccountId(accountId) } - when: "PBS processes auction request" prebidServerService.sendAuctionRequest(bidRequest) @@ -1008,7 +1093,7 @@ class ProfileSpec extends BaseSpec { def accountId = PBSUtils.randomNumber as String def height = PBSUtils.randomNumber def impProfile = ImpProfile.getProfile(accountId).tap { - it.body.banner.format.first.weight = null + it.body.banner.format.first.width = null it.body.banner.format.first.height = height } def bidRequest = getRequestWithProfiles(accountId, [impProfile]) as BidRequest @@ -1347,10 +1432,10 @@ class ProfileSpec extends BaseSpec { where: invalidProfile << [ - ImpProfile.getProfile().tap { it.type = ProfileType.EMPTY}, - ImpProfile.getProfile().tap { it.type = ProfileType.UNKNOWN}, - ImpProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.EMPTY}, - ImpProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.UNKNOWN}, + ImpProfile.getProfile().tap { it.type = ProfileType.EMPTY }, + ImpProfile.getProfile().tap { it.type = ProfileType.UNKNOWN }, + ImpProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.EMPTY }, + ImpProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.UNKNOWN }, ] } @@ -1406,13 +1491,64 @@ class ProfileSpec extends BaseSpec { where: invalidProfile << [ - RequestProfile.getProfile().tap { it.type = ProfileType.EMPTY}, - RequestProfile.getProfile().tap { it.type = ProfileType.UNKNOWN}, - RequestProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.EMPTY}, - RequestProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.UNKNOWN}, + RequestProfile.getProfile().tap { it.type = ProfileType.EMPTY }, + RequestProfile.getProfile().tap { it.type = ProfileType.UNKNOWN }, + RequestProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.EMPTY }, + RequestProfile.getProfile().tap { it.mergePrecedence = ProfileMergePrecedence.UNKNOWN }, + ] + } + + def "PBS should throw exception when profiles are not configured and request contain profileId"() { + when: "PBS processes auction request" + defaultPbsService.sendAuctionRequest(requestWithProfile) + + then: "PBs should throw error due to invalid profile config" + def exception = thrown(PrebidServerException) + assert exception.statusCode == 400 + assert exception.responseBody == INVALID_REQUEST_PREFIX + CONFIG_ERROR_MESSAGE + + where: + requestWithProfile << [ + BidRequest.getDefaultBidRequest().tap { + it.imp.first.ext.prebid.profileNames = [PBSUtils.randomString] + }, + BidRequest.getDefaultBidRequest().tap { + it.ext.prebid.profileNames = [PBSUtils.randomString] + } ] } + def "PBS should throw exception when profiles are not configured for filesystem and request contain profileId"() { + given: "PBS with profiles.fail-on-unknown config" + def config = FILESYSTEM_CONFIG + PROFILES_CONFIG + ['settings.filesystem.profiles-dir': null] + pbsContainer = new PrebidServerContainer(config) + pbsContainer.withFolder(REQUESTS_PATH) + pbsContainer.withFolder(IMPS_PATH) + pbsContainer.withFolder(RESPONSES_PATH) + pbsContainer.withFolder(CATEGORIES_PATH) + def accountsConfig = new FileSystemAccountsConfig(accounts: [new AccountConfig(id: ACCOUNT_ID_FILE_STORAGE, status: ACTIVE)]) + pbsContainer.withCopyToContainer(Transferable.of(encodeYaml(accountsConfig)), + SETTINGS_FILENAME) + pbsContainer.start() + pbsWithStoredProfiles = new PrebidServerService(pbsContainer) + + and: "BidRequest with profile" + def requestWithProfile = BidRequest.getDefaultBidRequest().tap { + it.ext.prebid.profileNames = [PBSUtils.randomString] + } + + when: "PBS processes auction request" + defaultPbsService.sendAuctionRequest(requestWithProfile) + + then: "PBs should throw error due to invalid profile config" + def exception = thrown(PrebidServerException) + assert exception.statusCode == 400 + assert exception.responseBody == INVALID_REQUEST_PREFIX + CONFIG_ERROR_MESSAGE + + cleanup: "Stop and remove pbs container" + pbsContainer.stop() + } + private static BidRequest getRequestWithProfiles(String accountId, List profiles) { BidRequest.getDefaultBidRequest().tap { if (profiles.type.contains(ProfileType.IMP)) { diff --git a/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy index f6b02f22e76..bd636e9ccea 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy @@ -118,7 +118,7 @@ class SeatNonBidSpec extends BaseSpec { def bidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { seatbid.first.tap { bid.first.height = bidRequest.imp.first.banner.format.first.height + 1 - bid.first.weight = bidRequest.imp.first.banner.format.first.weight + 1 + bid.first.width = bidRequest.imp.first.banner.format.first.width + 1 } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy index c5404290135..4e9bc40b590 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy @@ -306,8 +306,8 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { def higherWidth = lowerWidth + 1 def higherHigh = lowerHigh + 1 def bidRequest = BidRequest.defaultBidRequest.tap { - imp[0].banner.format = [new Format(weight: lowerWidth, height: lowerHigh), - new Format(weight: higherWidth, height: higherHigh)] + imp[0].banner.format = [new Format(width: lowerWidth, height: lowerHigh), + new Format(width: higherWidth, height: higherHigh)] } and: "Account with enabled fetch, fetch.url in the DB" @@ -374,19 +374,19 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { mediaType | impClosure org.prebid.server.functional.model.response.auction.MediaType.BANNER | { int widthVal, int heightVal -> Imp.getDefaultImpression(mediaType).tap { - banner.format = [new Format(weight: widthVal, height: heightVal)] + banner.format = [new Format(width: widthVal, height: heightVal)] } } org.prebid.server.functional.model.response.auction.MediaType.BANNER | { int widthVal, int heightVal -> Imp.getDefaultImpression(mediaType).tap { banner.format = null - banner.weight = widthVal + banner.width = widthVal banner.height = heightVal } } org.prebid.server.functional.model.response.auction.MediaType.VIDEO | { int widthVal, int heightVal -> Imp.getDefaultImpression(mediaType).tap { - video.weight = widthVal + video.width = widthVal video.height = heightVal } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy b/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy index e6dda6b407c..cf5e68bbc90 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy @@ -39,7 +39,7 @@ class AmpS3Spec extends StorageBaseSpec { assert bidderRequest.site?.publisher?.id == ampStoredRequest.site.publisher.id assert !bidderRequest.imp[0]?.tagId assert bidderRequest.imp[0]?.banner?.format[0]?.height == ampStoredRequest.imp[0].banner.format[0].height - assert bidderRequest.imp[0]?.banner?.format[0]?.weight == ampStoredRequest.imp[0].banner.format[0].weight + assert bidderRequest.imp[0]?.banner?.format[0]?.width == ampStoredRequest.imp[0].banner.format[0].width assert bidderRequest.regs?.gdpr == ampStoredRequest.regs.gdpr }