Skip to content

Commit

Permalink
Rename integration to channel in account config tests (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtuchkova authored Feb 21, 2022
1 parent 2175275 commit 3a0c16d
Show file tree
Hide file tree
Showing 19 changed files with 657 additions and 218 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.prebid.server.functional.model.config
package org.prebid.server.functional.model

import com.fasterxml.jackson.annotation.JsonValue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package org.prebid.server.functional.model.config
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.ChannelType

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy)
class AccountCcpaConfig {

Boolean enabled
Map<ChannelType, Boolean> enabledForRequestType
Map<ChannelType, Boolean> channelEnabled
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package org.prebid.server.functional.model.config
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.ChannelType

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy)
class AccountGdprConfig {

Boolean enabled
Map<ChannelType, Boolean> enabledForRequestType
Map<ChannelType, Boolean> channelEnabled
Map<Purpose, PurposeConfig> purposes
Map<SpecialFeature, SpecialFeatureConfig> specialFeatures
PurposeOneTreatmentInterpretation purposeOneTreatmentInterpretation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class AmpRequest {
Integer account
String gdprConsent
String consentString
String targeting
ConsentType consentType
Boolean gdprApplies
String addtlConsent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class App {
AppExt ext

static App getDefaultApp() {
new App(id: PBSUtils.randomString)
new App().tap {
id = PBSUtils.randomString
publisher = Publisher.defaultPublisher
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString

import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP
import static org.prebid.server.functional.model.request.auction.DistributionChannel.SITE

@EqualsAndHashCode
@ToString(includeNames = true, ignoreNulls = true)
class BidRequest {
Expand All @@ -29,14 +32,19 @@ class BidRequest {
Regs regs
BidRequestExt ext

static BidRequest getDefaultBidRequest() {
static BidRequest getDefaultBidRequest(DistributionChannel channel = SITE) {
new BidRequest().tap {
it.addImp(Imp.defaultImpression)
regs = Regs.defaultRegs
id = UUID.randomUUID()
tmax = 2500
site = Site.defaultSite
ext = new BidRequestExt(prebid: new Prebid(debug: 1))
if (channel == SITE) {
site = Site.defaultSite
}
if (channel == APP) {
app = App.defaultApp
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.prebid.server.functional.model.request.auction

import groovy.transform.ToString
import org.prebid.server.functional.model.ChannelType

@ToString(includeNames = true, ignoreNulls = true)
class Channel {

String name
ChannelType name
String version
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonValue

enum DistributionChannel {

SITE, APP

@JsonValue
String getValue() {
name().toLowerCase()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.prebid.server.functional.util.privacy.ConsentString
@ToString(includeNames = true, ignoreNulls = true)
class UserExt {

ConsentString consent
String consent
List<String> fcapids
UserTime time
UserExtData data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class PbsServiceFactory {
}

PrebidServerService getService(Map<String, String> config) {
if (containers.size() >= MAX_CONTAINERS_COUNT) {
def container = containers.find { !it.key.isEmpty() }
remove([(container.key): container.value])
}
if (containers.containsKey(config)) {
return new PrebidServerService(getContainer(config), mapper)
return new PrebidServerService(containers.get(config), mapper)
} else {
if (containers.size() >= MAX_CONTAINERS_COUNT) {
def container = containers.find { !it.key.isEmpty() }
remove([(container.key): container.value])
}
def pbsContainer = new PrebidServerContainer(config)
pbsContainer.start()
containers.put(config, pbsContainer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ LIMIT 1

void withBidder(String host) {
withConfig(["adapters.generic.enabled" : "true",
"adapters.generic.endpoint" : "$host/auction".toString(),
"adapters.generic.usersync.url" : "$host/generic-usersync".toString(),
"adapters.generic.endpoint" : "$host/auction" as String,
"adapters.generic.usersync.url" : "$host/generic-usersync" as String,
"adapters.generic.usersync.type": "redirect"
])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ class TargetingSpec extends BasePgSpec {
}

APP_BUNDLE | BidRequest.defaultBidRequest.tap {
app = App.defaultApp.tap { bundle = stringTargetingValue }
app = new App(id: PBSUtils.randomString,
bundle: stringTargetingValue)
}

UFPD_LANGUAGE | BidRequest.defaultBidRequest.tap {
Expand Down Expand Up @@ -320,7 +321,7 @@ class TargetingSpec extends BasePgSpec {
}
},
BidRequest.defaultBidRequest.tap {
app = App.defaultApp.tap {
app = new App(id: PBSUtils.randomString).tap {
ext = new AppExt(data: new AppExtData(language: stringTargetingValue))
}
}
Expand Down
Loading

0 comments on commit 3a0c16d

Please sign in to comment.