Commit 42a54764 authored by Daniel Scholl's avatar Daniel Scholl
Browse files

Merge branch 'bidirectional_test_data' into 'master'

Update test data for Entitlements V2

See merge request osdu/platform/deployment-and-operations/infra-azure-provisioning!230
parents 6b75c2d9 5ad47cd4
......@@ -84,5 +84,5 @@ __Upload Graph Cosmos DB Test Data__
> NOTE: requires Maven installed locally
```bash
cd entitlements_data_uploader
mvn compile exec:java -DGRAPH_DB_HOST=$GRAPH_DB_HOST -DGRAPH_DB_PASSWORD=$GRAPH_DB_PASSWORD -DSERVICE_PRINCIPAL_ID=$SERVICE_PRINCIPAL_ID -DNO_DATA_ACCESS_TESTER=$NO_DATA_ACCESS_TESTER
mvn compile exec:java -DGRAPH_DB_HOST=$GRAPH_DB_HOST -DGRAPH_DB_PASSWORD=$GRAPH_DB_PASSWORD -DSERVICE_PRINCIPAL_ID=$SERVICE_PRINCIPAL_ID -DNO_DATA_ACCESS_TESTER=$NO_DATA_ACCESS_TESTER -DDOMAIN=contoso.com
```
......@@ -12,41 +12,32 @@ import java.util.concurrent.ExecutionException;
public class Uploader {
private static final String DEFAULT_DP = "opendes";
public static void main(String[] args) throws IOException, ExecutionException, InterruptedException {
String dbHost = System.getProperty("GRAPH_DB_HOST");
String password = System.getProperty("GRAPH_DB_PASSWORD");
String intTesterUsername = System.getProperty("SERVICE_PRINCIPAL_ID");
String noDataAccessTester = System.getProperty("NO_DATA_ACCESS_TESTER");
String[] dataPartitions = new String[]{DEFAULT_DP, "common"};
String domain = System.getProperty("DOMAIN");
Client client = createClient(dbHost, password);
for (String dp: dataPartitions) {
String[] commands = getGroovyCommands("/bootstrap-data.txt");
for (String command : commands) {
if (!DEFAULT_DP.equals(dp)) {
command = replaceDefaultDp(command, dp);
}
submitCommand(client, command);
}
String[] commands = getGroovyCommands("/bootstrap-data.txt");
for (String command : commands) {
command = configureDomain(command, domain);
submitCommand(client, command);
}
String[] usersForIntTests = new String[]{"/users-for-tests-for-opendes-dp.txt", "/users-for-tests-for-common-dp.txt"};
for (String bootStrapFile: usersForIntTests) {
String[] commands = getGroovyCommands(bootStrapFile);
for (String command : commands) {
command = configureIntTester(command, intTesterUsername);
command = configureNoDataAccessTester(command, noDataAccessTester);
submitCommand(client, command);
}
String bootStrapFile = "/users-for-integration-tests.txt";
commands = getGroovyCommands(bootStrapFile);
for (String command : commands) {
command = configureDomain(command, domain);
command = configureIntTester(command, intTesterUsername);
command = configureNoDataAccessTester(command, noDataAccessTester);
submitCommand(client, command);
}
System.exit(0);
}
private static String replaceDefaultDp(String command, String dp) {
return command.replaceAll(DEFAULT_DP, dp);
System.exit(0);
}
private static String configureIntTester(String command, String intTester) {
......@@ -57,6 +48,10 @@ public class Uploader {
return command.replaceAll("NO_DATA_ACCESS_TESTER", noDataAccessTester);
}
private static String configureDomain(String command, String domain) {
return command.replaceAll("DOMAIN", domain);
}
private static Client createClient(String dbHost, String password) {
Cluster cluster = Cluster.build(dbHost)
.port(443)
......
g.addV('USER').property('nodeId', 'INT_TESTER_USERNAME').property('dataPartitionId', 'opendes')
g.V().has('nodeId','users@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','users@opendes.DOMAIN'))
g.V().has('nodeId','users.data.root@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','users.data.root@opendes.DOMAIN'))
g.V().has('nodeId','users.datalake.viewers@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','users.datalake.viewers@opendes.DOMAIN'))
g.V().has('nodeId','users.datalake.ops@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','users.datalake.ops@opendes.DOMAIN'))
g.V().has('nodeId','users.datalake.admins@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','users.datalake.admins@opendes.DOMAIN'))
g.V().has('nodeId','users.datalake.editors@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','users.datalake.editors@opendes.DOMAIN'))
g.V().has('nodeId','service.entitlements.admin@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.entitlements.admin@opendes.DOMAIN'))
g.V().has('nodeId','service.entitlements.user@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.entitlements.user@opendes.DOMAIN'))
g.V().has('nodeId','service.legal.editor@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.legal.editor@opendes.DOMAIN'))
g.V().has('nodeId','service.legal.user@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.legal.user@opendes.DOMAIN'))
g.V().has('nodeId','service.storage.viewer@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.storage.viewer@opendes.DOMAIN'))
g.V().has('nodeId','service.storage.admin@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.storage.admin@opendes.DOMAIN'))
g.V().has('nodeId','service.storage.creator@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.storage.creator@opendes.DOMAIN'))
g.V().has('nodeId','service.search.admin@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.search.admin@opendes.DOMAIN'))
g.V().has('nodeId','service.search.user@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.search.user@opendes.DOMAIN'))
g.V().has('nodeId','service.messaging.user@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.messaging.user@opendes.DOMAIN'))
g.V().has('nodeId','service.plugin.user@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.plugin.user@opendes.DOMAIN'))
g.V().has('nodeId','service.schema-service.editors@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.schema-service.editors@opendes.DOMAIN'))
g.V().has('nodeId','service.schema-service.viewers@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.schema-service.viewers@opendes.DOMAIN'))
g.V().has('nodeId','service.schema-service.admins@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.schema-service.admins@opendes.DOMAIN'))
g.V().has('nodeId','service.file.editors@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.file.editors@opendes.DOMAIN'))
g.V().has('nodeId','service.file.viewers@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.file.viewers@opendes.DOMAIN'))
g.V().has('nodeId','service.workflow.creator@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.workflow.creator@opendes.DOMAIN'))
g.V().has('nodeId','service.workflow.viewer@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.workflow.viewer@opendes.DOMAIN'))
g.V().has('nodeId','service.workflow.admin@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.workflow.admin@opendes.DOMAIN'))
g.addV('USER').property('nodeId', 'NO_DATA_ACCESS_TESTER').property('dataPartitionId', 'opendes')
g.V().has('nodeId','service.storage.admin@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','NO_DATA_ACCESS_TESTER'))
g.V().has('nodeId','NO_DATA_ACCESS_TESTER').addE('parent').to(g.V().has('nodeId','service.storage.admin@opendes.DOMAIN'))
g.V().has('nodeId','service.legal.editor@opendes.DOMAIN').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','NO_DATA_ACCESS_TESTER'))
g.V().has('nodeId','NO_DATA_ACCESS_TESTER').addE('parent').to(g.V().has('nodeId','service.legal.editor@opendes.DOMAIN'))
g.addV('USER').property('nodeId', 'testMember@test.com').property('dataPartitionId', 'opendes')
g.addV('USER').property('nodeId', 'testmMemberOwner@test.com').property('dataPartitionId', 'opendes')
\ No newline at end of file
g.addV('USER').property('nodeId', 'INT_TESTER_USERNAME').property('dataPartitionId', 'common')
g.V().has('nodeId','users@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.storage.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.legal.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.datalake.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.datalake.viewer@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.viewer@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.owner@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.search.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.search.user@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.viewers@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.owners@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.entitlements.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.schema-service.viewers@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.schema-service.editors@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.workflow.creator@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.workflow.viewer@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.workflow.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','users.datalake.ops@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','cron.job@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','notification.pubsub@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.file.viewers@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.file.editors@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.delivery.viewer@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.addV('USER').property('nodeId', 'NO_DATA_ACCESS_TESTER').property('dataPartitionId', 'common')
g.V().has('nodeId','service.storage.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','NO_DATA_ACCESS_TESTER'))
g.V().has('nodeId','service.legal.admin@common.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','NO_DATA_ACCESS_TESTER'))
g.addV('USER').property('nodeId', 'testMember@test.com').property('dataPartitionId', 'common')
g.addV('USER').property('nodeId', 'testmMemberOwner@test.com').property('dataPartitionId', 'common')
\ No newline at end of file
g.addV('USER').property('nodeId', 'INT_TESTER_USERNAME').property('dataPartitionId', 'opendes')
g.V().has('nodeId','service.storage.admin@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.legal.admin@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.datalake.viewer@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.test1@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.viewer@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.owner@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.search.admin@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.search.user@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.viewers@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','data.default.owners@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.entitlements.admin@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.schema-service.viewers@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.schema-service.editors@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.workflow.creator@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.workflow.viewer@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.workflow.admin@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','users.datalake.ops@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','cron.job@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','notification.pubsub@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.file.viewers@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.file.editors@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','service.delivery.viewer@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.V().has('nodeId','users@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','INT_TESTER_USERNAME'))
g.addV('USER').property('nodeId', 'NO_DATA_ACCESS_TESTER').property('dataPartitionId', 'opendes')
g.V().has('nodeId','service.storage.admin@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','NO_DATA_ACCESS_TESTER'))
g.V().has('nodeId','service.legal.admin@opendes.contoso.com').addE('child').property('role', 'OWNER').to(g.V().has('nodeId','NO_DATA_ACCESS_TESTER'))
g.addV('USER').property('nodeId', 'testMember@test.com').property('dataPartitionId', 'opendes')
g.addV('USER').property('nodeId', 'testmMemberOwner@test.com').property('dataPartitionId', 'opendes')
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment