Skip to content
Snippets Groups Projects
Commit 1ab3ad16 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

(cherry picked from commit 1556e541)

76562307 unhardcode group id in it
716159a5 GONRG-6935: Bring GROUP_ID variable to notification service
28b52e08 Merge branch 'GONRG-6935-Bring-GROUP-ID-variable-to-notification-service' into...
parent fd77b255
No related branches found
No related tags found
1 merge request!372Merge branch 'gc-unhardcode-groupid-in-it' into 'master'
Pipeline #178895 canceled
...@@ -6,13 +6,16 @@ gc-test: ...@@ -6,13 +6,16 @@ gc-test:
variables: variables:
ENVIRONMENT: $GC_ENVIRONMENT ENVIRONMENT: $GC_ENVIRONMENT
REGISTER_BASE_URL: $GC_REGISTER_BASE_URL REGISTER_BASE_URL: $GC_REGISTER_BASE_URL
GROUP_ID: osdu-gcp.go3-nrg.projects.epam.com
gc-dev2-test: gc-dev2-test:
variables: variables:
ENVIRONMENT: $GC_ENVIRONMENT ENVIRONMENT: $GC_ENVIRONMENT
REGISTER_BASE_URL: $GC_REGISTER_BASE_URL REGISTER_BASE_URL: $GC_REGISTER_BASE_URL
GROUP_ID: dev2.osdu.club
gc-anthos-test: gc-anthos-test:
variables: variables:
REGISTER_BASE_URL: $GC_REGISTER_BASE_URL REGISTER_BASE_URL: $GC_REGISTER_BASE_URL
GC_VENDOR: anthos 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 ...@@ -59,25 +59,26 @@ After the service has started it should be accessible via a web browser by visit
* Maven * Maven
* Values for the following environment variables in Config.java * Values for the following environment variables in Config.java
| name | value | description | sensitive? | source | | 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_ID` | `********` | Client Id for `DE_OPS_TESTER` | yes | -- |
| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret 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_ID` | `********` | Client Id for `DE_ADMIN_TESTER` | yes | -- |
| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret 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_ID` | `********` | Client Id for `DE_EDITOR_TESTER` | yes | -- |
| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret 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_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_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 | -- | | `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 | - | | `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 | - | | `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 | - | | `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 | - | | `NOTIFICATION_BASE_URL` | `http://localhost:8080/api/notification/v1/` | Notification service url | no | - |
| `CLIENT_TENANT` | ex `opendes` | Client tenant | no | - | | `CLIENT_TENANT` | ex `opendes` | Client tenant | no | - |
| `OSDU_TENANT` | ex `osdu` | osdu 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> | | `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 | - | | `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** **Entitlements configuration for integration accounts**
......
...@@ -80,6 +80,7 @@ After the service has started it should be accessible via a web browser by visit ...@@ -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> | | `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 | - | | `STORAGE_HOST` | `http://localhost:8081/api/storage/v1/` | Storage service url | no | - |
| `LEGAL_HOST` | `http://localhost:8081/api/legal/v1/` | Legal 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** **Entitlements configuration for integration accounts**
......
...@@ -37,6 +37,7 @@ import java.util.HashMap; ...@@ -37,6 +37,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.opengroup.osdu.notification.util.Constants.GROUP_ID;
public class TestPushEndpointGsa { public class TestPushEndpointGsa {
public static final String REGISTER_BASE_URL = "REGISTER_BASE_URL"; public static final String REGISTER_BASE_URL = "REGISTER_BASE_URL";
...@@ -58,6 +59,7 @@ public class TestPushEndpointGsa { ...@@ -58,6 +59,7 @@ public class TestPushEndpointGsa {
private String integrationAudience; private String integrationAudience;
private String storageHost; private String storageHost;
private String legalHost; private String legalHost;
private String groupId;
private static final String LEGAL_TAG_NAME = "notification-test-gsa"; private static final String LEGAL_TAG_NAME = "notification-test-gsa";
private ServicesUtils servicesUtils; private ServicesUtils servicesUtils;
...@@ -79,7 +81,8 @@ public class TestPushEndpointGsa { ...@@ -79,7 +81,8 @@ public class TestPushEndpointGsa {
} }
storageHost = System.getProperty(STORAGE_HOST, System.getenv(STORAGE_HOST)); storageHost = System.getProperty(STORAGE_HOST, System.getenv(STORAGE_HOST));
legalHost = System.getProperty(LEGAL_HOST, System.getenv(LEGAL_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); servicesUtils.createLegalTag(LEGAL_TAG_NAME);
createResourceInPartition(tenant); createResourceInPartition(tenant);
} }
......
...@@ -37,6 +37,7 @@ import java.util.Map; ...@@ -37,6 +37,7 @@ import java.util.Map;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.opengroup.osdu.notification.util.Constants.GROUP_ID;
public class TestPushEndpointHMAC { public class TestPushEndpointHMAC {
public static final String REGISTER_BASE_URL = "REGISTER_BASE_URL"; public static final String REGISTER_BASE_URL = "REGISTER_BASE_URL";
...@@ -57,6 +58,7 @@ public class TestPushEndpointHMAC { ...@@ -57,6 +58,7 @@ public class TestPushEndpointHMAC {
private String tenant; private String tenant;
private String storageHost; private String storageHost;
private String legalHost; private String legalHost;
private String groupId;
private static final String LEGAL_TAG_NAME = "notification-test-hmac"; private static final String LEGAL_TAG_NAME = "notification-test-hmac";
private ServicesUtils servicesUtils; private ServicesUtils servicesUtils;
...@@ -75,7 +77,8 @@ public class TestPushEndpointHMAC { ...@@ -75,7 +77,8 @@ public class TestPushEndpointHMAC {
tenant = System.getProperty(OSDU_TENANT, System.getenv(OSDU_TENANT)); tenant = System.getProperty(OSDU_TENANT, System.getenv(OSDU_TENANT));
storageHost = System.getProperty(STORAGE_HOST, System.getenv(STORAGE_HOST)); storageHost = System.getProperty(STORAGE_HOST, System.getenv(STORAGE_HOST));
legalHost = System.getProperty(LEGAL_HOST, System.getenv(LEGAL_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); servicesUtils.createLegalTag(LEGAL_TAG_NAME);
createResourceInPartition(tenant); 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 { ...@@ -31,13 +31,15 @@ public class ServicesUtils {
private String legalHost; private String legalHost;
private TestUtils testUtils; private TestUtils testUtils;
private String partitionId; private String partitionId;
private String groupId;
private FileUtils fileUtils; 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.storageHost = storageHost;
this.legalHost = legalHost; this.legalHost = legalHost;
this.testUtils = testUtils; this.testUtils = testUtils;
this.partitionId = partitionId; this.partitionId = partitionId;
this.groupId = groupId;
this.fileUtils = new FileUtils(); this.fileUtils = new FileUtils();
} }
...@@ -68,6 +70,7 @@ public class ServicesUtils { ...@@ -68,6 +70,7 @@ public class ServicesUtils {
String body = fileUtils.readFromLocalFilePath("/StorageRecord.json"); String body = fileUtils.readFromLocalFilePath("/StorageRecord.json");
body = body.replace("{{data-partition-id}}", partitionId); body = body.replace("{{data-partition-id}}", partitionId);
body = body.replace("{{legal-tag}}", partitionId + "-" + legalTag); body = body.replace("{{legal-tag}}", partitionId + "-" + legalTag);
body = body.replace("{{group_id}}", groupId);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String actualBody = body.replace("{{ids-suffix}}", suffix + String.valueOf(i)); String actualBody = body.replace("{{ids-suffix}}", suffix + String.valueOf(i));
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
}, },
"acl": { "acl": {
"viewers": [ "viewers": [
"data.default.viewers@{{data-partition-id}}.osdu-gcp.go3-nrg.projects.epam.com" "data.default.viewers@{{data-partition-id}}.{{group_id}}"
], ],
"owners": [ "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