diff --git a/src/main/java/org/prebid/server/auction/requestfactory/AmpRequestFactory.java b/src/main/java/org/prebid/server/auction/requestfactory/AmpRequestFactory.java index fb8187ed231..208d8bf20c8 100644 --- a/src/main/java/org/prebid/server/auction/requestfactory/AmpRequestFactory.java +++ b/src/main/java/org/prebid/server/auction/requestfactory/AmpRequestFactory.java @@ -415,6 +415,7 @@ private Future updateBidRequest(AuctionContext auctionContext) { .map(bidRequest -> paramsResolver.resolve(bidRequest, auctionContext, ENDPOINT, true)) .map(bidRequest -> ortb2RequestFactory.removeEmptyEids(bidRequest, auctionContext.getDebugWarnings())) .compose(resolvedBidRequest -> ortb2RequestFactory.validateRequest( + account, resolvedBidRequest, auctionContext.getHttpRequest(), auctionContext.getDebugWarnings())); diff --git a/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java b/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java index 34140a26228..67a28fb5b78 100644 --- a/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java +++ b/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java @@ -241,7 +241,8 @@ private Future updateAndValidateBidRequest(AuctionContext auctionCon return storedRequestProcessor.processAuctionRequest(account.getId(), auctionContext.getBidRequest()) .compose(auctionStoredResult -> updateBidRequest(auctionStoredResult, auctionContext)) - .compose(bidRequest -> ortb2RequestFactory.validateRequest(bidRequest, httpRequest, debugWarnings)) + .compose(bidRequest -> ortb2RequestFactory.validateRequest( + account, bidRequest, httpRequest, debugWarnings)) .map(interstitialProcessor::process); } diff --git a/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java b/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java index 01c4c8a43dc..ee7e5782574 100644 --- a/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java +++ b/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java @@ -192,11 +192,11 @@ public Future activityInfrastructureFrom(AuctionContext auctionContext.getDebugContext().getTraceLevel())); } - public Future validateRequest(BidRequest bidRequest, + public Future validateRequest(Account account, BidRequest bidRequest, HttpRequestContext httpRequestContext, List warnings) { - final ValidationResult validationResult = requestValidator.validate(bidRequest, httpRequestContext); + final ValidationResult validationResult = requestValidator.validate(account, bidRequest, httpRequestContext); if (validationResult.hasWarnings()) { warnings.addAll(validationResult.getWarnings()); diff --git a/src/main/java/org/prebid/server/auction/requestfactory/VideoRequestFactory.java b/src/main/java/org/prebid/server/auction/requestfactory/VideoRequestFactory.java index 8c4d5de8614..b2e56a5c369 100644 --- a/src/main/java/org/prebid/server/auction/requestfactory/VideoRequestFactory.java +++ b/src/main/java/org/prebid/server/auction/requestfactory/VideoRequestFactory.java @@ -33,6 +33,7 @@ import org.prebid.server.model.HttpRequestContext; import org.prebid.server.proto.openrtb.ext.request.ExtPublisher; import org.prebid.server.proto.openrtb.ext.request.ExtPublisherPrebid; +import org.prebid.server.settings.model.Account; import org.prebid.server.util.HttpUtil; import org.prebid.server.util.ObjectUtil; @@ -111,6 +112,7 @@ public Future> fromRequest(RoutingContext routingC .compose(httpRequest -> createBidRequest(httpRequest) .map(bidRequest -> removeEmptyEids(bidRequest, initialAuctionContext.getDebugWarnings())) .compose(bidRequest -> validateRequest( + initialAuctionContext.getAccount(), bidRequest, httpRequest, initialAuctionContext.getDebugWarnings())) @@ -324,11 +326,13 @@ private WithPodErrors fillImplicitParameters(HttpRequestContext http return WithPodErrors.of(updatedWithDebugBidRequest, bidRequestToErrors.getPodErrors()); } - private Future> validateRequest(WithPodErrors requestWithPodErrors, + private Future> validateRequest(Account account, + WithPodErrors requestWithPodErrors, HttpRequestContext httpRequestContext, List warnings) { - return ortb2RequestFactory.validateRequest(requestWithPodErrors.getData(), httpRequestContext, warnings) + return ortb2RequestFactory.validateRequest( + account, requestWithPodErrors.getData(), httpRequestContext, warnings) .map(bidRequest -> requestWithPodErrors); } } diff --git a/src/main/java/org/prebid/server/metric/MetricName.java b/src/main/java/org/prebid/server/metric/MetricName.java index 9ea3d15f0fc..c047f92ada8 100644 --- a/src/main/java/org/prebid/server/metric/MetricName.java +++ b/src/main/java/org/prebid/server/metric/MetricName.java @@ -63,6 +63,8 @@ public enum MetricName { nobid, gotbids, badinput, + disabled_bidder, + unknown_bidder, blocklisted_account, blocklisted_app, badserverresponse, diff --git a/src/main/java/org/prebid/server/metric/Metrics.java b/src/main/java/org/prebid/server/metric/Metrics.java index 52964a9f8b0..2e65dc4b766 100644 --- a/src/main/java/org/prebid/server/metric/Metrics.java +++ b/src/main/java/org/prebid/server/metric/Metrics.java @@ -329,6 +329,22 @@ public void updateAdapterRequestErrorMetric(String bidder, MetricName errorMetri forAdapter(bidder).request().incCounter(errorMetric); } + public void updateAdapterRequestDisabledBidderMetric(String bidder, Account account) { + forAdapter(bidder).request().incCounter(MetricName.disabled_bidder); + if (accountMetricsVerbosityResolver.forAccount(account) + .isAtLeast(AccountMetricsVerbosityLevel.detailed)) { + forAccount(account.getId()).adapter().forAdapter(bidder).request().incCounter(MetricName.disabled_bidder); + } + } + + public void updateAdapterRequestUnknownBidderMetric(String bidder, Account account) { + forAdapter(bidder).request().incCounter(MetricName.unknown_bidder); + if (accountMetricsVerbosityResolver.forAccount(account) + .isAtLeast(AccountMetricsVerbosityLevel.detailed)) { + forAccount(account.getId()).adapter().forAdapter(bidder).request().incCounter(MetricName.unknown_bidder); + } + } + public void updateAnalyticEventMetric(String analyticCode, MetricName eventType, MetricName result) { forAnalyticReporter(analyticCode).forEventType(eventType).incCounter(result); } diff --git a/src/main/java/org/prebid/server/validation/RequestValidator.java b/src/main/java/org/prebid/server/validation/RequestValidator.java index f596850955d..58e138e1ceb 100644 --- a/src/main/java/org/prebid/server/validation/RequestValidator.java +++ b/src/main/java/org/prebid/server/validation/RequestValidator.java @@ -40,6 +40,7 @@ import org.prebid.server.proto.openrtb.ext.request.ExtUserPrebid; import org.prebid.server.proto.openrtb.ext.request.ImpMediaType; import org.prebid.server.proto.openrtb.ext.response.BidType; +import org.prebid.server.settings.model.Account; import org.prebid.server.util.HttpUtil; import org.prebid.server.validation.model.ValidationResult; @@ -96,7 +97,7 @@ public RequestValidator(BidderCatalog bidderCatalog, * Validates the {@link BidRequest} against a list of validation checks, however, reports only one problem * at a time. */ - public ValidationResult validate(BidRequest bidRequest, HttpRequestContext httpRequestContext) { + public ValidationResult validate(Account account, BidRequest bidRequest, HttpRequestContext httpRequestContext) { final List warnings = new ArrayList<>(); try { if (StringUtils.isBlank(bidRequest.getId())) { @@ -121,7 +122,7 @@ public ValidationResult validate(BidRequest bidRequest, HttpRequestContext httpR validateTargeting(targeting); } aliases = ObjectUtils.defaultIfNull(extRequestPrebid.getAliases(), Collections.emptyMap()); - validateAliases(aliases); + validateAliases(aliases, warnings, metrics, account); validateAliasesGvlIds(extRequestPrebid, aliases); validateBidAdjustmentFactors(extRequestPrebid.getBidadjustmentfactors(), aliases); validateExtBidPrebidData(extRequestPrebid.getData(), aliases); @@ -491,18 +492,22 @@ private static void validateGranularityRangeIncrement(ExtGranularityRange range) * Validates aliases. Throws {@link ValidationException} in cases when alias points to invalid bidder or when alias * is equals to itself. */ - private void validateAliases(Map aliases) throws ValidationException { + private void validateAliases(Map aliases, List warnings, + Metrics metrics, Account account) throws ValidationException { + for (final Map.Entry aliasToBidder : aliases.entrySet()) { final String alias = aliasToBidder.getKey(); final String coreBidder = aliasToBidder.getValue(); if (!bidderCatalog.isValidName(coreBidder)) { - throw new ValidationException( + warnings.add( "request.ext.prebid.aliases.%s refers to unknown bidder: %s".formatted(alias, coreBidder)); - } - if (!bidderCatalog.isActive(coreBidder)) { - throw new ValidationException( + metrics.updateAdapterRequestUnknownBidderMetric(coreBidder, account); + } else if (!bidderCatalog.isActive(coreBidder)) { + warnings.add( "request.ext.prebid.aliases.%s refers to disabled bidder: %s".formatted(alias, coreBidder)); + metrics.updateAdapterRequestDisabledBidderMetric(coreBidder, account); } + if (alias.equals(coreBidder)) { throw new ValidationException(""" request.ext.prebid.aliases.%s defines a no-op alias. \ diff --git a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java index 1e0f63b9192..50fa6dd55ad 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java @@ -1753,8 +1753,8 @@ private void givenBidRequest( given(ortb2ImplicitParametersResolver.resolve(any(), any(), any(), anyBoolean())).willAnswer( answerWithFirstArgument()); - given(ortb2RequestFactory.validateRequest(any(), any(), any())) - .willAnswer(invocation -> Future.succeededFuture((BidRequest) invocation.getArgument(0))); + given(ortb2RequestFactory.validateRequest(any(), any(), any(), any())) + .willAnswer(invocation -> Future.succeededFuture((BidRequest) invocation.getArgument(1))); given(ortb2RequestFactory.enrichBidRequestWithAccountAndPrivacyData(any())) .willAnswer(invocation -> Future.succeededFuture(((AuctionContext) invocation.getArgument(0)) diff --git a/src/test/java/org/prebid/server/auction/requestfactory/AuctionRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/AuctionRequestFactoryTest.java index 96889137331..7179a05a715 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/AuctionRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/AuctionRequestFactoryTest.java @@ -165,8 +165,8 @@ public void setUp() { given(ortb2RequestFactory.executeRawAuctionRequestHooks(any())) .willAnswer(invocation -> Future.succeededFuture( ((AuctionContext) invocation.getArgument(0)).getBidRequest())); - given(ortb2RequestFactory.validateRequest(any(), any(), any())) - .willAnswer(invocationOnMock -> Future.succeededFuture((BidRequest) invocationOnMock.getArgument(0))); + given(ortb2RequestFactory.validateRequest(any(), any(), any(), any())) + .willAnswer(invocationOnMock -> Future.succeededFuture((BidRequest) invocationOnMock.getArgument(1))); given(ortb2RequestFactory.removeEmptyEids(any(), any())) .willAnswer(invocationOnMock -> invocationOnMock.getArgument(0)); given(ortb2RequestFactory.updateTimeout(any())).willAnswer(invocation -> invocation.getArgument(0)); @@ -662,7 +662,7 @@ public void shouldReturnFailedFutureIfRequestValidationFailed() { // given givenValidBidRequest(); - given(ortb2RequestFactory.validateRequest(any(), any(), any())) + given(ortb2RequestFactory.validateRequest(any(), any(), any(), any())) .willReturn(Future.failedFuture(new InvalidRequestException("errors"))); // when diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java index 23d485e99a0..84413d6fa79 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java @@ -104,6 +104,7 @@ public class Ortb2RequestFactoryTest extends VertxTest { private static final List BLOCKLISTED_ACCOUNTS = singletonList("bad_acc"); + private static final String ACCOUNT_ID = "accountId"; @Mock private UidsCookieService uidsCookieService; @@ -658,12 +659,13 @@ public void enrichAuctionContextShouldSetDebugOff() { @Test public void validateRequestShouldThrowInvalidRequestExceptionIfRequestIsInvalid() { // given - given(requestValidator.validate(any(), any())).willReturn(ValidationResult.error("error")); + given(requestValidator.validate(any(), any(), any())).willReturn(ValidationResult.error("error")); final BidRequest bidRequest = givenBidRequest(identity()); // when final Future result = target.validateRequest( + Account.empty(ACCOUNT_ID), bidRequest, HttpRequestContext.builder().build(), new ArrayList<>()); @@ -674,24 +676,25 @@ public void validateRequestShouldThrowInvalidRequestExceptionIfRequestIsInvalid( .isInstanceOf(InvalidRequestException.class) .hasMessage("error"); - verify(requestValidator).validate(eq(bidRequest), any()); + verify(requestValidator).validate(any(), eq(bidRequest), any()); } @Test public void validateRequestShouldReturnSameBidRequest() { // given - given(requestValidator.validate(any(), any())).willReturn(ValidationResult.success()); + given(requestValidator.validate(any(), any(), any())).willReturn(ValidationResult.success()); final BidRequest bidRequest = givenBidRequest(identity()); // when final BidRequest result = target.validateRequest( + Account.empty(ACCOUNT_ID), bidRequest, HttpRequestContext.builder().build(), new ArrayList<>()).result(); // then - verify(requestValidator).validate(eq(bidRequest), any()); + verify(requestValidator).validate(any(), eq(bidRequest), any()); assertThat(result).isSameAs(bidRequest); } diff --git a/src/test/java/org/prebid/server/auction/requestfactory/VideoRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/VideoRequestFactoryTest.java index 475b22a5d5b..c9d295ef460 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/VideoRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/VideoRequestFactoryTest.java @@ -345,7 +345,7 @@ public void shouldReturnExpectedResultAndReturnErrors() throws JsonProcessingExc verify(ortb2RequestFactory).createAuctionContext(any(), eq(MetricName.video)); verify(ortb2RequestFactory).enrichAuctionContext(any(), any(), eq(bidRequest), eq(0L)); verify(ortb2RequestFactory).fetchAccountWithoutStoredRequestLookup(any()); - verify(ortb2RequestFactory).validateRequest(eq(bidRequest), any(), any()); + verify(ortb2RequestFactory).validateRequest(any(), eq(bidRequest), any(), any()); verify(paramsResolver) .resolve(eq(bidRequest), any(), eq(Endpoint.openrtb2_video.value()), eq(false)); verify(ortb2RequestFactory).enrichBidRequestWithAccountAndPrivacyData( @@ -404,7 +404,7 @@ private void givenBidRequest(BidRequest bidRequest, List podErrors) { .build()); given(ortb2RequestFactory.fetchAccountWithoutStoredRequestLookup(any())).willReturn(Future.succeededFuture()); - given(ortb2RequestFactory.validateRequest(any(), any(), any())) + given(ortb2RequestFactory.validateRequest(any(), any(), any(), any())) .willAnswer(invocation -> Future.succeededFuture((BidRequest) invocation.getArgument(0))); given(paramsResolver.resolve(any(), any(), any(), anyBoolean())) diff --git a/src/test/java/org/prebid/server/metric/MetricsTest.java b/src/test/java/org/prebid/server/metric/MetricsTest.java index 47b1da61b37..06497865055 100644 --- a/src/test/java/org/prebid/server/metric/MetricsTest.java +++ b/src/test/java/org/prebid/server/metric/MetricsTest.java @@ -592,6 +592,40 @@ public void updateAdapterBidMetricsShouldUpdateMetrics() { assertThat(metricRegistry.counter("adapter.conversant.banner.nurl_bids_received").getCount()).isEqualTo(2); } + @Test + public void updateAdapterRequestUnknownBidderMetricsShouldIncrementMetrics() { + // when + metrics.updateAdapterRequestUnknownBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestUnknownBidderMetric(CONVERSANT, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestUnknownBidderMetric(CONVERSANT, Account.empty(ACCOUNT_ID)); + + // then + assertThat(metricRegistry.counter("adapter.rubicon.requests.unknown_bidder").getCount()).isOne(); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.unknown_bidder").getCount()).isOne(); + assertThat(metricRegistry.counter( + "adapter.conversant.requests.unknown_bidder").getCount()).isEqualTo(2); + assertThat(metricRegistry.counter( + "account.accountId.adapter.conversant.requests.unknown_bidder").getCount()).isEqualTo(2); + } + + @Test + public void updateAdapterRequestDisabledBidderMetricsShouldIncrementMetrics() { + // when + metrics.updateAdapterRequestDisabledBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestDisabledBidderMetric(CONVERSANT, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestDisabledBidderMetric(CONVERSANT, Account.empty(ACCOUNT_ID)); + + // then + assertThat(metricRegistry.counter("adapter.rubicon.requests.disabled_bidder").getCount()).isOne(); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.disabled_bidder").getCount()).isOne(); + assertThat(metricRegistry.counter( + "adapter.conversant.requests.disabled_bidder").getCount()).isEqualTo(2); + assertThat(metricRegistry.counter( + "account.accountId.adapter.conversant.requests.disabled_bidder").getCount()).isEqualTo(2); + } + @Test public void updateAdapterRequestErrorMetricShouldIncrementMetrics() { // when @@ -943,16 +977,22 @@ public void shouldNotUpdateAccountMetricsIfVerbosityIsNone() { metrics.updateAdapterRequestNobidMetrics(RUBICON, Account.empty(ACCOUNT_ID)); metrics.updateAdapterRequestGotbidsMetrics(RUBICON, Account.empty(ACCOUNT_ID)); metrics.updateAdapterBidMetrics(RUBICON, Account.empty(ACCOUNT_ID), 1234L, true, "banner"); + metrics.updateAdapterRequestDisabledBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestUnknownBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); // then assertThat(metricRegistry.counter("account.accountId.requests").getCount()).isZero(); assertThat(metricRegistry.counter("account.accountId.debug_requests").getCount()).isZero(); assertThat(metricRegistry.counter("account.accountId.requests.type.openrtb2-web").getCount()).isZero(); - assertThat(metricRegistry.timer("account.accountId.rubicon.request_time").getCount()).isZero(); - assertThat(metricRegistry.counter("account.accountId.rubicon.requests.nobid").getCount()).isZero(); - assertThat(metricRegistry.counter("account.accountId.rubicon.requests.gotbids").getCount()).isZero(); - assertThat(metricRegistry.histogram("account.accountId.rubicon.prices").getCount()).isZero(); - assertThat(metricRegistry.counter("account.accountId.rubicon.bids_received").getCount()).isZero(); + assertThat(metricRegistry.timer("account.accountId.adapter.rubicon.request_time").getCount()).isZero(); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.requests.nobid").getCount()).isZero(); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.requests.gotbids").getCount()).isZero(); + assertThat(metricRegistry.histogram("account.accountId.adapter.rubicon.prices").getCount()).isZero(); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.bids_received").getCount()).isZero(); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.unknown_bidder").getCount()).isZero(); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.disabled_bidder").getCount()).isZero(); } @Test @@ -968,16 +1008,58 @@ public void shouldUpdateAccountRequestsMetricOnlyIfVerbosityIsBasic() { metrics.updateAdapterRequestNobidMetrics(RUBICON, Account.empty(ACCOUNT_ID)); metrics.updateAdapterRequestGotbidsMetrics(RUBICON, Account.empty(ACCOUNT_ID)); metrics.updateAdapterBidMetrics(RUBICON, Account.empty(ACCOUNT_ID), 1234L, true, "banner"); + metrics.updateAdapterRequestDisabledBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestUnknownBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); // then assertThat(metricRegistry.counter("account.accountId.requests").getCount()).isOne(); assertThat(metricRegistry.counter("account.accountId.debug_requests").getCount()).isZero(); assertThat(metricRegistry.counter("account.accountId.requests.type.openrtb2-web").getCount()).isZero(); assertThat(metricRegistry.timer("account.accountId.rubicon.request_time").getCount()).isZero(); - assertThat(metricRegistry.counter("account.accountId.rubicon.requests.nobid").getCount()).isZero(); - assertThat(metricRegistry.counter("account.accountId.rubicon.requests.gotbids").getCount()).isZero(); - assertThat(metricRegistry.histogram("account.accountId.rubicon.prices").getCount()).isZero(); - assertThat(metricRegistry.counter("account.accountId.rubicon.bids_received").getCount()).isZero(); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.requests.nobid").getCount()).isZero(); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.requests.gotbids").getCount()).isZero(); + assertThat(metricRegistry.histogram("account.accountId.adapter.rubicon.prices").getCount()).isZero(); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.bids_received").getCount()).isZero(); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.unknown_bidder").getCount()).isZero(); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.disabled_bidder").getCount()).isZero(); + } + + @Test + public void shouldUpdateAccountRequestsMetricOnlyIfVerbosityIsDetailed() { + // given + given(accountMetricsVerbosityResolver.forAccount(any())).willReturn(AccountMetricsVerbosityLevel.detailed); + + // when + metrics.updateAccountRequestMetrics(Account.empty(ACCOUNT_ID), MetricName.openrtb2web); + metrics.updateAccountDebugRequestMetrics(Account.empty(ACCOUNT_ID), false); + metrics.updateAccountDebugRequestMetrics(Account.empty(ACCOUNT_ID), true); + metrics.updateAdapterResponseTime(RUBICON, Account.empty(ACCOUNT_ID), 500); + metrics.updateAdapterRequestNobidMetrics(RUBICON, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestGotbidsMetrics(RUBICON, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterBidMetrics(RUBICON, Account.empty(ACCOUNT_ID), 1234L, true, "banner"); + metrics.updateAdapterRequestDisabledBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); + metrics.updateAdapterRequestUnknownBidderMetric(RUBICON, Account.empty(ACCOUNT_ID)); + + // then + assertThat(metricRegistry.counter("account.accountId.requests").getCount()).isOne(); + assertThat(metricRegistry.counter("account.accountId.debug_requests").getCount()) + .isEqualTo(1); + assertThat(metricRegistry.counter("account.accountId.requests.type.openrtb2-web").getCount()) + .isEqualTo(1); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.requests.nobid").getCount()) + .isEqualTo(1); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.requests.gotbids").getCount()) + .isEqualTo(1); + assertThat(metricRegistry.histogram("account.accountId.adapter.rubicon.prices").getCount()) + .isEqualTo(1); + assertThat(metricRegistry.counter("account.accountId.adapter.rubicon.bids_received").getCount()) + .isEqualTo(1); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.unknown_bidder").getCount()).isEqualTo(1); + assertThat(metricRegistry.counter( + "account.accountId.adapter.rubicon.requests.disabled_bidder").getCount()).isEqualTo(1); } @Test diff --git a/src/test/java/org/prebid/server/validation/RequestValidatorTest.java b/src/test/java/org/prebid/server/validation/RequestValidatorTest.java index 29e12ea6b66..a9879c70040 100644 --- a/src/test/java/org/prebid/server/validation/RequestValidatorTest.java +++ b/src/test/java/org/prebid/server/validation/RequestValidatorTest.java @@ -41,6 +41,7 @@ import org.prebid.server.proto.openrtb.ext.request.ExtUser; import org.prebid.server.proto.openrtb.ext.request.ExtUserPrebid; import org.prebid.server.proto.openrtb.ext.request.ImpMediaType; +import org.prebid.server.settings.model.Account; import org.prebid.server.validation.model.ValidationResult; import java.math.BigDecimal; @@ -66,6 +67,7 @@ public class RequestValidatorTest extends VertxTest { private static final String RUBICON = "rubicon"; + private static final String ACCOUNT_ID = "accountId"; @Mock(strictness = LENIENT) private BidderCatalog bidderCatalog; @@ -90,7 +92,7 @@ public void validateShouldReturnOnlyOneErrorAtATime() { final BidRequest bidRequest = BidRequest.builder().build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result).isNotNull(); @@ -103,7 +105,7 @@ public void validateShouldReturnValidationMessageWhenRequestIdIsEmpty() { final BidRequest bidRequest = validBidRequestBuilder().id("").build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -116,7 +118,7 @@ public void validateShouldReturnValidationMessageWhenRequestIdIsNull() { final BidRequest bidRequest = validBidRequestBuilder().id(null).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -129,7 +131,7 @@ public void validateShouldReturnValidationMessageWhenTmaxIsNegative() { final BidRequest bidRequest = validBidRequestBuilder().id("1").tmax(-100L).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -142,7 +144,7 @@ public void validateShouldNotReturnValidationMessageWhenTmaxIsNull() { final BidRequest bidRequest = validBidRequestBuilder().tmax(null).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -154,7 +156,7 @@ public void validateShouldReturnValidationMessageWhenCurIsNull() { final BidRequest bidRequest = validBidRequestBuilder().cur(null).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -168,7 +170,7 @@ public void validateShouldReturnValidationMessageWhenNumberOfImpsIsZero() { final BidRequest bidRequest = validBidRequestBuilder().imp(null).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -186,7 +188,7 @@ public void validateShouldReturnValidationMessageWhenAliasesKeyDoesntContainAlia .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()) @@ -204,7 +206,7 @@ public void validateShouldReturnValidationMessageWhenAliasgvlidsValueLowerThatOn .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()) @@ -218,7 +220,7 @@ public void validateShouldReturnValidationMessageWhenSiteIdAndPageIsNull() { final BidRequest bidRequest = validBidRequestBuilder().site(Site.builder().id(null).build()).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -231,7 +233,7 @@ public void validateShouldReturnValidationMessageWhenSiteIdIsEmptyStringAndPageI final BidRequest bidRequest = validBidRequestBuilder().site(Site.builder().id("").build()).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -244,7 +246,7 @@ public void validateShouldReturnEmptyValidationMessagesWhenPageIdIsNullAndSiteId final BidRequest bidRequest = validBidRequestBuilder().site(Site.builder().id("1").page(null).build()).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.hasErrors()).isFalse(); @@ -256,7 +258,7 @@ public void validateShouldEmptyValidationMessagesWhenSitePageIsEmptyString() { final BidRequest bidRequest = validBidRequestBuilder().site(Site.builder().id("1").page("").build()).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.hasErrors()).isFalse(); @@ -268,7 +270,7 @@ public void validateShouldReturnValidationMessageWhenSiteIdAndPageBothEmpty() { final BidRequest bidRequest = validBidRequestBuilder().site(Site.builder().id("").page("").build()).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -283,7 +285,7 @@ public void validateShouldReturnValidationMessageWhenSiteExtAmpIsNegative() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -298,7 +300,7 @@ public void validateShouldReturnValidationMessageWhenSiteExtAmpIsGreaterThanOne( .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -312,7 +314,7 @@ public void validateShouldFailWhenDoohIdAndVenuetypeAreNulls() { final BidRequest bidRequest = validBidRequestBuilder().site(null).dooh(invalidDooh).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -326,7 +328,7 @@ public void validateShouldFailWhenDoohIdIsNullAndVenuetypeIsEmpty() { final BidRequest bidRequest = validBidRequestBuilder().site(null).dooh(invalidDooh).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -343,7 +345,7 @@ public void validateShouldReturnValidationMessageWhenRequestAppAndRequestSiteBot .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -359,7 +361,7 @@ public void validateShouldFailWhenDoohSiteAndAppArePresentInRequestAndStrictVali .app(App.builder().build()) .site(Site.builder().build()) .build(); - final ValidationResult result = target.validate(invalidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), invalidRequest, null); // then verify(metrics).updateAlertsMetrics(MetricName.general); @@ -376,7 +378,7 @@ public void validateShouldFailWhenSiteAndAppArePresentInRequestAndStrictValidati .app(App.builder().build()) .site(Site.builder().build()) .build(); - final ValidationResult result = target.validate(invalidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), invalidRequest, null); // then verify(metrics).updateAlertsMetrics(MetricName.general); @@ -393,7 +395,7 @@ public void validateShouldFailWhenDoohAndSiteArePresentInRequestAndStrictValidat .dooh(Dooh.builder().build()) .site(Site.builder().build()) .build(); - final ValidationResult result = target.validate(invalidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), invalidRequest, null); // then verify(metrics).updateAlertsMetrics(MetricName.general); @@ -410,7 +412,7 @@ public void validateShouldFailWhenDoohAndAppArePresentInRequestAndStrictValidati .dooh(Dooh.builder().build()) .app(App.builder().build()) .build(); - final ValidationResult result = target.validate(invalidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), invalidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -428,7 +430,7 @@ public void validateShouldReturnValidationMessageWhenMinWidthPercIsNull() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -445,7 +447,7 @@ public void validateShouldReturnValidationMessageWhenMinWidthPercIsLessThanZero( .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -462,7 +464,7 @@ public void validateShouldReturnValidationMessageWhenMinWidthPercGreaterThanHund .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -479,7 +481,7 @@ public void validateShouldReturnValidationMessageWhenMinHeightPercIsNull() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -497,7 +499,7 @@ public void validateShouldReturnValidationMessageWhenMinHeightPercIsLessThanZero .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -515,7 +517,7 @@ public void validateShouldReturnValidationMessageWhenMinHeightPercGreaterThanHun .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -529,7 +531,7 @@ public void validateShouldReturnEmptyValidationMessagesWhenBidRequestIsOk() { final BidRequest bidRequest = validBidRequestBuilder().build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -548,7 +550,7 @@ public void validateShouldReturnValidationMessageWhenRequestHaveDuplicatedImpIds .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -565,7 +567,7 @@ public void validateShouldNotReturnValidationMessageIfUserExtIsEmptyJsonObject() .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -579,7 +581,7 @@ public void validateShouldNotReturnErrorMessageWhenRegsIsEmptyObject() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -597,7 +599,7 @@ public void validateShouldReturnValidationMessageWhenPrebidBuyerIdsContainsNoVal .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -615,7 +617,7 @@ public void validateShouldReturnValidationMessageWhenEidsPermissionsHasNullEleme .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -633,7 +635,7 @@ public void validateShouldReturnValidationMessageWhenEidsPermissionsBiddersIsNul .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -652,7 +654,7 @@ public void validateShouldReturnValidationMessageWhenEidsPermissionsBiddersIsEmp .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -673,7 +675,7 @@ public void validateShouldReturnValidationMessageWhenEidsPermissionsBidderIsNotR .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -693,7 +695,7 @@ public void validateShouldReturnValidationMessageWhenEidsPermissionsBidderHasBla .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -717,7 +719,7 @@ public void validateShouldNotReturnValidationErrorWhenBidderIsAlias() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -735,7 +737,7 @@ public void validateShouldNotReturnValidationErrorWhenBidderIsAsterisk() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -753,7 +755,7 @@ public void validateShouldReturnValidationMessageWhenEidsPermissionsHasMissingSo .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -772,7 +774,7 @@ public void validateShouldReturnValidationMessageWhenCantParseTargetingPriceGran .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -791,7 +793,7 @@ public void validateShouldReturnValidationMessageWhenRangesAreEmptyList() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -812,7 +814,7 @@ public void validateShouldReturnValidationMessageWhenIncrementIsZero() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -832,7 +834,7 @@ public void validateShouldReturnValidationMessageWhenIncrementIsMissed() { .build())) .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -853,7 +855,7 @@ public void validateShouldReturnValidationMessageWhenIncrementIsNegative() { .build())) .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -872,7 +874,7 @@ public void validateShouldReturnValidationMessageWhenPrecisionIsNegative() { .build())) .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -895,7 +897,7 @@ public void validateShouldReturnValidationMessageWhenMediaTypePriceGranularityTy .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -923,7 +925,7 @@ public void validateShouldReturnValidationMessageWithCorrectMediaType() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -950,7 +952,7 @@ public void validateShouldReturnValidationMessageForInvalidTargetingPrefix() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -972,7 +974,7 @@ public void validateShouldReturnValidationMessageWhenRangesContainsMissedMaxValu .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -993,7 +995,7 @@ public void validateShouldReturnValidationMessageWhenRangesAreNotOrderedByMaxVal .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1016,7 +1018,7 @@ public void validateShouldReturnValidationMessageWhenRangesAreNotOrderedByMaxVal .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1038,7 +1040,7 @@ public void validateShouldReturnValidationMessageWhenIncrementIsNegativeInNotLea .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1057,7 +1059,7 @@ public void validateShouldReturnValidationMessageWhenPrebidBuyerIdsContainsUnkno .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1080,7 +1082,7 @@ public void validateShouldNotReturnAnyErrorInValidationResultWhenPrebidBuyerIdIs .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -1098,7 +1100,7 @@ public void validateShouldNotReturnAnyErrorInValidationResultWhenPrebidBuyerIdIs .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -1114,7 +1116,7 @@ public void validateShouldNotReturnValidationMessageWhenEidsIsEmpty() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -1130,7 +1132,7 @@ public void validateShouldReturnValidationMessageWhenEidHasEmptySource() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1146,7 +1148,7 @@ public void validateShouldReturnValidationMessageWhenAliasNameEqualsToBidderItPo final BidRequest bidRequest = validBidRequestBuilder().ext(ext).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1164,10 +1166,10 @@ public void validateShouldReturnValidationMessageWhenAliasPointOnNotValidBidderN final BidRequest bidRequest = validBidRequestBuilder().ext(ext).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then - assertThat(result.getErrors()).hasSize(1) + assertThat(result.getWarnings()).hasSize(1) .containsOnly("request.ext.prebid.aliases.alias refers to unknown bidder: fake"); } @@ -1182,10 +1184,10 @@ public void validateShouldReturnValidationMessageWhenAliasPointOnDisabledBidder( given(bidderCatalog.isActive("appnexus")).willReturn(false); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then - assertThat(result.getErrors()).hasSize(1) + assertThat(result.getWarnings()).hasSize(1) .containsOnly("request.ext.prebid.aliases.alias refers to disabled bidder: appnexus"); } @@ -1198,7 +1200,7 @@ public void validateShouldReturnEmptyValidationMessagesWhenAliasesWasUsed() { final BidRequest bidRequest = validBidRequestBuilder().ext(ext).build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -1212,7 +1214,7 @@ public void validateShouldReturnValidationResultWithErrorsWhenGdprIsNotOneOrZero .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1231,7 +1233,7 @@ public void validateShouldReturnValidationMessageWhenAdjustmentFactorNegative() .build())) .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1253,7 +1255,7 @@ public void validateShouldReturnValidationMessageWhenAdjustmentMediaFactorNegati .build())) .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1275,7 +1277,7 @@ public void validateShouldReturnValidationMessageWhenBidderUnknown() { .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1296,7 +1298,7 @@ public void validateShouldReturnValidationMessageWhenMediaBidderUnknown() { .build())) .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).hasSize(1) @@ -1320,7 +1322,7 @@ public void validateShouldReturnEmptyValidationMessagesWhenBidderIsKnownAndAdjus .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -1344,7 +1346,7 @@ public void validateShouldReturnEmptyValidationMessagesWhenBidderIsKnownAliasFor .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).isEmpty(); @@ -1365,7 +1367,7 @@ public void validateShouldReturnEmptyValidationMessagesWhenBidderIsKnownBidderCo .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then verify(bidderCatalog).isValidName(rubiconAlias); @@ -1386,7 +1388,7 @@ public void validateShouldReturnValidationMessageWhenMultipleSchainsForSameBidde .build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()) @@ -1403,7 +1405,7 @@ public void validateShouldReturnValidationMessageWhenImpValidationFailed() throw final BidRequest bidRequest = validBidRequestBuilder().build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getErrors()).containsOnly("imp[0] validation failed"); @@ -1418,7 +1420,7 @@ public void validateShouldReturnWarningMessageWhenImpValidationWarns() throws Va final BidRequest bidRequest = validBidRequestBuilder().build(); // when - final ValidationResult result = target.validate(bidRequest, null); + final ValidationResult result = target.validate(Account.empty(ACCOUNT_ID), bidRequest, null); // then assertThat(result.getWarnings()).containsOnly("imp[0] validation warning");