From 11e29e57c2c36a6b18355c12460cf2432f8da6ac Mon Sep 17 00:00:00 2001 From: pkaczmarek Date: Mon, 24 Feb 2025 11:44:40 +0100 Subject: [PATCH] New Adapter: Adt - Admatic alias --- src/main/resources/bidder-config/admatic.yaml | 6 ++ .../java/org/prebid/server/it/AdtTest.java | 37 ++++++++++++ .../it/openrtb2/adt/test-adt-bid-request.json | 57 +++++++++++++++++++ .../openrtb2/adt/test-adt-bid-response.json | 18 ++++++ .../adt/test-auction-adt-request.json | 24 ++++++++ .../adt/test-auction-adt-response.json | 36 ++++++++++++ .../server/it/test-application.properties | 2 + 7 files changed, 180 insertions(+) create mode 100644 src/test/java/org/prebid/server/it/AdtTest.java create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/adt/test-adt-bid-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/adt/test-adt-bid-response.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/adt/test-auction-adt-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/adt/test-auction-adt-response.json diff --git a/src/main/resources/bidder-config/admatic.yaml b/src/main/resources/bidder-config/admatic.yaml index 52dfd41246a..61be886c76f 100644 --- a/src/main/resources/bidder-config/admatic.yaml +++ b/src/main/resources/bidder-config/admatic.yaml @@ -1,6 +1,12 @@ adapters: admatic: endpoint: http://pbs.admatic.com.tr?host={{Host}} + aliases: + adt: + enabled: false + meta-info: + maintainer-email: publisher@adtarget.com.tr + vendor-id: 779 meta-info: maintainer-email: prebid@admatic.com.tr app-media-types: diff --git a/src/test/java/org/prebid/server/it/AdtTest.java b/src/test/java/org/prebid/server/it/AdtTest.java new file mode 100644 index 00000000000..43af3f37f7f --- /dev/null +++ b/src/test/java/org/prebid/server/it/AdtTest.java @@ -0,0 +1,37 @@ +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 AdtTest extends IntegrationTest { + + @Test + public void openrtb2AuctionShouldRespondWithBidsFromadt() throws IOException, JSONException { + // given + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/adt-exchange")) + .withQueryParam("host", equalTo("host")) + .withRequestBody(equalToJson(jsonFrom("openrtb2/adt/test-adt-bid-request.json"))) + .willReturn(aResponse().withBody(jsonFrom("openrtb2/adt/test-adt-bid-response.json")))); + + // when + final Response response = responseFor( + "openrtb2/adt/test-auction-adt-request.json", + Endpoint.openrtb2_auction + ); + + // then + assertJsonEquals("openrtb2/adt/test-auction-adt-response.json", response, List.of("adt")); + } + +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/adt/test-adt-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-adt-bid-request.json new file mode 100644 index 00000000000..806fd172232 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-adt-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/adt/test-adt-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-adt-bid-response.json new file mode 100644 index 00000000000..da5c7fc51cd --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-adt-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/adt/test-auction-adt-request.json b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-auction-adt-request.json new file mode 100644 index 00000000000..85515f9e724 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-auction-adt-request.json @@ -0,0 +1,24 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 320, + "h": 250 + }, + "ext": { + "adt": { + "host": "host", + "networkId": 4 + } + } + } + ], + "tmax": 5000, + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/adt/test-auction-adt-response.json b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-auction-adt-response.json new file mode 100644 index 00000000000..c4f8a96adbf --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/adt/test-auction-adt-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": "adt", + "group": 0 + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adt": "{{ adt.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 851962c5192..a84fa9ebd83 100644 --- a/src/test/resources/org/prebid/server/it/test-application.properties +++ b/src/test/resources/org/prebid/server/it/test-application.properties @@ -37,6 +37,8 @@ adapters.adman.enabled=true adapters.adman.endpoint=http://localhost:8090/adman-exchange 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.admixer.enabled=true adapters.admixer.endpoint=http://localhost:8090/admixer-exchange adapters.adnuntius.enabled=true