Skip to content

Commit

Permalink
Core: Default enabled property is true in analytics acc config
Browse files Browse the repository at this point in the history
  • Loading branch information
Compile-Ninja committed Oct 7, 2024
1 parent 2245587 commit f5b35cc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f5b35cc

Please sign in to comment.