Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CWire: add cwire.json and CwireTest.java #3693 #3726

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/resources/bidder-config/generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ adapters:
meta-info:
maintainer-email: [email protected]
app-media-types:
- banner
site-media-types:
- banner
supported-vendors:
Expand Down
36 changes: 36 additions & 0 deletions src/main/resources/static/bidder-params/cwire.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "CWire Adapter Params",
"description": "A schema which validates params accepted by the CWire adapter",
"type": "object",
"properties": {
"placementId": {
"type": "integer",
"description": "An ID which identifies this placement of the impression"
},
"domainId": {
"type": "integer",
"description": "An ID which identifies the site selling the impression"
},
"pageId": {
"type": "integer",
"description": "An ID which identifies the site selling the impression (deprecated)"
},
"cwcreative": {
"type": "string",
"description": "An CWire ID of the creative that we want to show"
},
"cwdebug": {
"type": "boolean",
"description": "Enable CWire debug mode"
},
"cwfeatures": {
"type": "array",
"items": {
"type": "string"
},
"description": "A string array of CWire features"
}
},
"required": []
}
35 changes: 35 additions & 0 deletions src/test/java/org/prebid/server/it/CwireTest.java
Original file line number Diff line number Diff line change
@@ -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 CwireTest extends IntegrationTest {

@Test
public void openrtb2AuctionShouldRespondWithBidsFromCwire() throws IOException, JSONException {
// given
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/cwire-exchange"))
.withRequestBody(equalToJson(
jsonFrom("openrtb2/cwire/test-cwire-bid-request.json")))
.willReturn(aResponse().withBody(
jsonFrom("openrtb2/cwire/test-cwire-bid-response.json"))));

// when
final Response response = responseFor("openrtb2/cwire/test-auction-cwire-request.json",
Endpoint.openrtb2_auction);

// then
assertJsonEquals("openrtb2/cwire/test-auction-cwire-response.json", response,
singletonList("cwire"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"id": "tid",
"imp": [
{
"id": "impId001",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"cwire": {
"placementId": 123,
"domainId": 456,
"pageId": 789,
"cwcreative": "exampleCreativeId",
"cwdebug": false,
"cwfeatures": [
"featureA",
"featureB"
]
}
}
}
],
"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
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"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"
},
"origbidcpm": 3.33
}
}
],
"seat": "cwire",
"group": 0
}
],
"cur": "USD",
"ext": {
"responsetimemillis": {
"cwire": "{{ cwire.response_time_ms }}"
},
"prebid": {
"auctiontimestamp": 1000
},
"tmaxrequest": 5000
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"id": "tid",
"imp": [
{
"id": "impId001",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"secure": 1,
"ext": {
"tid": "${json-unit.any-string}",
"bidder": {
"placementId": 123,
"domainId": 456,
"pageId": 789,
"cwcreative": "exampleCreativeId",
"cwdebug": false,
"cwfeatures": [
"featureA",
"featureB"
]
}
}
}
],
"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"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ adapters.generic.aliases.adrino.enabled=true
adapters.generic.aliases.adrino.endpoint=http://localhost:8090/adrino-exchange
adapters.generic.aliases.ccx.enabled=true
adapters.generic.aliases.ccx.endpoint=http://localhost:8090/ccx-exchange
adapters.generic.aliases.cwire.enabled=true
adapters.generic.aliases.cwire.endpoint=http://localhost:8090/cwire-exchange
adapters.generic.aliases.infytv.enabled=true
adapters.generic.aliases.infytv.endpoint=http://localhost:8090/infytv-exchange
adapters.generic.aliases.zeta_global_ssp.enabled=true
Expand Down
Loading