diff --git a/devops/gc/pipeline/override-stages.yml b/devops/gc/pipeline/override-stages.yml index 1564301f9077f79559338f66be372fb8823b7f0e..15bfd4e5ec543ff075735d2f2f1a57c1ec7e82ff 100644 --- a/devops/gc/pipeline/override-stages.yml +++ b/devops/gc/pipeline/override-stages.yml @@ -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 diff --git a/provider/notification-gc/docs/anthos/README.md b/provider/notification-gc/docs/anthos/README.md index c819fb53fc94b42c20c02af5326d37a67287dde8..5e1bdf25d9c97565d49b0ab5909b0e79e6e705f0 100644 --- a/provider/notification-gc/docs/anthos/README.md +++ b/provider/notification-gc/docs/anthos/README.md @@ -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** diff --git a/provider/notification-gc/docs/gc/README.md b/provider/notification-gc/docs/gc/README.md index 7802e9ce9e6b64d0c956f1cc37db8d956364508f..1e128086154024f8664eff36cc0d11d5a520a575 100644 --- a/provider/notification-gc/docs/gc/README.md +++ b/provider/notification-gc/docs/gc/README.md @@ -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** diff --git a/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointGsa.java b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointGsa.java index a03e0303451b55effedd1923ee035472314a0ea8..2245bebf5425439ebd5a0680c6c4e0b7695be2ff 100644 --- a/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointGsa.java +++ b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointGsa.java @@ -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); } diff --git a/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointHMAC.java b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointHMAC.java index d759d196634fd7e1d59bc1b4865c50c36c639ac6..a4b5ec17d9874c37f3c54f47b4908710b5d7231f 100644 --- a/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointHMAC.java +++ b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/api/TestPushEndpointHMAC.java @@ -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); } diff --git a/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/util/Constants.java b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/util/Constants.java new file mode 100644 index 0000000000000000000000000000000000000000..7889fab81ba31cbd3f5c840c2aca9d838c02aa21 --- /dev/null +++ b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/util/Constants.java @@ -0,0 +1,6 @@ +package org.opengroup.osdu.notification.util; + +public class Constants { + + public static final String GROUP_ID = "GROUP_ID"; +} diff --git a/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/util/ServicesUtils.java b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/util/ServicesUtils.java index a9a892872315c30bc247e5cec2f436c44bd267c0..8ccef30400bd6920e3b4d5e6457e693888c613dc 100644 --- a/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/util/ServicesUtils.java +++ b/testing/notification-test-gc/src/test/java/org/opengroup/osdu/notification/util/ServicesUtils.java @@ -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<>(); diff --git a/testing/notification-test-gc/src/test/resources/StorageRecord.json b/testing/notification-test-gc/src/test/resources/StorageRecord.json index 724c4a75ef2dfb7a4124f04d2e1bc42cdc860f2e..c4a8e395f201baf6ce31ca39d0de01968a2439a3 100644 --- a/testing/notification-test-gc/src/test/resources/StorageRecord.json +++ b/testing/notification-test-gc/src/test/resources/StorageRecord.json @@ -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}}" ] } }