Skip to content

Commit

Permalink
Merge branch 'master' into preciso_bdr_initial
Browse files Browse the repository at this point in the history
  • Loading branch information
PrecisoSRL authored Aug 1, 2023
2 parents 2477a7f + a53dcba commit ca7cf32
Show file tree
Hide file tree
Showing 382 changed files with 12,047 additions and 4,266 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ target/
.DS_Store

.allure/
src/main/proto/
3 changes: 3 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<module name="ConstantName">
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|(.*?)[l,L]ogger)$"/>
</module>
<module name="FinalLocalVariable">
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
Expand Down
2 changes: 1 addition & 1 deletion docs/application-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ There are two ways to configure application settings: database and file. This do
- `analytics.modules.<module-name>.*` - space for `module-name` analytics module specific configuration, may be of any shape
- `cookie-sync.default-timeout-ms` - overrides host level config
- `cookie-sync.default-limit` - if the "limit" isn't specified in the `/cookie_sync` request, this is what to use
- `cookie-sync.pri` - a comma-separated list of prioritized cookie families
- `cookie-sync.pri` - a list of prioritized bidder codes
- `cookie-sync.max-limit` - if the "limit" is specified in the `/cookie_sync` request, it can't be greater than this
value
- `cookie-sync.coop-sync.default` - if the "coopSync" value isn't specified in the `/cookie_sync` request, use this
Expand Down
16 changes: 16 additions & 0 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,19 @@ mvn clean package
```bash
mvn clean package --file extra/pom.xml
```

## Common problems
For IntelliJ IDEA users, if IDEA can't resolve proto classes:
First of all, you need to compile these files. They are compiled from .proto files located in src.main.proto. This can be done by running the mvn protobuf:compile command in your terminal or by clicking in IntelliJ IDEA:
Maven > prebid-server > Plugins > protobuf > protobuf:compile.

This step is also performed during the compile (and test-compile for tests) phase of Maven if you build the app using Maven directly.

After that, you can build and run the application via IntelliJ IDEA. However, IntelliJ IDEA will not recognize these files with its default settings yet, and it will still report an error even though the application can be compiled. This is because intellisense does not introspect large files by default, and the compiled classes from proto files are much larger than the default classes.

Here is how to resolve this:
In IntelliJ IDEA, click `Help > Edit custom properties...` and add modify any of these properties(in kilobytes):
`idea.max.content.load.filesize=your-value-here`(for example, `idea.max.content.load.filesize=200000`) - increases max file size that IDEA is able to open
`idea.max.intellisense.filesize=your-value-here`(for example, `idea.max.intellisense.filesize=200000`) - increases max file size for coding assistance and design-time code inspection.

You can find more information about these properties here: https://www.jetbrains.com/help/objc/configuring-file-size-limit.html
29 changes: 29 additions & 0 deletions docs/developers/unit-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Unit tests

## Run unit tests

### Run all tests

```
mvn test
```

### Run a single test file

```
mvn test -Dtest=GenericBidderTest
```

### Run a single unit test

```
mvn test -Dtest=GenericBidderTest#makeHttpRequestsShouldCreateExpectedUrl
```

### Run a unit test and skip checkstyle

Can be useful for printf-debugging because Checkstyle will fail on `System.out.println`

```
mvn test -Dtest=GenericBidderTest#makeHttpRequestsShouldCreateExpectedUrl -Dcheckstyle.skip
```
6 changes: 3 additions & 3 deletions extra/bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.121.0-SNAPSHOT</version>
<version>1.126.0-SNAPSHOT</version>
<relativePath>../../extra/pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -74,12 +74,12 @@
<dependency>
<groupId>org.prebid</groupId>
<artifactId>prebid-server</artifactId>
<version>1.121.0-SNAPSHOT</version>
<version>1.126.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>ortb2-blocking</artifactId>
<version>1.121.0-SNAPSHOT</version>
<version>1.126.0-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion extra/modules/ortb2-blocking/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>1.121.0-SNAPSHOT</version>
<version>1.126.0-SNAPSHOT</version>
</parent>

