From 921beb9c6987b7c17898c328e9cd213c62798e67 Mon Sep 17 00:00:00 2001
From: Yash Dholakia <ysdholak@amazon.com>
Date: Thu, 22 Jun 2023 13:54:27 +0000
Subject: [PATCH] Integration tests for notification to receive update when a
 record is updated in storage.

---
 .gitlab-ci.yml                                |   2 +-
 provider/notification-aws/pom.xml             | 102 ++++++------
 .../queue/NotificationRetryQueueService.java  |   2 +-
 .../queue/NotificationRetrySQSHandler.java    |   6 +-
 .../impl/NotificationQueueServiceImpl.java    |  32 ++--
 .../NotificationRetryQueueServiceImpl.java    |  24 +--
 .../repository/SubscriptionRepository.java    |   2 +-
 .../aws/security/ThreadSignatureService.java  |   4 +-
 .../aws/service/AwsNotificationHandler.java   |   2 +-
 .../provider/aws/utils/SQSUtils.java          |  12 +-
 .../src/main/resources/application.properties |   2 +-
 testing/notification-test-aws/pom.xml         |   2 +-
 .../subscriptions/LegalTagUtils.java          |  65 ++++++++
 .../subscriptions/RecordUtils.java            |  93 +++++++++++
 .../subscriptions/StorageTestUtils.java       | 124 ++++++++++++++
 .../subscriptions/TenantUtils.java            |  10 ++
 .../TestNotificationsEndpoint.java            | 157 ++++++++++++++++++
 .../subscriptions/verify_register-logs.sh     |   8 +
 18 files changed, 553 insertions(+), 96 deletions(-)
 create mode 100644 testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/LegalTagUtils.java
 create mode 100644 testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/RecordUtils.java
 create mode 100644 testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/StorageTestUtils.java
 create mode 100644 testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TenantUtils.java
 create mode 100644 testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java
 create mode 100644 testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/verify_register-logs.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index edba954cd..342908b2a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -47,4 +47,4 @@ include:
   - project: "osdu/platform/ci-cd-pipelines"
     file: "cloud-providers/ibm.yml"
 
-  - local: "devops/gc/pipeline/override-stages.yml"
+  - local: "devops/gc/pipeline/override-stages.yml"
\ No newline at end of file
diff --git a/provider/notification-aws/pom.xml b/provider/notification-aws/pom.xml
index ca8967177..2853bd7bc 100644
--- a/provider/notification-aws/pom.xml
+++ b/provider/notification-aws/pom.xml
@@ -92,7 +92,7 @@
             <version>${aws.version}</version>
         </dependency>
 
-       <dependency>
+        <dependency>
             <groupId>org.opengroup.osdu</groupId>
             <artifactId>notification-core</artifactId>
             <version>0.21.0-SNAPSHOT</version>
@@ -132,55 +132,55 @@
         </dependency>
 
         <dependency>
-             <groupId>com.fasterxml.jackson.core</groupId>
-             <artifactId>jackson-core</artifactId>
-             <version>${jackson.version}</version>
-         </dependency>
-         <dependency>
-             <groupId>com.fasterxml.jackson.core</groupId>
-             <artifactId>jackson-databind</artifactId>
-             <version>${jackson-databind.version}</version>
-         </dependency>
-         <dependency>
-             <groupId>com.fasterxml.jackson.core</groupId>
-             <artifactId>jackson-annotations</artifactId>
-             <version>${jackson.version}</version>
-         </dependency>
-
-     </dependencies>
-
-     <build>
-         <plugins>
-             <plugin>
-                 <groupId>org.springframework.boot</groupId>
-                 <artifactId>spring-boot-maven-plugin</artifactId>
-                 <version>${spring-boot-maven-plugin.version}</version>
-                 <executions>
-                     <execution>
-                         <goals>
-                             <goal>repackage</goal>
-                         </goals>
-                         <configuration>
-                             <classifier>spring-boot</classifier>
-                             <mainClass>
-                                 org.opengroup.osdu.notification.provider.aws.Application
-                             </mainClass>
-                         </configuration>
-                     </execution>
-                 </executions>
-             </plugin>
-             <plugin>
-                 <artifactId>maven-war-plugin</artifactId>
-                 <configuration>
-                     <failOnMissingWebXml>false</failOnMissingWebXml>
-                 </configuration>
-             </plugin>
-             <plugin>
-                 <groupId>org.owasp</groupId>
-                 <artifactId>dependency-check-maven</artifactId>
-                 <version>7.4.4</version>
-                 <configuration>
-                     <!-- .Disable Net content-->
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>${jackson-databind.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot-maven-plugin.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>spring-boot</classifier>
+                            <mainClass>
+                                org.opengroup.osdu.notification.provider.aws.Application
+                            </mainClass>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.owasp</groupId>
+                <artifactId>dependency-check-maven</artifactId>
+                <version>7.4.4</version>
+                <configuration>
+                    <!-- .Disable Net content-->
                     <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                     <nugetconfAnalyzerEnabled>false</nugetconfAnalyzerEnabled>
                     <nuspecAnalyzerEnabled>false</nuspecAnalyzerEnabled>
@@ -196,4 +196,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
+</project>
\ No newline at end of file
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetryQueueService.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetryQueueService.java
index aa7471569..bc7d33c14 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetryQueueService.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetryQueueService.java
@@ -24,4 +24,4 @@ public interface NotificationRetryQueueService {
     List<RetryProcessResult> processNotificationMessages(List<Message> messages);
 
     List<RetryProcessResult> processMessagesBySubscription(Subscription subscription, List<Message> messages);
-}
+}
\ No newline at end of file
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetrySQSHandler.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetrySQSHandler.java
index f04a75397..00f68fcf1 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetrySQSHandler.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/NotificationRetrySQSHandler.java
@@ -81,11 +81,11 @@ public class NotificationRetrySQSHandler {
                 logger.info("Processing {} messages from notification retry queue", messages.size());
                 List<RetryProcessResult> notificationResults = notificationRetryQueueService.processNotificationMessages(messages);
                 List<Message> failedMessages = notificationResults.stream().filter(msg -> NotificationResult.NACK.equals(msg.getResult())).map(RetryProcessResult::getMessage).collect(
-                    Collectors.toList());
+                        Collectors.toList());
                 notificationRetryQueueService.changeMessageVisibilityTimeout(sqsClient, notificationRetryQueueUrl, failedMessages);
 
                 List<Message> deleteMessageList = notificationResults.stream().filter(result -> NotificationResult.ACK.equals(result.getResult()))
