-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RP adapter: update segment logic (#1260)
- Loading branch information
1 parent
cf207ed
commit 69b4e8c
Showing
16 changed files
with
481 additions
and
49 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
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,61 @@ | ||
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.skyscreamer.jsonassert.JSONAssert; | ||
import org.skyscreamer.jsonassert.JSONCompareMode; | ||
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 io.restassured.RestAssured.given; | ||
import static java.util.Collections.singletonList; | ||
|
||
@RunWith(SpringRunner.class) | ||
public class RubiconTest extends IntegrationTest { | ||
|
||
@Test | ||
public void testOpenrtb2AuctionCoreFunctionality() throws IOException, JSONException { | ||
// given | ||
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/rubicon-exchange")) | ||
.withHeader("Accept", equalTo("application/json")) | ||
.withHeader("Content-Type", equalTo("application/json;charset=UTF-8")) | ||
.withQueryParam("tk_xint", equalTo("rp-pbs")) | ||
.withRequestBody(equalToJson( | ||
jsonFrom("openrtb2/rubicon/test-rubicon-bid-request.json"))) | ||
.willReturn(aResponse().withBody( | ||
jsonFrom("openrtb2/rubicon/test-rubicon-bid-response.json")))); | ||
|
||
// pre-bid cache | ||
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/cache")) | ||
.withRequestBody(equalToJson( | ||
jsonFrom("openrtb2/rubicon/test-cache-rubicon-request.json"))) | ||
.willReturn(aResponse().withBody( | ||
jsonFrom("openrtb2/rubicon/test-cache-rubicon-response.json")))); | ||
|
||
// when | ||
final Response response = given(SPEC) | ||
.header("Referer", "http://www.example.com") | ||
.header("X-Forwarded-For", "193.168.244.1") | ||
.header("User-Agent", "userAgent") | ||
.header("Origin", "http://www.example.com") | ||
// this uids cookie value stands for {"uids":{"rubicon":"RUB-UID"}} | ||
.cookie("uids", "eyJ1aWRzIjp7InJ1Ymljb24iOiJSVUItVUlEIn19") | ||
.body(jsonFrom("openrtb2/rubicon/test-auction-rubicon-request.json")) | ||
.post("/openrtb2/auction"); | ||
|
||
// then | ||
final String expectedAuctionResponse = openrtbAuctionResponseFrom( | ||
"openrtb2/rubicon/test-auction-rubicon-response.json", | ||
response, singletonList("rubicon")); | ||
|
||
JSONAssert.assertEquals(expectedAuctionResponse, response.asString(), JSONCompareMode.NON_EXTENSIBLE); | ||
} | ||
} |
Oops, something went wrong.