From e4d50791aa219a4f54e449f32e20e33cb5cd3b8e Mon Sep 17 00:00:00 2001 From: pkaczmarek Date: Fri, 28 Mar 2025 11:18:57 +0100 Subject: [PATCH 1/2] New Adapter: AdmaticDe - Admatic alias --- src/main/resources/bidder-config/admatic.yaml | 2 + .../org/prebid/server/it/AdmaticDeTest.java | 37 ++++++++++++ .../admaticde/test-admaticde-bid-request.json | 57 +++++++++++++++++++ .../test-admaticde-bid-response.json | 18 ++++++ .../test-auction-admaticde-request.json | 24 ++++++++ .../test-auction-admaticde-response.json | 36 ++++++++++++ .../server/it/test-application.properties | 2 + 7 files changed, 176 insertions(+) create mode 100644 src/test/java/org/prebid/server/it/AdmaticDeTest.java create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-admaticde-bid-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-admaticde-bid-response.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/admaticde/test-auction-admaticde-response.json diff --git a/src/main/resources/bidder-config/admatic.yaml b/src/main/resources/bidder-config/admatic.yaml index 61be886c76f..32ad3b44e88 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 meta-info: maintainer-email: prebid@admatic.com.tr app-media-types: 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..b84c2a8940e --- /dev/null +++ b/src/test/java/org/prebid/server/it/AdmaticDeTest.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 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 ced0d8f2ad4..13ad11ade8e 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.admixer.enabled=true adapters.admixer.endpoint=http://localhost:8090/admixer-exchange adapters.adnuntius.enabled=true From 4505b059876d640756e7f1fbe51ac81097688f4a Mon Sep 17 00:00:00 2001 From: pkaczmarek Date: Tue, 1 Apr 2025 13:11:59 +0200 Subject: [PATCH 2/2] fix comments --- src/test/java/org/prebid/server/it/AdmaticDeTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/org/prebid/server/it/AdmaticDeTest.java b/src/test/java/org/prebid/server/it/AdmaticDeTest.java index b84c2a8940e..13b171a0971 100644 --- a/src/test/java/org/prebid/server/it/AdmaticDeTest.java +++ b/src/test/java/org/prebid/server/it/AdmaticDeTest.java @@ -27,8 +27,7 @@ public void openrtb2AuctionShouldRespondWithBidsFromAdmaticde() throws IOExcepti // when final Response response = responseFor( "openrtb2/admaticde/test-auction-admaticde-request.json", - Endpoint.openrtb2_auction - ); + Endpoint.openrtb2_auction); // then assertJsonEquals("openrtb2/admaticde/test-auction-admaticde-response.json", response, List.of("admaticde"));