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-core/pom.xml b/testing/notification-test-core/pom.xml index e2779a05bc3f79b58dde9dba6ccfc7d7bfa6479e..5d4a558b6cf6684600daa6a91a6e2afb015be62a 100644 --- a/testing/notification-test-core/pom.xml +++ b/testing/notification-test-core/pom.xml @@ -21,7 +21,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.opengroup.osdu.notification</groupId> <artifactId>notification-test-core</artifactId> - <version>1.1-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <name>notification-test-core</name> <description>Integration tests core for notification</description> <packaging>jar</packaging> 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>