Skip to content

Commit

Permalink
Smarthub Bidder: Markapp Alias (#3293)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoxaAntoxic authored Jul 10, 2024
1 parent d0ee1d8 commit 172a85d
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/resources/bidder-config/smarthub.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
adapters:
smarthub:
endpoint: http://{{Host}}-prebid.smart-hub.io/?seat={{AccountId}}&token={{SourceId}}
endpoint: http://prebid.smart-hub.io/pbserver?partnerName={{Host}}&seat={{AccountID}}&token={{SourceId}}
aliases:
markapp:
enabled: false
endpoint: http://markapp-prebid.smart-hub.io/pbserver/?seat={{AccountID}}&token={{SourceId}}
meta-info:
maintainer-email: support@smart-hub.io
app-media-types:
Expand Down
35 changes: 35 additions & 0 deletions src/test/java/org/prebid/server/it/MarkappTest.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.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 MarkappTest extends IntegrationTest {

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

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

// then
assertJsonEquals("openrtb2/markapp/test-auction-markapp-response.json", response, singletonList("markapp"));
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/prebid/server/it/SmarthubTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class SmarthubTest extends IntegrationTest {

@Test
public void openrtb2AuctionShouldRespondWithBidsFromBetween() throws IOException, JSONException {
public void openrtb2AuctionShouldRespondWithBidsFromSmarthub() throws IOException, JSONException {
// given
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/smarthub-exchange"))
.withRequestBody(equalToJson(jsonFrom("openrtb2/smarthub/test-smarthub-bid-request.json")))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"id": "request_id",
"imp": [
{
"id": "imp_id",
"banner": {
"w": 300,
"h": 250
},
"ext": {
"markapp": {
"partnerName": "someUniquePartnerName",
"seat": "someSeat",
"token": "someToken"
}
}
}
],
"tmax": 5000,
"regs": {
"ext": {
"gdpr": 0
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "request_id",
"seatbid": [
{
"bid": [
{
"id": "bid_id",
"impid": "imp_id",
"price": 3.33,
"adm": "adm001",
"adid": "adid001",
"cid": "cid001",
"crid": "crid001",
"w": 300,
"h": 250,
"ext": {
"mediaType": "video",
"origbidcpm": 3.33,
"prebid": {
"type": "video"
}
}
}
],
"seat": "markapp",
"group": 0
}
],
"cur": "USD",
"ext": {
"responsetimemillis": {
"markapp": "{{ markapp.response_time_ms }}"
},
"prebid": {
"auctiontimestamp": 0
},
"tmaxrequest": 5000
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"id": "request_id",
"imp": [
{
"id": "imp_id",
"secure": 1,
"banner": {
"w": 300,
"h": 250
},
"ext": {
"tid": "${json-unit.any-string}",
"bidder": {
"partnerName": "someUniquePartnerName",
"seat": "someSeat",
"token": "someToken"
}
}
}
],
"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"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": "request_id",
"seatbid": [
{
"bid": [
{
"id": "bid_id",
"impid": "imp_id",
"price": 3.33,
"adid": "adid001",
"crid": "crid001",
"cid": "cid001",
"adm": "adm001",
"h": 250,
"w": 300,
"ext": {
"mediaType": "video"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ adapters.smartx.enabled=true
adapters.smartx.endpoint=http://localhost:8090/smartx-exchange
adapters.smarthub.enabled=true
adapters.smarthub.endpoint=http://localhost:8090/smarthub-exchange
adapters.smarthub.aliases.markapp.enabled=true
adapters.smarthub.aliases.markapp.endpoint=http://localhost:8090/markapp-exchange
adapters.smartyads.enabled=true
adapters.smartyads.endpoint=http://localhost:8090/smartyads-exchange
adapters.smilewanted.enabled=true
Expand Down

0 comments on commit 172a85d

Please sign in to comment.