-                                                                     .map(RetryProcessResult::getMessage).collect(Collectors.toList());
+                        .map(RetryProcessResult::getMessage).collect(Collectors.toList());
                 if (!deleteMessageList.isEmpty()) {
                     int deletedCount = sqsUtil.deleteMessages(deleteMessageList, notificationRetryQueueUrl, sqsClient);
                     logger.info("Deleted Messages count :: {}", deletedCount);
@@ -98,4 +98,4 @@ public class NotificationRetrySQSHandler {
         }
     }
 
-}
+}
\ No newline at end of file
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationQueueServiceImpl.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationQueueServiceImpl.java
index b79914ce6..387c40eeb 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationQueueServiceImpl.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationQueueServiceImpl.java
@@ -90,11 +90,11 @@ public class NotificationQueueServiceImpl implements NotificationQueueService {
     public List<Message> processNotificationMessages(List<Message> messages) {
         try {
             Map<String, List<Message>> messagesByDataPartition = messages.stream().collect(
-                Collectors.groupingBy(msg -> msg.getMessageAttributes().get("data-partition-id").getStringValue(), HashMap::new, Collectors.toCollection(ArrayList::new)));
+                    Collectors.groupingBy(msg -> msg.getMessageAttributes().get("data-partition-id").getStringValue(), HashMap::new, Collectors.toCollection(ArrayList::new)));
 
             return messagesByDataPartition.entrySet().parallelStream()
-                                          .map(entry -> processMessagesByDataPartition(entry.getKey(), entry.getValue()))
-                                          .filter(Objects::nonNull).flatMap(list -> list.stream()).collect(Collectors.toList());
+                    .map(entry -> processMessagesByDataPartition(entry.getKey(), entry.getValue()))
+                    .filter(Objects::nonNull).flatMap(list -> list.stream()).collect(Collectors.toList());
         } catch (Exception e) {
             logger.error("Exception processing messages :", e);
             return new ArrayList<>();
@@ -134,7 +134,7 @@ public class NotificationQueueServiceImpl implements NotificationQueueService {
                         continue;
                     }
                     Map<String, String> messageAttributes = message.getMessageAttributes().entrySet().stream().collect(
-                        Collectors.toMap(Entry::getKey, attribute -> attribute.getValue().getStringValue()));
+                            Collectors.toMap(Entry::getKey, attribute -> attribute.getValue().getStringValue()));
                     if (!notifySubscriber(subscription, message.getBody(), messageAttributes)) {
                         messagesToRetry.add(message);
                         hasPreviousFailed = true;
@@ -171,32 +171,32 @@ public class NotificationQueueServiceImpl implements NotificationQueueService {
             Map<String, MessageAttributeValue> messageAttributes = message.getMessageAttributes();
 
             MessageAttributeValue failedNotificationRecordId = new MessageAttributeValue()
-                .withDataType("String");
+                    .withDataType("String");
             failedNotificationRecordId.setStringValue(id);
 
             MessageAttributeValue subscriptionIdAttribute = new MessageAttributeValue()
-                .withDataType("String");
+                    .withDataType("String");
             subscriptionIdAttribute.setStringValue(subscription.getId());
 
             messageAttributes.put("subscriptionId", subscriptionIdAttribute);
             messageAttributes.put("failedNotificationRecordId", failedNotificationRecordId);
 
             SendMessageRequest sendMessageRequest = new SendMessageRequest()
-                .withQueueUrl(notificationRetryQueueUrl)
-                .withMessageBody(message.getBody())
-                .withMessageAttributes(messageAttributes);
+                    .withQueueUrl(notificationRetryQueueUrl)
+                    .withMessageBody(message.getBody())
+                    .withMessageAttributes(messageAttributes);
             sqsClient.sendMessage(sendMessageRequest);
 
             FailedNotificationDoc notificationDoc = FailedNotificationDoc.builder()
-                                                                         .id(id)
-                                                                         .partitionIdSubscriptionId(String.join("-", dataPartitionId, subscription.getId()))
-                                                                         .status(NotificationResult.NACK)
-                                                                         .createdOnEpoch(new Timestamp(currentTimeMillis).toString())
-                                                                         .dataPartitionId(dataPartitionId)
-                                                                         .ttl(ttl).build();
+                    .id(id)
+                    .partitionIdSubscriptionId(String.join("-", dataPartitionId, subscription.getId()))
+                    .status(NotificationResult.NACK)
+                    .createdOnEpoch(new Timestamp(currentTimeMillis).toString())
+                    .dataPartitionId(dataPartitionId)
+                    .ttl(ttl).build();
             dynamoDBQueryHelper.saveWithHashCondition(notificationDoc, "id");
         } catch (Exception e) {
             logger.error("Exception while inserting failed record, messageId: {}, subscriptionPushUrl: {} ", message.getMessageId(), subscription.getPushEndpoint(), e);
         }
     }
-}
+}
\ No newline at end of file
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationRetryQueueServiceImpl.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationRetryQueueServiceImpl.java
index 56b7ea88a..0652b4405 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationRetryQueueServiceImpl.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/queue/impl/NotificationRetryQueueServiceImpl.java
@@ -74,17 +74,17 @@ public class NotificationRetryQueueServiceImpl implements NotificationRetryQueue
     @Override
     public List<RetryProcessResult> processNotificationMessages(List<Message> messages) {
         Map<String, List<Message>> messagesBySubscription = messages.stream().collect(Collectors.groupingBy(
-            msg -> String.join(":", msg.getMessageAttributes().get("data-partition-id").getStringValue(), msg.getMessageAttributes().get("subscriptionId").getStringValue()),
-            HashMap::new, Collectors.toCollection(ArrayList::new)));
+                msg -> String.join(":", msg.getMessageAttributes().get("data-partition-id").getStringValue(), msg.getMessageAttributes().get("subscriptionId").getStringValue()),
+                HashMap::new, Collectors.toCollection(ArrayList::new)));
 
         return messagesBySubscription.entrySet().parallelStream().map(entry -> {
             try {
                 Optional<Subscription> subscription = subscriptionRepository.getSubscriptionById(entry.getValue().get(0).getMessageAttributes().get("subscriptionId").getStringValue(),
-                                                                                                 entry.getValue().get(0).getMessageAttributes().get("data-partition-id").getStringValue());
+                        entry.getValue().get(0).getMessageAttributes().get("data-partition-id").getStringValue());
                 if (!subscription.isPresent()) {
                     logger.info("Subscription with id {} not found for dataPartitionId {}",
-                                entry.getValue().get(0).getMessageAttributes().get("subscriptionId").getStringValue(),
-                                entry.getValue().get(0).getMessageAttributes().get("data-partition-id").getStringValue());
+                            entry.getValue().get(0).getMessageAttributes().get("subscriptionId").getStringValue(),
+                            entry.getValue().get(0).getMessageAttributes().get("data-partition-id").getStringValue());
                     deleteDbRecords(entry.getValue());
                     return entry.getValue().stream().map(msg -> new RetryProcessResult(msg, NotificationResult.ACK)).collect(Collectors.toList());
                 }
@@ -113,7 +113,7 @@ public class NotificationRetryQueueServiceImpl implements NotificationRetryQueue
                 continue;
             }
             Map<String, String> messageAttributes = message.getMessageAttributes().entrySet().stream().collect(
-                Collectors.toMap(Entry::getKey, attribute -> attribute.getValue().getStringValue()));
+                    Collectors.toMap(Entry::getKey, attribute -> attribute.getValue().getStringValue()));
             try {
                 HttpResponse response = notificationHandler.notifySubscriber(subscription, message.getBody(), messageAttributes);
                 if (!response.isSuccessCode()) {
@@ -122,12 +122,12 @@ public class NotificationRetryQueueServiceImpl implements NotificationRetryQueue
                 } else {
                     processResult.setResult(NotificationResult.ACK);
                     FailedNotificationDoc doc = dynamoDBQueryHelper.loadByPrimaryKey(FailedNotificationDoc.class,
-                                                                                     message.getMessageAttributes().get(FAILED_NOTIFICATION_RECORD_ID).getStringValue());
+                            message.getMessageAttributes().get(FAILED_NOTIFICATION_RECORD_ID).getStringValue());
                     if (doc != null) {
                         FailedNotificationDoc objectToDelete = new FailedNotificationDoc();
                         objectToDelete.setId(message.getMessageAttributes().get(FAILED_NOTIFICATION_RECORD_ID).getStringValue());
                         DynamoDBDeleteExpression deleteExpression = new DynamoDBDeleteExpression()
-                            .withConditionExpression("attribute_exists(id)");
+                                .withConditionExpression("attribute_exists(id)");
                         dynamoDBQueryHelper.deleteByObjectWithCondition(objectToDelete, deleteExpression);
                     }
                 }
