From f5098a5db98e81b31fc128ae790aed3af0f36aac Mon Sep 17 00:00:00 2001 From: nikhilsingh <nikhilsingh@microsoft.com> Date: Thu, 1 Jul 2021 12:20:47 +0530 Subject: [PATCH] Commit 6 Contents: 1-Response code correction and Config addition for wait time --- .../org/opengroup/osdu/notification/api/PubsubEndpoint.java | 2 +- .../java/org/opengroup/osdu/notification/auth/GsaAuth.java | 4 ---- .../java/org/opengroup/osdu/notification/auth/HmacAuth.java | 4 ---- .../osdu/notification/service/NotificationHandler.java | 2 +- 4 files changed, 2 insertions(+), 10 deletions(-) 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 667634044..558bc0480 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 @@ -55,7 +55,7 @@ public class PubsubEndpoint { HttpResponse response = notificationHandler.notifySubscriber(notificationId, pubsubMessage, headerAttributes); if (!response.isSuccessCode()) { this.log.error(NOT_ACKNOWLEDGE); - return new ResponseEntity<String>(NOT_ACKNOWLEDGE, HttpStatus.INTERNAL_SERVER_ERROR); + return new ResponseEntity<String>(NOT_ACKNOWLEDGE, HttpStatus.valueOf(response.getResponseCode())); } this.log.info(ACKNOWLEDGE); return new ResponseEntity<String>(ACKNOWLEDGE, HttpStatus.OK); diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/auth/GsaAuth.java b/notification-core/src/main/java/org/opengroup/osdu/notification/auth/GsaAuth.java index 0cd7c7c51..38618efa2 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/auth/GsaAuth.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/auth/GsaAuth.java @@ -35,22 +35,18 @@ public class GsaAuth implements SecretAuth { private GsaSecret gsaSecret; - @Override public void setSecret(Secret secret) { this.gsaSecret = (GsaSecret) secret; } - @Override public Secret getSecret() { return this.gsaSecret; } - @Override public String getPushUrl(String endpoint) throws Exception { return endpoint; } - @Override public Map<String, String> getRequestHeaders() { Map<String, String> requestHeader = new HashMap<>(); if (gsaSecret != null) { diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/auth/HmacAuth.java b/notification-core/src/main/java/org/opengroup/osdu/notification/auth/HmacAuth.java index 0973b14de..6eeaf1eda 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/auth/HmacAuth.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/auth/HmacAuth.java @@ -32,17 +32,14 @@ public class HmacAuth implements SecretAuth { private HmacSecret hmacSecret; - @Override public void setSecret(Secret secret) { this.hmacSecret = (HmacSecret) secret; } - @Override public Secret getSecret() { return this.hmacSecret; } - @Override public String getPushUrl(String endpoint) throws Exception { String pushUrl = endpoint; try { @@ -54,7 +51,6 @@ public class HmacAuth implements SecretAuth { return pushUrl; } - @Override public Map<String, String> getRequestHeaders() { Map<String, String> requestHeader = new HashMap<>(); return requestHeader; diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/service/NotificationHandler.java b/notification-core/src/main/java/org/opengroup/osdu/notification/service/NotificationHandler.java index ed8ff039b..124af890e 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/service/NotificationHandler.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/service/NotificationHandler.java @@ -41,7 +41,7 @@ public class NotificationHandler { private SubscriptionHandler subscriptionHandler; @Autowired private AuthFactory authFactory; - @Value("${app.expireTime:30000}") + @Value("${app.waitingTime:30000}") private int WAITING_TIME ; public HttpResponse notifySubscriber(String notificationId, String pubsubMessage, Map<String, String> headerAttributes) throws Exception { -- GitLab