aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/tools')
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java6
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java25
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java14
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java55
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java3
5 files changed, 14 insertions, 89 deletions
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java
index e5def6f73e..8e32779cb0 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java
@@ -27,6 +27,9 @@ public class CommandsHolder {
Option.builder(COMMAND_OPTION).hasArg().argName("command").desc("command name, mandatory").build());
registerCommands();
}
+
+ private CommandsHolder() {
+ }
private static void registerCommands() {
new SetHealingFlag().register();
@@ -40,9 +43,6 @@ public class CommandsHolder {
new SetHealingFlagByItemVersionCommand().register();
}
- private CommandsHolder() {
- }
-
public static Optional<Command> getCommand(String[] args) {
CommandLine cmd = parseArgs(args);
return cmd == null || !cmd.hasOption(COMMAND_OPTION) || cmd.getOptionValue(COMMAND_OPTION) == null
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java
index 8e0bb0e6b6..f55f1e88b1 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java
@@ -16,7 +16,6 @@ import java.util.stream.Stream;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.collections.CollectionUtils;
-import org.openecomp.core.tools.concurrent.ItemHealingTask;
import org.openecomp.core.tools.exceptions.HealingRuntimeException;
import org.openecomp.core.tools.loaders.VersionInfoCassandraLoader;
import org.openecomp.sdc.healing.api.HealingManager;
@@ -34,7 +33,6 @@ public class HealAll extends Command {
private static final int DEFAULT_THREAD_NUMBER = 100;
private static final String THREAD_NUM_OPTION = "t";
- private static List<ItemHealingTask> tasks = new ArrayList<>();
private VendorSoftwareProductManager vspManager;
private HealingManager healingManager;
@@ -83,27 +81,7 @@ public class HealAll extends Command {
}
private static void executeAllTasks(ExecutorService executor, BufferedWriter log) {
- List<Future<String>> futureTasks;
- try {
- futureTasks = executor.invokeAll(tasks);
- futureTasks.forEach(future -> {
- try {
- log.write(future.get());
- log.newLine();
- } catch (Exception e) {
- writeToLog(e.getMessage(), log);
- }
- });
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- writeToLog("migration tasks failed with message: " + e.getMessage(), log);
- throw new HealingRuntimeException(e);
- }
- boolean isThreadOpen = true;
- while (isThreadOpen) {
- isThreadOpen = futureTasks.stream().anyMatch(future -> !future.isDone());
- }
}
@@ -133,8 +111,7 @@ public class HealAll extends Command {
}
private void addTaskToTasks(VersionInfoEntity versionInfoEntity) {
- tasks.add(new ItemHealingTask(versionInfoEntity.getEntityId(), resolveVersion(versionInfoEntity).toString(),
- vspManager, healingManager));
+
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java
index db90652b8f..ce2f9acf62 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java
@@ -37,11 +37,13 @@ public class SetHealingFlagByItemVersionCommand extends Command {
private static final String ITEM_ID_OPTION = "i";
private static final String VERSION_ID_OPTION = "v";
private static final String PROJECT_OPTION = "o";
+ private static final String ITEM_ID = "item_id";
+ private static final String VERSION_ID = "version_id";
SetHealingFlagByItemVersionCommand() {
- options.addOption(Option.builder(ITEM_ID_OPTION).hasArg().argName("item_id")
+ options.addOption(Option.builder(ITEM_ID_OPTION).hasArg().argName(ITEM_ID)
.desc("id of the item to reset healing flag, mandatory").build());
- options.addOption(Option.builder(VERSION_ID_OPTION).hasArg().argName("version_id")
+ options.addOption(Option.builder(VERSION_ID_OPTION).hasArg().argName(VERSION_ID)
.desc("id of the version to delete from public, mandatory").build());
options.addOption(Option.builder(PROJECT_OPTION).hasArg().argName("old_project_version")
.desc("old project version, mandatory").build());
@@ -62,10 +64,10 @@ public class SetHealingFlagByItemVersionCommand extends Command {
ResultSet listItemVersion = versionCassandraLoader.listItemVersion();
List<HealingEntity> healingEntities = listItemVersion.all().stream().filter(
- entry -> (entry.getString("item_id").equals(itemId)
- && entry.getString("version_id").equals(versionId))).map(entry ->
- new HealingEntity(entry.getString("space"), entry.getString("item_id"),
- entry.getString("version_id"), true, projectVersion)).collect(Collectors.toList());
+ entry -> (entry.getString(ITEM_ID).equals(itemId)
+ && entry.getString(VERSION_ID).equals(versionId))).map(entry ->
+ new HealingEntity(entry.getString("space"), entry.getString(ITEM_ID),
+ entry.getString(VERSION_ID), true, projectVersion)).collect(Collectors.toList());
HealingHandler healingHandler = new HealingHandler();
healingHandler.populateHealingTable(healingEntities);
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java
deleted file mode 100644
index 878390fdc2..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.openecomp.core.tools.concurrent;
-
-import org.openecomp.sdc.healing.api.HealingManager;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.concurrent.Callable;
-
-/**
- * Created by ayalaben on 11/7/2017
- */
-public class ItemHealingTask implements Callable<String> {
-
- private String itemId;
- private Version version;
- private VendorSoftwareProductManager vspManager;
- private HealingManager healingManager;
-
- public String getItemId() {
- return itemId;
- }
-
- public String getVersionId() {
-// return version.getId();
- return null;
- }
-
-
- public ItemHealingTask(String itemId, String versionId,
- VendorSoftwareProductManager vspManager,
- HealingManager healingManager) {
-// this.itemId = itemId;
-// this.version = new Version(versionId);
- this.vspManager = vspManager;
- this.healingManager = healingManager;
-
- }
-
- @Override
- public String call() throws Exception {
-// VspDetails vspDetails = vspManager.getVsp(itemId, version);
-//
-// try {
-// healingManager.healItemVersion(itemId, version, ItemType.vsp, true);
-// } catch (Exception e) {
-// return (String
-// .format("healing failed on vsp: %s with id: %s, versionId: %s, with message: %s",
-// vspDetails.getName(), itemId, version.getId(), e.getMessage()));
-// }
-//
-// return String.format("healed vsp: %s, with id: %s, versionId: %s",
-// vspDetails.getName(), itemId, version.getId());
- return null;
- }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
index d36b41f7c2..146e173a28 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
@@ -32,6 +32,8 @@ public class ImportSingleTable {
private static final String INSERT_INTO = "INSERT INTO ";
private static final String VALUES = " VALUES ";
private static final Map<String, PreparedStatement> statementsCache = new HashMap<>();
+
+ public static final ImmutableMap<String, Name> dataTypesMap;
public void importFile(Path file) {
try {
@@ -141,7 +143,6 @@ public class ImportSingleTable {
return sb.toString();
}
- public static final ImmutableMap<String, Name> dataTypesMap;
static {
Builder<String, Name> builder = ImmutableMap.builder();