diff --git a/extra/modules/pb-richmedia-filter/src/main/java/org/prebid/server/hooks/modules/pb/richmedia/filter/config/PbRichmediaFilterModuleConfiguration.java b/extra/modules/pb-richmedia-filter/src/main/java/org/prebid/server/hooks/modules/pb/richmedia/filter/config/PbRichmediaFilterModuleConfiguration.java index bce3668c0a5..fe3a8a37ac6 100644 --- a/extra/modules/pb-richmedia-filter/src/main/java/org/prebid/server/hooks/modules/pb/richmedia/filter/config/PbRichmediaFilterModuleConfiguration.java +++ b/extra/modules/pb-richmedia-filter/src/main/java/org/prebid/server/hooks/modules/pb/richmedia/filter/config/PbRichmediaFilterModuleConfiguration.java @@ -20,8 +20,8 @@ public class PbRichmediaFilterModuleConfiguration { @Bean PbRichmediaFilterModule pbRichmediaFilterModule( - @Value("${hooks.modules.pb-richmedia-filter.filter-mraid}") Boolean filterMraid, - @Value("${hooks.modules.pb-richmedia-filter.mraid-script-pattern}") String mraidScriptPattern) { + @Value("${hooks.modules.pb-richmedia-filter.filter-mraid:false}") boolean filterMraid, + @Value("${hooks.modules.pb-richmedia-filter.mraid-script-pattern:#{null}}") String mraidScriptPattern) { final ObjectMapper mapper = ObjectMapperProvider.mapper(); final PbRichMediaFilterProperties globalProperties = PbRichMediaFilterProperties.of( diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy index c9bd259d3a9..453de43aa3c 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy @@ -33,13 +33,14 @@ class ModuleBaseSpec extends BaseSpec { } protected static Map getRichMediaFilterSettings(String scriptPattern, - boolean filterMraidEnabled = true, + Boolean filterMraidEnabled = true, Endpoint endpoint = OPENRTB2_AUCTION) { ["hooks.${PB_RICHMEDIA_FILTER.code}.enabled" : true, "hooks.modules.${PB_RICHMEDIA_FILTER.code}.mraid-script-pattern": scriptPattern, "hooks.modules.${PB_RICHMEDIA_FILTER.code}.filter-mraid" : filterMraidEnabled, "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan(endpoint, [(ALL_PROCESSED_BID_RESPONSES): [PB_RICHMEDIA_FILTER]]))] + .findAll { it.value != null } .collectEntries { key, value -> [(key.toString()): value.toString()] } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy index b12ff9644b4..c49743b275b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy @@ -35,6 +35,51 @@ class RichMediaFilterSpec extends ModuleBaseSpec { .collectEntries { key, value -> [(key.toString()): value.toString()] }) private final PrebidServerService pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(getRichMediaFilterSettings(PATTERN_NAME, false)) + def "PBS should process request without rich media module when host config have empty settings"() { + given: "Prebid server with empty settings for module" + def prebidServerService = pbsServiceFactory.getService(pbsConfig) + + and: "BidRequest with stored response" + def storedResponseId = PBSUtils.randomNumber + def bidRequest = BidRequest.defaultBidRequest.tap { + ext.prebid.returnAllBidStatus = true + it.ext.prebid.trace = VERBOSE + it.imp.first().ext.prebid.storedBidResponse = [new StoredBidResponse(id: storedResponseId, bidder: GENERIC)] + } + + and: "Stored bid response in DB" + def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { + it.seatbid[0].bid[0].adm = PBSUtils.randomString + } + def storedResponse = new StoredResponse(responseId: storedResponseId, storedBidResponse: storedBidResponse) + storedResponseDao.save(storedResponse) + + and: "Account in the DB" + def account = new Account(uuid: bidRequest.getAccountId()) + accountDao.save(account) + + when: "PBS processes auction request" + def response = prebidServerService.sendAuctionRequest(bidRequest) + + then: "Response header should contain seatbid" + assert response.seatbid.size() == 1 + + and: "Response shouldn't contain errors of invalid creation" + assert !response.ext.errors + + and: "Response shouldn't contain analytics" + assert !getAnalyticResults(response) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + + where: + pbsConfig << [getRichMediaFilterSettings(PBSUtils.randomString, null), + getRichMediaFilterSettings(null, true), + getRichMediaFilterSettings(null, false), + getRichMediaFilterSettings(null, null)] + } + def "PBS should process request without analytics when adm matches with pattern name and filter set to disabled in host config"() { given: "BidRequest with stored response" def storedResponseId = PBSUtils.randomNumber