Skip to content
Snippets Groups Projects
Commit 1556e541 authored by Rustam Lotsmanenko (EPAM)'s avatar Rustam Lotsmanenko (EPAM)
Browse files

Merge branch 'gc-unhardcode-groupid-in-it' into 'master'

unhardcode group id in it

See merge request !370
parents 77a983e5 28b52e08
No related branches found
No related tags found
1 merge request!370unhardcode group id in it
Pipeline #178891 passed with warnings
......@@ -6,13 +6,16 @@ gc-test:
variables:
ENVIRONMENT: $GC_ENVIRONMENT
REGISTER_BASE_URL: $GC_REGISTER_BASE_URL
GROUP_ID: osdu-gcp.go3-nrg.projects.epam.com
gc-dev2-test:
variables:
ENVIRONMENT: $GC_ENVIRONMENT
REGISTER_BASE_URL: $GC_REGISTER_BASE_URL
GROUP_ID: dev2.osdu.club
gc-anthos-test:
variables:
REGISTER_BASE_URL: $GC_REGISTER_BASE_URL
GC_VENDOR: anthos
GROUP_ID: osdu-gcp.go3-nrg.projects.epam.com
......@@ -59,25 +59,26 @@ After the service has started it should be accessible via a web browser by visit
* Maven
* Values for the following environment variables in Config.java
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_OPS_TESTER` | yes | -- |
| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_OPS_TESTER` | yes | -- |
| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_ADMIN_TESTER` | yes | -- |
| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_ADMIN_TESTER` | yes | -- |
| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_EDITOR_TESTER` | yes | -- |
| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_EDITOR_TESTER` | yes | -- |
| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_NO_ACCESS_TESTER` | yes | -- |
| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_NO_ACCESS_TESTER` | yes | -- |
| `TEST_OPENID_PROVIDER_URL` | `https://keycloak.com/auth/realms/osdu` | OpenID provider url | yes | -- |
| `ENVIRONMENT` | `dev` OR `local` OR `dev_gke`| Local for running locally with services url's predefined as <http://localhost> , Dev & Dev_Gke is configurable environment | no | - |
| `HMAC_SECRET` | ex`7a786376626e` | String in hex , must match pattern ^[a-zA-Z0-9]{8,30}+$ & be in register variable SUBSCRIBER_SECRET | yes | - |
| `REGISTER_BASE_URL` | `http://localhost:8081/api/register/v1` | Register service url | no | - |
| `NOTIFICATION_BASE_URL` | `http://localhost:8080/api/notification/v1/` | Notification service url | no | - |
| `CLIENT_TENANT` | ex `opendes` | Client tenant | no | - |
| `OSDU_TENANT` | ex `osdu` | osdu tenant | no | - |
| `TOPIC_ID` | ex `records-changed` | PubSub topic id | no | <https://console.cloud.google.com/cloudpubsub/topic> |
| `REGISTER_CUSTOM_PUSH_URL_HMAC` | ex `http://localhost:8081/api/register/v1/test/challenge/hmac-integration-test` | Register testing push url | no | - |
| name | value | description | sensitive? | source |
|------------------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|------------------------------------------------------|
| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_OPS_TESTER` | yes | -- |
| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_OPS_TESTER` | yes | -- |
| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_ADMIN_TESTER` | yes | -- |
| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_ADMIN_TESTER` | yes | -- |
| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_EDITOR_TESTER` | yes | -- |
| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_EDITOR_TESTER` | yes | -- |
| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_NO_ACCESS_TESTER` | yes | -- |
| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_NO_ACCESS_TESTER` | yes | -- |
| `TEST_OPENID_PROVIDER_URL` | `https://keycloak.com/auth/realms/osdu` | OpenID provider url | yes | -- |
| `ENVIRONMENT` | `dev` OR `local` OR `dev_gke` | Local for running locally with services url's predefined as <http://localhost> , Dev & Dev_Gke is configurable environment | no | - |
| `HMAC_SECRET` | ex`7a786376626e` | String in hex , must match pattern ^[a-zA-Z0-9]{8,30}+$ & be in register variable SUBSCRIBER_SECRET | yes | - |
| `REGISTER_BASE_URL` | `http://localhost:8081/api/register/v1` | Register service url | no | - |
| `NOTIFICATION_BASE_URL` | `http://localhost:8080/api/notification/v1/` | Notification service url | no | - |
| `CLIENT_TENANT` | ex `opendes` | Client tenant | no | - |
| `OSDU_TENANT` | ex `osdu` | osdu tenant | no | - |
| `TOPIC_ID` | ex `records-changed` | PubSub topic id | no | <https://console.cloud.google.com/cloudpubsub/topic> |
| `REGISTER_CUSTOM_PUSH_URL_HMAC` | ex `http://localhost:8081/api/register/v1/test/challenge/hmac-integration-test` | Register testing push url | no | - |
| `GROUP_ID` | `osdu-gcp.go3-nrg.projects.epam.com` | Group id, used in storage record ACL. Full group will be "data.default.viewers@{{data-partition-id}}.{{group_id}}" | no | - |
**Entitlements configuration for integration accounts**
......
......@@ -80,6 +80,7 @@ After the service has started it should be accessible via a web browser by visit
| `TOPIC_ID` | ex `records-changed` | PubSub topic id | no | <https://console.cloud.google.com/cloudpubsub/topic> |
| `STORAGE_HOST` | `http://localhost:8081/api/storage/v1/` | Storage service url | no | - |
| `LEGAL_HOST` | `http://localhost:8081/api/legal/v1/` | Legal service url | no | - |
| `GROUP_ID` | `osdu-gcp.go3-nrg.projects.epam.com` | Group id, used in storage record ACL. Full group will be "data.default.viewers@{{data-partition-id}}.{{group_id}}" | no | - |
**Entitlements configuration for integration accounts**
......
......@@ -37,6 +37,7 @@ import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.*;
import static org.opengroup.osdu.notification.util.Constants.GROUP_ID;
public class TestPushEndpointGsa {
public static final String REGISTER_BASE_URL = "REGISTER_BASE_URL";
......@@ -58,6 +59,7 @@ public class TestPushEndpointGsa {
private String integrationAudience;
private String storageHost;
private String legalHost;
private String groupId;
private static final String LEGAL_TAG_NAME = "notification-test-gsa";
private ServicesUtils servicesUtils;
......@@ -79,7 +81,8 @@ public class TestPushEndpointGsa {
}
storageHost = System.getProperty(STORAGE_HOST, System.getenv(STORAGE_HOST));
legalHost = System.getProperty(LEGAL_HOST, System.getenv(LEGAL_HOST));
servicesUtils = new ServicesUtils(storageHost, legalHost, testUtils, tenant);
groupId = System.getProperty(GROUP_ID, System.getenv(GROUP_ID));
servicesUtils = new ServicesUtils(storageHost, legalHost, testUtils, tenant, groupId);
servicesUtils.createLegalTag(LEGAL_TAG_NAME);
createResourceInPartition(tenant);
}
......
......@@ -37,6 +37,7 @@ import java.util.Map;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.opengroup.osdu.notification.util.Constants.GROUP_ID;
public class TestPushEndpointHMAC {
public static final String REGISTER_BASE_URL = "REGISTER_BASE_URL";
......@@ -57,6 +58,7 @@ public class TestPushEndpointHMAC {
private String tenant;
private String storageHost;
private String legalHost;
private String groupId;
private static final String LEGAL_TAG_NAME = "notification-test-hmac";
private ServicesUtils servicesUtils;
......@@ -75,7 +77,8 @@ public class TestPushEndpointHMAC {
tenant = System.getProperty(OSDU_TENANT, System.getenv(OSDU_TENANT));
storageHost = System.getProperty(STORAGE_HOST, System.getenv(STORAGE_HOST));
legalHost = System.getProperty(LEGAL_HOST, System.getenv(LEGAL_HOST));
servicesUtils = new ServicesUtils(storageHost, legalHost, testUtils, tenant);
groupId = System.getProperty(GROUP_ID, System.getenv(GROUP_ID));
servicesUtils = new ServicesUtils(storageHost, legalHost, testUtils, tenant, groupId);
servicesUtils.createLegalTag(LEGAL_TAG_NAME);
createResourceInPartition(tenant);
}
......
package org.opengroup.osdu.notification.util;
public class Constants {
public static final String GROUP_ID = "GROUP_ID";
}
......@@ -31,13 +31,15 @@ public class ServicesUtils {
private String legalHost;
private TestUtils testUtils;
private String partitionId;
private String groupId;
private FileUtils fileUtils;
public ServicesUtils(String storageHost, String legalHost, TestUtils testUtils, String partitionId) {
public ServicesUtils(String storageHost, String legalHost, TestUtils testUtils, String partitionId, String groupId) {
this.storageHost = storageHost;
this.legalHost = legalHost;
this.testUtils = testUtils;
this.partitionId = partitionId;
this.groupId = groupId;
this.fileUtils = new FileUtils();
}
......@@ -68,6 +70,7 @@ public class ServicesUtils {
String body = fileUtils.readFromLocalFilePath("/StorageRecord.json");
body = body.replace("{{data-partition-id}}", partitionId);
body = body.replace("{{legal-tag}}", partitionId + "-" + legalTag);
body = body.replace("{{group_id}}", groupId);
for (int i = 0; i < count; i++) {
String actualBody = body.replace("{{ids-suffix}}", suffix + String.valueOf(i));
Map<String, String> headers = new HashMap<>();
......
......@@ -23,10 +23,10 @@
},
"acl": {
"viewers": [
"data.default.viewers@{{data-partition-id}}.osdu-gcp.go3-nrg.projects.epam.com"
"data.default.viewers@{{data-partition-id}}.{{group_id}}"
],
"owners": [
"data.default.owners@{{data-partition-id}}.osdu-gcp.go3-nrg.projects.epam.com"
"data.default.owners@{{data-partition-id}}.{{group_id}}"
]
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment