Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Transition PAAPI parameters #3634

Open
wants to merge 12 commits into
base: feature/paa
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum BidderName {
APPNEXUS("appnexus"),
RUBICON_ALIAS("rubiconAlias"),
OPENX("openx"),
OPENX_ALIAS("openxalias"),
ACEEX("aceex"),
ACUITYADS("acuityads"),
AAX("aax"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.bidder.BidderName
import org.prebid.server.functional.model.request.auction.BidAdjustment
import org.prebid.server.functional.model.request.auction.PaaFormat
import org.prebid.server.functional.model.request.auction.Targeting
import org.prebid.server.functional.model.response.auction.MediaType

Expand All @@ -23,6 +24,7 @@ class AccountAuctionConfig {
AccountEventsConfig events
AccountPriceFloorsConfig priceFloors
Targeting targeting
PaaFormat paaformat
@JsonProperty("preferredmediatype")
Map<BidderName, MediaType> preferredMediaType
@JsonProperty("privacysandbox")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonValue
import org.prebid.server.functional.util.PBSUtils

enum AuctionEnvironment {

NOT_SUPPORTED(0),
DEVICE_ORCHESTRATED(1),
SERVER_ORCHESTRATED(3),
UNKNOWN(Integer.MAX_VALUE),

@JsonValue
private int value

AuctionEnvironment(Integer value) {
this.value = value
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Bidder {
AppNexus appNexus
Openx openx
Ix ix
@JsonProperty("openxalias")
Openx openxAlias

static Bidder getDefaultBidder() {
new Bidder().tap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ class ImpExt {
String tid
String gpid
String sid
Integer ae
@JsonProperty("ae")
AuctionEnvironment auctionEnvironment
String all
String skadn
String general
@JsonProperty("igs")
List<InterestGroupAuctionSupport> interestGroupAuctionSupports
AnyUnsupportedBidder anyUnsupportedBidder

static ImpExt getDefaultImpExt() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonProperty
import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionSupport {

@JsonProperty("ae")
AuctionEnvironment auctionEnvironment
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonValue

enum PaaFormat {

ORIGINAL, IAB, INVALID

@JsonValue
String getValue() {
name().toLowerCase()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Prebid {
PrebidModulesConfig modules
PrebidAnalytics analytics
StoredAuctionResponse storedAuctionResponse
PaaFormat paaFormat

static class Channel {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.prebid.server.functional.model.response.auction

import com.fasterxml.jackson.annotation.JsonProperty
import groovy.transform.ToString
import org.prebid.server.functional.model.response.BidderError
import org.prebid.server.functional.model.response.Debug
Expand All @@ -15,4 +16,6 @@ class BidResponseExt {
Map<String, ResponseSyncData> usersync
BidResponsePrebid prebid
Map<ErrorType, List<WarningEntry>> warnings
@JsonProperty("igi")
List<InterestGroupAuctionIntent> interestGroupAuctionIntent
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
import org.prebid.server.functional.model.Currency

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy)
class InterestGroupAuctionBuyer {

String origin
BigDecimal maxBid
Currency cur
Map pbs
InterestGroupAuctionBuyerExt ext
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.prebid.server.functional.model.response.auction

import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionBuyerExt {

String bidder
String adapter
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.prebid.server.functional.model.response.auction

import com.fasterxml.jackson.annotation.JsonProperty
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 InterestGroupAuctionIntent {

String impId
@JsonProperty("igb")
List<InterestGroupAuctionBuyer> interestGroupAuctionBuyer
@JsonProperty("igs")
List<InterestGroupAuctionSeller> interestGroupAuctionSeller
InterestGroupAuctionIntentExt ext
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.prebid.server.functional.model.response.auction

import groovy.transform.ToString
import org.prebid.server.functional.model.bidder.BidderName

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionIntentExt {

BidderName bidder
BidderName adapter
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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 InterestGroupAuctionSeller {

String impId
Map config
InterestGroupAuctionSellerExt ext
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.prebid.server.functional.model.response.auction

import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionSellerExt {

String bidder
String adapter
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.prebid.server.functional.model.response.auction


import groovy.transform.ToString
import org.prebid.server.functional.model.request.auction.BidRequest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.prebid.server.functional.model.db.Account
import org.prebid.server.functional.model.db.StoredImp
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.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
Expand All @@ -15,6 +16,7 @@ import org.prebid.server.functional.model.request.auction.Imp
import org.prebid.server.functional.model.request.auction.ImpExt
import org.prebid.server.functional.model.request.auction.ImpExtContext
import org.prebid.server.functional.model.request.auction.ImpExtContextData
import org.prebid.server.functional.model.request.auction.InterestGroupAuctionSupport
import org.prebid.server.functional.model.request.auction.Native
import org.prebid.server.functional.model.request.auction.PrebidStoredRequest
import org.prebid.server.functional.model.request.auction.Site
Expand All @@ -34,6 +36,10 @@ import static org.prebid.server.functional.model.bidder.BidderName.APPNEXUS
import static org.prebid.server.functional.model.bidder.CompressionType.GZIP
import static org.prebid.server.functional.model.bidder.CompressionType.NONE
import static org.prebid.server.functional.model.request.auction.Asset.titleAsset
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.DistributionChannel.APP
import static org.prebid.server.functional.model.request.auction.DistributionChannel.DOOH
import static org.prebid.server.functional.model.request.auction.DistributionChannel.SITE
Expand Down Expand Up @@ -781,7 +787,7 @@ class BidderParamsSpec extends BaseSpec {
def impExt = ImpExt.getDefaultImpExt().tap {
prebid.bidder.generic = null
generic = new Generic()
ae = PBSUtils.randomNumber
auctionEnvironment = PBSUtils.getRandomEnum(AuctionEnvironment)
all = PBSUtils.randomNumber
context = new ImpExtContext(data: new ImpExtContextData())
data = new ImpExtContextData(pbAdSlot: PBSUtils.randomString)
Expand All @@ -801,7 +807,7 @@ class BidderParamsSpec extends BaseSpec {
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
verifyAll(bidderRequest.imp[0].ext) {
bidder == impExt.generic
ae == impExt.ae
auctionEnvironment == impExt.auctionEnvironment
all == impExt.all
context == impExt.context
data == impExt.data
Expand Down Expand Up @@ -847,7 +853,7 @@ class BidderParamsSpec extends BaseSpec {
def "PBS should send request to bidder when adapters.bidder.aliases.bidder.meta-info.currency-accepted not specified"() {
given: "PBS with adapter configuration"
def pbsService = pbsServiceFactory.getService(
"adapters.generic.aliases.alias.enabled" : "true",
"adapters.generic.aliases.alias.enabled": "true",
"adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString(),
"adapters.generic.aliases.alias.meta-info.currency-accepted": "")

Expand Down Expand Up @@ -955,7 +961,7 @@ class BidderParamsSpec extends BaseSpec {
def "PBS should send request to bidder when adapters.bidder.aliases.bidder.meta-info.currency-accepted intersect with requested currency"() {
given: "PBS with adapter configuration"
def pbsService = pbsServiceFactory.getService(
"adapters.generic.aliases.alias.enabled" : "true",
"adapters.generic.aliases.alias.enabled": "true",
"adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString(),
"adapters.generic.aliases.alias.meta-info.currency-accepted": "${USD},${EUR}".toString())

Expand Down Expand Up @@ -996,7 +1002,7 @@ class BidderParamsSpec extends BaseSpec {
def "PBS shouldn't send request to bidder and emit warning when adapters.bidder.aliases.bidder.meta-info.currency-accepted not intersect with requested currency"() {
given: "PBS with adapter configuration"
def pbsService = pbsServiceFactory.getService(
"adapters.generic.aliases.alias.enabled" : "true",
"adapters.generic.aliases.alias.enabled": "true",
"adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString(),
"adapters.generic.aliases.alias.meta-info.currency-accepted": "${JPY},${CHF}".toString())

Expand Down Expand Up @@ -1040,4 +1046,66 @@ class BidderParamsSpec extends BaseSpec {
assert seatNonBid.nonBid[0].impId == bidRequest.imp[0].id
assert seatNonBid.nonBid[0].statusCode == REQUEST_BLOCKED_UNACCEPTABLE_CURRENCY
}

def "PBS should add auction environment to imp.ext.igs when it is present in imp.ext and imp.ext.igs is empty"() {
given: "Default bid request with populated imp.ext"
def bidRequest = BidRequest.defaultBidRequest.tap {
imp[0].ext.tap {
auctionEnvironment = requestedAuctionEnvironment
interestGroupAuctionSupports = [new InterestGroupAuctionSupport(auctionEnvironment: null)]
}
}

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 == requestedAuctionEnvironment
assert bidderRequest.imp[0].ext.interestGroupAuctionSupports[0].auctionEnvironment == requestedAuctionEnvironment

where:
requestedAuctionEnvironment << [NOT_SUPPORTED, DEVICE_ORCHESTRATED]
}

def "PBS shouldn't add unsupported auction environment to imp.ext.igs when it is present in imp.ext and imp.ext.igs is empty"() {
given: "Default bid request with populated imp.ext"
def bidRequest = BidRequest.defaultBidRequest.tap {
imp[0].ext.tap {
auctionEnvironment = requestedAuctionEnvironment
interestGroupAuctionSupports = [new InterestGroupAuctionSupport(auctionEnvironment: null)]
}
}

when: "PBS processes auction request"
defaultPbsService.sendAuctionRequest(bidRequest)

then: "Bidder request should imp[].ae same value as requested"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.imp[0].ext.auctionEnvironment == requestedAuctionEnvironment
assert !bidderRequest.imp[0].ext.interestGroupAuctionSupports[0].auctionEnvironment

where:
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)
def extIgsAuctionEnv = PBSUtils.getRandomEnum(AuctionEnvironment)
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[0].auctionEnvironment == extIgsAuctionEnv
}
}
Loading
Loading