@@ -149,8 +149,8 @@ public class NotificationRetryQueueServiceImpl implements NotificationRetryQueue
                 timeout = timeout < SQS_MIN_VISIBILITY_TIMEOUT ? SQS_MIN_VISIBILITY_TIMEOUT : SQS_MAX_VISIBILITY_TIMEOUT;
             }
             entries.add(
-                new ChangeMessageVisibilityBatchRequestEntry(message.getMessageId(), message.getReceiptHandle())
-                    .withVisibilityTimeout(timeout));
+                    new ChangeMessageVisibilityBatchRequestEntry(message.getMessageId(), message.getReceiptHandle())
+                            .withVisibilityTimeout(timeout));
             if (entries.size() == 10) {
                 sqsClient.changeMessageVisibilityBatch(sqsQueueUrl, entries);
                 entries.clear();
@@ -166,12 +166,12 @@ public class NotificationRetryQueueServiceImpl implements NotificationRetryQueue
         DynamoDBQueryHelperV2 dynamoDBQueryHelper = dynamoDBQueryHelperFactory.getQueryHelperUsingSSM(failedNotificationTablePath);
         messages.parallelStream().forEach(message -> {
             FailedNotificationDoc doc = dynamoDBQueryHelper.loadByPrimaryKey(FailedNotificationDoc.class,
-                                                                             message.getMessageAttributes().get(FAILED_NOTIFICATION_RECORD_ID).getStringValue());
+                    message.getMessageAttributes().get(FAILED_NOTIFICATION_RECORD_ID).getStringValue());
             try {
                 FailedNotificationDoc objectToDelete = new FailedNotificationDoc();
                 objectToDelete.setId(message.getMessageAttributes().get(FAILED_NOTIFICATION_RECORD_ID).getStringValue());
                 DynamoDBDeleteExpression deleteExpression = new DynamoDBDeleteExpression()
-                    .withConditionExpression("attribute_exists(id)");
+                        .withConditionExpression("attribute_exists(id)");
                 dynamoDBQueryHelper.deleteByObjectWithCondition(objectToDelete, deleteExpression);
             } catch (Exception e) {
                 logger.info("Failed to delete: {}", e.getMessage());
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/repository/SubscriptionRepository.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/repository/SubscriptionRepository.java
index 51f4897ba..4cecb6736 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/repository/SubscriptionRepository.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/repository/SubscriptionRepository.java
@@ -91,4 +91,4 @@ public class SubscriptionRepository {
         return secret;
     }
 
-}
+}
\ No newline at end of file
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/security/ThreadSignatureService.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/security/ThreadSignatureService.java
index ca530568c..bd54591c5 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/security/ThreadSignatureService.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/security/ThreadSignatureService.java
@@ -63,8 +63,8 @@ public class ThreadSignatureService implements ISignatureService {
             String dataBytesEncoded = Base64.getEncoder().encodeToString(dataBytes);
             StringBuilder output = new StringBuilder();
             output.append(dataBytesEncoded)
-                  .append(".")
-                  .append(DatatypeConverter.printHexBinary(signature).toLowerCase());
+                    .append(".")
+                    .append(DatatypeConverter.printHexBinary(signature).toLowerCase());
 
             return output.toString();
         } catch (Exception ex) {
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/service/AwsNotificationHandler.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/service/AwsNotificationHandler.java
index ea841de6e..96bba5679 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/service/AwsNotificationHandler.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/service/AwsNotificationHandler.java
@@ -78,7 +78,7 @@ public class AwsNotificationHandler {
 
         if (!response.isSuccessCode()) {
             logger.error("Subscriber notification request failed. notificationId={} pushEndpoint={} createdBy={} response={}",
-                         subscription.getNotificationId(), subscription.getPushEndpoint(), subscription.getCreatedBy(), response.getBody());
+                    subscription.getNotificationId(), subscription.getPushEndpoint(), subscription.getCreatedBy(), response.getBody());
         }
         return response;
     }
diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/utils/SQSUtils.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/utils/SQSUtils.java
index 6d86f8e97..c55b2400e 100644
--- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/utils/SQSUtils.java
+++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/utils/SQSUtils.java
@@ -70,7 +70,7 @@ public class SQSUtils {
 
     public List<SendMessageResult> sendMessagesToDeadLetterQueue(String deadLetterQueueUrl, List<Message> messages, AmazonSQS sqsClient) {
         return messages.stream().map(message -> sendMessageToDeadLetterQueue(deadLetterQueueUrl, message, sqsClient))
-                              .collect(Collectors.toList());
+                .collect(Collectors.toList());
 
     }
 
@@ -78,15 +78,15 @@ public class SQSUtils {
 
         Map<String, MessageAttributeValue> messageAttributes = message.getMessageAttributes();
         MessageAttributeValue exceptionAttribute = new MessageAttributeValue()
-            .withDataType("String");
+                .withDataType("String");
 
         exceptionAttribute.setStringValue("Exception message: missing dataPartitionId");
         messageAttributes.put("Exception", exceptionAttribute);
         SendMessageRequest send_msg_request = new SendMessageRequest()
-            .withQueueUrl(deadLetterQueueUrl)
-            .withMessageBody(message.getBody())
-            .withMessageAttributes(messageAttributes);
+                .withQueueUrl(deadLetterQueueUrl)
+                .withMessageBody(message.getBody())
+                .withMessageAttributes(messageAttributes);
         return sqsClient.sendMessage(send_msg_request);
     }
 
-}
+}
\ No newline at end of file
diff --git a/provider/notification-aws/src/main/resources/application.properties b/provider/notification-aws/src/main/resources/application.properties
index 33bc46a2a..4bfd1059f 100644
--- a/provider/notification-aws/src/main/resources/application.properties
+++ b/provider/notification-aws/src/main/resources/application.properties
@@ -1,4 +1,4 @@
-# Copyright � 2020 Amazon Web Services
+# Copyright ? 2020 Amazon Web Services
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/testing/notification-test-aws/pom.xml b/testing/notification-test-aws/pom.xml
index 6c60b2771..445339875 100644
--- a/testing/notification-test-aws/pom.xml
+++ b/testing/notification-test-aws/pom.xml
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>org.opengroup.osdu</groupId>
             <artifactId>os-core-common</artifactId>
