diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java b/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java index b1bc60252566348c11ee2c9ddf44c75345717ac4..edbce0c44ab6f27f5a949bd58240db67ca2ef2e0 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java @@ -162,7 +162,7 @@ public class PubsubEndpoint { throw new AppException(HttpStatus.SC_NOT_FOUND, "Not found subscription for notificationId:" + notificationId, "Subscription not found"); } - Subscription subscription = service.query(notificationId).get(0); + Subscription subscription = subscriptionList.get(0); String jsonSubscription = gson.toJson(subscription); this.subscriptionCacheFactory.put(subscription.getNotificationId(), jsonSubscription); diff --git a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/pubsub/EventGridHandshakeHandler.java b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/pubsub/EventGridHandshakeHandler.java index b3b2a861f885a62d07699f91e7e028137f85d33b..686636d81d51e00bc69895f8a105063a7423bdbe 100644 --- a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/pubsub/EventGridHandshakeHandler.java +++ b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/pubsub/EventGridHandshakeHandler.java @@ -35,7 +35,7 @@ public class EventGridHandshakeHandler implements IPubsubHandshakeHandler { */ @Override public String getHandshakeResponse() { - String response; + String response; try { String validationCode = this.eventGridRequestBodyExtractor.getValidationCodeForHandshake(); @@ -50,4 +50,4 @@ public class EventGridHandshakeHandler implements IPubsubHandshakeHandler { return response; } -} +} \ No newline at end of file diff --git a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/ServiceAccountJwtAzureClientImpl.java b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/ServiceAccountJwtAzureClientImpl.java index 5d6d993341d4868719e363f8895c0ef92c7714af..99f7abf6ed4afef82994170d89650024187f3624 100644 --- a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/ServiceAccountJwtAzureClientImpl.java +++ b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/ServiceAccountJwtAzureClientImpl.java @@ -58,7 +58,7 @@ public class ServiceAccountJwtAzureClientImpl implements IServiceAccountJwtClien IdToken cachedToken = (IdToken) tenantJwtCache.get(tenant.getName()); if ((cachedToken != null) && !IdToken.refreshToken(cachedToken)) { - return cachedToken.getTokenValue(); + return "Bearer " + cachedToken.getTokenValue(); } // TODO : Control the thread count via config and pool should be created once. @@ -76,7 +76,7 @@ public class ServiceAccountJwtAzureClientImpl implements IServiceAccountJwtClien service.shutdown(); } } - return ACCESS_TOKEN; + return "Bearer " + ACCESS_TOKEN; } // TODO : Refactor for making it test-able. diff --git a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/pubsub/EventGridHandshakeHandlerTest.java b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/provider/azure/EventGridHandshakeHandlerTest.java similarity index 97% rename from provider/notification-azure/src/test/java/org/opengroup/osdu/notification/pubsub/EventGridHandshakeHandlerTest.java rename to provider/notification-azure/src/test/java/org/opengroup/osdu/notification/provider/azure/EventGridHandshakeHandlerTest.java index 3006ae111dc0455f620e1d64f1865a3707dd60ab..b58451b966a0f192f13111ad3728a3ed606c2a28 100644 --- a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/pubsub/EventGridHandshakeHandlerTest.java +++ b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/provider/azure/EventGridHandshakeHandlerTest.java @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.opengroup.osdu.notification.pubsub; +package org.opengroup.osdu.notification.provider.azure; import org.junit.Assert; import org.junit.Test; @@ -72,5 +72,4 @@ public class EventGridHandshakeHandlerTest { fail("Should Throw AppException"); } } -} - +} \ No newline at end of file diff --git a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/pubsub/EventGridRequestBodyExtractorTest.java b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/provider/azure/EventGridRequestBodyExtractorTest.java similarity index 99% rename from provider/notification-azure/src/test/java/org/opengroup/osdu/notification/pubsub/EventGridRequestBodyExtractorTest.java rename to provider/notification-azure/src/test/java/org/opengroup/osdu/notification/provider/azure/EventGridRequestBodyExtractorTest.java index ad875413152efab0d5431ee334aa940bc926f36b..bce964c17c1fe8f000a66c41954a63c792618285 100644 --- a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/pubsub/EventGridRequestBodyExtractorTest.java +++ b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/provider/azure/EventGridRequestBodyExtractorTest.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.opengroup.osdu.notification.pubsub; +package org.opengroup.osdu.notification.provider.azure; import org.junit.Assert; import org.junit.Test; diff --git a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java index 5153d6205f2f5205c8853fa58c9259380a5c597d..8e5db06d1c1abf310034bbe0a12b94a5ae180c2a 100644 --- a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java +++ b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java @@ -97,24 +97,26 @@ public class ServiceAccountClientImplTest { public void should_getTokenFromCache_getIdTokenTest() { // SetUp when(tenantJwtCacheMock.get(any())).thenReturn(idToken); + String expectedToken = "Bearer " +idToken.getTokenValue(); // Act String returnedIdToken = sut.getIdToken(tenantName); // Assert - Assert.assertEquals(idToken.getTokenValue(), returnedIdToken); + Assert.assertEquals(expectedToken, returnedIdToken); } @Test public void should_updateCache_getIdTokenTest() { // Set up when(tenantJwtCacheMock.get(any())).thenReturn(idToken); + String expectedToken = "Bearer " +idToken.getTokenValue(); // Act String returnedToken = this.sut.getIdToken(tenantName); // Assert - Assert.assertEquals(validToken, returnedToken); + Assert.assertEquals(expectedToken, returnedToken); } @Test diff --git a/testing/notification-test-azure/pom.xml b/testing/notification-test-azure/pom.xml index cacbfac57ce7ddc7df80265db50ad6c3b6d96241..0083132f3c26fc22a3784edaf142f80f5be34f0b 100644 --- a/testing/notification-test-azure/pom.xml +++ b/testing/notification-test-azure/pom.xml @@ -42,11 +42,11 @@ <distributionManagement> <repository> <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/143/packages/maven</url> + <url>https://community.opengroup.org/api/v4/projects/157/packages/maven</url> </repository> <snapshotRepository> <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/143/packages/maven</url> + <url>https://community.opengroup.org/api/v4/projects/157/packages/maven</url> </snapshotRepository> </distributionManagement> @@ -56,20 +56,37 @@ <artifactId>notification-test-core</artifactId> <version>1.0-SNAPSHOT</version> </dependency> + <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> - <version>0.0.20</version> + <artifactId>core-lib-azure</artifactId> + <version>0.0.22</version> + <exclusions> + <exclusion> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + </exclusion> + <exclusion> + <groupId>io.projectreactor.netty</groupId> + <artifactId>reactor-netty</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> - <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-azure</artifactId> - <version>0.0.17</version> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + <version>3.3.5.RELEASE</version> + </dependency> + <dependency> + <groupId>io.projectreactor.netty</groupId> + <artifactId>reactor-netty</artifactId> + <version>0.9.7.RELEASE</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> + <scope>test</scope> </dependency> </dependencies> diff --git a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java new file mode 100644 index 0000000000000000000000000000000000000000..915558b3c7425ebe3b2516a21bf55af7f2f80f78 --- /dev/null +++ b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java @@ -0,0 +1,73 @@ +// Copyright © Microsoft Corporation +// +// 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 +// +// http://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.notification.api; + +import org.opengroup.osdu.notification.util.Config; +import org.opengroup.osdu.notification.util.RestDescriptor; +import org.opengroup.osdu.notification.util.TestUtils; + +import java.util.HashMap; +import java.util.Map; + +public class PubsubEndpointHMACDescriptor extends RestDescriptor { + + @Override + public String getPath() { + return "push-handlers/records-changed"; + } + + @Override + public String getHttpMethod() { + return "POST"; + } + + @Override + public String getValidBody() { + return "[{\n" + + " \"id\": \"2425\",\n" + + " \"eventType\": \"recordInserted\",\n" + + " \"subject\": \"myapp/vehicles/motorcycles\",\n" + + " \"data\": {\n" + + " \"attributes\": {\n" + + " \"correlation-id\": \"39137f49-67d6-4001-a6aa-15521ef4f49e\",\n" + + " \"data-partition-id\": \"" + TestUtils.getOsduTenant() + "\"\n" + + " },\n" + + " \"data\": \"W3sia2luZCI6InRlc3RraW5kIiwiaWQiOiJ0ZXN0aWQiLCJvcGVyYXRpb250eXBlIjoiY3JlYXRlIn0seyJraW5kIjoidGVzdGtpbmQyIiwiaWQiOiJ0ZXN0aWQyIiwib3BlcmF0aW9udHlwZSI6InVwZGF0ZSJ9XQ\",\n" + + " \"messageId\": \"136969346945\"\n" + + " },\n" + + " \"dataVersion\": \"1.0\",\n" + + " \"metadataVersion\": \"1\",\n" + + " \"eventTime\": \"2020-08-14T18:04:12+00:00\",\n" + + " \"topic\": \"/subscriptions/c99e2bf3-1777-412b-baba-d823676589c2/resourceGroups/komakkar-OSDU-RG/providers/Microsoft.EventGrid/topics/recordChanged\"\n" + + " }]"; + + } + + @Override + public Map<String,String> getOsduTenantHeaders() { + Map<String, String> headers = new HashMap<>(); + headers.put("Aeg-Subscription-Name", arg()); + headers.put("data-partition-id", Config.Instance().OsduTenant); + return headers; + } + + @Override + public Map<String,String> getCustomerTenantHeaders(){ + Map<String, String> headers = new HashMap<>(); + headers.put("Aeg-Subscription-Name", arg()); + headers.put("data-partition-id", Config.Instance().ClientTenant); + return headers; + } +} diff --git a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java index a18328c340158fbe152575791e6660739984fa10..89ef6a4e27ce59ffa109085de356b1891c6f6872 100644 --- a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java +++ b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java @@ -1,3 +1,17 @@ +// Copyright © Microsoft Corporation +// +// 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 +// +// http://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.notification.api; import org.junit.After; diff --git a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java index 0af4600be0963289de1c245817dcb34478dfde71..8674c780592950bebb1f86e8328abc8f9f5abc46 100644 --- a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java +++ b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java @@ -1,3 +1,17 @@ +// Copyright © Microsoft Corporation +// +// 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 +// +// http://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.notification.util; import com.google.common.base.Strings; diff --git a/testing/notification-test-core/pom.xml b/testing/notification-test-core/pom.xml index f7a40f21c467dd3128c2f40a489f35fb75b0b8a8..5d4a558b6cf6684600daa6a91a6e2afb015be62a 100644 --- a/testing/notification-test-core/pom.xml +++ b/testing/notification-test-core/pom.xml @@ -69,7 +69,17 @@ <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>os-core-common</artifactId> - <version>0.3.6</version> + <version>0.3.4</version> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>javax.json</groupId> diff --git a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointGSADescriptor.java b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointGSADescriptor.java index 65a359f2fe64029e1195fb0b4e72a259304dfff1..476c1b684115c2bbf9bfc5706b10fbc4fc2d4e43 100644 --- a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointGSADescriptor.java +++ b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointGSADescriptor.java @@ -20,6 +20,9 @@ import org.opengroup.osdu.notification.util.Config; import org.opengroup.osdu.notification.util.RestDescriptor; import org.opengroup.osdu.notification.util.TestUtils; +import java.util.HashMap; +import java.util.Map; + public class PubsubEndpointGSADescriptor extends RestDescriptor { @Override @@ -44,4 +47,18 @@ public class PubsubEndpointGSADescriptor extends RestDescriptor { "\t\"subscription\":\"" + Config.Instance().NotificationId + "\"\n" + "}"; } + + @Override + public Map<String,String> getOsduTenantHeaders(){ + Map<String, String> headers = new HashMap<>(); + headers.put("data-partition-id", Config.Instance().OsduTenant); + return headers; + } + + @Override + public Map<String,String> getCustomerTenantHeaders(){ + Map<String, String> headers = new HashMap<>(); + headers.put("data-partition-id", Config.Instance().ClientTenant); + return headers; + } } diff --git a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java index f0f2e601a56cf5ceaef7b5138cdfc588a1cd2ad4..60791c283f2088c22626c67c1d79951e2272fa7e 100644 --- a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java +++ b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java @@ -16,9 +16,13 @@ package org.opengroup.osdu.notification.api; +import org.opengroup.osdu.notification.util.Config; import org.opengroup.osdu.notification.util.RestDescriptor; import org.opengroup.osdu.notification.util.TestUtils; +import java.util.HashMap; +import java.util.Map; + public class PubsubEndpointHMACDescriptor extends RestDescriptor { @Override @@ -45,4 +49,18 @@ public class PubsubEndpointHMACDescriptor extends RestDescriptor { "\t\"subscription\": \""+ arg() +"\"\n" + "}\n"; } + + @Override + public Map<String,String> getOsduTenantHeaders(){ + Map<String, String> headers = new HashMap<>(); + headers.put("data-partition-id", Config.Instance().OsduTenant); + return headers; + } + + @Override + public Map<String,String> getCustomerTenantHeaders(){ + Map<String, String> headers = new HashMap<>(); + headers.put("data-partition-id", Config.Instance().ClientTenant); + return headers; + } } diff --git a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACTests.java b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACTests.java index 98429acbcc16c1e930e9d15a548dc7c39db76df0..20094465104e331a08c1dfb1174573e658f7c29f 100644 --- a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACTests.java +++ b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACTests.java @@ -92,6 +92,8 @@ public abstract class PubsubEndpointHMACTests extends BaseTestTemplate { Subscription subscriptionCreated = subscriptionService.create(subscription); notificationId = subscriptionCreated.getNotificationId(); subscriptionId = subscriptionCreated.getId(); + + Config.Instance().NotificationId = notificationId; } @Override diff --git a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java index e1fafaf80af20c436bb8160afbf293ab884d16f7..7812c54cd815ca1dc159f1125a55c1a2051d88ed 100644 --- a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java +++ b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java @@ -33,17 +33,15 @@ public class Config { public static Config Instance() { String env = getEnvironment(); - config.ClientTenant = "nonexistenttenant"; config.IntegrationAudience = "245464679631-ktfdfpl147m1mjpbutl00b3cmffissgq.apps.googleusercontent.com"; config.OsduTenant = "opendes"; config.Topic = "records-changed"; config.hmacSecretValue = System.getProperty("HMAC_SECRET", System.getenv("HMAC_SECRET")); - if (env.equalsIgnoreCase("LOCAL")) { //make sure to run register service on a different port. You can also choose to point to Register service that is running in cloud - String registerUrl = "http://localhost:8081/"; + String registerUrl = "http://localhost:8081/api/register/v1"; //must have notification and register services running on different ports config.HostUrl = "http://localhost:8080/"; diff --git a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/RestDescriptor.java b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/RestDescriptor.java index e39016791013f2570f1a181fda47bec50adce8a6..38690fc885965e34570151a04883230632f48c86 100644 --- a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/RestDescriptor.java +++ b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/RestDescriptor.java @@ -18,6 +18,8 @@ package org.opengroup.osdu.notification.util; import com.sun.jersey.api.client.ClientResponse; +import java.util.Map; + public abstract class RestDescriptor { public RestDescriptor() { @@ -30,22 +32,24 @@ public abstract class RestDescriptor { public abstract String getPath(); public abstract String getHttpMethod(); public abstract String getValidBody(); + public abstract Map<String,String> getOsduTenantHeaders(); + public abstract Map<String,String> getCustomerTenantHeaders(); public String getQuery() { return ""; } public ClientResponse runHttp(String arg, String token) throws Exception{ this.arg = arg; - return TestUtils.send(getPath(), getHttpMethod(), token, getValidBody(), getQuery(), true); + return TestUtils.send(getPath(), getHttpMethod(), token, getValidBody(), getQuery(), getOsduTenantHeaders(),true); } public ClientResponse run(String arg, String token) throws Exception{ this.arg = arg; - return TestUtils.send(getPath(), getHttpMethod(), token, getValidBody(), getQuery(), false); + return TestUtils.send(getPath(), getHttpMethod(), token, getValidBody(), getQuery(), getOsduTenantHeaders(),false); } public ClientResponse runOnCustomerTenant(String arg, String token) throws Exception{ this.arg = arg; - return TestUtils.send(getPath(), getHttpMethod(), token, getValidBody(), getQuery(), TestUtils.getCustomerTenantHeaders(), false); + return TestUtils.send(getPath(), getHttpMethod(), token, getValidBody(), getQuery(), getCustomerTenantHeaders(), false); } public ClientResponse runOptions(String arg, String token) throws Exception{ this.arg = arg; - return TestUtils.send(getPath(), "OPTIONS", token, "", "", false); + return TestUtils.send(getPath(), "OPTIONS", token, "", "", getOsduTenantHeaders(),false); } } \ No newline at end of file diff --git a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/TestUtils.java b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/TestUtils.java index 43100436180da85d09bfccebf5f3629d23bcf311..393089845fdad198817e00950eb9e7300dd7ff84 100644 --- a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/TestUtils.java +++ b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/TestUtils.java @@ -62,27 +62,6 @@ public abstract class TestUtils { public abstract String getEditorToken() throws Exception; public abstract String getNoAccessToken() throws Exception; - - public static ClientResponse send(String path, String httpMethod, String token, String requestBody, String query, boolean enforceHttp) - throws Exception { - - Map<String, String> headers = getOsduTenantHeaders(); - - return send(path, httpMethod, token, requestBody, query, headers, enforceHttp); - } - - public static Map<String, String> getOsduTenantHeaders() { - Map<String, String> headers = new HashMap<>(); - headers.put("data-partition-id", getOsduTenant()); - return headers; - } - - public static Map<String, String> getCustomerTenantHeaders() { - Map<String, String> headers = new HashMap<>(); - headers.put("data-partition-id", getCustomerTenant()); - return headers; - } - public static ClientResponse send(String path, String httpMethod, String token, String requestBody, String query, Map<String,String> headers, boolean enforceHttp) throws Exception { diff --git a/testing/pom.xml b/testing/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..98ce82767af6753513c309f65f50753c2ce576f9 --- /dev/null +++ b/testing/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2017-2019, Schlumberger + + 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 + + http://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> + <groupId>org.opengroup.osdu</groupId> + <artifactId>os-notification-testing</artifactId> + <version>0.0.5-SNAPSHOT</version> + <description>Root Notification Service project</description> + <packaging>pom</packaging> + + <licenses> + <license> + <name>Apache License, Version 2.0</name> + <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + <modules> + <module>notification-test-core</module> + <module>notification-test-azure</module> + <module>notification-test-gcp</module> + </modules> + + <repositories> + <repository> + <id>${gitlab-server}</id> + <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> + </repository> + </repositories> + + <distributionManagement> + <repository> + <id>${gitlab-server}</id> + <url>https://community.opengroup.org/api/v4/projects/44/packages/maven</url> + </repository> + <snapshotRepository> + <id>${gitlab-server}</id> + <url>https://community.opengroup.org/api/v4/projects/44/packages/maven</url> + </snapshotRepository> + </distributionManagement> + +</project>