From f5b35cc2e4e5080d666425f05a74d264fd17dac3 Mon Sep 17 00:00:00 2001 From: serhiinahornyi Date: Mon, 7 Oct 2024 10:05:55 +0200 Subject: [PATCH] Core: Default enabled property is true in analytics acc config --- .../reporter/AnalyticsReporterDelegator.java | 8 ++++-- .../AnalyticsReporterDelegatorTest.java | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java b/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java index f51db7f8ead..10db83bec8a 100644 --- a/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java +++ b/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java @@ -239,8 +239,12 @@ private boolean isNotAllowedAdapterByGlobalOrAccountAnalyticsConfig(String adapt if (modules != null && modules.containsKey(adapter)) { final ObjectNode moduleConfig = modules.get(adapter); - return moduleConfig == null || !moduleConfig.has("enabled") - || !moduleConfig.get("enabled").asBoolean(); + + if (moduleConfig == null || !moduleConfig.has("enabled")) { + return false; + } + + return !moduleConfig.get("enabled").asBoolean(); } return !globalEnabledAdapters.contains(adapter); diff --git a/src/test/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegatorTest.java b/src/test/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegatorTest.java index cc0a712b4e8..4f81b761e59 100644 --- a/src/test/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegatorTest.java +++ b/src/test/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegatorTest.java @@ -426,6 +426,31 @@ public void shouldNotCallAnalyticsAdapterIfDisabledByAccount() { verify(firstReporter, never()).processEvent(auctionEventCaptor.capture()); } + @Test + public void shouldCallAnalyticsAdapterIfAdapterNodePresentButEnabledPropertyNotPresent() { + // given + final ObjectNode moduleConfig = mapper.createObjectNode(); + moduleConfig.put("property1", "value1"); + moduleConfig.put("property2", "value2"); + + final AuctionContext auctionContext = AuctionContext.builder() + .account(Account.builder() + .analytics(AccountAnalyticsConfig.of( + true, null, Map.of("logAnalytics", moduleConfig))) + .build()) + .bidRequest(BidRequest.builder() + .ext(ExtRequest.of(ExtRequestPrebid.builder().analytics(mapper.createObjectNode()).build())) + .build()) + .build(); + + // when + target.processEvent(AuctionEvent.builder().auctionContext(auctionContext).build()); + + // then + verify(vertx, times(2)).runOnContext(any()); + verify(firstReporter).processEvent(any()); + } + @Test public void shouldUpdateAuctionEventWithPropertiesFromAdapterSpecificAccountConfig() { // given