fix artifact update condition 17/417/1
authorSerban Jora <sj2381@att.com>
Wed, 10 Jan 2018 00:40:48 +0000 (19:40 -0500)
committerSerban Jora <sj2381@att.com>
Wed, 10 Jan 2018 00:40:59 +0000 (19:40 -0500)
Change-Id: If844b885ab33f18c0ba2d5724eecebdbb5f22ab1
Signed-off-by: Serban Jora <sj2381@att.com>
gateway/src/main/java/org/acumos/federation/gateway/adapter/PeerGateway.java

index 61f6e15..c8c81ab 100644 (file)
@@ -429,19 +429,22 @@ public class PeerGateway {
                                                                                                                cdsClient);
                                        }
                                        else {
-                                               //an update might not actually be necessary but we cannot compare
-                                               //timestamps as they are locally generated 
-                                               localArtifact = updateMLPArtifact(peerArtifact, localArtifact, cdsClient);
+                                               //check version
+                                               if (!peerArtifact.getVersion().equals(localArtifact.getVersion())) {
+                                                       localArtifact = updateMLPArtifact(peerArtifact, localArtifact, cdsClient);
+                                               }
+                                               else {
+                                                       //mark the fact that loca artifact does not need an update
+                                                       localArtifact = null;
+                                               }
                                        }
 
                                        //TODO: add the delete of those who are not available anymore
 
-                                       //if (localArtifact == null) {
-                                               //not transactional .. hard to recover from, we'll re-attempt
-                                               //next time we process the enclosing solution/revision (should be
-                                               //marked accordingly)
-                                               //if anything happened an exception 
-                                       //}
+                                       if (localArtifact == null) {
+                                               //the artifact does not need an update
+                                               continue;
+                                       }
 
                                        //artifacts file download and push it to nexus: we continue here 
                                        //as we persisted the peer URI