<artifactId>ortb2-blocking</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions extra/modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.121.0-SNAPSHOT</version>
<version>1.126.0-SNAPSHOT</version>
<relativePath>../../extra/pom.xml</relativePath>
</parent>

Expand All @@ -27,7 +27,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>

<prebid-server.version>1.121.0-SNAPSHOT</prebid-server.version>
<prebid-server.version>1.126.0-SNAPSHOT</prebid-server.version>

<lombok.version>1.18.22</lombok.version>

Expand Down
2 changes: 1 addition & 1 deletion extra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.121.0-SNAPSHOT</version>
<version>1.126.0-SNAPSHOT</version>
<packaging>pom</packaging>

<scm>
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.121.0-SNAPSHOT</version>
<version>1.126.0-SNAPSHOT</version>
<relativePath>extra/pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -66,9 +66,9 @@
<assertj.version>3.24.2</assertj.version>
<wiremock.version>2.35.0</wiremock.version>
<awaitility.version>4.2.0</awaitility.version>
<jetty.version>9.4.48.v20220622</jetty.version>
<jetty.version>9.4.51.v20230217</jetty.version>
<restassured.version>4.4.0</restassured.version>
<h2.version>2.1.214</h2.version>
<h2.version>2.2.220</h2.version>
<spock.version>2.4-M1-groovy-3.0</spock.version>
<groovy.version>3.0.14</groovy.version>
<testcontainers.version>1.17.4</testcontainers.version>
Expand Down
2 changes: 2 additions & 0 deletions sample/prebid-config-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ gdpr:
vendorlist:
v2:
cache-dir: /var/tmp/vendor2
v3:
cache-dir: /var/tmp/vendor3
admin-endpoints:
logging-changelevel:
enabled: true
Expand Down
2 changes: 2 additions & 0 deletions sample/prebid-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ gdpr:
vendorlist:
v2:
cache-dir: /var/tmp/vendor2
v3:
cache-dir: /var/tmp/vendor3
admin-endpoints:
logging-changelevel:
enabled: true
Expand Down
2 changes: 2 additions & 0 deletions src/main/docker/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ gdpr:
vendorlist:
v2:
cache-dir: /app/prebid-server/data/vendorlist-v2
v3:
cache-dir: /app/prebid-server/data/vendorlist-v3
6 changes: 6 additions & 0 deletions src/main/java/com/iab/openrtb/request/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public class App {
*/
List<String> kwarray;

/**
* A domain to be used for inventory authorization in the case of inventory
* sharing arrangements between an app owner and content owner.
*/
String inventorypartnerdomain;

/**
* Placeholder for exchange-specific extensions to OpenRTB.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/iab/openrtb/request/BidRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public class BidRequest {
*/
App app;

/**
* This object should be included if the ad supported content is a Digital Out-Of-Home screen.
* A bid request with a DOOH object must not contain a site or app object.
*/
Dooh dooh;

/**
* Details via a {@link Device} object (Section 3.2.18) about the user’s device
* to which the impression will be delivered.
Expand Down
63 changes: 63 additions & 0 deletions src/main/java/com/iab/openrtb/request/Dooh.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.iab.openrtb.request;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.Builder;
import lombok.Value;

import java.util.List;

/**
* This object should be included if the ad supported content is a Digital Out-Of-Home screen.
* A bid request with a DOOH object must not contain a site or app object.
* At a minimum, it is useful to provide id and/or venuetypeid, but this is not strictly required.
*/
@Value
@Builder
public class Dooh {

/**
* Exchange provided id for a placement or logical grouping of placements.
*/
String id;

/**
* Name of the dooh placement.
*/
String name;

/**
* The type of out-of-home venue. The taxonomy to be used is defined by the venuetax field.
* If no venuetax field is supplied, The OpenOOH Venue Taxonomy is assumed.
*/
List<String> venuetype;

/**
* The venue taxonomy in use.
*/
Integer venuetypetax;

/**
* Details about the publisher of the placement.
*/
Publisher publisher;

/**
* Domain of the inventory owner (e.g., “mysite.foo.com”)
*/
String domain;

/**
* Comma separated list of keywords about the DOOH placement.
*/
String keywords;

/**
* Details about the Content within the DOOH placement.
*/
Content content;

/**
* Placeholder for exchange-specific extensions to OpenRTB.
*/
JsonNode ext;
}
6 changes: 6 additions & 0 deletions src/main/java/com/iab/openrtb/request/Site.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ public class Site {
*/
List<String> kwarray;

/**
* A domain to be used for inventory authorization in the case of inventory sharing
* arrangements between a site owner and content owner.
*/
String inventorypartnerdomain;

/**
* Placeholder for exchange-specific extensions to OpenRTB.
*/
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/org/prebid/server/activity/ActivityPayload.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.prebid.server.activity;
package org.prebid.server.activity.infrastructure;

import lombok.Value;

@Value(staticConstructor = "of")
public class ActivityContextResult {
public class ActivityCallResult {

boolean isAllowed;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.prebid.server.activity;
package org.prebid.server.activity.infrastructure;

import org.prebid.server.activity.rule.Rule;
import org.prebid.server.activity.infrastructure.payload.ActivityCallPayload;
import org.prebid.server.activity.infrastructure.rule.Rule;

import java.util.List;
import java.util.Objects;
Expand All @@ -20,19 +21,19 @@ public static ActivityConfiguration of(boolean allowByDefault, List<Rule> rules)
return new ActivityConfiguration(allowByDefault, rules);
}

public ActivityContextResult isAllowed(ActivityPayload activityPayload) {
public ActivityCallResult isAllowed(ActivityCallPayload activityCallPayload) {
int processedRulesCount = 0;
Rule matchedRule = null;

for (Rule rule : rules) {
processedRulesCount++;
if (rule.matches(activityPayload)) {
if (rule.matches(activityCallPayload)) {
matchedRule = rule;
break;
}
}

return ActivityContextResult.of(
return ActivityCallResult.of(
Optional.ofNullable(matchedRule)
.map(Rule::allowed)
.orElse(allowByDefault),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

package org.prebid.server.activity;
package org.prebid.server.activity.infrastructure;

import org.prebid.server.activity.Activity;
import org.prebid.server.activity.ComponentType;
import org.prebid.server.activity.infrastructure.payload.ActivityCallPayload;
import org.prebid.server.metric.Metrics;
import org.prebid.server.proto.openrtb.ext.request.TraceLevel;

Expand Down Expand Up @@ -35,16 +38,13 @@ private static void validate(Map<Activity, ActivityConfiguration> activitiesConf
}
}

public boolean isAllowed(Activity activity, ComponentType componentType, String componentName) {
final ActivityPayload activityPayload = ActivityPayload.of(componentType, componentName);
final ActivityContextResult result = activitiesConfigurations.get(activity).isAllowed(activityPayload);

updateMetrics(activity, activityPayload, result);

public boolean isAllowed(Activity activity, ActivityCallPayload activityCallPayload) {
final ActivityCallResult result = activitiesConfigurations.get(activity).isAllowed(activityCallPayload);
updateMetrics(activity, activityCallPayload, result);
return result.isAllowed();
}

private void updateMetrics(Activity activity, ActivityPayload activityPayload, ActivityContextResult result) {
private void updateMetrics(Activity activity, ActivityCallPayload activityCallPayload, ActivityCallResult result) {
final int processedRulesCount = result.getProcessedRulesCount();
if (processedRulesCount > 0) {
metrics.updateRequestsActivityProcessedRulesCount(processedRulesCount);
Expand All @@ -58,8 +58,8 @@ private void updateMetrics(Activity activity, ActivityPayload activityPayload, A
if (traceLevel == TraceLevel.verbose) {
metrics.updateAccountActivityDisallowedCount(accountId, activity);
}
if (activityPayload.getComponentType() == ComponentType.BIDDER) {
metrics.updateAdapterActivityDisallowedCount(activityPayload.getComponentName(), activity);
if (activityCallPayload.componentType() == ComponentType.BIDDER) {
metrics.updateAdapterActivityDisallowedCount(activityCallPayload.componentName(), activity);
}
}
}
Expand Down
Loading

0 comments on commit ca7cf32

Please sign in to comment.