-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mhupalo
committed
Nov 16, 2021
1 parent
6bda093
commit cdc197d
Showing
65 changed files
with
1,486 additions
and
22 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/test/groovy/org/prebid/server/functional/model/deals/alert/Action.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.prebid.server.functional.model.deals.alert | ||
|
||
enum Action { | ||
|
||
RAISE | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/groovy/org/prebid/server/functional/model/deals/alert/AlertEvent.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.prebid.server.functional.model.deals.alert | ||
|
||
import com.fasterxml.jackson.databind.PropertyNamingStrategies | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming | ||
import groovy.transform.ToString | ||
|
||
import java.time.ZonedDateTime | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy) | ||
class AlertEvent { | ||
|
||
String id | ||
Action action | ||
AlertPriority priority | ||
ZonedDateTime updatedAt | ||
String name | ||
String details | ||
AlertSource source | ||
} |
6 changes: 6 additions & 0 deletions
6
src/test/groovy/org/prebid/server/functional/model/deals/alert/AlertPriority.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.prebid.server.functional.model.deals.alert | ||
|
||
enum AlertPriority { | ||
|
||
HIGH, MEDIUM, LOW | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/groovy/org/prebid/server/functional/model/deals/alert/AlertSource.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.prebid.server.functional.model.deals.alert | ||
|
||
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 AlertSource { | ||
|
||
String env | ||
String dataCenter | ||
String region | ||
String system | ||
String subSystem | ||
String hostId | ||
} |
37 changes: 37 additions & 0 deletions
37
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/DeliverySchedule.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat | ||
import groovy.transform.ToString | ||
import org.prebid.server.functional.util.PBSUtils | ||
|
||
import java.time.ZoneId | ||
import java.time.ZonedDateTime | ||
|
||
import static java.time.ZoneOffset.UTC | ||
import static org.prebid.server.functional.model.deals.lineitem.LineItem.TIME_PATTERN | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
class DeliverySchedule { | ||
|
||
String planId | ||
|
||
@JsonFormat(pattern = TIME_PATTERN) | ||
ZonedDateTime startTimeStamp | ||
|
||
@JsonFormat(pattern = TIME_PATTERN) | ||
ZonedDateTime endTimeStamp | ||
|
||
@JsonFormat(pattern = TIME_PATTERN) | ||
ZonedDateTime updatedTimeStamp | ||
|
||
Set<Token> tokens | ||
|
||
static getDefaultDeliverySchedule() { | ||
new DeliverySchedule(planId: PBSUtils.randomString, | ||
startTimeStamp: ZonedDateTime.now(ZoneId.from(UTC)), | ||
endTimeStamp: ZonedDateTime.now(ZoneId.from(UTC)).plusDays(1), | ||
updatedTimeStamp: ZonedDateTime.now(ZoneId.from(UTC)), | ||
tokens: [Token.defaultToken] | ||
) | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/FrequencyCap.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import groovy.transform.ToString | ||
import org.prebid.server.functional.util.PBSUtils | ||
|
||
import static PeriodType.DAY | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
class FrequencyCap { | ||
|
||
String fcapId | ||
Integer count | ||
Integer periods | ||
String periodType | ||
|
||
static getDefaultFrequencyCap() { | ||
new FrequencyCap(count: 1, | ||
fcapId: PBSUtils.randomString, | ||
periods: 1, | ||
periodType: DAY | ||
) | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/LineItem.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat | ||
import groovy.transform.ToString | ||
import org.prebid.server.functional.model.deals.lineitem.targeting.Targeting | ||
import org.prebid.server.functional.util.PBSUtils | ||
|
||
import java.time.ZoneId | ||
import java.time.ZonedDateTime | ||
|
||
import static Status.ACTIVE | ||
import static java.time.ZoneOffset.UTC | ||
import static org.prebid.server.functional.model.bidder.BidderName.GENERIC | ||
import static org.prebid.server.functional.model.deals.lineitem.RelativePriority.VERY_HIGH | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
class LineItem { | ||
|
||
public static final String TIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'" | ||
|
||
String lineItemId | ||
|
||
String extLineItemId | ||
|
||
String dealId | ||
|
||
List<LineItemSize> sizes | ||
|
||
String accountId | ||
|
||
String source | ||
|
||
Price price | ||
|
||
RelativePriority relativePriority | ||
|
||
@JsonFormat(pattern = TIME_PATTERN) | ||
ZonedDateTime startTimeStamp | ||
|
||
@JsonFormat(pattern = TIME_PATTERN) | ||
ZonedDateTime endTimeStamp | ||
|
||
@JsonFormat(pattern = TIME_PATTERN) | ||
ZonedDateTime updatedTimeStamp | ||
|
||
Status status | ||
|
||
List<FrequencyCap> frequencyCaps | ||
|
||
List<DeliverySchedule> deliverySchedules | ||
|
||
Targeting targeting | ||
|
||
static LineItem getDefaultLineItem(String accountId) { | ||
int plannerAdapterLineItemId = PBSUtils.randomNumber | ||
String plannerAdapterName = PBSUtils.randomString | ||
new LineItem(lineItemId: "${plannerAdapterName}-$plannerAdapterLineItemId", | ||
extLineItemId: plannerAdapterLineItemId, | ||
dealId: PBSUtils.randomString, | ||
sizes: [LineItemSize.defaultLineItemSize], | ||
accountId: accountId, | ||
source: GENERIC.name().toLowerCase(), | ||
price: Price.defaultPrice, | ||
relativePriority: VERY_HIGH, | ||
startTimeStamp: ZonedDateTime.now(ZoneId.from(UTC)), | ||
endTimeStamp: ZonedDateTime.now(ZoneId.from(UTC)).plusMonths(1), | ||
updatedTimeStamp: ZonedDateTime.now(ZoneId.from(UTC)), | ||
status: ACTIVE, | ||
frequencyCaps: [], | ||
deliverySchedules: [DeliverySchedule.defaultDeliverySchedule], | ||
targeting: Targeting.defaultTargeting | ||
) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/LineItemSize.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude | ||
import groovy.transform.ToString | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.ALWAYS | ||
|
||
@ToString(includeNames = true) | ||
@JsonInclude(content = ALWAYS) | ||
class LineItemSize { | ||
|
||
Integer w | ||
Integer h | ||
|
||
static getDefaultLineItemSize() { | ||
new LineItemSize(w: 300, | ||
h: 250 | ||
) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/MediaType.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue | ||
|
||
enum MediaType { | ||
|
||
BANNER("banner") | ||
|
||
@JsonValue | ||
final String value | ||
|
||
private MediaType(String value) { | ||
this.value = value | ||
} | ||
|
||
@Override | ||
String toString() { | ||
value | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/PeriodType.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue | ||
|
||
enum PeriodType { | ||
|
||
HOUR("hour"), | ||
DAY("day"), | ||
WEEK("week"), | ||
MONTH("month"), | ||
CAMPAIGN("campaign") | ||
|
||
@JsonValue | ||
final String value | ||
|
||
private PeriodType(String value) { | ||
this.value = value | ||
} | ||
|
||
@Override | ||
String toString() { | ||
value | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/Price.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import groovy.transform.ToString | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
class Price { | ||
|
||
BigDecimal cpm | ||
String currency | ||
|
||
static getDefaultPrice() { | ||
new Price(cpm: 0.01, | ||
currency: "USD" | ||
) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/RelativePriority.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue | ||
|
||
enum RelativePriority { | ||
|
||
VERY_HIGH(1), | ||
HIGH(2), | ||
MEDIUM(3), | ||
LOW(4), | ||
VERY_LOW(5) | ||
|
||
@JsonValue | ||
final Integer value | ||
|
||
private RelativePriority(Integer value) { | ||
this.value = value | ||
} | ||
|
||
@Override | ||
String toString() { | ||
value | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/Status.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue | ||
|
||
enum Status { | ||
|
||
ACTIVE("active"), | ||
DELETED("deleted"), | ||
PAUSED("paused") | ||
|
||
@JsonValue | ||
final String value | ||
|
||
private Status(String value) { | ||
this.value = value | ||
} | ||
|
||
@Override | ||
String toString() { | ||
value | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/groovy/org/prebid/server/functional/model/deals/lineitem/Token.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.prebid.server.functional.model.deals.lineitem | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import groovy.transform.ToString | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
class Token { | ||
|
||
@JsonProperty("class") | ||
Integer priorityClass | ||
|
||
Integer total | ||
|
||
static getDefaultToken() { | ||
new Token(priorityClass: 1, | ||
total: 1000 | ||
) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...groovy/org/prebid/server/functional/model/deals/lineitem/targeting/BooleanOperator.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.prebid.server.functional.model.deals.lineitem.targeting | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue | ||
|
||
enum BooleanOperator { | ||
|
||
AND('$and'), | ||
OR('$or'), | ||
NOT('$not'), | ||
|
||
INVALID('$invalid'), | ||
UPPERCASE_AND('$AND') | ||
|
||
@JsonValue | ||
final String value | ||
|
||
private BooleanOperator(String value) { | ||
this.value = value | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...roovy/org/prebid/server/functional/model/deals/lineitem/targeting/MatchingFunction.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.prebid.server.functional.model.deals.lineitem.targeting | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue | ||
|
||
enum MatchingFunction { | ||
|
||
MATCHES('$matches'), | ||
IN('$in'), | ||
INTERSECTS('$intersects'), | ||
WITHIN('$within') | ||
|
||
@JsonValue | ||
final String value | ||
|
||
private MatchingFunction(String value) { | ||
this.value = value | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...y/org/prebid/server/functional/model/deals/lineitem/targeting/MatchingFunctionNode.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.prebid.server.functional.model.deals.lineitem.targeting | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue | ||
import groovy.transform.PackageScope | ||
|
||
@PackageScope | ||
class MatchingFunctionNode { | ||
|
||
Map<MatchingFunction, List<?>> matchingFunctionMultipleValuesNode | ||
|
||
Map<MatchingFunction, ?> matchingFunctionSingleValueNode | ||
|
||
@JsonValue | ||
def getMatchingFunctionNode() { | ||
matchingFunctionMultipleValuesNode ?: matchingFunctionSingleValueNode | ||
} | ||
} |
Oops, something went wrong.