-            <version>0.3.6</version>
+            <version>0.21.0</version>
         </dependency>
 
         <dependency>
diff --git a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/LegalTagUtils.java b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/LegalTagUtils.java
new file mode 100644
index 000000000..086093862
--- /dev/null
+++ b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/LegalTagUtils.java
@@ -0,0 +1,65 @@
+package org.opengroup.osdu.notification.subscriptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.http.HttpStatus;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.sun.jersey.api.client.ClientResponse;
+import org.opengroup.osdu.notification.util.TestUtils;
+
+import java.util.UUID;
+
+public class LegalTagUtils {
+
+    public static ClientResponse create(String legalTagName, String token, boolean isTestPartition) throws Exception {
+        return create("US", legalTagName, "2099-01-25", "Public Domain Data", token, isTestPartition);
+    }
+
+    protected static ClientResponse create(String countryOfOrigin, String name, String expDate, String dataType, String token, boolean isTestPartition)
+            throws Exception {
+        String body = getBody(countryOfOrigin, name, expDate, dataType);
+        ClientResponse response = StorageTestUtils.send(getLegalUrl(), "legaltags", "POST", StorageTestUtils.getHeaders(TenantUtils.getTenantName(isTestPartition), token, UUID.randomUUID().toString(), isTestPartition), body,
+                "");
+
+        assertEquals(HttpStatus.SC_CREATED, response.getStatus());
+        Thread.sleep(100);
+        return response;
+    }
+
+    public static ClientResponse delete(String legalTagName, String token, boolean isTestPartition) throws Exception {
+        return StorageTestUtils.send(getLegalUrl(), "legaltags/" + legalTagName, "DELETE", StorageTestUtils.getHeaders(TenantUtils.getTenantName(isTestPartition), token, UUID.randomUUID().toString(), isTestPartition), "", "");
+    }
+
+    protected static String getLegalUrl() {
+        String legalUrl = System.getProperty("LEGAL_URL", System.getenv("LEGAL_URL"));
+        if (legalUrl == null || legalUrl.contains("-null")) {
+            legalUrl = "https://os-legal-dot-opendes.appspot.com/api/legal/v1/";
+        }
+        return legalUrl;
+    }
+
+    protected static String getBody(String countryOfOrigin, String name, String expDate, String dataType) {
+
+        JsonArray coo = new JsonArray();
+        coo.add(countryOfOrigin);
+
+        JsonObject properties = new JsonObject();
+        properties.add("countryOfOrigin", coo);
+        properties.addProperty("contractId", "A1234");
+        properties.addProperty("expirationDate", expDate);
+        properties.addProperty("dataType", dataType);
+        properties.addProperty("originator", "MyCompany");
+        properties.addProperty("securityClassification", "Public");
+        properties.addProperty("exportClassification", "EAR99");
+        properties.addProperty("personalData", "No Personal Data");
+
+        JsonObject tag = new JsonObject();
+        tag.addProperty("name", name);
+        tag.addProperty("description", "test for " + name);
+        tag.add("properties", properties);
+
+        return tag.toString();
+    }
+}
diff --git a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/RecordUtils.java b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/RecordUtils.java
new file mode 100644
index 000000000..3c14f0b4d
--- /dev/null
+++ b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/RecordUtils.java
@@ -0,0 +1,93 @@
+package org.opengroup.osdu.notification.subscriptions;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import org.opengroup.osdu.core.common.Constants;
+
+public class RecordUtils {
+
+    private static final String domain = System.getProperty("DOMAIN", System.getenv("DOMAIN"));
+
+    public static String createJsonRecordWithReference(int recordsCount, String id, String kind, String legalTag, String fromCrs, String conversionType, boolean isTestPartition) {
+
+        JsonArray records = new JsonArray();
+
+        for (int i = 0; i < recordsCount; i++) {
+
+            JsonObject data = new JsonObject();
+            data.addProperty("X", 16.00);
+            data.addProperty("Y", 10.00);
+            data.addProperty("Z", 0.0);
+
+            JsonArray propertyNames = new JsonArray();
+            propertyNames.add("X");
+            propertyNames.add("Y");
+            propertyNames.add("Z");
+
+            JsonObject meta = new JsonObject();
+            meta.addProperty(Constants.KIND, conversionType);
+            meta.addProperty(Constants.PERSISTABLE_REFERENCE, fromCrs);
+            meta.add(Constants.PROPERTY_NAMES, propertyNames);
+
+            JsonArray metaBlocks = new JsonArray();
+            metaBlocks.add(meta);
+
+            JsonObject record = getRecordWithInputData(id + i, kind, legalTag, data, isTestPartition);
+            record.add(Constants.META, metaBlocks);
+
+            records.add(record);
+        }
+
+        return records.toString();
+    }
+
+    private static JsonObject getRecordWithInputData(String id, String kind, String legalTag, JsonObject data, boolean isTestPartition) {
+        JsonObject record = getDefaultRecord(id, kind, legalTag, isTestPartition);
+        record.add("data", data);
+        return record;
+    }
+
+    private static JsonObject getDefaultRecord(String id, String kind, String legalTag, boolean isTestPartition) {
+        JsonArray acls = new JsonArray();
+        acls.add(String.format("data.test1@%s", getAclSuffix(isTestPartition)));
+        return getDefaultRecordFromAcl(id, kind, legalTag, acls);
+    }
+
+    private static JsonObject getDefaultRecordFromAcl(String id, String kind, String legalTag, JsonArray acls) {
+        JsonObject acl = new JsonObject();
+        acl.add("viewers", acls);
+        acl.add("owners", acls);
+
+        JsonArray tags = new JsonArray();
+        tags.add(legalTag);
+
+        JsonArray ordcJson = new JsonArray();
+        ordcJson.add("BR");
+
+        JsonObject legal = new JsonObject();
+        legal.add("legaltags", tags);
+        legal.add("otherRelevantDataCountries", ordcJson);
+
+        JsonObject record = new JsonObject();
+        record.addProperty("id", id);
+        record.addProperty("kind", kind);
+        record.add("acl", acl);
+        record.add("legal", legal);
+        return record;
+    }
+
+    public static final String getAclSuffix(boolean isTestPartition) {
+        String environment = getEnvironment();
+        //build.gradle currently throws exception if a variable is set to empty or not set at all
+        //workaround by setting it to an "empty" string to construct the url
+        if (environment.equalsIgnoreCase("empty")) environment = "";
+        if (!environment.isEmpty())
+            environment = "." + environment;
+
+        return String.format("%s%s.%s", TenantUtils.getTenantName(isTestPartition), environment, domain);
+    }
+
+    public static String getEnvironment() {
+        return System.getProperty("DEPLOY_ENV", System.getenv("DEPLOY_ENV"));
+    }
+}
diff --git a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/StorageTestUtils.java b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/StorageTestUtils.java
new file mode 100644
index 000000000..befe02863
--- /dev/null
+++ b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/StorageTestUtils.java
@@ -0,0 +1,124 @@
+package org.opengroup.osdu.notification.subscriptions;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import org.opengroup.osdu.core.common.model.http.DpsHeaders;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import javax.ws.rs.core.MediaType;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
+import java.util.*;
+
+public class StorageTestUtils {
+
+    public static ClientResponse send(String path, String httpMethod, Map<String, String> headers, String requestBody,
+                                      String query) throws Exception {
+
+        log(httpMethod, StorageTestUtils.getApiPath(path + query), headers, requestBody);
+        Client client = StorageTestUtils.getClient();
+
+        WebResource webResource = client.resource(StorageTestUtils.getApiPath(path + query));
+
+        WebResource.Builder builder = webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON);
+        headers.forEach(builder::header);
+
+        return builder.method(httpMethod, ClientResponse.class, requestBody);
+    }
+
+    public static ClientResponse send(String url, String path, String httpMethod, Map<String, String> headers,
+                                      String requestBody, String query) throws Exception {
+
+        log(httpMethod, url + path, headers, requestBody);
+        Client client = StorageTestUtils.getClient();
+
+        WebResource webResource = client.resource(url + path);
+        WebResource.Builder builder = webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON);
+        headers.forEach(builder::header);
+
+        return builder.method(httpMethod, ClientResponse.class, requestBody);
+    }
+
+    private static void log(String method, String url, Map<String, String> headers, String body) {
+        System.out.println(String.format("%s: %s", method, url));
+        System.out.println(body);
+    }
+
+    public static String getApiPath(String api) throws Exception {
+        String baseUrl = System.getProperty("STORAGE_URL", System.getenv("STORAGE_URL"));
+        if (baseUrl == null || baseUrl.contains("-null")) {
+            baseUrl = "https://localhost:8443/api/storage/v2/";
+        }
+        URL mergedURL = new URL(baseUrl + api);
+        System.out.println(mergedURL.toString());
+        return mergedURL.toString();
+    }
+
+    protected static Client getClient() {
+        TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
+            @Override
+            public X509Certificate[] getAcceptedIssuers() {
+                return null;
+            }
+
+            @Override
+            public void checkClientTrusted(X509Certificate[] certs, String authType) {
+            }
+
+            @Override
+            public void checkServerTrusted(X509Certificate[] certs, String authType) {
+            }
+        }};
+
+        try {
+            SSLContext sc = SSLContext.getInstance("TLS");
+            sc.init(null, trustAllCerts, new SecureRandom());
+            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+        } catch (Exception e) {
+        }
+        allowMethods("PATCH");
+        return Client.create();
+    }
+
+    private static void allowMethods(String... methods) {
+        try {
+            Field methodsField = HttpURLConnection.class.getDeclaredField("methods");
+
+            Field modifiersField = Field.class.getDeclaredField("modifiers");
+            modifiersField.setAccessible(true);
+            modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL);
+
+            methodsField.setAccessible(true);
+
+            String[] oldMethods = (String[]) methodsField.get(null);
+            Set<String> methodsSet = new LinkedHashSet<>(Arrays.asList(oldMethods));
+            methodsSet.addAll(Arrays.asList(methods));
+            String[] newMethods = methodsSet.toArray(new String[0]);
+
+            methodsField.set(null/*static field*/, newMethods);
+        } catch (NoSuchFieldException | IllegalAccessException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public static Map<String, String> getHeaders(String tenantName, String token, String correlationId, boolean isTestPartition) {
+        Map<String, String> headers = new HashMap<>();
+        if(tenantName == null || tenantName.isEmpty()) {
+            tenantName = TenantUtils.getTenantName(false);
+        }
+        headers.put("data-partition-id", TenantUtils.getTenantName(isTestPartition));
+        headers.put("Authorization", token);
+
+        System.out.printf("Using correlation-id for the request: %s \n", correlationId);
+        headers.put("correlation-id", correlationId);
+        return headers;
+    }
+}
diff --git a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TenantUtils.java b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TenantUtils.java
new file mode 100644
index 000000000..182461b86
--- /dev/null
+++ b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TenantUtils.java
@@ -0,0 +1,10 @@
+package org.opengroup.osdu.notification.subscriptions;
+
+public class TenantUtils {
+
+    public static String getTenantName(boolean isTestPartition) {
+        return isTestPartition ?
+                TestNotificationsEndpoint.PARTITION_TEST
+                : System.getProperty("OSDU_TENANT", System.getenv("OSDU_TENANT"));
+    }
+}
diff --git a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java
new file mode 100644
index 000000000..de53e60c3
--- /dev/null
+++ b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java
@@ -0,0 +1,157 @@
+package org.opengroup.osdu.notification.subscriptions;
+
+import com.sun.jersey.api.client.ClientResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.opengroup.osdu.core.common.model.http.DpsHeaders;
+import org.opengroup.osdu.core.common.model.notification.HmacSecret;
+import org.opengroup.osdu.core.common.model.notification.Subscription;
+import org.opengroup.osdu.core.common.notification.ISubscriptionService;
+import org.opengroup.osdu.core.common.notification.SubscriptionAPIConfig;
+import org.opengroup.osdu.core.common.notification.SubscriptionException;
+import org.opengroup.osdu.core.common.notification.SubscriptionFactory;
+import org.opengroup.osdu.notification.util.*;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestNotificationsEndpoint extends TestBase {
+
+    private String subscriptionId = null;
+    private ISubscriptionService awssubscriptionService;
+    private TestUtils testUtils;
+    private static SubscriptionFactory awsfactory;
+
+    private static final long NOW = System.currentTimeMillis();
+    private static final String RECORD_ID_PREFIX = TenantUtils.getTenantName(false) + ":query:";
+    private static final String RECORD_ID_PREFIX_TEST = TenantUtils.getTenantName(true) + ":query:";
+    private static final String KIND = TenantUtils.getTenantName(false) + ":ds:query:1.0." + NOW;
+    private static final String KIND_TEST = TenantUtils.getTenantName(true) + ":ds:query:1.0." + NOW;
+    private static final String LEGAL_TAG = TenantUtils.getTenantName(false) + "-storage-" + System.currentTimeMillis();
+    private static final String LEGAL_TAG_TEST = TenantUtils.getTenantName(true) + "-storage-" + System.currentTimeMillis();
+
+    protected static final String PARTITION_TEST = "performance-test";
+
+    protected static final String PERSISTABLE_REFERENCE = "%7B%22LB_CRS%22%3A%22%257B%2522WKT%2522%253A%2522PROJCS%255B%255C%2522British_National_Grid%255C%2522%252CGEOGCS%255B%255C%2522GCS_OSGB_1936%255C%2522%252CDATUM%255B%255C%2522D_OSGB_1936%255C%2522%252CSPHEROID%255B%255C%2522Airy_1830%255C%2522%252C6377563.396%252C299.3249646%255D%255D%252CPRIMEM%255B%255C%2522Greenwich%255C%2522%252C0.0%255D%252CUNIT%255B%255C%2522Degree%255C%2522%252C0.0174532925199433%255D%255D%252CPROJECTION%255B%255C%2522Transverse_Mercator%255C%2522%255D%252CPARAMETER%255B%255C%2522False_Easting%255C%2522%252C400000.0%255D%252CPARAMETER%255B%255C%2522False_Northing%255C%2522%252C-100000.0%255D%252CPARAMETER%255B%255C%2522Central_Meridian%255C%2522%252C-2.0%255D%252CPARAMETER%255B%255C%2522Scale_Factor%255C%2522%252C0.9996012717%255D%252CPARAMETER%255B%255C%2522Latitude_Of_Origin%255C%2522%252C49.0%255D%252CUNIT%255B%255C%2522Meter%255C%2522%252C1.0%255D%252CAUTHORITY%255B%255C%2522EPSG%255C%2522%252C27700%255D%255D%2522%252C%2522Type%2522%253A%2522LBCRS%2522%252C%2522EngineVersion%2522%253A%2522PE_10_3_1%2522%252C%2522AuthorityCode%2522%253A%257B%2522Authority%2522%253A%2522EPSG%2522%252C%2522Code%2522%253A%252227700%2522%257D%252C%2522Name%2522%253A%2522British_National_Grid%2522%257D%22%2C%22TRF%22%3A%22%257B%2522WKT%2522%253A%2522GEOGTRAN%255B%255C%2522OSGB_1936_To_WGS_1984_Petroleum%255C%2522%252CGEOGCS%255B%255C%2522GCS_OSGB_1936%255C%2522%252CDATUM%255B%255C%2522D_OSGB_1936%255C%2522%252CSPHEROID%255B%255C%2522Airy_1830%255C%2522%252C6377563.396%252C299.3249646%255D%255D%252CPRIMEM%255B%255C%2522Greenwich%255C%2522%252C0.0%255D%252CUNIT%255B%255C%2522Degree%255C%2522%252C0.0174532925199433%255D%255D%252CGEOGCS%255B%255C%2522GCS_WGS_1984%255C%2522%252CDATUM%255B%255C%2522D_WGS_1984%255C%2522%252CSPHEROID%255B%255C%2522WGS_1984%255C%2522%252C6378137.0%252C298.257223563%255D%255D%252CPRIMEM%255B%255C%2522Greenwich%255C%2522%252C0.0%255D%252CUNIT%255B%255C%2522Degree%255C%2522%252C0.0174532925199433%255D%255D%252CMETHOD%255B%255C%2522Position_Vector%255C%2522%255D%252CPARAMETER%255B%255C%2522X_Axis_Translation%255C%2522%252C446.448%255D%252CPARAMETER%255B%255C%2522Y_Axis_Translation%255C%2522%252C-125.157%255D%252CPARAMETER%255B%255C%2522Z_Axis_Translation%255C%2522%252C542.06%255D%252CPARAMETER%255B%255C%2522X_Axis_Rotation%255C%2522%252C0.15%255D%252CPARAMETER%255B%255C%2522Y_Axis_Rotation%255C%2522%252C0.247%255D%252CPARAMETER%255B%255C%2522Z_Axis_Rotation%255C%2522%252C0.842%255D%252CPARAMETER%255B%255C%2522Scale_Difference%255C%2522%252C-20.489%255D%252CAUTHORITY%255B%255C%2522EPSG%255C%2522%252C1314%255D%255D%2522%252C%2522Type%2522%253A%2522STRF%2522%252C%2522EngineVersion%2522%253A%2522PE_10_3_1%2522%252C%2522AuthorityCode%2522%253A%257B%2522Authority%2522%253A%2522EPSG%2522%252C%2522Code%2522%253A%25221314%2522%257D%252C%2522Name%2522%253A%2522OSGB_1936_To_WGS_1984_Petroleum%2522%257D%22%2C%22Type%22%3A%22EBCRS%22%2C%22EngineVersion%22%3A%22PE_10_3_1%22%2C%22Name%22%3A%22OSGB+1936+*+UKOOA-Pet+%2F+British+National+Grid+%5B27700%2C1314%5D%22%2C%22AuthorityCode%22%3A%7B%22Authority%22%3A%22MyCompany%22%2C%22Code%22%3A%2227700006%22%7D%7D";
+    @BeforeClass
+    public static void classSetup() {
+        SubscriptionAPIConfig config = SubscriptionAPIConfig.builder().rootUrl(Config.Instance().RegisterServicePath).build();
+        awsfactory = new SubscriptionFactory(config);
+    }
+
+    @Before
+    public void setup() throws Exception {
+        this.testUtils = new AwsTestUtils();
+    }
+
+    @After
+    @Override
+    public void tearDown() throws Exception {
+        //LegalTagUtils.delete(LEGAL_TAG, testUtils.getOpsToken());
+        this.testUtils = null;
+    }
+
+    private void createResource() throws Exception {
+        Map<String, String> headers = new HashMap<>();
+        headers.put(DpsHeaders.DATA_PARTITION_ID, TestUtils.getOsduTenant());
+        headers.put(DpsHeaders.AUTHORIZATION, testUtils.getOpsToken());
+        //hardcoding user here for 200 response tests. This is just initializing the subscription creation
+        headers.put("x-user-id", AwsConfig.getAWSCognitoUser());
+        DpsHeaders dpsHeaders = DpsHeaders.createFromMap(headers);
+        awssubscriptionService = awsfactory.create(dpsHeaders);
+
+        Map<String,String> h = dpsHeaders.getHeaders();
+        System.out.println(h);
+
+
+        //Create a new subscription to pub/sub
+        Subscription subscription = new Subscription();
+        subscription.setName("Subscription-test-for-notification");
+        subscription.setDescription("Subscription test for fetching notifications");
+        subscription.setTopic(Config.Instance().Topic);
+        //This seems to be a bug. Don't need to add the string
+        //subscription.setPushEndpoint(Config.Instance().HMACPushUrl + "hmac-integration-test");
+        subscription.setPushEndpoint(Config.Instance().HMACPushUrl);
+        HmacSecret secret = new HmacSecret();
+        secret.setValue(Config.Instance().hmacSecretValue);
+
+        subscription.setSecret(secret);
+        try {
+            Subscription subscriptionCreated = awssubscriptionService.create(subscription);
+
+            String notificationId = subscriptionCreated.getNotificationId();
+            subscriptionId = subscriptionCreated.getId();
+            Config.Instance().NotificationId = notificationId;
+        }catch (SubscriptionException e){
+            System.out.println("Subscription exception inner response : " + e.getHttpResponse());
+            throw e;
+        }
+    }
+
+    private ClientResponse createStorageRecord(final String correlationId) throws Exception {
+        String recordId = RECORD_ID_PREFIX + UUID.randomUUID().toString();
+        String jsonInput = RecordUtils.createJsonRecordWithReference(1, recordId, KIND, LEGAL_TAG, PERSISTABLE_REFERENCE, "CRS", false);
+        return StorageTestUtils.send("records", "PUT", StorageTestUtils.getHeaders(TenantUtils.getTenantName(false), testUtils.getAdminToken(), correlationId, false), jsonInput, "");
+    }
+
+    private ClientResponse createStorageRecordForTestPartition(final String correlationId) throws Exception {
+        String recordId = RECORD_ID_PREFIX_TEST + UUID.randomUUID().toString();
+        String jsonInput = RecordUtils.createJsonRecordWithReference(1, recordId, KIND_TEST, LEGAL_TAG_TEST, PERSISTABLE_REFERENCE, "CRS", true);
+        return StorageTestUtils.send("records", "PUT", StorageTestUtils.getHeaders(TenantUtils.getTenantName(true), testUtils.getAdminToken(), correlationId, true), jsonInput, "");
+    }
+
+    @Test
+    public void testVerifyNotificationReceivedWhenDataPartitionIdIsDifferent() throws Exception {
+        try {
+            LegalTagUtils.create(LEGAL_TAG_TEST, testUtils.getOpsToken(), true);
+            createResource();
+            final String correlationId = UUID.randomUUID().toString();
+            ClientResponse response = createStorageRecordForTestPartition(correlationId);
+            assertEquals(201, response.getStatus());
+            //Executing notifications response to endpoints takes an upper bound of 120s.
+            Thread.sleep(120000);
+
+            //Run Bash File to fetch logs from register endpoint and verify that notification was received
+            String bashFileToExecute = "src/test/java/org/opengroup/osdu/notification/subscriptions/verify_register-logs.sh " + correlationId;
+            Process process = Runtime.getRuntime().exec(bashFileToExecute);
+            process.waitFor();
+            int exitValue = process.exitValue();
+            assertEquals(exitValue, 1);
+        } catch (Exception e) {
+            System.out.println("Error while verifying notification service" + e);
+        } finally {
+            awssubscriptionService.delete(subscriptionId);
+            LegalTagUtils.delete(LEGAL_TAG_TEST, testUtils.getOpsToken(), true);
+        }
+    }
+
+    @Test
+    public void testVerifyNotificationReceivedWhenDataPartitionIdIsSame() throws Exception {
+        try {
+            LegalTagUtils.create(LEGAL_TAG, testUtils.getOpsToken(), false);
+            createResource();
+            final String correlationId = UUID.randomUUID().toString();
+            ClientResponse response = createStorageRecord(correlationId);
+            assertEquals(201, response.getStatus());
+            //Executing notifications response to endpoints takes an upper bound of 120s.
+            Thread.sleep(120000);
+
+            //Run Bash File to fetch logs from register endpoint and verify that notification was received
+            String bashFileToExecute = "src/test/java/org/opengroup/osdu/notification/subscriptions/verify_register-logs.sh " + correlationId;
+            Process process = Runtime.getRuntime().exec(bashFileToExecute);
+            process.waitFor();
+            int exitValue = process.exitValue();
+            assertEquals(exitValue, 0);
+        } catch (Exception e) {
+            System.out.println("Error while verifying notification service" + e);
+        } finally {
+            awssubscriptionService.delete(subscriptionId);
+            LegalTagUtils.delete(LEGAL_TAG_TEST, testUtils.getOpsToken(), false);
+        }
+    }
+}
diff --git a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/verify_register-logs.sh b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/verify_register-logs.sh
new file mode 100644
index 000000000..6832babe4
--- /dev/null
+++ b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/verify_register-logs.sh
@@ -0,0 +1,8 @@
+register_pod=$(kubectl get pods --all-namespaces -o=jsonpath='{range .items..metadata}{.name}{"\n"}{end}' | fgrep os-register-)
+register_logs=$(kubectl logs $register_pod -n osdu-instance-$OSDU_INSTANCE_NAME-core --since=2m)
+
+if echo $register_logs | grep $1; then
+  return 0
+else
+  return 1
+fi
\ No newline at end of file
-- 
GitLab