From a264a2b781cf7263dd1de733524a168969a7352f Mon Sep 17 00:00:00 2001 From: Dubyk Danylo <45672370+CTMBNara@users.noreply.github.com> Date: Fri, 15 Jul 2022 19:29:26 +0300 Subject: [PATCH] Support `Imp.ext.tid` as not a bidder properties object. (#1947) * Support `Imp.ext.tid` as not a bidder properties object. * Add functional test * Add tid property to the model Co-authored-by: Oleksandr Zhevedenko --- .../Ortb2ImplicitParametersResolver.java | 2 +- .../model/request/auction/ImpExt.groovy | 1 + .../functional/tests/BidderParamsSpec.groovy | 19 ++++++++++++++++--- .../Ortb2ImplicitParametersResolverTest.java | 8 ++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolver.java b/src/main/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolver.java index c16836e8363..89a8882a0f6 100644 --- a/src/main/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolver.java +++ b/src/main/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolver.java @@ -71,7 +71,7 @@ public class Ortb2ImplicitParametersResolver { private static final String BIDDER_EXT = "bidder"; private static final Set IMP_EXT_NON_BIDDER_FIELDS = - Set.of(PREBID_EXT, "context", "all", "general", "skadn", "data", "gpid"); + Set.of(PREBID_EXT, "context", "all", "general", "skadn", "data", "gpid", "tid"); private final boolean shouldCacheOnlyWinningBids; private final String adServerCurrency; diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/ImpExt.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/ImpExt.groovy index 6673868d9d5..313055cb521 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/ImpExt.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/ImpExt.groovy @@ -18,6 +18,7 @@ class ImpExt { AppNexus appNexus ImpExtContext context ImpExtContextData data + String tid static ImpExt getDefaultImpExt() { new ImpExt().tap { 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 2d5f887bb64..538d55a7c3d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy @@ -1,7 +1,6 @@ package org.prebid.server.functional.tests import io.qameta.allure.Issue -import org.prebid.server.functional.model.bidder.BidderName import org.prebid.server.functional.model.bidder.Generic import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.db.StoredRequest @@ -566,7 +565,7 @@ class BidderParamsSpec extends BaseSpec { def "PBS should request to bidder with header Content-Encoding = gzip when adapters.BIDDER.endpoint-compression = gzip"() { given: "PBS with adapter configuration" def compressionType = GZIP.value - def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled": "true", + def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled" : "true", "adapters.generic.endpoint-compression": compressionType]) and: "Default bid request" @@ -582,7 +581,7 @@ class BidderParamsSpec extends BaseSpec { def "PBS should send request to bidder without header Content-Encoding when adapters.BIDDER.endpoint-compression = none"() { given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled": "true", + def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled" : "true", "adapters.generic.endpoint-compression": NONE.value]) and: "Default bid request" @@ -595,4 +594,18 @@ class BidderParamsSpec extends BaseSpec { assert !response.ext?.debug?.httpcalls?.get(GENERIC.value)?.requestHeaders?.first() ?.get(CONTENT_ENCODING_HEADER) } + + def "PBS should not treat reserved imp[].ext.tid object as a bidder"() { + given: "Default basic BidRequest with imp[].ext.tid object" + def bidRequest = BidRequest.defaultBidRequest + def tid = PBSUtils.getRandomString() + bidRequest.imp.first().ext.tid = tid + + when: "PBS processes auction request" + defaultPbsService.sendAuctionRequest(bidRequest) + + then: "imp[].ext.tid object should be passed to a bidder" + def bidderRequest = bidder.getBidderRequest(bidRequest.id) + assert bidderRequest.imp?.first()?.ext?.tid == tid + } } diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java index 188a7cdf707..3a4b5e064cd 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java @@ -982,6 +982,10 @@ public void shouldMoveBidderParametersToImpExtPrebidBidderAndMergeWithExisting() .put("skadn-data", "skadn-value")) .set("data", mapper.createObjectNode() .put("data-data", "data-value")) + .set("gpid", mapper.createObjectNode() + .put("gpid-data", "gpid-value")) + .set("tid", mapper.createObjectNode() + .put("tid-data", "tid-value")) .set("prebid", mapper.createObjectNode() .set("bidder", mapper.createObjectNode() .set("bidder2", mapper.createObjectNode().put("param22", "value22"))) @@ -1004,6 +1008,10 @@ public void shouldMoveBidderParametersToImpExtPrebidBidderAndMergeWithExisting() .put("skadn-data", "skadn-value")) .set("data", mapper.createObjectNode() .put("data-data", "data-value")) + .set("gpid", mapper.createObjectNode() + .put("gpid-data", "gpid-value")) + .set("tid", mapper.createObjectNode() + .put("tid-data", "tid-value")) .set("prebid", mapper.createObjectNode() .set("bidder", mapper.createObjectNode() .set(