Skip to content

Commit b1f47a7

Browse files
marki1anAnd1sSosulzhenko
authored
Test: Rule Engine (#4103)
Co-authored-by: Alex Maltsev <and1sscsgo@gmail.com> Co-authored-by: osulzhenko <osulzhenko@magnite.com>
1 parent cb7aeaf commit b1f47a7

46 files changed

Lines changed: 5537 additions & 65 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/test/groovy/org/prebid/server/functional/model/ModuleName.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ enum ModuleName {
88
PB_RESPONSE_CORRECTION ("pb-response-correction"),
99
ORTB2_BLOCKING("ortb2-blocking"),
1010
PB_REQUEST_CORRECTION('pb-request-correction'),
11+
PB_RULE_ENGINE('pb-rule-engine')
1112

1213
@JsonValue
1314
final String code

src/test/groovy/org/prebid/server/functional/model/config/ModuleHookImplementation.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ enum ModuleHookImplementation {
1111
ORTB2_BLOCKING_BIDDER_REQUEST("ortb2-blocking-bidder-request"),
1212
ORTB2_BLOCKING_RAW_BIDDER_RESPONSE("ortb2-blocking-raw-bidder-response"),
1313
PB_REQUEST_CORRECTION_PROCESSED_AUCTION_REQUEST("pb-request-correction-processed-auction-request"),
14+
PB_RULES_ENGINE_PROCESSED_AUCTION_REQUEST("pb-rule-engine-processed-auction-request")
1415

1516
@JsonValue
1617
final String code
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.prebid.server.functional.model.config
2+
3+
import java.time.ZonedDateTime
4+
5+
class PbRulesEngine {
6+
7+
Boolean enabled
8+
Boolean generateRulesFromBidderConfig
9+
ZonedDateTime timestamp
10+
List<RuleSet> ruleSets
11+
12+
static PbRulesEngine createRulesEngineWithRule(Boolean enabled = true) {
13+
new PbRulesEngine().tap {
14+
it.enabled = enabled
15+
it.generateRulesFromBidderConfig = false
16+
it.ruleSets = [RuleSet.createRuleSets()]
17+
}
18+
}
19+
}

src/test/groovy/org/prebid/server/functional/model/config/PbsModulesConfig.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ class PbsModulesConfig {
1313
Ortb2BlockingConfig ortb2Blocking
1414
PbResponseCorrection pbResponseCorrection
1515
PbRequestCorrectionConfig pbRequestCorrection
16+
PbRulesEngine pbRuleEngine
1617
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.prebid.server.functional.model.config
2+
3+
import com.fasterxml.jackson.annotation.JsonValue
4+
5+
enum ResultFunction {
6+
7+
INCLUDE_BIDDERS("includeBidders"),
8+
EXCLUDE_BIDDER("excludeBidders"),
9+
LOG_A_TAG("logAtag")
10+
11+
String value
12+
13+
ResultFunction(String value) {
14+
this.value = value
15+
}
16+
17+
@Override
18+
@JsonValue
19+
String toString() {
20+
return value
21+
}
22+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.prebid.server.functional.model.config
2+
3+
import org.prebid.server.functional.model.bidder.BidderName
4+
5+
class RuleEngineArguments {
6+
7+
List<BidderName> bidders
8+
Integer seatNonBid
9+
Boolean ifSyncedId
10+
String analyticsValue
11+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package org.prebid.server.functional.model.config
2+
3+
import com.fasterxml.jackson.annotation.JsonValue
4+
5+
enum RuleEngineFunction {
6+
7+
DEVICE_COUNTRY("deviceCountry", null),
8+
DEVICE_COUNTRY_IN("deviceCountryIn", "countries"),
9+
DATA_CENTER("dataCenter", null),
10+
DATA_CENTER_IN("dataCenterIn", "datacenters"),
11+
CHANNEL("channel", null),
12+
EID_AVAILABLE("eidAvailable", null),
13+
EID_IN("eidIn", "sources"),
14+
USER_FPD_AVAILABLE("userFpdAvailable", null),
15+
FPD_AVAILABLE("fpdAvailable", null),
16+
GPP_SID_AVAILABLE("gppSidAvailable", null),
17+
GPP_SID_IN("gppSidIn", "sids"),
18+
TCF_IN_SCOPE("tcfInScope", null),
19+
PERCENT("percent", "pct"),
20+
PREBID_KEY("prebidKey", "key"),
21+
DOMAIN("domain", null),
22+
DOMAIN_IN("domainIn", "domains"),
23+
BUNDLE("bundle", null),
24+
BUNDLE_IN("bundleIn", "bundles"),
25+
MEDIA_TYPE_IN("mediaTypeIn", "types"),
26+
AD_UNIT_CODE("adUnitCode", null),
27+
AD_UNIT_CODE_IN("adUnitCodeIn", "codes"),
28+
DEVICE_TYPE("deviceType", null),
29+
DEVICE_TYPE_IN("deviceTypeIn", "types")
30+
31+
private String value
32+
private String fieldName
33+
34+
RuleEngineFunction(String value, String fieldName) {
35+
this.value = value
36+
this.fieldName = fieldName
37+
}
38+
39+
@JsonValue
40+
@Override
41+
String toString() {
42+
return value
43+
}
44+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.prebid.server.functional.model.config
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty
4+
import org.prebid.server.functional.util.PBSUtils
5+
6+
class RuleEngineFunctionArgs {
7+
8+
List<Object> countries
9+
List<Object> datacenters
10+
List<Object> sources
11+
List<Object> sids
12+
@JsonProperty("pct")
13+
Object percent
14+
Object key
15+
List<Object> domains
16+
List<Object> bundles
17+
List<Object> codes
18+
List<Object> types
19+
String operator
20+
BigDecimal value
21+
Currency currency
22+
23+
static RuleEngineFunctionArgs getDefaultFunctionArgs() {
24+
new RuleEngineFunctionArgs().tap {
25+
countries = [PBSUtils.randomString]
26+
datacenters = [PBSUtils.randomString]
27+
sources = [PBSUtils.randomString]
28+
sids = [PBSUtils.randomNumber]
29+
percent = PBSUtils.getRandomNumber(1, 100)
30+
key = PBSUtils.randomString
31+
domains = [PBSUtils.randomString]
32+
bundles = [PBSUtils.randomString]
33+
codes = [PBSUtils.randomString]
34+
types = [PBSUtils.randomString]
35+
}
36+
}
37+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.prebid.server.functional.model.config
2+
3+
class RuleEngineModelDefault {
4+
5+
ResultFunction function
6+
RuleEngineModelDefaultArgs args
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.prebid.server.functional.model.config
2+
3+
class RuleEngineModelDefaultArgs {
4+
5+
String analyticsValue
6+
}

0 commit comments

Comments
 (0)