diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy index 309bba2eea6..e0c3b279200 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy @@ -121,7 +121,7 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec { accountDao.save(account) when: "PBS processes auction requests" - def bidResponse = pbsServiceFactory.getService(PBS_CONFIG).sendAuctionRequest(bidRequest) + def bidResponse = activityPbsService.sendAuctionRequest(bidRequest) then: "Bid response should contain basic info in debug" def infrastructure = bidResponse.ext.debug.trace.activityInfrastructure diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy index 34242d43cec..771fac9bd84 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy @@ -13,8 +13,6 @@ import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.DistributionChannel import org.prebid.server.functional.model.request.auction.Regs import org.prebid.server.functional.model.request.auction.RegsExt -import org.prebid.server.functional.service.PrebidServerService -import org.prebid.server.functional.testcontainers.container.PrebidServerContainer import org.prebid.server.functional.util.PBSUtils import org.prebid.server.functional.util.privacy.BogusConsent import org.prebid.server.functional.util.privacy.CcpaConsent @@ -320,10 +318,8 @@ class GdprAmpSpec extends PrivacyBaseSpec { def startTime = Instant.now() and: "Create new container" - def serverContainer = new PrebidServerContainer(GDPR_VENDOR_LIST_CONFIG + - ["adapters.generic.meta-info.vendor-id": GENERIC_VENDOR_ID as String]) - serverContainer.start() - def privacyPbsService = new PrebidServerService(serverContainer) + def config = GDPR_VENDOR_LIST_CONFIG + ["adapters.generic.meta-info.vendor-id": GENERIC_VENDOR_ID as String] + def defaultPrivacyPbsService = pbsServiceFactory.getService(config) and: "Prepare tcf consent string" def tcfConsent = new TcfConsent.Builder() @@ -347,21 +343,21 @@ class GdprAmpSpec extends PrivacyBaseSpec { vendorListResponse.setResponse(tcfPolicyVersion) when: "PBS processes amp request" - privacyPbsService.sendAmpRequest(ampRequest) + defaultPrivacyPbsService.sendAmpRequest(ampRequest) then: "Used vendor list have proper specification version of GVL" def properVendorListPath = VENDOR_LIST_PATH.replace("{VendorVersion}", tcfPolicyVersion.vendorListVersion.toString()) - PBSUtils.waitUntil { privacyPbsService.isFileExist(properVendorListPath) } - def vendorList = privacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) + PBSUtils.waitUntil { defaultPrivacyPbsService.isFileExist(properVendorListPath) } + def vendorList = defaultPrivacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) assert vendorList.tcfPolicyVersion == tcfPolicyVersion.vendorListVersion and: "Logs should contain proper vendor list version" - def logs = privacyPbsService.getLogsByTime(startTime) + def logs = defaultPrivacyPbsService.getLogsByTime(startTime) assert getLogsByText(logs, "Created new TCF 2 vendor list for version " + "v${tcfPolicyVersion.vendorListVersion}.${tcfPolicyVersion.vendorListVersion}") - cleanup: "Stop container with default request" - serverContainer.stop() + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(config) where: tcfPolicyVersion << [TCF_POLICY_V2, TCF_POLICY_V4, TCF_POLICY_V5] @@ -410,7 +406,10 @@ class GdprAmpSpec extends PrivacyBaseSpec { } def "PBS amp should emit the same error without a second GVL list request if a retry is too soon for the exponential-backoff"() { - given: "Test start time" + given: "Prebid server with privacy settings" + def defaultPrivacyPbsService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG) + + and: "Test start time" def startTime = Instant.now() and: "Prepare tcf consent string" @@ -438,14 +437,14 @@ class GdprAmpSpec extends PrivacyBaseSpec { vendorListResponse.setResponse(tcfPolicyVersion, Delay.seconds(EXPONENTIAL_BACKOFF_MAX_DELAY + 3)) when: "PBS processes amp request" - privacyPbsService.sendAmpRequest(ampRequest) + defaultPrivacyPbsService.sendAmpRequest(ampRequest) then: "PBS shouldn't fetch vendor list" def vendorListPath = VENDOR_LIST_PATH.replace("{VendorVersion}", tcfPolicyVersion.vendorListVersion.toString()) - assert !privacyPbsService.isFileExist(vendorListPath) + assert !defaultPrivacyPbsService.isFileExist(vendorListPath) and: "Logs should contain proper vendor list version" - def logs = privacyPbsService.getLogsByTime(startTime) + def logs = defaultPrivacyPbsService.getLogsByTime(startTime) def tcfError = "TCF 2 vendor list for version v${tcfPolicyVersion.vendorListVersion}.${tcfPolicyVersion.vendorListVersion} not found, started downloading." assert getLogsByText(logs, tcfError) @@ -453,18 +452,21 @@ class GdprAmpSpec extends PrivacyBaseSpec { def secondStartTime = Instant.now() when: "PBS processes amp request" - privacyPbsService.sendAmpRequest(ampRequest) + defaultPrivacyPbsService.sendAmpRequest(ampRequest) then: "PBS shouldn't fetch vendor list" - assert !privacyPbsService.isFileExist(vendorListPath) + assert !defaultPrivacyPbsService.isFileExist(vendorListPath) and: "Logs should contain proper vendor list version" - def logsSecond = privacyPbsService.getLogsByTime(secondStartTime) + def logsSecond = defaultPrivacyPbsService.getLogsByTime(secondStartTime) assert getLogsByText(logsSecond, tcfError) and: "Reset vendor list response" vendorListResponse.reset() + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(GENERAL_PRIVACY_CONFIG) + where: tcfPolicyVersion << [TCF_POLICY_V2, TCF_POLICY_V4, TCF_POLICY_V5] } @@ -659,7 +661,10 @@ class GdprAmpSpec extends PrivacyBaseSpec { } def "PBS amp should set 3 for tcfPolicyVersion when tcfPolicyVersion is #tcfPolicyVersion"() { - given: "Tcf consent setup" + given: "Prebid server with privacy settings" + def defaultPrivacyPbsService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG) + + and: "Tcf consent setup" def tcfConsent = new TcfConsent.Builder() .setPurposesLITransparency(BASIC_ADS) .setTcfPolicyVersion(tcfPolicyVersion.value) @@ -681,14 +686,17 @@ class GdprAmpSpec extends PrivacyBaseSpec { vendorListResponse.setResponse(tcfPolicyVersion) when: "PBS processes amp request" - privacyPbsService.sendAmpRequest(ampRequest) + defaultPrivacyPbsService.sendAmpRequest(ampRequest) then: "Used vendor list have proper specification version of GVL" def properVendorListPath = VENDOR_LIST_PATH.replace("{VendorVersion}", tcfPolicyVersion.vendorListVersion.toString()) - PBSUtils.waitUntil { privacyPbsService.isFileExist(properVendorListPath) } - def vendorList = privacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) + PBSUtils.waitUntil { defaultPrivacyPbsService.isFileExist(properVendorListPath) } + def vendorList = defaultPrivacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) assert vendorList.gvlSpecificationVersion == V3 + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(GENERAL_PRIVACY_CONFIG) + where: tcfPolicyVersion << [TCF_POLICY_V4, TCF_POLICY_V5] } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy index 66003fa2716..351875e5f90 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy @@ -10,8 +10,6 @@ import org.prebid.server.functional.model.request.auction.DistributionChannel import org.prebid.server.functional.model.request.auction.Regs import org.prebid.server.functional.model.request.auction.RegsExt import org.prebid.server.functional.model.response.auction.ErrorType -import org.prebid.server.functional.service.PrebidServerService -import org.prebid.server.functional.testcontainers.container.PrebidServerContainer import org.prebid.server.functional.util.PBSUtils import org.prebid.server.functional.util.privacy.BogusConsent import org.prebid.server.functional.util.privacy.TcfConsent @@ -278,10 +276,8 @@ class GdprAuctionSpec extends PrivacyBaseSpec { def startTime = Instant.now() and: "Create new container" - def serverContainer = new PrebidServerContainer(GDPR_VENDOR_LIST_CONFIG + - ["adapters.generic.meta-info.vendor-id": GENERIC_VENDOR_ID as String]) - serverContainer.start() - def privacyPbsService = new PrebidServerService(serverContainer) + def config = GDPR_VENDOR_LIST_CONFIG + ["adapters.generic.meta-info.vendor-id": GENERIC_VENDOR_ID as String] + def defaultPrivacyPbsService = pbsServiceFactory.getService(config) and: "Tcf consent setup" def tcfConsent = new TcfConsent.Builder() @@ -298,21 +294,21 @@ class GdprAuctionSpec extends PrivacyBaseSpec { vendorListResponse.setResponse(tcfPolicyVersion) when: "PBS processes auction request" - privacyPbsService.sendAuctionRequest(bidRequest) + defaultPrivacyPbsService.sendAuctionRequest(bidRequest) then: "Used vendor list have proper specification version of GVL" def properVendorListPath = VENDOR_LIST_PATH.replace("{VendorVersion}", tcfPolicyVersion.vendorListVersion.toString()) - PBSUtils.waitUntil { privacyPbsService.isFileExist(properVendorListPath) } - def vendorList = privacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) + PBSUtils.waitUntil { defaultPrivacyPbsService.isFileExist(properVendorListPath) } + def vendorList = defaultPrivacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) assert vendorList.tcfPolicyVersion == tcfPolicyVersion.vendorListVersion and: "Logs should contain proper vendor list version" - def logs = privacyPbsService.getLogsByTime(startTime) + def logs = defaultPrivacyPbsService.getLogsByTime(startTime) assert getLogsByText(logs, "Created new TCF 2 vendor list for version " + "v${tcfPolicyVersion.vendorListVersion}.${tcfPolicyVersion.vendorListVersion}") - cleanup: "Stop container with default request" - serverContainer.stop() + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(config) where: tcfPolicyVersion << [TCF_POLICY_V2, TCF_POLICY_V4, TCF_POLICY_V5] @@ -357,7 +353,10 @@ class GdprAuctionSpec extends PrivacyBaseSpec { } def "PBS auction should emit the same error without a second GVL list request if a retry is too soon for the exponential-backoff"() { - given: "Test start time" + given: "Prebid server with privacy settings" + def defaultPrivacyPbsService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG) + + and: "Test start time" def startTime = Instant.now() and: "Tcf consent setup" @@ -378,14 +377,14 @@ class GdprAuctionSpec extends PrivacyBaseSpec { vendorListResponse.setResponse(tcfPolicyVersion, Delay.seconds(EXPONENTIAL_BACKOFF_MAX_DELAY + 3)) when: "PBS processes auction request" - privacyPbsService.sendAuctionRequest(bidRequest) + defaultPrivacyPbsService.sendAuctionRequest(bidRequest) then: "Used vendor list have proper specification version of GVL" def properVendorListPath = VENDOR_LIST_PATH.replace("{VendorVersion}", tcfPolicyVersion.vendorListVersion.toString()) - assert !privacyPbsService.isFileExist(properVendorListPath) + assert !defaultPrivacyPbsService.isFileExist(properVendorListPath) and: "Logs should contain proper vendor list version" - def logs = privacyPbsService.getLogsByTime(startTime) + def logs = defaultPrivacyPbsService.getLogsByTime(startTime) def tcfError = "TCF 2 vendor list for version v${tcfPolicyVersion.vendorListVersion}.${tcfPolicyVersion.vendorListVersion} not found, started downloading." assert getLogsByText(logs, tcfError) @@ -393,18 +392,21 @@ class GdprAuctionSpec extends PrivacyBaseSpec { def secondStartTime = Instant.now() when: "PBS processes amp request" - privacyPbsService.sendAuctionRequest(bidRequest) + defaultPrivacyPbsService.sendAuctionRequest(bidRequest) then: "PBS shouldn't fetch vendor list" - assert !privacyPbsService.isFileExist(properVendorListPath) + assert !defaultPrivacyPbsService.isFileExist(properVendorListPath) and: "Logs should contain proper vendor list version" - def logsSecond = privacyPbsService.getLogsByTime(secondStartTime) + def logsSecond = defaultPrivacyPbsService.getLogsByTime(secondStartTime) assert getLogsByText(logsSecond, tcfError) and: "Reset vendor list response" vendorListResponse.reset() + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(GENERAL_PRIVACY_CONFIG) + where: tcfPolicyVersion << [TCF_POLICY_V2, TCF_POLICY_V4, TCF_POLICY_V5] } @@ -783,7 +785,10 @@ class GdprAuctionSpec extends PrivacyBaseSpec { } def "PBS auction should set 3 for tcfPolicyVersion when tcfPolicyVersion is #tcfPolicyVersion"() { - given: "Tcf consent setup" + given: "Prebid server with privacy settings" + def defaultPrivacyPbsService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG) + + and: "Tcf consent setup" def tcfConsent = new TcfConsent.Builder() .setPurposesLITransparency(BASIC_ADS) .setTcfPolicyVersion(tcfPolicyVersion.value) @@ -798,14 +803,17 @@ class GdprAuctionSpec extends PrivacyBaseSpec { vendorListResponse.setResponse(tcfPolicyVersion) when: "PBS processes auction request" - privacyPbsService.sendAuctionRequest(bidRequest) + defaultPrivacyPbsService.sendAuctionRequest(bidRequest) then: "Used vendor list have proper specification version of GVL" def properVendorListPath = VENDOR_LIST_PATH.replace("{VendorVersion}", tcfPolicyVersion.vendorListVersion.toString()) - PBSUtils.waitUntil { privacyPbsService.isFileExist(properVendorListPath) } - def vendorList = privacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) + PBSUtils.waitUntil { defaultPrivacyPbsService.isFileExist(properVendorListPath) } + def vendorList = defaultPrivacyPbsService.getValueFromContainer(properVendorListPath, VendorListConsent.class) assert vendorList.gvlSpecificationVersion == V3 + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(GENERAL_PRIVACY_CONFIG) + where: tcfPolicyVersion << [TCF_POLICY_V4, TCF_POLICY_V5] } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy index 602fbb87347..f684cb10313 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy @@ -1778,7 +1778,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS cookie sync should process rule when geo doesn't intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG + GEO_LOCATION + + def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.geo-info.[0].country": countyConfig, "geolocation.configurations.geo-info.[0].region" : regionConfig]) @@ -1830,7 +1830,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS setuid should process rule when geo doesn't intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG + GEO_LOCATION + + def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": countyConfig, "geolocation.configurations.[0].geo-info.region" : regionConfig]) @@ -1885,7 +1885,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS cookie sync should disallowed rule when device.geo intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG + GEO_LOCATION + + def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": countyConfig, "geolocation.configurations.[0].geo-info.region" : regionConfig]) @@ -1936,7 +1936,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS setuid should disallowed rule when device.geo intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG + GEO_LOCATION + + def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": countyConfig, "geolocation.configurations.[0].geo-info.region" : regionConfig]) @@ -1986,7 +1986,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS cookie sync should fetch geo once when gpp sync user and account require geo look up"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG + GEO_LOCATION + + def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": USA.ISOAlpha3, "geolocation.configurations.[0].geo-info.region" : ALABAMA.abbreviation]) diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy index 145a33336f9..d4cbf17e2dd 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy @@ -106,15 +106,14 @@ abstract class PrivacyBaseSpec extends BaseSpec { protected static final Integer MAX_INVALID_TCF_POLICY_VERSION = 63 protected static final Integer MIN_INVALID_TCF_POLICY_VERSION = 6 - @Shared - protected final PrebidServerService privacyPbsService = pbsServiceFactory.getService(GDPR_VENDOR_LIST_CONFIG + - GENERIC_CONFIG + GENERIC_VENDOR_CONFIG + RETRY_POLICY_EXPONENTIAL_CONFIG + GDPR_EEA_COUNTRY) + protected static final Map GENERAL_PRIVACY_CONFIG = + GENERIC_CONFIG + GDPR_VENDOR_LIST_CONFIG + GENERIC_VENDOR_CONFIG + RETRY_POLICY_EXPONENTIAL_CONFIG - protected static final Map PBS_CONFIG = OPENX_CONFIG + - GENERIC_CONFIG + GDPR_VENDOR_LIST_CONFIG + SETTING_CONFIG + GENERIC_VENDOR_CONFIG + @Shared + protected final PrebidServerService privacyPbsService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GDPR_EEA_COUNTRY) @Shared - protected final PrebidServerService activityPbsService = pbsServiceFactory.getService(PBS_CONFIG) + protected final PrebidServerService activityPbsService = pbsServiceFactory.getService(OPENX_CONFIG + SETTING_CONFIG + GENERAL_PRIVACY_CONFIG) def setupSpec() { vendorListResponse.setResponse() diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfFullTransmitEidsActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfFullTransmitEidsActivitiesSpec.groovy index 934aa69de33..d798bc4c478 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfFullTransmitEidsActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfFullTransmitEidsActivitiesSpec.groovy @@ -25,7 +25,7 @@ class TcfFullTransmitEidsActivitiesSpec extends PrivacyBaseSpec { private static PrebidServerService privacyPbsServiceWithMultipleGvl def setupSpec() { - privacyPbsContainerWithMultipleGvl = new PrebidServerContainer(PBS_CONFIG) + privacyPbsContainerWithMultipleGvl = new PrebidServerContainer(GENERAL_PRIVACY_CONFIG) def prepareEncodeResponseBodyWithPurposesOnly = getVendorListContent(true, false, false) def prepareEncodeResponseBodyWithLegIntPurposes = getVendorListContent(false, true, false) def prepareEncodeResponseBodyWithLegIntAndFlexiblePurposes = getVendorListContent(false, true, true)