Skip to content

Commit

Permalink
Moved the After optout tests
Browse files Browse the repository at this point in the history
They now wait for optout to happen. Times out in 5 min
  • Loading branch information
thomasm-ttd committed Mar 11, 2024
1 parent 0dccd40 commit a7600a0
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 126 deletions.
50 changes: 30 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<uid2-shared.version>7.3.0-0c9c5b24fe</uid2-shared.version>
<uid2-shared.version>7.4.7-1876cb3a4a</uid2-shared.version>
</properties>
<packaging>jar</packaging>

Expand All @@ -38,52 +38,62 @@
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.uid2</groupId>
<artifactId>uid2-shared</artifactId>
<version>${uid2-shared.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.uid2</groupId>
<artifactId>uid2-client</artifactId>
<version>4.3.2-479d2cb58f</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
<version>3.25.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<version>1.9.2</version>
<version>1.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
<version>4.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.uid2</groupId>
<artifactId>uid2-client</artifactId>
<version>4.3.0-3f9bbbefc8</version>
</dependency>
</dependencies>

<build>
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/app/component/Operator.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ public JsonNode v0TokenRefresh(String token) throws Exception {
return Mapper.OBJECT_MAPPER.readTree(response);
}

public JsonNode v0CheckedTokenRefresh(String token) {
try {
return v0TokenRefresh(token);
} catch (Exception e) {
return Mapper.OBJECT_MAPPER.createObjectNode();
}
}

public JsonNode v0TokenValidate(String type, String identity, String advertisingToken) throws Exception {
String response = HttpClient.get(getBaseUrl() + "/token/validate?" + type + "=" + URLEncoder.encode(identity, StandardCharsets.UTF_8) + "&token=" + URLEncoder.encode(advertisingToken, StandardCharsets.UTF_8), CLIENT_API_KEY);
return Mapper.OBJECT_MAPPER.readTree(response);
Expand Down Expand Up @@ -163,6 +171,14 @@ public JsonNode v1TokenRefresh(String token) throws Exception {
return Mapper.OBJECT_MAPPER.readTree(response);
}

public JsonNode v1CheckedTokenRefresh(String token) {
try {
return v1TokenRefresh(token);
} catch (Exception e) {
return Mapper.OBJECT_MAPPER.createObjectNode();
}
}

public JsonNode v1TokenValidate(String type, String identity, String advertisingToken) throws Exception {
String response = HttpClient.get(getBaseUrl() + "/v1/token/validate?" + type + "=" + URLEncoder.encode(identity, StandardCharsets.UTF_8) + "&token=" + URLEncoder.encode(advertisingToken, StandardCharsets.UTF_8), CLIENT_API_KEY);
return Mapper.OBJECT_MAPPER.readTree(response);
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/app/component/Optout.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import app.common.Mapper;
import com.fasterxml.jackson.databind.JsonNode;

public class Optout extends App {
public class OptOut extends App {
private static final String CORE_API_TOKEN = EnvUtil.getEnv("UID2_E2E_OPTOUT_TO_CALL_CORE_API_TOKEN");
public Optout(String host, Integer port, String name) {
public OptOut(String host, Integer port, String name) {
super(host, port, name);
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/suite/E2ELocalFullTestSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import suite.core.CoreRefreshTest;
import suite.core.CoreTest;
import suite.operator.*;
import suite.optout.BeforeOptoutTest;
import suite.optout.OptOutTest;
import suite.validator.V0ApiValidatorTest;
import suite.validator.V2ApiValidatorTest;

Expand All @@ -19,7 +19,7 @@
V1ApiOperatorTest.class,
V2ApiOperatorTest.class,
V2ApiOperatorPublicOnlyTest.class,
BeforeOptoutTest.class,
OptOutTest.class,
V0ApiValidatorTest.class,
V1ApiOperatorTest.class,
V2ApiValidatorTest.class
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/suite/E2EPublicOperatorTestSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import suite.core.CoreRefreshTest;
import suite.core.CoreTest;
import suite.operator.*;
import suite.optout.BeforeOptoutTest;
import suite.optout.OptOutTest;

@Suite
@SelectClasses({
Expand All @@ -17,7 +17,7 @@
V1ApiOperatorTest.class,
V2ApiOperatorTest.class,
V2ApiOperatorPublicOnlyTest.class,
BeforeOptoutTest.class
OptOutTest.class
})
public class E2EPublicOperatorTestSuite {
}
77 changes: 0 additions & 77 deletions src/test/java/suite/optout/AfterOptoutTest.java

This file was deleted.

Loading

0 comments on commit a7600a0

Please sign in to comment.