Skip to content

Commit 704ab67

Browse files
committed
Bidder Configuration Fixes
1 parent 413779f commit 704ab67

11 files changed

Lines changed: 29 additions & 27 deletions

File tree

src/main/java/org/prebid/server/bidder/adkernel/AdkernelBidder.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class AdkernelBidder implements Bidder<BidRequest> {
4141
new TypeReference<>() {
4242
};
4343

44+
private static final String ZONE_ID_MACRO = "{{ZoneId}}";
45+
4446
private static final String MF_SUFFIX = "__mf";
4547
private static final String MF_SUFFIX_BANNER = "b" + MF_SUFFIX;
4648
private static final String MF_SUFFIX_VIDEO = "v" + MF_SUFFIX;
@@ -49,11 +51,11 @@ public class AdkernelBidder implements Bidder<BidRequest> {
4951

5052
private static final int MF_SUFFIX_LENGTH = MF_SUFFIX.length() + 1;
5153

52-
private final String endpointTemplate;
54+
private final String endpointUrl;
5355
private final JacksonMapper mapper;
5456

55-
public AdkernelBidder(String endpointTemplate, JacksonMapper mapper) {
56-
this.endpointTemplate = HttpUtil.validateUrl(Objects.requireNonNull(endpointTemplate));
57+
public AdkernelBidder(String endpointUrl, JacksonMapper mapper) {
58+
this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl));
5759
this.mapper = Objects.requireNonNull(mapper);
5860
}
5961

@@ -183,10 +185,9 @@ private HttpRequest<BidRequest> createHttpRequest(Map.Entry<ExtImpAdkernel, List
183185
App app) {
184186

185187
final ExtImpAdkernel impExt = extAndImp.getKey();
186-
final String uri = endpointTemplate.formatted(impExt.getZoneId());
188+
final String uri = endpointUrl.replace(ZONE_ID_MACRO, HttpUtil.encodeUrl(impExt.getZoneId().toString()));
187189

188-
final MultiMap headers = HttpUtil.headers()
189-
.add(HttpUtil.X_OPENRTB_VERSION_HEADER, "2.5");
190+
final MultiMap headers = HttpUtil.headers().add(HttpUtil.X_OPENRTB_VERSION_HEADER, "2.5");
190191

191192
final BidRequest outgoingRequest = createBidRequest(extAndImp.getValue(), requestBuilder, site, app);
192193

src/main/java/org/prebid/server/bidder/audiencenetwork/AudienceNetworkBidder.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,26 @@ public class AudienceNetworkBidder implements Bidder<BidRequest> {
5353

5454
private static final List<Integer> SUPPORTED_BANNER_HEIGHT = Arrays.asList(250, 50);
5555

56+
private static final String PLATFORM_MACRO = "{{PlatformId}}";
57+
private static final String REQUEST_MACRO = "{{RequestId}}";
58+
private static final String PUBLISHER_MACRO = "{{PublisherId}}";
59+
5660
private final String endpointUrl;
5761
private final String platformId;
5862
private final String appSecret;
59-
private final String timeoutNotificationUrlTemplate;
63+
private final String timeoutNotificationUrl;
6064
private final JacksonMapper mapper;
6165

6266
public AudienceNetworkBidder(String endpointUrl,
6367
String platformId,
6468
String appSecret,
65-
String timeoutNotificationUrlTemplate,
69+
String timeoutNotificationUrl,
6670
JacksonMapper mapper) {
6771

6872
this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl));
6973
this.platformId = checkBlankString(Objects.requireNonNull(platformId), "platform-id");
7074
this.appSecret = checkBlankString(Objects.requireNonNull(appSecret), "app-secret");
71-
this.timeoutNotificationUrlTemplate = HttpUtil.validateUrl(
72-
Objects.requireNonNull(timeoutNotificationUrlTemplate));
75+
this.timeoutNotificationUrl = HttpUtil.validateUrl(Objects.requireNonNull(timeoutNotificationUrl));
7376
this.mapper = Objects.requireNonNull(mapper);
7477
}
7578

@@ -343,7 +346,9 @@ public HttpRequest<Void> makeTimeoutNotification(HttpRequest<BidRequest> httpReq
343346

344347
return HttpRequest.<Void>builder()
345348
.method(HttpMethod.GET)
346-
.uri(timeoutNotificationUrlTemplate.formatted(platformId, publisherId, requestId))
349+
.uri(timeoutNotificationUrl.replace(PLATFORM_MACRO, HttpUtil.encodeUrl(platformId))
350+
.replace(PUBLISHER_MACRO, HttpUtil.encodeUrl(publisherId))
351+
.replace(REQUEST_MACRO, HttpUtil.encodeUrl(requestId)))
347352
.build();
348353
}
349354
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
adapters:
22
adkernel:
3-
endpoint: http://pbs.adksrv.com/hb?zone=%s
3+
endpoint: http://pbs.adksrv.com/hb?zone={{ZoneId}}
44
endpoint-compression: gzip
55
aliases:
66
rxnetwork: ~

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ adapters:
1111
vendor-id: 0
1212
platform-id:
1313
app-secret:
14-
timeout-notification-url-template: https://www.facebook.com/audiencenetwork/nurl/?partner=%s&app=%s&auction=%s&ortb_loss_code=2
14+
timeout-notification-url-template: https://www.facebook.com/audiencenetwork/nurl/?partner={{PlatformId}}&app={{PublisherId}}&auction={{RequestId}}&ortb_loss_code=2

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
adapters:
22
ix:
33
# Please contact the maintainer to obtain endpoint details
4-
endpoint: https://
4+
endpoint: https://localhost
55
ortb-version: "2.6"
66
meta-info:
77
maintainer-email: pdu-supply-prebid@indexexchange.com

src/test/java/org/prebid/server/bidder/adkernel/AdkernelBidderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
public class AdkernelBidderTest extends VertxTest {
4848

49-
private static final String ENDPOINT_URL = "https://test.com?zone=%s";
49+
private static final String ENDPOINT_URL = "https://test.com?zone={{ZoneId}}";
5050

5151
private final AdkernelBidder target = new AdkernelBidder(ENDPOINT_URL, jacksonMapper);
5252

src/test/java/org/prebid/server/bidder/audiencenetwork/AudienceNetworkBidderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public class AudienceNetworkBidderTest extends VertxTest {
4646
private static final String PLATFORM_ID = "101";
4747
private static final String APP_SECRET = "6237";
4848
private static final String DEFAULT_BID_CURRENCY = "USD";
49-
public static final String TIMEOUT_NOTIFICATION_URL_TEMPLATE = "https://url/?p=%s&a=%s&auction=%s&ortb_loss_code=2";
49+
public static final String TIMEOUT_NOTIFICATION_URL_TEMPLATE =
50+
"https://url/?p={{PlatformId}}&a={{PublisherId}}&auction={{RequestId}}&ortb_loss_code=2";
5051

5152
private final AudienceNetworkBidder target = new AudienceNetworkBidder(
5253
ENDPOINT_URL,

src/test/java/org/prebid/server/bidder/huaweiads/HuaweiEndpointResolverTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@
33
import org.apache.commons.lang3.StringUtils;
44
import org.junit.jupiter.api.BeforeEach;
55
import org.junit.jupiter.api.Test;
6-
import org.junit.jupiter.api.extension.ExtendWith;
7-
import org.mockito.junit.jupiter.MockitoExtension;
86

97
import static org.assertj.core.api.Assertions.assertThat;
108
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
119

12-
@ExtendWith(MockitoExtension.class)
1310
public class HuaweiEndpointResolverTest {
1411

1512
private static final String ENDPOINT_URL = "https://test-url.org/";
1613
private static final String CHINESE_ENDPOINT_URL = "https://test-url.org/china";
1714
private static final String EUROPEAN_ENDPOINT_URL = "https://test-url.org/europe";
18-
private static final String RUSSIAN_ENDPOINT_URL = "https://test-url.orc/russia";
15+
private static final String RUSSIAN_ENDPOINT_URL = "https://test-url.org/russia";
1916
private static final String ASIAN_ENDPOINT_URL = "https://test-url.org/asian";
2017

2118
private HuaweiEndpointResolver target;

src/test/java/org/prebid/server/execution/file/supplier/RemoteFileSupplierTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void setUp() {
7474

7575
private RemoteFileSupplier target(boolean checkRemoteFileSize) {
7676
return new RemoteFileSupplier(
77-
"https://download.url/",
77+
"https://download.url.com/",
7878
SAVE_PATH,
7979
TMP_PATH,
8080
httpClient,

src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import org.prebid.server.spring.config.bidder.model.usersync.UsersyncConfigurationProperties;
99
import org.prebid.server.spring.config.bidder.model.usersync.UsersyncMethodConfigurationProperties;
1010

11-
import java.net.MalformedURLException;
12-
1311
import static org.assertj.core.api.Assertions.assertThat;
1412
import static org.assertj.core.api.Assertions.assertThatThrownBy;
1513

@@ -57,7 +55,7 @@ public void createShouldValidateExternalUrl() {
5755

5856
// given, when and then
5957
assertThatThrownBy(() -> UsersyncerCreator.create(null).apply(config, CookieFamilySource.ROOT))
60-
.hasCauseExactlyInstanceOf(MalformedURLException.class)
58+
.isInstanceOf(IllegalArgumentException.class)
6159
.hasMessage("URL supplied is not valid: null");
6260
}
6361

0 commit comments

Comments
 (0)