diff --git a/src/main/resources/static/bidder-params/nativo.json b/src/main/resources/static/bidder-params/nativo.json new file mode 100644 index 00000000000..d25ec75f3bc --- /dev/null +++ b/src/main/resources/static/bidder-params/nativo.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Nativo Adapter Params", + "description": "A schema which validates params accepted by the Nativo adapter", + "type": "object", + "properties": { + "placementId": { + "type": ["integer", "string"], + "description": "Placement ID" + } + } +} diff --git a/src/test/java/org/prebid/server/it/NativoTest.java b/src/test/java/org/prebid/server/it/NativoTest.java new file mode 100644 index 00000000000..f8d1cf086ee --- /dev/null +++ b/src/test/java/org/prebid/server/it/NativoTest.java @@ -0,0 +1,35 @@ +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 NativoTest extends IntegrationTest { + + @Test + public void openrtb2AuctionShouldRespondWithBidsFromNativo() throws IOException, JSONException { + // given + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/nativo-exchange")) + .withRequestBody(equalToJson( + jsonFrom("openrtb2/nativo/test-nativo-bid-request.json"))) + .willReturn(aResponse().withBody( + jsonFrom("openrtb2/nativo/test-nativo-bid-response.json")))); + + // when + final Response response = responseFor("openrtb2/nativo/test-auction-nativo-request.json", + Endpoint.openrtb2_auction); + + // then + assertJsonEquals("openrtb2/nativo/test-auction-nativo-response.json", response, + singletonList("nativo")); + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-auction-nativo-request.json b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-auction-nativo-request.json new file mode 100644 index 00000000000..1cd8abe5f07 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-auction-nativo-request.json @@ -0,0 +1,46 @@ +{ + "id": "tid", + "imp": [ + { + "id": "impId001", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "nativo": { + "placementId": 12345678 + } + } + } + ], + "device": { + "pxratio": 4.2, + "dnt": 2, + "language": "en", + "ifa": "ifaId" + }, + "site": { + "publisher": { + "id": "publisherId" + } + }, + "at": 1, + "tmax": 5000, + "cur": [ + "USD" + ], + "source": { + "fd": 1, + "tid": "tid" + }, + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-auction-nativo-response.json b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-auction-nativo-response.json new file mode 100644 index 00000000000..e744d31c4f7 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-auction-nativo-response.json @@ -0,0 +1,42 @@ +{ + "id": "tid", + "seatbid": [ + { + "bid": [ + { + "id": "bid001", + "impid": "impId001", + "exp": 300, + "price": 3.33, + "adm": "adm001", + "adid": "adid001", + "cid": "cid001", + "crid": "crid001", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner", + "meta": { + "adaptercode": "nativo" + } + }, + "origbidcpm": 3.33 + } + } + ], + "seat": "nativo", + "group": 0 + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "nativo": "{{ nativo.response_time_ms }}" + }, + "prebid": { + "auctiontimestamp": 1000 + }, + "tmaxrequest": 5000 + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-nativo-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-nativo-bid-request.json new file mode 100644 index 00000000000..595682efc23 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-nativo-bid-request.json @@ -0,0 +1,69 @@ +{ + "id": "tid", + "imp": [ + { + "id": "impId001", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "secure": 1, + "ext": { + "tid": "${json-unit.any-string}", + "bidder": { + "placementId": 12345678 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com", + "publisher": { + "id": "publisherId", + "domain": "example.com" + }, + "ext": { + "amp": 0 + } + }, + "device": { + "dnt": 2, + "ua": "userAgent", + "ip": "193.168.244.1", + "pxratio": 4.2, + "language": "en", + "ifa": "ifaId" + }, + "at": 1, + "tmax": "${json-unit.any-number}", + "cur": [ + "USD" + ], + "source": { + "fd": 1, + "tid": "tid" + }, + "regs": { + "ext": { + "gdpr": 0 + } + }, + "ext": { + "prebid": { + "channel": { + "name": "web" + }, + "server": { + "externalurl": "http://localhost:8080", + "gvlid": 1, + "datacenter": "local", + "endpoint": "/openrtb2/auction" + } + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-nativo-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-nativo-bid-response.json new file mode 100644 index 00000000000..c31fabcb822 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/nativo/test-nativo-bid-response.json @@ -0,0 +1,20 @@ +{ + "id": "tid", + "seatbid": [ + { + "bid": [ + { + "id": "bid001", + "impid": "impId001", + "price": 3.33, + "adid": "adid001", + "crid": "crid001", + "cid": "cid001", + "adm": "adm001", + "h": 250, + "w": 300 + } + ] + } + ] +}