From c274410495c4d035139f9f74d27aa14a55a6fea1 Mon Sep 17 00:00:00 2001 From: SerhiiNahornyi Date: Wed, 27 Dec 2023 23:10:27 +0200 Subject: [PATCH] Indicue: Add adapter (#2866) --- .../resources/bidder-config/adtelligent.yaml | 6 ++ .../org/prebid/server/it/IndicueTest.java | 37 ++++++++++++ .../indicue/test-auction-indicue-request.json | 26 ++++++++ .../test-auction-indicue-response.json | 36 +++++++++++ .../indicue/test-indicue-bid-request.json | 59 +++++++++++++++++++ .../indicue/test-indicue-bid-response.json | 20 +++++++ .../server/it/test-application.properties | 2 + 7 files changed, 186 insertions(+) create mode 100644 src/test/java/org/prebid/server/it/IndicueTest.java create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-response.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/indicue/test-indicue-bid-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/indicue/test-indicue-bid-response.json diff --git a/src/main/resources/bidder-config/adtelligent.yaml b/src/main/resources/bidder-config/adtelligent.yaml index 62d94c0865e..faeb18c9bdf 100644 --- a/src/main/resources/bidder-config/adtelligent.yaml +++ b/src/main/resources/bidder-config/adtelligent.yaml @@ -36,6 +36,12 @@ adapters: meta-info: maintainer-email: info@copper6.com vendor-id: 0 + indicue: + enabled: false + endpoint: http://ghb.console.indicue.com/pbs/ortb + meta-info: + maintainer-email: ops@indicue.com + vendor-id: 0 meta-info: maintainer-email: hb@adtelligent.com app-media-types: diff --git a/src/test/java/org/prebid/server/it/IndicueTest.java b/src/test/java/org/prebid/server/it/IndicueTest.java new file mode 100644 index 00000000000..205196b91d5 --- /dev/null +++ b/src/test/java/org/prebid/server/it/IndicueTest.java @@ -0,0 +1,37 @@ +package org.prebid.server.it; + +import io.restassured.response.Response; +import org.json.JSONException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.prebid.server.model.Endpoint; +import org.springframework.test.context.junit4.SpringRunner; + +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; + +@RunWith(SpringRunner.class) +public class IndicueTest extends IntegrationTest { + + @Test + public void openrtb2AuctionShouldRespondWithBidsFromIndicue() throws IOException, JSONException { + // given + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/indicue-exchange")) + .withRequestBody(equalToJson(jsonFrom("openrtb2/indicue/test-indicue-bid-request.json"))) + .willReturn(aResponse().withBody( + jsonFrom("openrtb2/indicue/test-indicue-bid-response.json")))); + + // when + final Response response = responseFor("openrtb2/indicue/test-auction-indicue-request.json", + Endpoint.openrtb2_auction); + + // then + assertJsonEquals("openrtb2/indicue/test-auction-indicue-response.json", response, + singletonList("indicue")); + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-request.json b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-request.json new file mode 100644 index 00000000000..121a1975ac8 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-request.json @@ -0,0 +1,26 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "indicue": { + "aid": 1000, + "siteId": 1234, + "bidFloor": 20, + "placementId": 10 + } + } + } + ], + "tmax": 5000, + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-response.json b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-response.json new file mode 100644 index 00000000000..c561c6a98e8 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-auction-indicue-response.json @@ -0,0 +1,36 @@ +{ + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "price": 8.43, + "adm": "adm14", + "crid": "crid14", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + }, + "origbidcpm": 8.43 + } + } + ], + "seat": "indicue", + "group": 0 + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "indicue": "{{ indicue.response_time_ms }}" + }, + "prebid": { + "auctiontimestamp": 0 + }, + "tmaxrequest": 5000 + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-indicue-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-indicue-bid-request.json new file mode 100644 index 00000000000..d4673e30e95 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-indicue-bid-request.json @@ -0,0 +1,59 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "secure": 1, + "banner": { + "w": 300, + "h": 250 + }, + "bidfloor": 20, + "ext": { + "adtelligent": { + "aid": 1000, + "placementId": 10, + "siteId": 1234, + "bidFloor": 20 + } + } + } + ], + "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/indicue/test-indicue-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-indicue-bid-response.json new file mode 100644 index 00000000000..1da8f18279d --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/indicue/test-indicue-bid-response.json @@ -0,0 +1,20 @@ +{ + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "price": 8.43, + "adm": "adm14", + "crid": "crid14", + "w": 300, + "h": 250 + } + ], + "seat": "adtelligent", + "group": 0 + } + ] +} 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 45bee734ecc..3c67f06ca66 100644 --- a/src/test/resources/org/prebid/server/it/test-application.properties +++ b/src/test/resources/org/prebid/server/it/test-application.properties @@ -52,6 +52,8 @@ adapters.adtelligent.aliases.pgam.enabled=true adapters.adtelligent.aliases.pgam.endpoint=http://localhost:8090/pgam-exchange adapters.adtelligent.aliases.copper6.enabled=true adapters.adtelligent.aliases.copper6.endpoint=http://localhost:8090/copper6-exchange +adapters.adtelligent.aliases.indicue.enabled=true +adapters.adtelligent.aliases.indicue.endpoint=http://localhost:8090/indicue-exchange adapters.adtrgtme.enabled=true adapters.adtrgtme.endpoint=http://localhost:8090/adtrgtme-exchange adapters.advangelists.enabled=true