Skip to content

Commit a945d89

Browse files
Merge branch 'prebid:master' into wurfl-devicedetection-enhancements
2 parents 6dae3c1 + fa13078 commit a945d89

File tree

16 files changed

+229
-82
lines changed

16 files changed

+229
-82
lines changed

src/main/java/org/prebid/server/auction/externalortb/ProfilesProcessor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ public Future<BidRequest> process(AuctionContext auctionContext, BidRequest bidR
107107
private AllProfilesIds profilesIds(BidRequest bidRequest, AuctionContext auctionContext, String accountId) {
108108
final AllProfilesIds initialProfilesIds = new AllProfilesIds(
109109
requestProfilesIds(bidRequest),
110-
bidRequest.getImp().stream().map(this::impProfilesIds).toList());
110+
Optional.ofNullable(bidRequest)
111+
.map(BidRequest::getImp)
112+
.orElse(Collections.emptyList())
113+
.stream()
114+
.map(this::impProfilesIds)
115+
.toList());
111116

112117
final AllProfilesIds profilesIds = truncate(
113118
initialProfilesIds,

src/main/java/org/prebid/server/settings/DatabaseApplicationSettings.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public DatabaseApplicationSettings(DatabaseClient databaseClient,
102102
Objects.requireNonNull(selectAccountQuery));
103103
this.selectStoredRequestsQuery = Objects.requireNonNull(selectStoredRequestsQuery);
104104
this.selectAmpStoredRequestsQuery = Objects.requireNonNull(selectAmpStoredRequestsQuery);
105-
this.selectProfilesQuery = Objects.requireNonNull(selectProfilesQuery);
105+
this.selectProfilesQuery = selectProfilesQuery;
106106
this.selectStoredResponsesQuery = Objects.requireNonNull(selectStoredResponsesQuery);
107107
}
108108

@@ -186,6 +186,11 @@ public Future<StoredDataResult<Profile>> getProfiles(String accountId,
186186
Set<String> impIds,
187187
Timeout timeout) {
188188

189+
// TODO: remove in PBS 4.0
190+
if (selectProfilesQuery == null) {
191+
return Future.failedFuture("Profiles storage not configured.");
192+
}
193+
189194
return fetchStoredData(
190195
selectProfilesQuery,
191196
requestIds,

src/main/java/org/prebid/server/settings/FileApplicationSettings.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public FileApplicationSettings(FileSystem fileSystem,
7777

7878
storedIdToRequest = readStoredData(fileSystem, Objects.requireNonNull(storedRequestsDir));
7979
storedIdToImp = readStoredData(fileSystem, Objects.requireNonNull(storedImpsDir));
80-
profileIdToProfile = readProfiles(fileSystem, Objects.requireNonNull(profilesDir), jacksonMapper);
80+
profileIdToProfile = profilesDir != null // TODO: require in PBS 4.0
81+
? readProfiles(fileSystem, Objects.requireNonNull(profilesDir), jacksonMapper)
82+
: Collections.emptyMap();
8183
storedIdToSeatBid = readStoredData(fileSystem, Objects.requireNonNull(storedResponsesDir));
8284
fileToCategories = readCategories(fileSystem, Objects.requireNonNull(categoriesDir), jacksonMapper);
8385
}

src/main/java/org/prebid/server/spring/config/SettingsConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ FileApplicationSettings fileApplicationSettings(
7777
@Value("${settings.filesystem.settings-filename}") String settingsFileName,
7878
@Value("${settings.filesystem.stored-requests-dir}") String storedRequestsDir,
7979
@Value("${settings.filesystem.stored-imps-dir}") String storedImpsDir,
80-
@Value("${settings.filesystem.profiles-dir}") String profilesDir,
80+
@Value("${settings.filesystem.profiles-dir:#{null}}") String profilesDir,
8181
@Value("${settings.filesystem.stored-responses-dir}") String storedResponsesDir,
8282
@Value("${settings.filesystem.categories-dir}") String categoriesDir,
8383
FileSystem fileSystem,
@@ -104,7 +104,7 @@ DatabaseApplicationSettings databaseApplicationSettings(
104104
@Value("${settings.database.account-query}") String accountQuery,
105105
@Value("${settings.database.stored-requests-query}") String storedRequestsQuery,
106106
@Value("${settings.database.amp-stored-requests-query}") String ampStoredRequestsQuery,
107-
@Value("${settings.database.profiles-query}") String profilesQuery,
107+
@Value("${settings.database.profiles-query:#{null}}") String profilesQuery,
108108
@Value("${settings.database.stored-responses-query}") String storedResponsesQuery,
109109
ParametrizedQueryHelper parametrizedQueryHelper,
110110
DatabaseClient databaseClient,

src/test/groovy/org/prebid/server/functional/model/request/auction/Banner.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Banner {
1010

1111
List<Format> format
1212
@JsonProperty("w")
13-
Integer weight
13+
Integer width
1414
@JsonProperty("h")
1515
Integer height
1616
List<Integer> btype

src/test/groovy/org/prebid/server/functional/model/request/auction/Format.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@ import org.prebid.server.functional.util.PBSUtils
1010
class Format {
1111

1212
@JsonProperty("w")
13-
Integer weight
13+
Integer width
1414
@JsonProperty("h")
1515
Integer height
1616
@JsonProperty("wratio")
17-
Integer weightRatio
17+
Integer widthRatio
1818
@JsonProperty("hratio")
1919
Integer heightRatio
2020
@JsonProperty("wmin")
21-
Integer weightMin
21+
Integer widthMin
2222

2323
static Format getDefaultFormat() {
2424
new Format().tap {
25-
weight = 300
25+
width = 300
2626
height = 250
2727
}
2828
}
2929

3030
static Format getRandomFormat() {
3131
new Format().tap {
32-
weight = PBSUtils.randomNumber
32+
width = PBSUtils.randomNumber
3333
height = PBSUtils.randomNumber
3434
}
3535
}

src/test/groovy/org/prebid/server/functional/model/request/auction/Video.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Video {
1616
Integer poddur
1717
List<Integer> protocols
1818
@JsonProperty("w")
19-
Integer weight
19+
Integer width
2020
@JsonProperty("h")
2121
Integer height
2222
Integer podid
@@ -47,6 +47,6 @@ class Video {
4747
List<Integer> podDeduplication
4848

4949
static Video getDefaultVideo() {
50-
new Video(mimes: ["video/mp4"], weight: 300, height: 200)
50+
new Video(mimes: ["video/mp4"], width: 300, height: 200)
5151
}
5252
}

src/test/groovy/org/prebid/server/functional/model/response/auction/Bid.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class Bid implements ObjectMapperWrapper {
4040
String langb
4141
String dealid
4242
@JsonProperty("w")
43-
Integer weight
43+
Integer width
4444
@JsonProperty("h")
4545
Integer height
4646
@JsonProperty("wratio")
47-
Integer weightRatio
47+
Integer widthRatio
4848
@JsonProperty("hratio")
4949
Integer heightRatio
5050
Integer exp
@@ -65,7 +65,7 @@ class Bid implements ObjectMapperWrapper {
6565
price = imp.bidFloor != null ? imp.bidFloor : PBSUtils.getRandomPrice()
6666
crid = 1
6767
height = imp.banner && imp.banner.format ? imp.banner.format.first().height : null
68-
weight = imp.banner && imp.banner.format ? imp.banner.format.first().weight : null
68+
width = imp.banner && imp.banner.format ? imp.banner.format.first().width : null
6969
if (imp.nativeObj || imp.video) {
7070
adm = new Adm(assets: [Asset.defaultAsset])
7171
}

src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ LIMIT 1
3838
"settings.database.account-query" : DB_ACCOUNT_QUERY,
3939
"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%)",
4040
"settings.database.amp-stored-requests-query": "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%)",
41-
"settings.database.stored-responses-query" : "SELECT resId, COALESCE(storedAuctionResponse, storedBidResponse) as responseData FROM stored_responses WHERE resId IN (%RESPONSE_ID_LIST%)",
42-
'settings.database.profiles-query' : "SELECT accountId, profileId, profile, mergePrecedence, type FROM profiles WHERE profileId in (%REQUEST_ID_LIST%, %IMP_ID_LIST%)"
41+
"settings.database.stored-responses-query" : "SELECT resId, COALESCE(storedAuctionResponse, storedBidResponse) as responseData FROM stored_responses WHERE resId IN (%RESPONSE_ID_LIST%)"
4342
].asImmutable()
4443

4544
static Map<String, String> getPubstackAnalyticsConfig(String scopeId) {

src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Bidder extends NetworkScaffolding {
7575
def formatNode = it.get("banner") != null ? it.get("banner").get("format") : null
7676
new Imp(id: it.get("id").asText(),
7777
banner: formatNode != null
78-
? new Banner(format: [new Format(weight: formatNode.first().get("w").asInt(), height: formatNode.first().get("h").asInt())])
78+
? new Banner(format: [new Format(width: formatNode.first().get("w").asInt(), height: formatNode.first().get("h").asInt())])
7979
: null)}
8080
def bidRequest = new BidRequest(id: id, imp: imps)
8181
def response = BidResponse.getDefaultBidResponse(bidRequest)

0 commit comments

Comments
 (0)