aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorshrek2000 <orenkle@amdocs.com>2018-01-22 14:33:20 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-01-22 14:00:54 +0000
commit07957fb76bd3e450a17cc5a66c3db521e4344a36 (patch)
treeb9f153ce69ea8caa02f571ea64ccbf3c37138c07 /openecomp-be
parent09cc405325d939d486b3b0f251311ce41e3b9ab5 (diff)
Fix zusammen export tool
No need for multithreading Issue-ID: SDC-941 Change-Id: If68b7ab79b2857a3ee6ab88dd80997ceb58a1aab Signed-off-by: shrek2000 <orenkle@amdocs.com>
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java38
1 files changed, 11 insertions, 27 deletions
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 6351d7fa55..71a260798a 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
@@ -3,24 +3,10 @@ package org.openecomp.core.tools.importinfo;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.DataType.Name;
import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.ResultSetFuture;
import com.datastax.driver.core.Session;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import org.apache.commons.lang3.StringUtils;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory;
-import org.openecomp.core.tools.exportinfo.ExportDataCommand;
-import org.openecomp.core.tools.model.ColumnDefinition;
-import org.openecomp.core.tools.model.TableData;
-import org.openecomp.core.tools.util.Utils;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Path;
@@ -31,6 +17,15 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory;
+import org.openecomp.core.tools.exportinfo.ExportDataCommand;
+import org.openecomp.core.tools.model.ColumnDefinition;
+import org.openecomp.core.tools.model.TableData;
+import org.openecomp.core.tools.util.Utils;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
public class ImportSingleTable {
@@ -46,7 +41,7 @@ public class ImportSingleTable {
TableData tableData = objectMapper.readValue(file.toFile(), TableData.class);
Session session = CassandraSessionFactory.getSession();
PreparedStatement ps = getPrepareStatement(tableData, session);
- tableData.rows.parallelStream().forEach(row -> executeQuery(session, ps, tableData.definitions, row));
+ tableData.rows.forEach(row -> executeQuery(session, ps, tableData.definitions, row));
} catch (IOException e) {
Utils.logError(logger, e);
}
@@ -71,18 +66,7 @@ public class ImportSingleTable {
Name name = dataTypesMap.get(columnDefinition.getType());
handleByType(bind, i, rowData, name);
}
- ResultSetFuture resultSetFuture = session.executeAsync(bind);
- Futures.addCallback(resultSetFuture, new FutureCallback<ResultSet>() {
- @Override
- public void onSuccess(ResultSet resultSet) {
- Utils.printMessage(logger, "successful write ");
- }
-
- @Override
- public void onFailure(Throwable t) {
- Utils.logError(logger, t);
- }
- });
+ session.execute(bind);
}
private void handleByType(BoundStatement bind, int i, String rowData, Name name) {