Skip to content

Commit

Permalink
PulsePoint Adapter: ensuring ct/cp params can be either int or string (
Browse files Browse the repository at this point in the history
  • Loading branch information
anand-venkatraman authored May 22, 2024
1 parent 88ba248 commit 37cd7aa
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/main/resources/static/bidder-params/pulsepoint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
"type": "object",
"properties": {
"cp": {
"type": "integer",
"type": [
"integer",
"string"
],
"description": "An ID which identifies the publisher selling the impression"
},
"ct": {
"type": "integer",
"type": [
"integer",
"string"
],
"description": "An ID which identifies the ad slot being sold"
}
},
Expand Down
18 changes: 16 additions & 2 deletions src/test/java/org/prebid/server/it/PulsepointTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@ public class PulsepointTest extends IntegrationTest {

@Test
public void openrtb2AuctionShouldRespondWithBidsFromPulsepoint() throws IOException, JSONException {
// pulsepoint params as integers
openrtb2AuctionShouldRespondWithBidsFromPulsepoint(
"openrtb2/pulsepoint/test-auction-pulsepoint-request.json",
"openrtb2/pulsepoint/test-pulsepoint-bid-request.json");

// pulsepoint params as string
openrtb2AuctionShouldRespondWithBidsFromPulsepoint(
"openrtb2/pulsepoint/test-auction-pulsepoint-request-params-as-string.json",
"openrtb2/pulsepoint/test-pulsepoint-bid-request-params-as-string.json");
}

private void openrtb2AuctionShouldRespondWithBidsFromPulsepoint(String auctionFilePath,
String pulsepointRequestPath)
throws IOException, JSONException {
// given
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/pulsepoint-exchange"))
.withRequestBody(equalToJson(jsonFrom("openrtb2/pulsepoint/test-pulsepoint-bid-request.json")))
.withRequestBody(equalToJson(jsonFrom(pulsepointRequestPath)))
.willReturn(aResponse().withBody(jsonFrom("openrtb2/pulsepoint/test-pulsepoint-bid-response.json"))));

// when
final Response response = responseFor("openrtb2/pulsepoint/test-auction-pulsepoint-request.json",
final Response response = responseFor(auctionFilePath,
Endpoint.openrtb2_auction);

// then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"id": "request_id",
"imp": [
{
"id": "imp_id",
"banner": {
"w": 300,
"h": 600
},
"ext": {
"pulsepoint": {
"cp": "321",
"ct": "456"
}
}
}
],
"tmax": 5000,
"regs": {
"ext": {
"gdpr": 0
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"id": "request_id",
"imp": [
{
"id": "imp_id",
"secure": 1,
"banner": {
"w": 300,
"h": 600
},
"tagid" : "456",
"ext": {
"tid": "${json-unit.any-string}",
"bidder": {
"cp": "321",
"ct": "456"
}
}
}
],
"source": {
"tid": "${json-unit.any-string}"
},
"site": {
"domain": "www.example.com",
"page": "http://www.example.com",
"publisher": {
"id": "321",
"domain": "example.com"
},
"ext": {
"amp": 0
}
},
"device": {
"ua": "userAgent",
"ip": "193.168.244.1"
},
"at": 1,
"tmax": "${json-unit.any-number}",
"cur": [
"USD"
],
"regs": {
"ext": {
"gdpr": 0
}
},
"ext": {
"prebid": {
"server": {
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"endpoint": "/openrtb2/auction"
}
}
}
}

0 comments on commit 37cd7aa

Please sign in to comment.