Skip to content

Commit acd0a31

Browse files
committed
Fixed optout and core env vars
1 parent 4f49284 commit acd0a31

File tree

4 files changed

+10
-24
lines changed

4 files changed

+10
-24
lines changed

src/test/java/app/AppsMap.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package app;
22

3-
import common.EnvUtil;
43
import app.component.App;
54

65
import java.lang.reflect.InvocationTargetException;
@@ -10,7 +9,6 @@
109

1110
public final class AppsMap {
1211
private static final Map<String, String> APP_MAP;
13-
private static final String ENV = EnvUtil.getEnv("UID2_E2E_ENV");
1412

1513
private static final Apps APPS;
1614

@@ -28,7 +26,7 @@ public final class AppsMap {
2826
"github-test-pipeline", "app.GitHubTestPipelineApps"
2927
);
3028

31-
APPS = (Apps) Class.forName(APP_MAP.get(ENV)).getDeclaredConstructor().newInstance();
29+
APPS = (Apps) Class.forName(APP_MAP.get(App.ENV)).getDeclaredConstructor().newInstance();
3230
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
3331
throw new RuntimeException(e);
3432
}

src/test/java/app/LocalApps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
public final class LocalApps extends Apps {
88
public LocalApps() {
99
super(Set.of(
10-
// TODO: Add optout, monitorstack
1110
new Localstack("http://localhost", 5001, "Local - Localstack"),
1211
new Admin("http://localhost", 8089, "Local - Admin"),
1312
new Core("http://localhost", 8088, "Local - Core"),
1413
new Operator("http://localhost", 8888, "Local - Public Operator", Operator.Type.PUBLIC),
1514
new Operator("http://localhost", 8180, "Local - Private Operator", Operator.Type.PRIVATE),
15+
new Optout("http://localhost", 8081, "Local - Optout"),
1616
new Prometheus("http://localhost", 9085, "Local - Validator Prometheus")
1717
));
1818
}

src/test/java/app/component/Core.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package app.component;
22

3+
import common.Const;
34
import common.EnvUtil;
45
import common.HttpClient;
56
import common.Mapper;
@@ -9,10 +10,10 @@
910
import java.util.Map;
1011

1112
public class Core extends App {
12-
private static final String CORE_API_TOKEN = EnvUtil.getEnv("UID2_E2E_CORE_API_TOKEN");
13-
private static final String OPTOUT_TO_CALL_CORE_API_TOKEN = EnvUtil.getEnv("UID2_E2E_OPTOUT_TO_CALL_CORE_API_TOKEN");
14-
public static final String CORE_URL = EnvUtil.getEnv("UID2_E2E_CORE_URL");
15-
public static final String OPTOUT_URL = EnvUtil.getEnv("UID2_E2E_OPTOUT_URL");
13+
private static final String OPERATOR_API_KEY = EnvUtil.getEnv(Const.Config.Core.OPERATOR_API_KEY);
14+
private static final String OPTOUT_API_KEY = EnvUtil.getEnv(Const.Config.Core.OPTOUT_API_KEY);
15+
public static final String CORE_URL = EnvUtil.getEnv(Const.Config.Core.CORE_URL);
16+
public static final String OPTOUT_URL = EnvUtil.getEnv(Const.Config.Core.OPTOUT_URL);
1617

1718
public Core(String host, Integer port, String name) {
1819
super(host, port, name);
@@ -23,7 +24,7 @@ public Core(String host, String name) {
2324
}
2425

2526
public JsonNode attest(String attestationRequest) throws Exception {
26-
String response = HttpClient.post(getBaseUrl() + "/attest", attestationRequest, CORE_API_TOKEN);
27+
String response = HttpClient.post(getBaseUrl() + "/attest", attestationRequest, OPERATOR_API_KEY);
2728
return Mapper.OBJECT_MAPPER.readTree(response);
2829
}
2930

@@ -35,12 +36,12 @@ public JsonNode getWithCoreApiToken(String path, boolean encrypted) throws Excep
3536
Map<String, String> headers = new HashMap<>();
3637
if (encrypted)
3738
headers.put("Encrypted", "true");
38-
String response = HttpClient.get(getBaseUrl() + path, CORE_API_TOKEN, headers);
39+
String response = HttpClient.get(getBaseUrl() + path, OPERATOR_API_KEY, headers);
3940
return Mapper.OBJECT_MAPPER.readTree(response);
4041
}
4142

4243
public JsonNode getWithOptOutApiToken(String path) throws Exception {
43-
String response = HttpClient.get(getBaseUrl() + path, OPTOUT_TO_CALL_CORE_API_TOKEN);
44+
String response = HttpClient.get(getBaseUrl() + path, OPTOUT_API_KEY);
4445
return Mapper.OBJECT_MAPPER.readTree(response);
4546
}
4647
}
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
package app.component;
22

3-
4-
import common.EnvUtil;
5-
import common.HttpClient;
6-
import common.Mapper;
7-
import com.fasterxml.jackson.databind.JsonNode;
8-
93
public class Optout extends App {
10-
private static final String CORE_API_TOKEN = EnvUtil.getEnv("UID2_E2E_OPTOUT_TO_CALL_CORE_API_TOKEN");
114
public Optout(String host, Integer port, String name) {
125
super(host, port, name);
136
}
14-
15-
public JsonNode getPath(String path) throws Exception {
16-
String response = HttpClient.get(getBaseUrl() + path, CORE_API_TOKEN);
17-
return Mapper.OBJECT_MAPPER.readTree(response);
18-
}
19-
207
}

0 commit comments

Comments
 (0)