aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp')
-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
11 files changed, 18 insertions, 29 deletions
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);