summaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools
diff options
context:
space:
mode:
authorDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-14 19:14:21 +0530
committerDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-18 17:26:38 +0530
commit396cb378ab8940b1adb8ba1adc656d0b4ad66f99 (patch)
treeb4f6ddc8e7cdfe39bfcbdc75cff7e85c284c5b65 /openecomp-be/tools
parent27f5c2b105676eebb477714fd7323467151965d2 (diff)
Fixed SONAR issues
Fixed blocker, critical, major & minor SONAR issues. Issue-ID: SDC-343 Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926 Signed-off-by: dd4616 <Divesh.Mirchandani@amdocs.com>
Diffstat (limited to 'openecomp-be/tools')
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java55
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java8
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java2
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java3
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java1
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java7
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java2
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java4
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java4
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java7
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java20
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java4
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java1
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java1
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java2
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java1
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java3
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java4
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java2
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java2
20 files changed, 41 insertions, 92 deletions
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java
index e0f3e016fe..1711e41a65 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java
@@ -70,7 +70,7 @@ public class MigrationMain {
private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
private static int status = 0;
- public static Map<String, VersionInfoEntity> versionInfoMap = new HashMap<>();
+ private static Map<String, VersionInfoEntity> versionInfoMap = new HashMap<>();
public static void main(String[] args) {
CassandraElementRepository cassandraElementRepository = new CassandraElementRepository();
@@ -116,8 +116,7 @@ public class MigrationMain {
convertVsp(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository);
printMessage(logger, "Converted VSPs\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for VSPs ,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
@@ -125,9 +124,7 @@ public class MigrationMain {
convertOrchestrationTemplateCandidate(context, cassandraElementRepository);
printMessage(logger, "Converted OrchestrationTemplateCandidates\n");
} catch (Exception e) {
- printMessage(logger,
- "Could not perform migration for OrchestrationTemplateCandidates ,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
@@ -136,61 +133,49 @@ public class MigrationMain {
convertComponent(context, cassandraElementRepository);
printMessage(logger, "Converted Components\n");
} catch (Exception e) {
- printMessage(logger,
- "Could not perform migration for Components ,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertNic(context, cassandraElementRepository);
printMessage(logger, "Converted Nics\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for Nics ,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertNetwork(context, cassandraElementRepository);
printMessage(logger, "Converted Networks\n");
} catch (Exception e) {
- printMessage(logger,
- "Could not perform migration for Networks ,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertMibs(context, cassandraElementRepository);
printMessage(logger, "Converted MIBs\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for MIBs,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertServiceArtifact(context, cassandraElementRepository);
printMessage(logger, "Converted Service Artifacts\n");
} catch (Exception e) {
- printMessage(logger,
- "Could not perform migration for Service Artifacts,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertServiceTemplate(context, cassandraElementRepository);
printMessage(logger, "Converted Service Templates\n");
} catch (Exception e) {
- printMessage(logger,
- "Could not perform migration for Service Templates,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertProcesses(context, cassandraElementRepository);
printMessage(logger, "Converted Processes\n");
} catch (Exception e) {
- printMessage(logger,
- "Could not perform migration for Processes,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
@@ -199,40 +184,35 @@ public class MigrationMain {
convertVlm(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository);
printMessage(logger, "Converted VLMs\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for VLMs,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertLKG(context, cassandraElementRepository);
printMessage(logger, "Converted LKGs\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for LKGs,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertFeatureGroup(context, cassandraElementRepository);
printMessage(logger, "Converted Feature Groups\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for Feature Groups,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertEP(context, cassandraElementRepository);
printMessage(logger, "Converted EPs\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for EPs,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
try {
convertLicenseAgreement(context, cassandraElementRepository);
printMessage(logger, "Converted License Agreements\n");
} catch (Exception e) {
- printMessage(logger, "Could not perform migration for License Agreements,the error is :");
- e.printStackTrace();
+ logger.debug(e.getMessage(), e);
status = -1;
}
}
@@ -482,5 +462,8 @@ public class MigrationMain {
.getViewableVersions().contains(versionId));
}
-
+ public static Map<String, VersionInfoEntity> getVersionInfoMap()
+ {
+ return versionInfoMap;
+ }
}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java
index c6778544fd..e6ceb360bd 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java
@@ -1,25 +1,17 @@
package org.openecomp.core.migration.convertors;
import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.datatypes.item.ItemVersionData;
import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.migration.loaders.VspInformation;
import org.openecomp.core.migration.store.ElementHandler;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
public class OrchestrationTemplateCandidateConvertor {
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java
index 2e5fac830e..2e483747ed 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java
@@ -5,9 +5,7 @@ import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.ItemVersionData;
import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.loaders.VspInformation;
import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java
index 76e35b56c4..15b8ad729a 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java
@@ -7,11 +7,8 @@ import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
import org.openecomp.core.migration.store.ElementHandler;
import org.openecomp.core.model.types.ServiceArtifact;
import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType;
import org.openecomp.sdc.model.impl.zusammen.StructureElement;
-
import java.util.HashSet;
import java.util.List;
import java.util.Set;
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java
index b8c173843d..09da455847 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java
@@ -25,7 +25,6 @@ import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity;
import java.util.Collection;
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java
index bac4b6e440..26fc23cf5d 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java
@@ -20,21 +20,14 @@
package org.openecomp.core.migration.loaders;
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.UDTMapper;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
import java.util.Collection;
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java
index 2a6efd22f3..725298b195 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java
@@ -24,10 +24,8 @@ import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.dao.VersionInfoDao;
import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
import java.util.Collection;
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java
index 34e7d79001..548a8d989b 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java
@@ -104,7 +104,7 @@ public class ElementHandler {
private static Id getVersionId(String itemId, Version versionId) {
VersionInfoEntity versionInfo =
- MigrationMain.versionInfoMap.get(itemId);
+ MigrationMain.getVersionInfoMap().get(itemId);
if (versionInfo == null) {
return new Id(versionId.toString());
}
@@ -121,7 +121,7 @@ public class ElementHandler {
private static boolean isActiveVersion(String itemId, Version versionId) {
VersionInfoEntity versionInfo =
- MigrationMain.versionInfoMap.get(itemId);
+ MigrationMain.getVersionInfoMap().get(itemId);
return versionInfo != null && versionInfo.getActiveVersion().equals(versionId);
}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java
index 97f5aaf265..801984ab24 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java
@@ -94,7 +94,7 @@ public class ItemHandler {
private static Id getVersionId(String itemId, Version versionId) {
VersionInfoEntity versionInfo =
- MigrationMain.versionInfoMap.get(itemId);
+ MigrationMain.getVersionInfoMap().get(itemId);
if (versionInfo == null) {
return new Id(versionId.toString());
}
@@ -110,7 +110,7 @@ public class ItemHandler {
}
private static boolean isActiveVersion(String itemId, Version versionId) {
VersionInfoEntity versionInfo =
- MigrationMain.versionInfoMap.get(itemId);
+ MigrationMain.getVersionInfoMap().get(itemId);
if (versionInfo == null) {
return false;
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java
index 685f70db98..487b4131e6 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java
@@ -1,5 +1,7 @@
package org.openecomp.core.tools.Commands;
+import static java.nio.file.Files.createDirectories;
+
import com.amdocs.zusammen.datatypes.SessionContext;
import org.apache.commons.io.FileUtils;
import org.openecomp.core.tools.Commands.exportdata.ElementHandler;
@@ -18,12 +20,8 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-
-import static java.nio.file.Files.createDirectories;
public class ExportDataCommand {
private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
@@ -45,7 +43,6 @@ public class ExportDataCommand {
FileUtils.forceDelete(rootDir.toFile());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java
index 57486b81e3..cebff91160 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java
@@ -24,19 +24,21 @@ public class ImportCommand {
if (zippedFile == null){
logger.error("Import must have a valid file as an input.");
}
- zippedFile = zippedFile.replaceAll("\\r", "");
- if(filterItem != null) {
- filterItem = filterItem.replaceAll("\\r", "");
+ if (zippedFile != null) {
+ zippedFile = zippedFile.replaceAll("\\r", "");
+ if (filterItem != null) {
+ filterItem = filterItem.replaceAll("\\r", "");
+ }
+ Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
+ ExportDataCommand.initDir(rootDir);
+ ZipUtils.unzip(Paths.get(zippedFile), rootDir);
+ TreeWalker.walkFiles(context, rootDir, filterItem);
+ FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end.
}
- Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
- ExportDataCommand.initDir(rootDir);
- ZipUtils.unzip(Paths.get(zippedFile), rootDir);
- TreeWalker.walkFiles(context, rootDir, filterItem);
- FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end.
+
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java
index 7058c57e85..031d1328b5 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java
@@ -16,9 +16,9 @@ import java.util.*;
public class ResetOldVersion {
- public static Map<String, List<String>> itemVersionMap = new HashMap<>();
+ private static Map<String, List<String>> itemVersionMap = new HashMap<>();
- public static int count =0;
+ private static int count =0;
public static void reset(SessionContext context, String oldVersion,String emptyOldVersion) {
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java
index 49eaaeaa76..e03b7ffa82 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java
@@ -94,7 +94,6 @@ public class ElementHandler {
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java
index 710b731f8b..ebbfb56ed0 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java
@@ -76,7 +76,6 @@ public class ItemHandler {
write(itemFilePath, itemJson.getBytes());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java
index e8e703bff0..4ff562484c 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java
@@ -51,7 +51,6 @@ public class VersionHandler {
write(versionFilePath, versionJson.getBytes());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
@@ -68,7 +67,6 @@ public class VersionHandler {
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java
index d51458aff1..d439468e97 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java
@@ -91,7 +91,6 @@ public class ElementImport {
versionCassandraLoader.insertElementToVersion(elementEntity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java
index 9ec5d639c2..4dd4a1f2c8 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java
@@ -25,7 +25,7 @@ public class ItemImport {
return;
}
String itemJson = new String(Files.readAllBytes(itemPath));
- if (itemJson == null || itemJson.trim().isEmpty()) {
+ if (itemJson.trim().isEmpty()) {
return;
}
Item item = JsonUtil.json2Object(itemJson, Item.class);
@@ -35,7 +35,6 @@ public class ItemImport {
System.out.println("Item Created :"+item.getInfo().getName()+" , "+item.getId());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java
index 15f8b02e2b..30c4152491 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java
@@ -4,14 +4,10 @@ import com.amdocs.zusammen.datatypes.SessionContext;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import javax.validation.constraints.Min;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
import java.util.stream.Stream;
public class TreeWalker {
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java
index 8f6c67d212..48433d8a90 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java
@@ -26,7 +26,7 @@ public class VersionImport {
return;
}
String versionJson = new String(Files.readAllBytes(versionPath));
- if (versionJson == null || versionJson.trim().isEmpty()) {
+ if (versionJson.trim().isEmpty()) {
return;
}
VersionEntity versionEntity = JsonUtil.json2Object(versionJson, VersionEntity.class);
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java
index 5da7407c9f..e9d4174d6c 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java
@@ -26,7 +26,7 @@ public class VersionInfoImport {
return;
}
String versionInfoJson = new String(Files.readAllBytes(versionInfoFilePath));
- if (versionInfoJson == null || versionInfoJson.trim().isEmpty()) {
+ if (versionInfoJson.trim().isEmpty()) {
return;
}
VersionInfoEntity versionInfoEntity = JsonUtil.json2Object(versionInfoJson, VersionInfoEntity.class);