summaryrefslogtreecommitdiffstats
path: root/asdctool/src
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool/src')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java18
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java2
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java4
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java6
4 files changed, 17 insertions, 13 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
index 8c704357ff..03f3e41bd9 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
@@ -381,7 +381,7 @@ public class ArtifactUuidFix {
return true;
}
- if (artifacts.size() < artifactsUuid.size()) {
+ if ((artifactsUuid != null) && (artifacts.size() < artifactsUuid.size())) {
log.info(" artifacts.size() < artifactsUuid.size() group {} in resource {} ", gr.getName(), resourceName);
return true;
}
@@ -391,7 +391,7 @@ public class ArtifactUuidFix {
gr.getName(), resourceName);
return true;
}
- if (artifactsUuid.contains(null)) {
+ if (artifactsUuid != null && artifactsUuid.contains(null)) {
log.info(" artifactsUuid.contains(null) group {} in resource {} ", gr.getName(), resourceName);
return true;
}
@@ -412,7 +412,7 @@ public class ArtifactUuidFix {
artifactlabel, artifactId, gr.getName(), resourceName);
return true;
}
- if (!artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
+ if (artifactsUuid != null && !artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
log.info(
" artifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} group {} in resource {} ",
artifactlabel, gr.getName(), resourceName);
@@ -454,7 +454,7 @@ public class ArtifactUuidFix {
instArtifatIdSet.addAll(instArtifactsId);
}
- if (artifacts.size() < artifactsUuid.size()) {
+ if ((artifactsUuid != null) && (artifacts.size() < artifactsUuid.size())) {
log.info(" artifacts.size() < artifactsUuid.size() inst {} in service {} ", instName, servicename);
return true;
}
@@ -464,7 +464,7 @@ public class ArtifactUuidFix {
instName, servicename);
return true;
}
- if (artifactsUuid.contains(null)) {
+ if (artifactsUuid != null && artifactsUuid.contains(null)) {
log.info(" artifactsUuid.contains(null) inst {} in service {} ", instName, servicename);
return true;
}
@@ -496,7 +496,7 @@ public class ArtifactUuidFix {
artifactlabel, artifactId, instName, servicename);
return true;
}
- if (!artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
+ if (artifactsUuid != null && !artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
log.info(
" artifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} inst {} in service {} ",
artifactlabel, instName, servicename);
@@ -522,7 +522,7 @@ public class ArtifactUuidFix {
return true;
}
}
- if(vfModule != null ){
+ if(vfModule != null && artifactsUuid != null){
return isProblematicVFModule(vfModule, artifactsUuid, instArtifactsUuid);
}
@@ -658,7 +658,7 @@ public class ArtifactUuidFix {
writer.flush();
}
} catch (IOException e) {
- log.error(e.getMessage());
+ log.error(e.getMessage());
} finally {
titanDao.commit();
}
@@ -1043,7 +1043,7 @@ public class ArtifactUuidFix {
}
} catch (IOException e) {
- log.error(e.getMessage());
+ log.error(e.getMessage());
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
index 48421639bf..ebd2e2e108 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
@@ -159,7 +159,7 @@ public class DataMigration {
try {
elasticSearchClient.initialize();
} catch (URISyntaxException e) {
- e.printStackTrace();
+ log.error(e.getMessage());
return false;
}
return true;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
index de23c69a3a..d8b8936dca 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
@@ -76,7 +76,9 @@ public class ProductLogic {
return productsToDelete;
} catch (Exception e) {
log.info("get All Products failed - {}" , e);
- graph.tx().rollback();
+ if(graph != null) {
+ graph.tx().rollback();
+ }
return null;
} finally {
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java
index 08de0eb951..982c85b060 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.asdctool.impl;
+import static org.junit.Assert.assertFalse;
import org.junit.Test;
public class ProductLogicTest {
@@ -8,7 +9,7 @@ public class ProductLogicTest {
return new ProductLogic();
}
- @Test(expected=NullPointerException.class)
+ @Test
public void testDeleteAllProducts() throws Exception {
ProductLogic testSubject;
String titanFile = "";
@@ -20,5 +21,6 @@ public class ProductLogicTest {
// default test
testSubject = createTestSubject();
result = testSubject.deleteAllProducts(titanFile, beHost, bePort, adminUser);
+ assertFalse(result);
}
-} \ No newline at end of file
+}