-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1585262
commit c5f2939
Showing
9 changed files
with
199 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.prebid.server.it; | ||
|
||
import io.restassured.response.Response; | ||
import org.json.JSONException; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.prebid.server.model.Endpoint; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import java.io.IOException; | ||
|
||
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.post; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; | ||
import static java.util.Collections.singletonList; | ||
|
||
@RunWith(SpringRunner.class) | ||
public class JdpMediaTest extends IntegrationTest { | ||
|
||
@Test | ||
public void openrtb2AuctionShouldRespondWithBidsFromJdpMedia() throws IOException, JSONException { | ||
// given | ||
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/jdpmedia-exchange")) | ||
.withQueryParam("host", equalTo("someUniquePartnerName")) | ||
.withQueryParam("accountId", equalTo("someSeat")) | ||
.withQueryParam("sourceId", equalTo("someToken")) | ||
.withRequestBody(equalToJson(jsonFrom("openrtb2/jdpmedia/test-jdpmedia-bid-request.json"))) | ||
.willReturn(aResponse().withBody(jsonFrom("openrtb2/jdpmedia/test-jdpmedia-bid-response.json")))); | ||
|
||
// when | ||
final Response response = responseFor("openrtb2/jdpmedia/test-auction-jdpmedia-request.json", | ||
Endpoint.openrtb2_auction); | ||
|
||
// then | ||
assertJsonEquals("openrtb2/jdpmedia/test-auction-jdpmedia-response.json", response, singletonList("jdpmedia")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/test/resources/org/prebid/server/it/openrtb2/jdpmedia/test-auction-jdpmedia-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"id": "request_id", | ||
"imp": [ | ||
{ | ||
"id": "imp_id", | ||
"banner": { | ||
"w": 300, | ||
"h": 250 | ||
}, | ||
"ext": { | ||
"jdpmedia": { | ||
"partnerName": "someUniquePartnerName", | ||
"seat": "someSeat", | ||
"token": "someToken" | ||
} | ||
} | ||
} | ||
], | ||
"tmax": 5000, | ||
"regs": { | ||
"ext": { | ||
"gdpr": 0 | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...test/resources/org/prebid/server/it/openrtb2/jdpmedia/test-auction-jdpmedia-response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"id": "request_id", | ||
"seatbid": [ | ||
{ | ||
"bid": [ | ||
{ | ||
"id": "bid_id", | ||
"impid": "imp_id", | ||
"price": 3.33, | ||
"adm": "adm001", | ||
"adid": "adid001", | ||
"cid": "cid001", | ||
"crid": "crid001", | ||
"w": 300, | ||
"h": 250, | ||
"ext": { | ||
"mediaType": "video", | ||
"origbidcpm": 3.33, | ||
"prebid": { | ||
"type": "video" | ||
} | ||
} | ||
} | ||
], | ||
"seat": "jdpmedia", | ||
"group": 0 | ||
} | ||
], | ||
"cur": "USD", | ||
"ext": { | ||
"responsetimemillis": { | ||
"jdpmedia": "{{ jdpmedia.response_time_ms }}" | ||
}, | ||
"prebid": { | ||
"auctiontimestamp": 0 | ||
}, | ||
"tmaxrequest": 5000 | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/test/resources/org/prebid/server/it/openrtb2/jdpmedia/test-jdpmedia-bid-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"id": "request_id", | ||
"imp": [ | ||
{ | ||
"id": "imp_id", | ||
"secure": 1, | ||
"banner": { | ||
"w": 300, | ||
"h": 250 | ||
}, | ||
"ext": { | ||
"tid": "${json-unit.any-string}", | ||
"bidder": { | ||
"partnerName": "someUniquePartnerName", | ||
"seat": "someSeat", | ||
"token": "someToken" | ||
} | ||
} | ||
} | ||
], | ||
"source": { | ||
"tid": "${json-unit.any-string}" | ||
}, | ||
"site": { | ||
"domain": "www.example.com", | ||
"page": "http://www.example.com", | ||
"publisher": { | ||
"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" | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/test/resources/org/prebid/server/it/openrtb2/jdpmedia/test-jdpmedia-bid-response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"id": "request_id", | ||
"seatbid": [ | ||
{ | ||
"bid": [ | ||
{ | ||
"id": "bid_id", | ||
"impid": "imp_id", | ||
"price": 3.33, | ||
"adid": "adid001", | ||
"crid": "crid001", | ||
"cid": "cid001", | ||
"adm": "adm001", | ||
"h": 250, | ||
"w": 300, | ||
"ext": { | ||
"mediaType": "video" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters