From 876128538f9013996cf0737f75251d27f95106c2 Mon Sep 17 00:00:00 2001
From: "Rustam Lotsmanenko (EPAM)" <rustam_lotsmanenko@epam.com>
Date: Mon, 30 May 2022 13:01:13 +0000
Subject: [PATCH] int tests for anthos env (GONRG-4979)

---
 provider/partition-gcp/README.md              | 25 +----
 provider/partition-gcp/docs/anthos/README.md  | 24 +++++
 provider/partition-gcp/docs/gcp/README.md     | 24 ++++-
 testing/partition-test-anthos/pom.xml         | 52 ++++++++++
 .../partition/api/TestCreatePartition.java    | 72 ++++++++++++++
 .../partition/api/TestDeletePartition.java    | 58 +++++++++++
 .../partition/api/TestGetPartitionById.java   | 67 +++++++++++++
 .../partition/api/TestGetVersionInfo.java     | 37 ++++++++
 .../partition/api/TestListPartitions.java     | 67 +++++++++++++
 .../partition/api/TestUpdatePartition.java    | 69 ++++++++++++++
 .../api/util/AnthosAuthorizationTestUtil.java | 58 +++++++++++
 .../osdu/partition/util/AnthosTestUtils.java  | 33 +++++++
 .../partition/util/OpenIDTokenProvider.java   | 95 +++++++++++++++++++
 .../util/conf/OpenIDProviderConfig.java       | 80 ++++++++++++++++
 .../src/test/resources/logback-test.xml       | 30 ++++++
 testing/pom.xml                               |  3 +-
 16 files changed, 772 insertions(+), 22 deletions(-)
 create mode 100644 testing/partition-test-anthos/pom.xml
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestCreatePartition.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestDeletePartition.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetPartitionById.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetVersionInfo.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestListPartitions.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestUpdatePartition.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/util/AnthosAuthorizationTestUtil.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/AnthosTestUtils.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/OpenIDTokenProvider.java
 create mode 100644 testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/conf/OpenIDProviderConfig.java
 create mode 100644 testing/partition-test-anthos/src/test/resources/logback-test.xml

diff --git a/provider/partition-gcp/README.md b/provider/partition-gcp/README.md
index ba368928f..b35b141b9 100644
--- a/provider/partition-gcp/README.md
+++ b/provider/partition-gcp/README.md
@@ -115,27 +115,12 @@ $ (cd testing/partition-test-core/ && mvn clean install)
 ```
 
 ### Running E2E Tests
-This section describes how to run cloud OSDU E2E tests (testing/partition-test-gcp).
+This section describes how to run cloud OSDU E2E tests.
 
-You will need to have the following environment variables defined.
-
-| name | value | description | sensitive? | source |
-| ---  | ---   | ---         | ---        | ---    |
-| `ENVIRONMENT` | ex `dev` |  | no |  |
-| `PARTITION_BASE_URL` | ex `http://localhost:8080/` | service base URL | yes |  |
-| `CLIENT_TENANT` | ex `opendes` | name of the client partition | yes |  |
-| `MY_TENANT` | ex `opendes` | name of the OSDU partition | yes |  |
-| `INTEGRATION_TESTER` | `********` | Service account for API calls. Note: this user must be `PARTITION_ADMIN_ACCOUNT` | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
-| `NO_DATA_ACCESS_TESTER` | `********` | Service account base64 encoded string without data access | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
-| `INTEGRATION_TEST_AUDIENCE` | `********` | client application ID | yes | https://console.cloud.google.com/apis/credentials |
-
-Execute following command to build code and run all the integration tests:
-
-```bash
-# Note: this assumes that the environment variables for integration tests as outlined
-#       above are already exported in your environment.
-$ (cd testing/partition-test-gcp/ && mvn clean test)
-```
+### Anthos test configuration:
+[Anthos service configuration ](docs/anthos/README.md)
+### GCP test configuration:
+[Gcp service configuration ](docs/gcp/README.md)
 
 ## Deployment
 Partition Service is compatible with App Engine Flexible Environment and Cloud Run.
diff --git a/provider/partition-gcp/docs/anthos/README.md b/provider/partition-gcp/docs/anthos/README.md
index ce44301f4..477d62f01 100644
--- a/provider/partition-gcp/docs/anthos/README.md
+++ b/provider/partition-gcp/docs/anthos/README.md
@@ -44,3 +44,27 @@ CONSTRAINT PartitionProperty_id UNIQUE (id)
 CREATE INDEX PartitionProperty_dataGin ON partition."PartitionProperty" USING GIN (data);
 
 ```
+
+### Running E2E Tests
+
+You will need to have the following environment variables defined.
+
+| name | value | description | sensitive? | source |
+| ---  | ---   | ---         | ---        | ---    |
+| `ENVIRONMENT` | ex `dev` |  | no |  |
+| `PARTITION_BASE_URL` | ex `http://localhost:8080/` | service base URL | yes |  |
+| `CLIENT_TENANT` | ex `opendes` | name of the client partition | yes |  |
+| `MY_TENANT` | ex `opendes` | name of the OSDU partition | yes |  |
+| `TEST_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `$INTEGRATION_TESTER` | yes | -- |
+| `TEST_OPENID_PROVIDER_CLIENT_SECRET` | `********` |  | Client secret for `$INTEGRATION_TESTER` | -- |
+| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `$NO_ACCESS_INTEGRATION_TESTER` | yes | -- |
+| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET` | `********` |  | Client secret for `$NO_ACCESS_INTEGRATION_TESTER` | -- |
+| `TEST_OPENID_PROVIDER_URL` | `https://keycloak.com/auth/realms/osdu` | OpenID provider url | yes | -- |
+
+Execute following command to build code and run all the integration tests:
+
+```bash
+# Note: this assumes that the environment variables for integration tests as outlined
+#       above are already exported in your environment.
+$ (cd testing/partition-test-anthos/ && mvn clean test)
+```
\ No newline at end of file
diff --git a/provider/partition-gcp/docs/gcp/README.md b/provider/partition-gcp/docs/gcp/README.md
index 331676b32..fca42ffeb 100644
--- a/provider/partition-gcp/docs/gcp/README.md
+++ b/provider/partition-gcp/docs/gcp/README.md
@@ -35,4 +35,26 @@ TBD
 
 | Required roles |
 | ---    |
-| - |
\ No newline at end of file
+| - |
+
+### Running E2E Tests
+
+You will need to have the following environment variables defined.
+
+| name | value | description | sensitive? | source |
+| ---  | ---   | ---         | ---        | ---    |
+| `ENVIRONMENT` | ex `dev` |  | no |  |
+| `PARTITION_BASE_URL` | ex `http://localhost:8080/` | service base URL | yes |  |
+| `CLIENT_TENANT` | ex `opendes` | name of the client partition | yes |  |
+| `MY_TENANT` | ex `opendes` | name of the OSDU partition | yes |  |
+| `INTEGRATION_TESTER` | `********` | Service account for API calls. Note: this user must be `PARTITION_ADMIN_ACCOUNT` | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
+| `NO_DATA_ACCESS_TESTER` | `********` | Service account base64 encoded string without data access | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
+| `INTEGRATION_TEST_AUDIENCE` | `********` | client application ID | yes | https://console.cloud.google.com/apis/credentials |
+
+Execute following command to build code and run all the integration tests:
+
+```bash
+# Note: this assumes that the environment variables for integration tests as outlined
+#       above are already exported in your environment.
+$ (cd testing/partition-test-gcp/ && mvn clean test)
+```
\ No newline at end of file
diff --git a/testing/partition-test-anthos/pom.xml b/testing/partition-test-anthos/pom.xml
new file mode 100644
index 000000000..1d48bac5d
--- /dev/null
+++ b/testing/partition-test-anthos/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2020-2022 Google LLC
+  ~ Copyright 2020-2022 EPAM Systems, Inc
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     https://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.opengroup.osdu</groupId>
+        <artifactId>os-partition-testing</artifactId>
+        <version>0.15.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>org.opengroup.osdu.partition</groupId>
+    <artifactId>partition-test-anthos</artifactId>
+    <version>0.15.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.opengroup.osdu.partition</groupId>
+            <artifactId>partition-test-core</artifactId>
+            <version>0.15.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.nimbusds</groupId>
+            <artifactId>oauth2-oidc-sdk</artifactId>
+            <version>9.15</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestCreatePartition.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestCreatePartition.java
new file mode 100644
index 000000000..ea91ba411
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestCreatePartition.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.api;
+
+import static org.junit.Assert.assertEquals;
+
+import com.sun.jersey.api.client.ClientResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opengroup.osdu.partition.api.util.AnthosAuthorizationTestUtil;
+import org.opengroup.osdu.partition.util.AnthosTestUtils;
+
+public class TestCreatePartition extends CreatePartitionTest {
+
+    private AnthosAuthorizationTestUtil authorizationTestUtil;
+
+    @Override
+    @Before
+    public void setup() {
+        this.testUtils = new AnthosTestUtils();
+        this.authorizationTestUtil = new AnthosAuthorizationTestUtil(this.descriptor, this.testUtils);
+    }
+
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        deleteResource();
+        this.testUtils = null;
+        this.authorizationTestUtil = null;
+    }
+
+    @Override
+    @Test
+    public void should_return40XResponseCode_when_makingRequest_withInvalidPayload()
+        throws Exception {
+        String invalidPayload = "{\"properties_invalid\":{}}";
+        ClientResponse response = descriptor.runWithCustomPayload(getId(), invalidPayload,
+            testUtils.getAccessToken());
+        assertEquals(400, response.getStatus());
+    }
+
+    @Override
+    public void should_return401_when_noAccessToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_noAccessToken(getId());
+    }
+
+    @Override
+    public void should_return401_when_accessingWithCredentialsWithoutPermission() throws Exception {
+        authorizationTestUtil.should_return401or403_when_accessingWithCredentialsWithoutPermission(getId());
+    }
+
+    @Override
+    public void should_return401_when_makingHttpRequestWithoutToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_makingHttpRequestWithoutToken(getId());
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestDeletePartition.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestDeletePartition.java
new file mode 100644
index 000000000..ba764ebb9
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestDeletePartition.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.api;
+
+import org.junit.After;
+import org.junit.Before;
+import org.opengroup.osdu.partition.api.util.AnthosAuthorizationTestUtil;
+import org.opengroup.osdu.partition.util.AnthosTestUtils;
+
+public class TestDeletePartition extends DeletePartitionTest {
+
+    private AnthosAuthorizationTestUtil authorizationTestUtil;
+
+    @Override
+    @Before
+    public void setup() {
+        this.testUtils = new AnthosTestUtils();
+        this.authorizationTestUtil = new AnthosAuthorizationTestUtil(this.descriptor, this.testUtils);
+    }
+
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        deleteResource();
+        this.testUtils = null;
+        this.authorizationTestUtil = null;
+    }
+
+    @Override
+    public void should_return401_when_noAccessToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_noAccessToken(getId());
+    }
+
+    @Override
+    public void should_return401_when_accessingWithCredentialsWithoutPermission() throws Exception {
+        authorizationTestUtil.should_return401or403_when_accessingWithCredentialsWithoutPermission(getId());
+    }
+
+    @Override
+    public void should_return401_when_makingHttpRequestWithoutToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_makingHttpRequestWithoutToken(getId());
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetPartitionById.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetPartitionById.java
new file mode 100644
index 000000000..fbaa4b1b6
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetPartitionById.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.api;
+
+import com.sun.jersey.api.client.ClientResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.opengroup.osdu.partition.api.descriptor.DeletePartitionDescriptor;
+import org.opengroup.osdu.partition.api.util.AnthosAuthorizationTestUtil;
+import org.opengroup.osdu.partition.util.AnthosTestUtils;
+
+public class TestGetPartitionById extends GetPartitionByIdApitTest {
+
+    private AnthosAuthorizationTestUtil authorizationTestUtil;
+
+    @Override
+    @Before
+    public void setup() {
+        this.testUtils = new AnthosTestUtils();
+        this.authorizationTestUtil = new AnthosAuthorizationTestUtil(this.descriptor, this.testUtils);
+    }
+
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        deleteResource();
+        this.testUtils = null;
+        this.authorizationTestUtil = null;
+    }
+
+    @Override
+    protected void deleteResource() throws Exception {
+        DeletePartitionDescriptor deletePartitionDes = new DeletePartitionDescriptor();
+        deletePartitionDes.setPartitionId(getId());
+        ClientResponse response = deletePartitionDes.run(getId(), this.testUtils.getAccessToken());
+    }
+
+    @Override
+    public void should_return401_when_noAccessToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_noAccessToken(getId());
+    }
+
+    @Override
+    public void should_return401_when_accessingWithCredentialsWithoutPermission() throws Exception {
+        authorizationTestUtil.should_return401or403_when_accessingWithCredentialsWithoutPermission(getId());
+    }
+
+    @Override
+    public void should_return401_when_makingHttpRequestWithoutToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_makingHttpRequestWithoutToken(getId());
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetVersionInfo.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetVersionInfo.java
new file mode 100644
index 000000000..088e7a452
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestGetVersionInfo.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.api;
+
+import org.junit.After;
+import org.junit.Before;
+import org.opengroup.osdu.partition.util.AnthosTestUtils;
+
+public class TestGetVersionInfo extends GetVersionInfoApiTest {
+
+    @Before
+    @Override
+    public void setup() {
+        this.testUtils = new AnthosTestUtils();
+    }
+
+    @After
+    @Override
+    public void tearDown() {
+        this.testUtils = null;
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestListPartitions.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestListPartitions.java
new file mode 100644
index 000000000..a90d4e73d
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestListPartitions.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.api;
+
+import com.sun.jersey.api.client.ClientResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.opengroup.osdu.partition.api.descriptor.DeletePartitionDescriptor;
+import org.opengroup.osdu.partition.api.util.AnthosAuthorizationTestUtil;
+import org.opengroup.osdu.partition.util.AnthosTestUtils;
+
+public class TestListPartitions extends ListPartitionsApitTest {
+
+    private AnthosAuthorizationTestUtil authorizationTestUtil;
+
+    @Override
+    @Before
+    public void setup() {
+        this.testUtils = new AnthosTestUtils();
+        this.authorizationTestUtil = new AnthosAuthorizationTestUtil(this.descriptor, this.testUtils);
+    }
+
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        deleteResource();
+        this.testUtils = null;
+        this.authorizationTestUtil = null;
+    }
+
+    @Override
+    protected void deleteResource() throws Exception {
+        DeletePartitionDescriptor deletePartitionDes = new DeletePartitionDescriptor();
+        deletePartitionDes.setPartitionId(getId());
+        ClientResponse response = deletePartitionDes.run(getId(), this.testUtils.getAccessToken());
+    }
+
+    @Override
+    public void should_return401_when_noAccessToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_noAccessToken(getId());
+    }
+
+    @Override
+    public void should_return401_when_accessingWithCredentialsWithoutPermission() throws Exception {
+        authorizationTestUtil.should_return401or403_when_accessingWithCredentialsWithoutPermission(getId());
+    }
+
+    @Override
+    public void should_return401_when_makingHttpRequestWithoutToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_makingHttpRequestWithoutToken(getId());
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestUpdatePartition.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestUpdatePartition.java
new file mode 100644
index 000000000..26e61d584
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/TestUpdatePartition.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.api;
+
+import static org.junit.Assert.assertEquals;
+
+import com.sun.jersey.api.client.ClientResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.opengroup.osdu.partition.api.descriptor.DeletePartitionDescriptor;
+import org.opengroup.osdu.partition.api.util.AnthosAuthorizationTestUtil;
+import org.opengroup.osdu.partition.util.AnthosTestUtils;
+
+public class TestUpdatePartition extends UpdatePartitionTest {
+
+    private AnthosAuthorizationTestUtil authorizationTestUtil;
+
+    @Override
+    @Before
+    public void setup() {
+        this.testUtils = new AnthosTestUtils();
+        this.authorizationTestUtil = new AnthosAuthorizationTestUtil(this.descriptor, this.testUtils);
+    }
+
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        deleteResource();
+        this.testUtils = null;
+        this.authorizationTestUtil = null;
+    }
+
+    @Override
+    protected void deleteResource() throws Exception {
+        DeletePartitionDescriptor deletePartitionDes = new DeletePartitionDescriptor();
+        deletePartitionDes.setPartitionId(getId());
+        ClientResponse response = deletePartitionDes.run(getId(), this.testUtils.getAccessToken());
+    }
+
+    @Override
+    public void should_return401_when_noAccessToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_noAccessToken(getId());
+    }
+
+    @Override
+    public void should_return401_when_accessingWithCredentialsWithoutPermission() throws Exception {
+        authorizationTestUtil.should_return401or403_when_accessingWithCredentialsWithoutPermission(getId());
+    }
+
+    @Override
+    public void should_return401_when_makingHttpRequestWithoutToken() throws Exception {
+        authorizationTestUtil.should_return401or403_when_makingHttpRequestWithoutToken(getId());
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/util/AnthosAuthorizationTestUtil.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/util/AnthosAuthorizationTestUtil.java
new file mode 100644
index 000000000..20af46342
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/api/util/AnthosAuthorizationTestUtil.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.api.util;
+
+import static org.hamcrest.core.AnyOf.anyOf;
+import static org.junit.Assert.assertThat;
+
+import com.sun.jersey.api.client.ClientResponse;
+import org.hamcrest.core.Is;
+import org.opengroup.osdu.partition.util.RestDescriptor;
+import org.opengroup.osdu.partition.util.TestUtils;
+
+public class AnthosAuthorizationTestUtil {
+
+    private RestDescriptor descriptor;
+    private TestUtils testUtils;
+
+    public AnthosAuthorizationTestUtil(RestDescriptor descriptor, TestUtils testUtils) {
+        this.descriptor = descriptor;
+        this.testUtils = testUtils;
+    }
+
+    public void should_return401or403_when_noAccessToken(String partitionId) throws Exception {
+        ClientResponse response = descriptor.runOnCustomerTenant(partitionId, testUtils.getNoAccessToken());
+        assertThat(error(response.getEntity(String.class)), response.getStatus(), anyOf(Is.is(401), Is.is(403)));
+    }
+
+
+    public void should_return401or403_when_accessingWithCredentialsWithoutPermission(String partitionId) throws Exception {
+        ClientResponse response = descriptor.run(partitionId, testUtils.getNoAccessToken());
+        assertThat(error(response.getEntity(String.class)), response.getStatus(), anyOf(Is.is(401), Is.is(403)));
+    }
+
+
+    public void should_return401or403_when_makingHttpRequestWithoutToken(String partitionId) throws Exception {
+        ClientResponse response = descriptor.run(partitionId, "");
+        assertThat(error(response.getEntity(String.class)), response.getStatus(), anyOf(Is.is(401), Is.is(403)));
+    }
+
+    protected String error(String body) {
+        return String.format("%s: %s %s %s", descriptor.getHttpMethod(), descriptor.getPath(), descriptor.getQuery(), body);
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/AnthosTestUtils.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/AnthosTestUtils.java
new file mode 100644
index 000000000..7e8de8038
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/AnthosTestUtils.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.util;
+
+public class AnthosTestUtils extends TestUtils {
+
+    private final OpenIDTokenProvider tokenProvider = new OpenIDTokenProvider();
+
+    @Override
+    public String getAccessToken() {
+        return "Bearer " + tokenProvider.getToken();
+    }
+
+    @Override
+    public String getNoAccessToken() {
+        return "Bearer " + tokenProvider.getNoAccessToken();
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/OpenIDTokenProvider.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/OpenIDTokenProvider.java
new file mode 100644
index 000000000..57cf5542e
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/OpenIDTokenProvider.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.util;
+
+import com.nimbusds.oauth2.sdk.AuthorizationGrant;
+import com.nimbusds.oauth2.sdk.ClientCredentialsGrant;
+import com.nimbusds.oauth2.sdk.ParseException;
+import com.nimbusds.oauth2.sdk.Scope;
+import com.nimbusds.oauth2.sdk.TokenRequest;
+import com.nimbusds.oauth2.sdk.TokenResponse;
+import com.nimbusds.oauth2.sdk.auth.ClientAuthentication;
+import com.nimbusds.oauth2.sdk.auth.ClientSecretBasic;
+import com.nimbusds.oauth2.sdk.auth.Secret;
+import com.nimbusds.oauth2.sdk.id.ClientID;
+import com.nimbusds.openid.connect.sdk.OIDCTokenResponseParser;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Objects;
+import net.minidev.json.JSONObject;
+import org.opengroup.osdu.partition.util.conf.OpenIDProviderConfig;
+
+public class OpenIDTokenProvider {
+
+    private static final OpenIDProviderConfig openIDProviderConfig = OpenIDProviderConfig.Instance();
+    private static final String ID_TOKEN = "id_token";
+    private final AuthorizationGrant clientGrant = new ClientCredentialsGrant();
+    private final URI tokenEndpointURI;
+    private final Scope scope;
+    private final ClientAuthentication clientAuthentication;
+    private final ClientAuthentication noAccessClientAuthentication;
+
+    public OpenIDTokenProvider() {
+        this.tokenEndpointURI = openIDProviderConfig.getProviderMetadata().getTokenEndpointURI();
+        this.scope = new Scope(openIDProviderConfig.getScopes());
+        this.clientAuthentication =
+            new ClientSecretBasic(
+                new ClientID(openIDProviderConfig.getClientId()),
+                new Secret(openIDProviderConfig.getClientSecret())
+            );
+        this.noAccessClientAuthentication =
+            new ClientSecretBasic(
+                new ClientID(openIDProviderConfig.getNoAccessClientId()),
+                new Secret(openIDProviderConfig.getNoAccessClientSecret())
+            );
+    }
+
+    public String getToken() {
+        try {
+            TokenRequest request = new TokenRequest(this.tokenEndpointURI, this.clientAuthentication, this.clientGrant, this.scope);
+            return requestToken(request);
+        } catch (ParseException | IOException e) {
+            throw new RuntimeException("Unable get credentials from INTEGRATION_TESTER variables", e);
+        }
+    }
+
+    public String getNoAccessToken() {
+        try {
+            TokenRequest request = new TokenRequest(this.tokenEndpointURI, this.noAccessClientAuthentication, this.clientGrant, this.scope);
+            return requestToken(request);
+        } catch (ParseException | IOException e) {
+            throw new RuntimeException("Unable get credentials from INTEGRATION_TESTER variables", e);
+        }
+    }
+
+    private String requestToken(TokenRequest tokenRequest) throws ParseException, IOException {
+
+        TokenResponse parse = OIDCTokenResponseParser.parse(tokenRequest.toHTTPRequest().send());
+
+        if (!parse.indicatesSuccess()) {
+            throw new RuntimeException("Unable get credentials from INTEGRATION_TESTER variables");
+        }
+
+        JSONObject jsonObject = parse.toSuccessResponse().toJSONObject();
+        String idTokenValue = jsonObject.getAsString(ID_TOKEN);
+        if (Objects.isNull(idTokenValue) || idTokenValue.isEmpty()) {
+            throw new RuntimeException("Unable get credentials from INTEGRATION_TESTER variables");
+        }
+        return idTokenValue;
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/conf/OpenIDProviderConfig.java b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/conf/OpenIDProviderConfig.java
new file mode 100644
index 000000000..5c049c1fd
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/java/org/opengroup/osdu/partition/util/conf/OpenIDProviderConfig.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2020-2022 Google LLC
+ * Copyright 2020-2022 EPAM Systems, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opengroup.osdu.partition.util.conf;
+
+import com.nimbusds.oauth2.sdk.http.HTTPRequest;
+import com.nimbusds.oauth2.sdk.http.HTTPResponse;
+import com.nimbusds.oauth2.sdk.id.Issuer;
+import com.nimbusds.openid.connect.sdk.op.OIDCProviderConfigurationRequest;
+import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata;
+
+public class OpenIDProviderConfig {
+
+    private String clientId;
+    private String clientSecret;
+    private String noAccessClientId;
+    private String noAccessClientSecret;
+    private String url;
+    private final String[] scopes = {"openid"};
+    private static final OpenIDProviderConfig openIDProviderConfig = new OpenIDProviderConfig();
+    private static OIDCProviderMetadata providerMetadata;
+
+    public static OpenIDProviderConfig Instance() {
+        try {
+            openIDProviderConfig.clientId = System.getProperty("TEST_OPENID_PROVIDER_CLIENT_ID", System.getenv("TEST_OPENID_PROVIDER_CLIENT_ID"));
+            openIDProviderConfig.clientSecret = System.getProperty("TEST_OPENID_PROVIDER_CLIENT_SECRET", System.getenv("TEST_OPENID_PROVIDER_CLIENT_SECRET"));
+            openIDProviderConfig.noAccessClientId =
+                System.getProperty("TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID", System.getenv("TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID"));
+            openIDProviderConfig.noAccessClientSecret =
+                System.getProperty("TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET", System.getenv("TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET"));
+            openIDProviderConfig.url = System.getProperty("TEST_OPENID_PROVIDER_URL", System.getenv("TEST_OPENID_PROVIDER_URL"));
+            Issuer issuer = new Issuer(openIDProviderConfig.url);
+            OIDCProviderConfigurationRequest request = new OIDCProviderConfigurationRequest(issuer);
+            HTTPRequest httpRequest = request.toHTTPRequest();
+            HTTPResponse httpResponse = httpRequest.send();
+            providerMetadata = OIDCProviderMetadata.parse(httpResponse.getContentAsJSONObject());
+        } catch (Exception e) {
+            throw new RuntimeException("Malformed token provider configuration", e);
+        }
+        return openIDProviderConfig;
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public String getClientSecret() {
+        return clientSecret;
+    }
+
+    public String getNoAccessClientId() {
+        return noAccessClientId;
+    }
+
+    public String getNoAccessClientSecret() {
+        return noAccessClientSecret;
+    }
+
+    public String[] getScopes() {
+        return scopes;
+    }
+
+    public OIDCProviderMetadata getProviderMetadata() {
+        return providerMetadata;
+    }
+}
diff --git a/testing/partition-test-anthos/src/test/resources/logback-test.xml b/testing/partition-test-anthos/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..e7cfe02a5
--- /dev/null
+++ b/testing/partition-test-anthos/src/test/resources/logback-test.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2020-2022 Google LLC
+  ~ Copyright 2020-2022 EPAM Systems, Inc
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     https://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<configuration>
+  <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
+  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%yellow([%thread]) %highlight(| %-5level |) %green(%d) %cyan(| %logger{15} |) %highlight(%msg) %n</pattern>
+      <charset>utf8</charset>
+    </encoder>
+  </appender>
+  <root level="INFO">
+    <appender-ref ref="CONSOLE" />
+  </root>
+</configuration>
diff --git a/testing/pom.xml b/testing/pom.xml
index 6530222ca..530051332 100644
--- a/testing/pom.xml
+++ b/testing/pom.xml
@@ -34,7 +34,8 @@
 		<module>partition-test-azure</module>
 		<module>partition-test-aws</module>
 		<module>partition-test-ibm</module>
-    <module>partition-test-gcp</module>
+    	<module>partition-test-gcp</module>
+		<module>partition-test-anthos</module>
   </modules>
 
 	<repositories>
-- 
GitLab