diff --git a/src/main/resources/bidder-config/admatic.yaml b/src/main/resources/bidder-config/admatic.yaml index 9ad8f211166..63f0710ab15 100644 --- a/src/main/resources/bidder-config/admatic.yaml +++ b/src/main/resources/bidder-config/admatic.yaml @@ -7,6 +7,8 @@ adapters: meta-info: maintainer-email: publisher@adtarget.com.tr vendor-id: 779 + admaticde: + enabled: false yobee: enabled: false meta-info: diff --git a/src/test/java/org/prebid/server/it/AdmaticDeTest.java b/src/test/java/org/prebid/server/it/AdmaticDeTest.java new file mode 100644 index 00000000000..4963f138219 --- /dev/null +++ b/src/test/java/org/prebid/server/it/AdmaticDeTest.java @@ -0,0 +1,36 @@ +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 java.util.List; + +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; + +public class AdmaticDeTest extends IntegrationTest { + + @Test + public void openrtb2AuctionShouldRespondWithBidsFromAdmaticDe() throws IOException, JSONException { + // given + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/admaticde-exchange")) + .withQueryParam("host", equalTo("host")) + .withRequestBody(equalToJson(jsonFrom("openrtb2/admaticde/test-admaticde-bid-request.json"))) + .willReturn(aResponse().withBody(jsonFrom("openrtb2/admaticde/test-admaticde-bid-response.json")))); + + // when + final Response response = responseFor( + "openrtb2/admaticde/test-auction-admaticde-request.json", + Endpoint.openrtb2_auction); + + // then + assertJsonEquals("openrtb2/admaticde/test-auction-admaticde-response.json", response, List.of("admaticde")); + } + +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-admaticde-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-admaticde-bid-request.json new file mode 100644 index 00000000000..806fd172232 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-admaticde-bid-request.json @@ -0,0 +1,57 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "secure": 1, + "banner": { + "w": 320, + "h": 250 + }, + "ext": { + "tid": "${json-unit.any-string}", + "bidder": { + "host": "host", + "networkId": 4 + } + } + } + ], + "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/admaticde/test-admaticde-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-admaticde-bid-response.json new file mode 100644 index 00000000000..da5c7fc51cd --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-admaticde-bid-response.json @@ -0,0 +1,18 @@ +{ + "id": "tid", + "seatbid": [ + { + "bid": [ + { + "crid": "24080", + "adid": "2068416", + "price": 0.01, + "id": "bid_id", + "impid": "imp_id", + "cid": "8048" + } + ], + "type": "banner" + } + ] +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-request.json b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-request.json new file mode 100644 index 00000000000..e3d323a26e0 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-request.json @@ -0,0 +1,24 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 320, + "h": 250 + }, + "ext": { + "admaticde": { + "host": "host", + "networkId": 4 + } + } + } + ], + "tmax": 5000, + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-response.json b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-response.json new file mode 100644 index 00000000000..6a5b940a2cb --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-response.json @@ -0,0 +1,36 @@ +{ + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "exp": 300, + "price": 0.01, + "adid": "2068416", + "cid": "8048", + "crid": "24080", + "ext": { + "prebid": { + "type": "banner" + }, + "origbidcpm": 0.01 + } + } + ], + "seat": "admaticde", + "group": 0 + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "admaticde": "{{ admaticde.response_time_ms }}" + }, + "prebid": { + "auctiontimestamp": 0 + }, + "tmaxrequest": 5000 + } +} 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 ec4a280daf9..7ae84a8223d 100644 --- a/src/test/resources/org/prebid/server/it/test-application.properties +++ b/src/test/resources/org/prebid/server/it/test-application.properties @@ -39,6 +39,8 @@ adapters.admatic.enabled=true adapters.admatic.endpoint=http://localhost:8090/admatic-exchange?host={{Host}} adapters.admatic.aliases.adt.enabled=true adapters.admatic.aliases.adt.endpoint=http://localhost:8090/adt-exchange?host={{Host}} +adapters.admatic.aliases.admaticde.enabled=true +adapters.admatic.aliases.admaticde.endpoint=http://localhost:8090/admaticde-exchange?host={{Host}} adapters.admatic.aliases.yobee.enabled=true adapters.admatic.aliases.yobee.endpoint=http://localhost:8090/yobee-exchange?host={{Host}} adapters.admixer.enabled=true