-
Notifications
You must be signed in to change notification settings - Fork 224
Tests: Add profiles #4056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests: Add profiles #4056
Changes from 7 commits
857f989
53f60b4
2f81d22
7955988
800b82a
8bc7146
752c62b
115ad69
525ec4c
72a77e0
d912dd2
7c29c75
a678bee
bc0545e
773a859
0504dcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package org.prebid.server.functional.model.config | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty | ||
| import com.fasterxml.jackson.databind.PropertyNamingStrategies | ||
| import com.fasterxml.jackson.databind.annotation.JsonNaming | ||
| import groovy.transform.ToString | ||
|
|
||
| @ToString(includeNames = true, ignoreNulls = true) | ||
| @JsonNaming(PropertyNamingStrategies.KebabCaseStrategy) | ||
| class AccountProfilesConfigs { | ||
|
|
||
| Integer limit | ||
| Boolean failOnUnknown | ||
|
|
||
| @JsonProperty("fail_on_unknown") | ||
| Boolean failOnUnknownSnakeCase | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package org.prebid.server.functional.model.db | ||
|
|
||
| import groovy.transform.ToString | ||
| import jakarta.persistence.Column | ||
| import jakarta.persistence.Convert | ||
| import jakarta.persistence.Entity | ||
| import jakarta.persistence.Id | ||
| import jakarta.persistence.Table | ||
| import org.prebid.server.functional.model.db.typeconverter.ImpConfigTypeConverter | ||
| import org.prebid.server.functional.model.db.typeconverter.ProfileMergePrecedenceConvert | ||
| import org.prebid.server.functional.model.db.typeconverter.ProfileTypeConvert | ||
| import org.prebid.server.functional.model.request.auction.Imp | ||
| import org.prebid.server.functional.model.request.profile.ImpProfile | ||
| import org.prebid.server.functional.model.request.profile.ProfileMergePrecedence | ||
| import org.prebid.server.functional.model.request.profile.ProfileType | ||
|
|
||
| @Entity | ||
| @Table(name = "profiles") | ||
| @ToString(includeNames = true) | ||
| class StoredProfileImp { | ||
|
|
||
| @Id | ||
| @Column(name = "profileId") | ||
| String profileName | ||
| @Column(name = "accountId") | ||
| String accountId | ||
| @Column(name = "mergePrecedence") | ||
| @Convert(converter = ProfileMergePrecedenceConvert) | ||
| ProfileMergePrecedence mergePrecedence | ||
| @Column(name = "type") | ||
| @Convert(converter = ProfileTypeConvert) | ||
| ProfileType type | ||
| @Column(name = "profile") | ||
| @Convert(converter = ImpConfigTypeConverter) | ||
| Imp impBody | ||
|
|
||
| static StoredProfileImp getProfile(ImpProfile profile) { | ||
| new StoredProfileImp().tap { | ||
| it.profileName = profile.id | ||
| it.accountId = profile.accountId | ||
| it.mergePrecedence = profile.mergePrecedence | ||
| it.type = profile.type | ||
| it.impBody = profile.body | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package org.prebid.server.functional.model.db | ||
|
|
||
| import groovy.transform.ToString | ||
| import jakarta.persistence.Column | ||
| import jakarta.persistence.Convert | ||
| import jakarta.persistence.Entity | ||
| import jakarta.persistence.Id | ||
| import jakarta.persistence.Table | ||
| import org.prebid.server.functional.model.db.typeconverter.ProfileMergePrecedenceConvert | ||
| import org.prebid.server.functional.model.db.typeconverter.ProfileTypeConvert | ||
| import org.prebid.server.functional.model.db.typeconverter.BidRequestConfigTypeConverter | ||
| import org.prebid.server.functional.model.request.auction.BidRequest | ||
| import org.prebid.server.functional.model.request.profile.ProfileMergePrecedence | ||
| import org.prebid.server.functional.model.request.profile.RequestProfile | ||
| import org.prebid.server.functional.model.request.profile.ProfileType | ||
|
|
||
| @Entity | ||
| @Table(name = "profiles") | ||
| @ToString(includeNames = true) | ||
| class StoredProfileRequest { | ||
|
|
||
| @Id | ||
| @Column(name = "profileId") | ||
| String profileName | ||
| @Column(name = "accountId") | ||
| String accountId | ||
| @Column(name = "mergePrecedence") | ||
| @Convert(converter = ProfileMergePrecedenceConvert) | ||
| ProfileMergePrecedence mergePrecedence | ||
| @Column(name = "type") | ||
| @Convert(converter = ProfileTypeConvert) | ||
| ProfileType type | ||
| @Column(name = "profile") | ||
| @Convert(converter = BidRequestConfigTypeConverter) | ||
| BidRequest requestBody | ||
|
|
||
| static StoredProfileRequest getProfile(RequestProfile profile) { | ||
| new StoredProfileRequest().tap { | ||
| it.profileName = profile.id | ||
| it.accountId = profile.accountId | ||
| it.mergePrecedence = profile.mergePrecedence | ||
| it.type = profile.type | ||
| it.requestBody = profile.body | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package org.prebid.server.functional.model.db.typeconverter | ||
|
|
||
| import jakarta.persistence.AttributeConverter | ||
| import org.prebid.server.functional.model.request.profile.ProfileMergePrecedence | ||
| import org.prebid.server.functional.util.ObjectMapperWrapper | ||
|
|
||
| class ProfileMergePrecedenceConvert implements AttributeConverter<ProfileMergePrecedence, String>, ObjectMapperWrapper { | ||
|
|
||
| @Override | ||
| String convertToDatabaseColumn(ProfileMergePrecedence profileMergePrecedence) { | ||
| profileMergePrecedence?.value | ||
| } | ||
|
|
||
| @Override | ||
| ProfileMergePrecedence convertToEntityAttribute(String value) { | ||
| value ? ProfileMergePrecedence.forValue(value) : null | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package org.prebid.server.functional.model.db.typeconverter | ||
|
|
||
| import jakarta.persistence.AttributeConverter | ||
| import org.prebid.server.functional.model.request.profile.ProfileType | ||
| import org.prebid.server.functional.util.ObjectMapperWrapper | ||
|
|
||
| class ProfileTypeConvert implements AttributeConverter<ProfileType, String>, ObjectMapperWrapper { | ||
|
||
|
|
||
| @Override | ||
| String convertToDatabaseColumn(ProfileType profileMergePrecedence) { | ||
| profileMergePrecedence?.value | ||
| } | ||
|
|
||
| @Override | ||
| ProfileType convertToEntityAttribute(String value) { | ||
| value ? ProfileType.forValue(value) : null | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package org.prebid.server.functional.model.filesystem | ||
|
|
||
| import com.fasterxml.jackson.databind.PropertyNamingStrategies | ||
| import com.fasterxml.jackson.databind.annotation.JsonNaming | ||
| import groovy.transform.ToString | ||
| import org.prebid.server.functional.model.config.AccountConfig | ||
|
|
||
| @ToString(includeNames = true, ignoreNulls = true) | ||
| @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy) | ||
|
||
| class FileSystemAccountsConfig { | ||
|
|
||
| List<AccountConfig> accounts | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package org.prebid.server.functional.model.filesystem | ||
|
|
||
| import com.fasterxml.jackson.databind.PropertyNamingStrategies | ||
| import com.fasterxml.jackson.databind.annotation.JsonNaming | ||
| import groovy.transform.ToString | ||
| import org.prebid.server.functional.model.AccountStatus | ||
| import org.prebid.server.functional.model.config.AccountConfig | ||
|
|
||
|
|
||
| import java.sql.Timestamp | ||
|
|
||
|
|
||
| @ToString(includeNames = true, ignoreNulls = true) | ||
| @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy) | ||
| class FilesystemAccount { | ||
|
||
|
|
||
| Integer id | ||
| String priceGranularity | ||
| Integer bannerCacheTtl | ||
| Integer videoCacheTtl | ||
| Boolean eventsEnabled | ||
| String tcfConfig | ||
| Integer truncateTargetAttr | ||
| String defaultIntegration | ||
| String analyticsConfig | ||
| String bidValidations | ||
| AccountStatus status | ||
| AccountConfig config | ||
| Integer updatedBy | ||
| String updatedByUser | ||
| Timestamp updated | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,8 @@ class ImpExtPrebid { | |
| Map<BidderName, Imp> imp | ||
| String adUnitCode | ||
| PrebidOptions options | ||
|
|
||
| @JsonProperty("profiles") | ||
| List<String> profilesNames | ||
|
||
|
|
||
| static ImpExtPrebid getDefaultImpExtPrebid() { | ||
| new ImpExtPrebid().tap { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,8 @@ class Prebid { | |
| PaaFormat paaFormat | ||
| @JsonProperty("alternatebiddercodes") | ||
| AlternateBidderCodes alternateBidderCodes | ||
| @JsonProperty("profiles") | ||
| List<String> profilesNames | ||
|
||
|
|
||
| static class Channel { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package org.prebid.server.functional.model.request.profile | ||
|
|
||
| import groovy.transform.ToString | ||
| import org.prebid.server.functional.model.request.auction.Imp | ||
| import org.prebid.server.functional.util.PBSUtils | ||
|
|
||
| import static ProfileMergePrecedence.PROFILE | ||
|
|
||
| @ToString(includeNames = true, ignoreNulls = true) | ||
| class ImpProfile extends Profile<Imp> { | ||
|
|
||
| static getProfile(String accountId, | ||
|
||
| Imp imp = Imp.defaultImpression, | ||
| String name = PBSUtils.randomString, | ||
| ProfileMergePrecedence mergePrecedence = PROFILE) { | ||
|
|
||
| new ImpProfile(accountId: accountId, | ||
| id: name, | ||
| type: ProfileType.IMP, | ||
| mergePrecedence: mergePrecedence, | ||
| body: imp) | ||
| } | ||
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you don't need the
ObjectMapperWrapperdependency here