Commit 5d011a4f authored by Rostislav Vatolin [SLB]'s avatar Rostislav Vatolin [SLB]
Browse files

make domain configurable

parent 4050a94c
Pipeline #29798 passed with stages
in 28 seconds
......@@ -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
```
......@@ -17,11 +17,13 @@ public class Uploader {
String password = System.getProperty("GRAPH_DB_PASSWORD");
String intTesterUsername = System.getProperty("SERVICE_PRINCIPAL_ID");
String noDataAccessTester = System.getProperty("NO_DATA_ACCESS_TESTER");
String domain = System.getProperty("DOMAIN");
Client client = createClient(dbHost, password);
String[] commands = getGroovyCommands("/bootstrap-data.txt");
for (String command : commands) {
command = configureDomain(command, domain);
submitCommand(client, command);
}
......@@ -29,6 +31,7 @@ public class Uploader {
commands = getGroovyCommands(bootStrapFile);
for (String command : commands) {
command = configureDomain(command, domain);
command = configureIntTester(command, intTesterUsername);
command = configureNoDataAccessTester(command, noDataAccessTester);
submitCommand(client, command);
......@@ -45,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.contoso.com').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.contoso.com'))
g.V().has('nodeId','users.data.root@opendes.contoso.com').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.contoso.com'))
g.V().has('nodeId','users.datalake.viewers@opendes.contoso.com').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.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','users.datalake.ops@opendes.contoso.com'))
g.V().has('nodeId','users.datalake.admins@opendes.contoso.com').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.contoso.com'))
g.V().has('nodeId','users.datalake.editors@opendes.contoso.com').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.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.entitlements.admin@opendes.contoso.com'))
g.V().has('nodeId','service.entitlements.user@opendes.contoso.com').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.contoso.com'))
g.V().has('nodeId','service.legal.editor@opendes.contoso.com').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.contoso.com'))
g.V().has('nodeId','service.legal.user@opendes.contoso.com').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.contoso.com'))
g.V().has('nodeId','service.storage.viewer@opendes.contoso.com').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.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.storage.admin@opendes.contoso.com'))
g.V().has('nodeId','service.storage.creator@opendes.contoso.com').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.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.search.admin@opendes.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.search.user@opendes.contoso.com'))
g.V().has('nodeId','service.messaging.user@opendes.contoso.com').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.contoso.com'))
g.V().has('nodeId','service.plugin.user@opendes.contoso.com').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.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.schema-service.editors@opendes.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.schema-service.viewers@opendes.contoso.com'))
g.V().has('nodeId','service.schema-service.admins@opendes.contoso.com').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.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.file.editors@opendes.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.file.viewers@opendes.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.workflow.creator@opendes.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.workflow.viewer@opendes.contoso.com'))
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','INT_TESTER_USERNAME').addE('parent').to(g.V().has('nodeId','service.workflow.admin@opendes.contoso.com'))
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.contoso.com').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.contoso.com'))
g.V().has('nodeId','service.legal.editor@opendes.contoso.com').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.contoso.com'))
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
Supports Markdown
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