diff --git a/src/main/resources/static/bidder-params/blue.json b/src/main/resources/static/bidder-params/blue.json new file mode 100644 index 00000000000..db8680cb111 --- /dev/null +++ b/src/main/resources/static/bidder-params/blue.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Blue Adapter Params", + "description": "A schema which validates params accepted by the Blue adapter", + "type": "object", + "properties": { + "placementId": { + "type": "string", + "description": "Placement ID provided by Blue" + }, + "publisherId": { + "type": "string", + "description": "The publisher’s ID provided by Blue" + } + }, + "required": [ + "publisherId" + ] +} diff --git a/src/test/java/org/prebid/server/it/BlueTest.java b/src/test/java/org/prebid/server/it/BlueTest.java new file mode 100644 index 00000000000..d67eb8c95d3 --- /dev/null +++ b/src/test/java/org/prebid/server/it/BlueTest.java @@ -0,0 +1,32 @@ +package org.prebid.server.it; + +import io.restassured.response.Response; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.prebid.server.model.Endpoint; + +import java.io.IOException; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +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; + +public class BlueTest extends IntegrationTest { + + @Test + public void openrtb2AuctionShouldRespondWithBidsFromBlue() throws IOException, JSONException { + // given + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/blue-exchange")) + .withRequestBody(equalToJson(jsonFrom("openrtb2/blue/test-blue-bid-request.json"))) + .willReturn(aResponse().withBody(jsonFrom("openrtb2/blue/test-blue-bid-response.json")))); + + // when + final Response response = + responseFor("openrtb2/blue/test-auction-blue-request.json", Endpoint.openrtb2_auction); + + // then + assertJsonEquals("openrtb2/blue/test-auction-blue-response.json", response, singletonList("blue")); + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/blue/test-auction-blue-request.json b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-auction-blue-request.json new file mode 100644 index 00000000000..7e411f92af5 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-auction-blue-request.json @@ -0,0 +1,24 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "blue": { + "publisherId": "testPublisherId", + "placementId": "testPlacementId" + } + } + } + ], + "tmax": 5000, + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/blue/test-auction-blue-response.json b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-auction-blue-response.json new file mode 100644 index 00000000000..f241baedf4c --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-auction-blue-response.json @@ -0,0 +1,39 @@ +{ + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "exp": 300, + "price": 3.33, + "adm": "adm001", + "adid": "adid001", + "cid": "cid001", + "crid": "crid001", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + }, + "origbidcpm": 3.33 + } + } + ], + "seat": "blue", + "group": 0 + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "blue": 0 + }, + "prebid": { + "auctiontimestamp": 0 + }, + "tmaxrequest": 5000 + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/blue/test-blue-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-blue-bid-request.json new file mode 100644 index 00000000000..c35ffb20194 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-blue-bid-request.json @@ -0,0 +1,57 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 250 + }, + "secure": 1, + "ext": { + "tid": "${json-unit.any-string}", + "bidder": { + "publisherId": "testPublisherId", + "placementId": "testPlacementId" + } + } + } + ], + "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" + } + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/blue/test-blue-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-blue-bid-response.json new file mode 100644 index 00000000000..a4c0edc3e09 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/blue/test-blue-bid-response.json @@ -0,0 +1,20 @@ +{ + "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 + } + ] + } + ] +} diff --git a/src/test/resources/org/prebid/server/it/test-application.properties b/src/test/resources/org/prebid/server/it/test-application.properties index 2e115d00348..895ef5de9eb 100644 --- a/src/test/resources/org/prebid/server/it/test-application.properties +++ b/src/test/resources/org/prebid/server/it/test-application.properties @@ -6,6 +6,8 @@ adapters.generic.aliases.nativo.enabled=true adapters.generic.aliases.nativo.endpoint=http://localhost:8090/nativo-exchange adapters.generic.aliases.adrino.enabled=true adapters.generic.aliases.adrino.endpoint=http://localhost:8090/adrino-exchange +adapters.generic.aliases.blue.enabled=true +adapters.generic.aliases.blue.endpoint=http://localhost:8090/blue-exchange adapters.generic.aliases.ccx.enabled=true adapters.generic.aliases.ccx.endpoint=http://localhost:8090/ccx-exchange adapters.generic.aliases.infytv.enabled=true