Skip to content
Open
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,4 @@ public void updateShouldRemoveImpFromUpdateBidRequestWhenAllBiddersFiltered() {
assertThat(result.getImp()).isEmpty();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,4 @@ public void getShouldThrowExceptionWhenBucketNotFound() {
assertThat(ar.cause().getMessage()).contains("Bucket not found");
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public LiveIntentOmniChannelIdentityProcessedAuctionRequestHook(LiveIntentOmniCh
double logSamplingRate) {

this.config = Objects.requireNonNull(config);
HttpUtil.validateUrlSyntax(config.getIdentityResolutionEndpoint());
HttpUtil.validateUrl(config.getIdentityResolutionEndpoint());
this.mapper = Objects.requireNonNull(mapper);
this.httpClient = Objects.requireNonNull(httpClient);
this.logSamplingRate = logSamplingRate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.prebid.server.log.Logger;
import org.prebid.server.log.LoggerFactory;
import org.prebid.server.util.HttpUtil;
import org.prebid.server.util.Uri;
import org.prebid.server.validation.ValidationException;
import org.prebid.server.vertx.httpclient.HttpClient;
import org.prebid.server.vertx.httpclient.model.HttpClientResponse;
Expand All @@ -27,10 +28,10 @@ public class APIClientImpl implements APIClient {
private static final Logger logger = LoggerFactory.getLogger(APIClientImpl.class);
private static final ConditionalLogger conditionalLogger = new ConditionalLogger(logger);

private static final String TENANT = "{{TENANT}}";
private static final String ORIGIN = "{{ORIGIN}}";
private static final String TENANT = "TENANT";
private static final String ORIGIN = "ORIGIN";

private final String endpoint;
private final Uri endpoint;
private final HttpClient httpClient;
private final JacksonMapper mapper;
private final double logSamplingRate;
Expand All @@ -40,7 +41,7 @@ public APIClientImpl(String endpoint,
JacksonMapper mapper,
double logSamplingRate) {

this.endpoint = HttpUtil.validateUrl(Objects.requireNonNull(endpoint));
this.endpoint = Uri.of(endpoint);
this.httpClient = Objects.requireNonNull(httpClient);
this.mapper = Objects.requireNonNull(mapper);
this.logSamplingRate = logSamplingRate;
Expand All @@ -64,8 +65,9 @@ public Future<TargetingResult> getTargeting(OptableTargetingProperties propertie

private String resolveEndpoint(String tenant, String origin) {
return endpoint
.replace(TENANT, tenant)
.replace(ORIGIN, origin);
.replaceMacro(TENANT, tenant)
.replaceMacro(ORIGIN, origin)
.expand();
}

private static MultiMap headers(OptableTargetingProperties properties, List<String> ips, String userAgent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import com.iab.openrtb.response.Bid;
import com.iab.openrtb.response.BidResponse;
import com.iab.openrtb.response.SeatBid;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.MultiMap;
import io.vertx.core.http.impl.headers.HeadersMultiMap;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus;
import org.prebid.server.activity.infrastructure.ActivityInfrastructure;
import org.prebid.server.auction.gpp.model.GppContext;
import org.prebid.server.auction.model.AuctionContext;
Expand Down Expand Up @@ -194,11 +194,11 @@ protected Device givenDevice() {

protected HttpClientResponse givenSuccessHttpResponse(String fileName) {
final MultiMap headers = HeadersMultiMap.headers().add("Content-Type", "application/json");
return HttpClientResponse.of(HttpStatus.SC_OK, headers, givenBodyFromFile(fileName));
return HttpClientResponse.of(HttpResponseStatus.OK.code(), headers, givenBodyFromFile(fileName));
}

protected HttpClientResponse givenFailHttpResponse(String fileName) {
return givenFailHttpResponse(HttpStatus.SC_BAD_REQUEST, fileName);
return givenFailHttpResponse(HttpResponseStatus.BAD_REQUEST.code(), fileName);
}

protected HttpClientResponse givenFailHttpResponse(int statusCode, String fileName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.prebid.server.hooks.modules.optable.targeting.v1.net;

import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.Future;
import io.vertx.core.MultiMap;
import org.apache.http.HttpStatus;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -122,8 +122,8 @@ public void shouldNotFailWhenHttpClientIsCrashed() {
@Test
public void shouldNotFailWhenInternalErrorOccurs() {
// given
when(httpClient.get(any(), any(), anyLong())).thenReturn(Future.succeededFuture(
givenFailHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, "plain_text_response.json")));
when(httpClient.get(any(), any(), anyLong())).thenReturn(Future.succeededFuture(givenFailHttpResponse(
HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "plain_text_response.json")));

// when
final Future<TargetingResult> result = target.getTargeting(
Expand All @@ -143,8 +143,8 @@ public void shouldUseAuthorizationHeaderIfApiKeyIsPresent() {
target = new APIClientImpl("http://endpoint.optable.com", httpClient, jacksonMapper, 10);

when(httpClient.get(any(), any(), anyLong()))
.thenReturn(Future.succeededFuture(givenFailHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
"plain_text_response.json")));
.thenReturn(Future.succeededFuture(givenFailHttpResponse(
HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "plain_text_response.json")));

// when
final Future<TargetingResult> result = target.getTargeting(givenOptableTargetingProperties(false),
Expand All @@ -162,14 +162,14 @@ public void shouldUseAuthorizationHeaderIfApiKeyIsPresent() {
public void shouldBuildApiUrlByReplacingTenantAndOriginMacros() {
// given
target = new APIClientImpl(
"http://endpoint.optable.com?t={{TENANT}}&o={{ORIGIN}}",
"http://endpoint.optable.com?t={TENANT}&o={ORIGIN}",
httpClient,
jacksonMapper,
10);

when(httpClient.get(any(), any(), anyLong()))
.thenReturn(Future.succeededFuture(givenFailHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
"plain_text_response.json")));
.thenReturn(Future.succeededFuture(givenFailHttpResponse(
HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "plain_text_response.json")));

// when
final Future<TargetingResult> result = target.getTargeting(givenOptableTargetingProperties(false),
Expand All @@ -187,7 +187,7 @@ public void shouldBuildApiUrlByReplacingTenantAndOriginMacros() {
public void shouldNotUseAuthorizationHeaderIfApiKeyIsAbsent() {
// given
when(httpClient.get(any(), any(), anyLong())).thenReturn(Future.succeededFuture(
givenFailHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, "plain_text_response.json")));
givenFailHttpResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "plain_text_response.json")));

// when
final Future<TargetingResult> result = target.getTargeting(
Expand All @@ -209,7 +209,7 @@ public void shouldNotUseAuthorizationHeaderIfApiKeyIsAbsent() {
public void shouldPassThroughIpAddressesAndUserAgent() {
// given
when(httpClient.get(any(), any(), anyLong())).thenReturn(Future.succeededFuture(
givenFailHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, "plain_text_response.json")));
givenFailHttpResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "plain_text_response.json")));

// when
final Future<TargetingResult> result = target.getTargeting(
Expand All @@ -233,7 +233,7 @@ public void shouldPassThroughIpAddressesAndUserAgent() {
public void shouldNotPassThroughIpAddressAndUserAgentWhenNotSpecified() {
// given
when(httpClient.get(any(), any(), anyLong())).thenReturn(Future.succeededFuture(
givenFailHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, "plain_text_response.json")));
givenFailHttpResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "plain_text_response.json")));

// when
final Future<TargetingResult> result = target.getTargeting(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,4 @@ private ExtBidPrebid parseExtBidPrebid(Bid bid) {
return null;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,4 @@ public void shouldProduceReturnTrueWhenConfigIsEnabledAndBidRequestHasApp() {
private static Config givenConfig(boolean enabled) {
return Config.of(true, AppVideoHtmlConfig.of(enabled, null));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ PbRichmediaFilterModule pbRichmediaFilterModule(
new BidResponsesMraidFilter(),
new ModuleConfigResolver(mapper, globalProperties))));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,4 @@ public MraidFilterResult filterByPattern(String mraidScriptPattern,

return MraidFilterResult.of(filteredResponses, analyticsResults);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,4 @@ private static BidderBid givenBid(String impId, String adm) {
private static BidderError givenError(String... rejectedImps) {
return BidderError.of("Invalid bid", BidderError.Type.invalid_bid, Set.of(rejectedImps));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,4 @@ public void resolveShouldReturnGlobalConfigWhenAccountConfigMissingProperties()
// then
assertThat(actualProperties).isEqualTo(GLOBAL_PROPERTIES);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,4 @@ private static AnalyticsResult givenAnalyticsResult(String bidder, String... rej
Bid.builder().id("bid-" + impId).impid(impId).build()).build()).toList(),
RESPONSE_REJECTED_INVALID_CREATIVE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ public void shouldHaveValidInitialConfigs() {
// given and when and then
assertThat(PbRichmediaFilterModule.CODE).isEqualTo("pb-richmedia-filter");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,4 @@ private static SchemaFunctionArguments<BidRequest, RequestRuleContext> givenFunc
null,
RequestRuleContext.of(AuctionContext.builder().build(), Granularity.Request.instance(), "datacenter"));
}

}
19 changes: 0 additions & 19 deletions extra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
<commons.collections.version>4.4</commons.collections.version>
<commons.compress.version>1.27.1</commons.compress.version>
<commons-math3.version>3.6.1</commons-math3.version>
<commons-validator.version>1.10.0</commons-validator.version>
<scram.version>2.1</scram.version>
<httpclient.version>4.5.14</httpclient.version>
<ipaddress.version>5.5.1</ipaddress.version>
<oshi.version>6.8.0</oshi.version>
<json-schema-validator.version>1.5.6</json-schema-validator.version>
Expand Down Expand Up @@ -137,23 +135,6 @@
<artifactId>commons-math3</artifactId>
<version>${commons-math3.version}</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${commons-validator.version}</version>
</dependency>
<!-- TODO: refactor code to replace URIBuilder with something else so that this dep can be removed -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.seancfoley</groupId>
<artifactId>ipaddress</artifactId>
Expand Down
12 changes: 4 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
<groupId>io.vertx</groupId>
<artifactId>vertx-auth-common</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-uri-template</artifactId>
</dependency>
<dependency>
<groupId>com.ongres.scram</groupId>
<artifactId>client</artifactId>
Expand Down Expand Up @@ -110,14 +114,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
</dependency>
<dependency>
<groupId>com.github.seancfoley</groupId>
<artifactId>ipaddress</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sample/configs/prebid-config-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ status-response: "ok"
adapters:
appnexus:
enabled: true
ix:
criteo:
enabled: true
openx:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion sample/configs/prebid-config-s3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ server:
adapters:
appnexus:
enabled: true
ix:
criteo:
enabled: true
openx:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion sample/configs/prebid-config-with-51d-dd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ status-response: "ok"
adapters:
appnexus:
enabled: true
ix:
criteo:
enabled: true
openx:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion sample/configs/prebid-config-with-module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ status-response: "ok"
adapters:
appnexus:
enabled: true
ix:
criteo:
enabled: true
openx:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion sample/configs/prebid-config-with-optable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ status-response: "ok"
adapters:
appnexus:
enabled: true
ix:
criteo:
enabled: true
openx:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion sample/configs/prebid-config-with-wurfl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ status-response: "ok"
adapters:
appnexus:
enabled: true
ix:
criteo:
enabled: true
openx:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion sample/configs/prebid-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ status-response: "ok"
adapters:
appnexus:
enabled: true
ix:
criteo:
enabled: true
openx:
enabled: true
Expand Down
Loading