Fix cds error regex and add logging 56/1156/1
authorSerban Jora <sj2381@att.com>
Thu, 1 Mar 2018 20:35:00 +0000 (15:35 -0500)
committerSerban Jora <sj2381@att.com>
Thu, 1 Mar 2018 20:35:07 +0000 (15:35 -0500)
Change-Id: I38a567fd9c1d844a36665af59eee80b2d9d17e62
Signed-off-by: Serban Jora <sj2381@att.com>
Issue-ID: MODELING-276

gateway/src/main/java/org/acumos/federation/gateway/adapter/PeerGateway.java
gateway/src/main/java/org/acumos/federation/gateway/common/JsonResponse.java
gateway/src/main/java/org/acumos/federation/gateway/task/PeerSubscriptionTaskScheduler.java
gateway/src/main/java/org/acumos/federation/gateway/util/Errors.java

index 44f123c..99d8466 100644 (file)
@@ -170,6 +170,8 @@ public class PeerGateway {
                                                localSolution = createMLPSolution(peerSolution, cdsClient);
                                        }
                                        else {
+                                               log.info(EELFLoggerDelegate.debugLogger, "Solution Id : " + peerSolution.getSolutionId()
+                                                               + " exists locally, updating local catalog ");
                                                localSolution = updateMLPSolution(peerSolution, localSolution, cdsClient);
                                        }
 
index 8caf452..908f297 100644 (file)
@@ -39,7 +39,6 @@ public class JsonResponse<T> implements Serializable {
         * Was there an error ?
         */
        @JsonProperty(value = JSONTags.TAG_RESPONSE_ERROR)
-       //private Boolean error;
        private String error;
 
        /**
@@ -53,15 +52,7 @@ public class JsonResponse<T> implements Serializable {
         */
        @JsonProperty(value = JSONTags.TAG_RESPONSE_CONTENT)
        private T content;
-/*
-       public Boolean isError() {
-               return this.error;
-       }
-
-       public void setError(Boolean isError) {
-               this.error = isError;
-       }
-*/
+       
        public String getError() {
                return this.error;
        }
@@ -106,7 +97,7 @@ public class JsonResponse<T> implements Serializable {
                private JsonResponse<T> response = new JsonResponse();
 
                public JsonResponseBuilder() {
-                       this.response.setError(Boolean.FALSE.toString());
+                       this.response.setError(null);
                }
 
                public JsonResponseBuilder<T>   withMessage(String theMessage) {
@@ -146,7 +137,7 @@ public class JsonResponse<T> implements Serializable {
                }
                
                public JsonErrorResponseBuilder<T>      withError(Throwable theError) {
-                       this.response.setMessage(theError.toString());
+                       this.response.setError(theError.toString());
                        return this;
                }
 
index ab131b4..7ed4b3c 100644 (file)
@@ -138,6 +138,9 @@ public class PeerSubscriptionTaskScheduler {
                for (MLPPeer mlpPeer : mlpPeers) {
                        log.info(EELFLoggerDelegate.debugLogger, "checkPeer : " + mlpPeer);
 
+                       if (mlpPeer.isSelf())
+                               continue;
+
                        // cancel peer tasks for inactive peers
                        if (PeerStatus.Active != PeerStatus.forCode(mlpPeer.getStatusCode())) {
                                // cancel all peer sub tasks for this peer
index ab3b5fa..92efa4b 100644 (file)
@@ -35,7 +35,7 @@ public class Errors {
        private static Pattern cdsNotFoundPattern = null;
        {
                try {
-                       cdsNotFoundPattern = Pattern.compile("No (.*) for ID (.*)");
+                       cdsNotFoundPattern = Pattern.compile("No (.*) with ID (.*)");
                }
                catch (PatternSyntaxException psx) {
                        throw new RuntimeException("Invalid error pattern", psx);