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 @@ -107,7 +107,12 @@ public Future<BidRequest> process(AuctionContext auctionContext, BidRequest bidR
private AllProfilesIds profilesIds(BidRequest bidRequest, AuctionContext auctionContext, String accountId) {
final AllProfilesIds initialProfilesIds = new AllProfilesIds(
requestProfilesIds(bidRequest),
bidRequest.getImp().stream().map(this::impProfilesIds).toList());
Optional.ofNullable(bidRequest)
.map(BidRequest::getImp)
.orElse(Collections.emptyList())
.stream()
.map(this::impProfilesIds)
.toList());

final AllProfilesIds profilesIds = truncate(
initialProfilesIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public DatabaseApplicationSettings(DatabaseClient databaseClient,
Objects.requireNonNull(selectAccountQuery));
this.selectStoredRequestsQuery = Objects.requireNonNull(selectStoredRequestsQuery);
this.selectAmpStoredRequestsQuery = Objects.requireNonNull(selectAmpStoredRequestsQuery);
this.selectProfilesQuery = Objects.requireNonNull(selectProfilesQuery);
this.selectProfilesQuery = selectProfilesQuery;
this.selectStoredResponsesQuery = Objects.requireNonNull(selectStoredResponsesQuery);
}

Expand Down Expand Up @@ -186,6 +186,11 @@ public Future<StoredDataResult<Profile>> getProfiles(String accountId,
Set<String> impIds,
Timeout timeout) {

// TODO: remove in PBS 4.0
if (selectProfilesQuery == null) {
return Future.failedFuture("Profiles storage not configured.");
}

return fetchStoredData(
selectProfilesQuery,
requestIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public FileApplicationSettings(FileSystem fileSystem,

storedIdToRequest = readStoredData(fileSystem, Objects.requireNonNull(storedRequestsDir));
storedIdToImp = readStoredData(fileSystem, Objects.requireNonNull(storedImpsDir));
profileIdToProfile = readProfiles(fileSystem, Objects.requireNonNull(profilesDir), jacksonMapper);
profileIdToProfile = profilesDir != null // TODO: require in PBS 4.0
? readProfiles(fileSystem, Objects.requireNonNull(profilesDir), jacksonMapper)
: Collections.emptyMap();
storedIdToSeatBid = readStoredData(fileSystem, Objects.requireNonNull(storedResponsesDir));
fileToCategories = readCategories(fileSystem, Objects.requireNonNull(categoriesDir), jacksonMapper);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ FileApplicationSettings fileApplicationSettings(
@Value("${settings.filesystem.settings-filename}") String settingsFileName,
@Value("${settings.filesystem.stored-requests-dir}") String storedRequestsDir,
@Value("${settings.filesystem.stored-imps-dir}") String storedImpsDir,
@Value("${settings.filesystem.profiles-dir}") String profilesDir,
@Value("${settings.filesystem.profiles-dir:#{null}}") String profilesDir,
@Value("${settings.filesystem.stored-responses-dir}") String storedResponsesDir,
@Value("${settings.filesystem.categories-dir}") String categoriesDir,
FileSystem fileSystem,
Expand All @@ -104,7 +104,7 @@ DatabaseApplicationSettings databaseApplicationSettings(
@Value("${settings.database.account-query}") String accountQuery,
@Value("${settings.database.stored-requests-query}") String storedRequestsQuery,
@Value("${settings.database.amp-stored-requests-query}") String ampStoredRequestsQuery,
@Value("${settings.database.profiles-query}") String profilesQuery,
@Value("${settings.database.profiles-query:#{null}}") String profilesQuery,
@Value("${settings.database.stored-responses-query}") String storedResponsesQuery,
ParametrizedQueryHelper parametrizedQueryHelper,
DatabaseClient databaseClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Banner {

List<Format> format
@JsonProperty("w")
Integer weight
Integer width
@JsonProperty("h")
Integer height
List<Integer> btype
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Video {
Integer poddur
List<Integer> protocols
@JsonProperty("w")
Integer weight
Integer width
@JsonProperty("h")
Integer height
Integer podid
Expand Down Expand Up @@ -47,6 +47,6 @@ class Video {
List<Integer> podDeduplication

static Video getDefaultVideo() {
new Video(mimes: ["video/mp4"], weight: 300, height: 200)
new Video(mimes: ["video/mp4"], width: 300, height: 200)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> getPubstackAnalyticsConfig(String scopeId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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"() {
Expand All @@ -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
}

Expand Down
Loading
Loading