Skip to content

Commit a52f2df

Browse files
CWire: add cwire.json and CwireTest.java #3693 (#3726)
1 parent cd771c0 commit a52f2df

File tree

8 files changed

+264
-0
lines changed

8 files changed

+264
-0
lines changed

src/main/resources/bidder-config/generic.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ adapters:
8181
meta-info:
8282
maintainer-email: [email protected]
8383
app-media-types:
84+
- banner
8485
site-media-types:
8586
- banner
8687
supported-vendors:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "CWire Adapter Params",
4+
"description": "A schema which validates params accepted by the CWire adapter",
5+
"type": "object",
6+
"properties": {
7+
"placementId": {
8+
"type": "integer",
9+
"description": "An ID which identifies this placement of the impression"
10+
},
11+
"domainId": {
12+
"type": "integer",
13+
"description": "An ID which identifies the site selling the impression"
14+
},
15+
"pageId": {
16+
"type": "integer",
17+
"description": "An ID which identifies the site selling the impression (deprecated)"
18+
},
19+
"cwcreative": {
20+
"type": "string",
21+
"description": "An CWire ID of the creative that we want to show"
22+
},
23+
"cwdebug": {
24+
"type": "boolean",
25+
"description": "Enable CWire debug mode"
26+
},
27+
"cwfeatures": {
28+
"type": "array",
29+
"items": {
30+
"type": "string"
31+
},
32+
"description": "A string array of CWire features"
33+
}
34+
},
35+
"required": []
36+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.prebid.server.it;
2+
3+
import io.restassured.response.Response;
4+
import org.json.JSONException;
5+
import org.junit.jupiter.api.Test;
6+
import org.prebid.server.model.Endpoint;
7+
8+
import java.io.IOException;
9+
10+
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
11+
import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
12+
import static com.github.tomakehurst.wiremock.client.WireMock.post;
13+
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
14+
import static java.util.Collections.singletonList;
15+
16+
public class CwireTest extends IntegrationTest {
17+
18+
@Test
19+
public void openrtb2AuctionShouldRespondWithBidsFromCwire() throws IOException, JSONException {
20+
// given
21+
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/cwire-exchange"))
22+
.withRequestBody(equalToJson(
23+
jsonFrom("openrtb2/cwire/test-cwire-bid-request.json")))
24+
.willReturn(aResponse().withBody(
25+
jsonFrom("openrtb2/cwire/test-cwire-bid-response.json"))));
26+
27+
// when
28+
final Response response = responseFor("openrtb2/cwire/test-auction-cwire-request.json",
29+
Endpoint.openrtb2_auction);
30+
31+
// then
32+
assertJsonEquals("openrtb2/cwire/test-auction-cwire-response.json", response,
33+
singletonList("cwire"));
34+
}
35+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"id": "tid",
3+
"imp": [
4+
{
5+
"id": "impId001",
6+
"banner": {
7+
"format": [
8+
{
9+
"w": 300,
10+
"h": 250
11+
}
12+
]
13+
},
14+
"ext": {
15+
"cwire": {
16+
"placementId": 123,
17+
"domainId": 456,
18+
"pageId": 789,
19+
"cwcreative": "exampleCreativeId",
20+
"cwdebug": false,
21+
"cwfeatures": [
22+
"featureA",
23+
"featureB"
24+
]
25+
}
26+
}
27+
}
28+
],
29+
"device": {
30+
"pxratio": 4.2,
31+
"dnt": 2,
32+
"language": "en",
33+
"ifa": "ifaId"
34+
},
35+
"site": {
36+
"publisher": {
37+
"id": "publisherId"
38+
}
39+
},
40+
"at": 1,
41+
"tmax": 5000,
42+
"cur": [
43+
"USD"
44+
],
45+
"source": {
46+
"fd": 1,
47+
"tid": "tid"
48+
},
49+
"regs": {
50+
"ext": {
51+
"gdpr": 0
52+
}
53+
}
54+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"id": "tid",
3+
"seatbid": [
4+
{
5+
"bid": [
6+
{
7+
"id": "bid001",
8+
"impid": "impId001",
9+
"exp": 300,
10+
"price": 3.33,
11+
"adm": "adm001",
12+
"adid": "adid001",
13+
"cid": "cid001",
14+
"crid": "crid001",
15+
"w": 300,
16+
"h": 250,
17+
"ext": {
18+
"prebid": {
19+
"type": "banner"
20+
},
21+
"origbidcpm": 3.33
22+
}
23+
}
24+
],
25+
"seat": "cwire",
26+
"group": 0
27+
}
28+
],
29+
"cur": "USD",
30+
"ext": {
31+
"responsetimemillis": {
32+
"cwire": "{{ cwire.response_time_ms }}"
33+
},
34+
"prebid": {
35+
"auctiontimestamp": 1000
36+
},
37+
"tmaxrequest": 5000
38+
}
39+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"id": "tid",
3+
"imp": [
4+
{
5+
"id": "impId001",
6+
"banner": {
7+
"format": [
8+
{
9+
"w": 300,
10+
"h": 250
11+
}
12+
]
13+
},
14+
"secure": 1,
15+
"ext": {
16+
"tid": "${json-unit.any-string}",
17+
"bidder": {
18+
"placementId": 123,
19+
"domainId": 456,
20+
"pageId": 789,
21+
"cwcreative": "exampleCreativeId",
22+
"cwdebug": false,
23+
"cwfeatures": [
24+
"featureA",
25+
"featureB"
26+
]
27+
}
28+
}
29+
}
30+
],
31+
"site": {
32+
"domain": "www.example.com",
33+
"page": "http://www.example.com",
34+
"publisher": {
35+
"id": "publisherId",
36+
"domain": "example.com"
37+
},
38+
"ext": {
39+
"amp": 0
40+
}
41+
},
42+
"device": {
43+
"dnt": 2,
44+
"ua": "userAgent",
45+
"ip": "193.168.244.1",
46+
"pxratio": 4.2,
47+
"language": "en",
48+
"ifa": "ifaId"
49+
},
50+
"at": 1,
51+
"tmax": "${json-unit.any-number}",
52+
"cur": [
53+
"USD"
54+
],
55+
"source": {
56+
"fd": 1,
57+
"tid": "tid"
58+
},
59+
"regs": {
60+
"ext": {
61+
"gdpr": 0
62+
}
63+
},
64+
"ext": {
65+
"prebid": {
66+
"channel": {
67+
"name": "web"
68+
},
69+
"server": {
70+
"externalurl": "http://localhost:8080",
71+
"gvlid": 1,
72+
"datacenter": "local",
73+
"endpoint": "/openrtb2/auction"
74+
}
75+
}
76+
}
77+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"id": "tid",
3+
"seatbid": [
4+
{
5+
"bid": [
6+
{
7+
"id": "bid001",
8+
"impid": "impId001",
9+
"price": 3.33,
10+
"adid": "adid001",
11+
"crid": "crid001",
12+
"cid": "cid001",
13+
"adm": "adm001",
14+
"h": 250,
15+
"w": 300
16+
}
17+
]
18+
}
19+
]
20+
}

src/test/resources/org/prebid/server/it/test-application.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ adapters.generic.aliases.adrino.enabled=true
88
adapters.generic.aliases.adrino.endpoint=http://localhost:8090/adrino-exchange
99
adapters.generic.aliases.ccx.enabled=true
1010
adapters.generic.aliases.ccx.endpoint=http://localhost:8090/ccx-exchange
11+
adapters.generic.aliases.cwire.enabled=true
12+
adapters.generic.aliases.cwire.endpoint=http://localhost:8090/cwire-exchange
1113
adapters.generic.aliases.infytv.enabled=true
1214
adapters.generic.aliases.infytv.endpoint=http://localhost:8090/infytv-exchange
1315
adapters.generic.aliases.zeta_global_ssp.enabled=true

0 commit comments

Comments
 (0)