Skip to content

Commit

Permalink
OpenX: accept unit as string or integer, emit string
Browse files Browse the repository at this point in the history
  • Loading branch information
laurb9 committed May 7, 2024
1 parent 35dbb44 commit 4ba0811
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/static/bidder-params/openx.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"properties": {
"unit": {
"type": "string",
"type": ["number", "string"],
"description": "The ad unit id.",
"pattern": "^[0-9]+$"
},
Expand Down
29 changes: 15 additions & 14 deletions src/test/java/org/prebid/server/bidder/openx/OpenxBidderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,19 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
ExtImpOpenx.builder()
.customParams(givenCustomParams("foo1", singletonList("bar1")))
.delDomain("se-demo-d.openx.net")
.unit("unitId").build()))).build(),
.unit("555555").build()))).build(),
Imp.builder()
.id("impId2")
.bidfloor(BigDecimal.valueOf(0.5))
.banner(Banner.builder().build())
.ext(mapper.valueToTree(
ExtPrebid.of(null,
ExtImpOpenx.builder()
.customFloor(BigDecimal.valueOf(0.1))
.customParams(givenCustomParams("foo2", "bar2"))
.delDomain("se-demo-d.openx.net")
.unit("unitId").build()))).build(),
Map.of(
"bidder", Map.of(
"customFloor", "0.1",
"customParams", givenCustomParams("foo2", "bar2"),
"delDomain", "se-demo-d.openx.net",
"unit", 123456
)))).build(),
Imp.builder()
.id("impId3")
.video(Video.builder().build())
Expand All @@ -230,7 +231,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.customFloor(BigDecimal.valueOf(0.1))
.customParams(givenCustomParams("foo3", "bar3"))
.delDomain("se-demo-d.openx.net")
.unit("unitId").build()))).build(),
.unit("555555").build()))).build(),
Imp.builder()
.id("impId4")
.video(Video.builder().build())
Expand All @@ -239,7 +240,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
ExtImpOpenx.builder()
.customParams(givenCustomParams("foo4", "bar4"))
.platform("PLATFORM")
.unit("unitId").build()))).build(),
.unit("555555").build()))).build(),

Imp.builder().id("impId1").audio(Audio.builder().build()).build()))
.user(User.builder().ext(ExtUser.builder().consent("consent").build()).build())
Expand All @@ -264,7 +265,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
Imp.builder()
.id("impId1")
.banner(Banner.builder().build())
.tagid("unitId")
.tagid("555555")
.bidfloor(BigDecimal.valueOf(0.5))
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
Expand All @@ -276,7 +277,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
Imp.builder()
.id("impId2")
.banner(Banner.builder().build())
.tagid("unitId")
.tagid("123456")
.bidfloor(BigDecimal.valueOf(0.5))
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
Expand All @@ -301,7 +302,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.video(Video.builder()
.ext(mapper.valueToTree(OpenxVideoExt.of(1)))
.build())
.tagid("unitId")
.tagid("555555")
// check if each of video imps is a part of separate bidRequest
.bidfloor(BigDecimal.valueOf(0.1))
.ext(mapper.valueToTree(
Expand All @@ -326,7 +327,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
Imp.builder()
.id("impId4")
.video(Video.builder().build())
.tagid("unitId")
.tagid("555555")
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
.customParams(
Expand Down Expand Up @@ -418,7 +419,7 @@ public void makeHttpRequestShouldReturnResultWithAuctionEnvironment() {
Imp.builder()
.id("impId2")
.banner(Banner.builder().build())
.tagid("unitId")
.tagid("555555")
.ext(mapper.valueToTree(Map.of("ae", 1, "bidder", Map.of())))
.build()))
.build();
Expand Down

0 comments on commit 4ba0811

Please sign in to comment.