From 20da3d02c6c5507761c257b6ec6f58dcfc27d05a Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Fri, 15 Jun 2018 08:28:00 +0200 Subject: Add tests for SdcSchema classes Introduce Cassandra Unit tool and tests for schema-related classes Change-Id: I14da602c42056730e7992dd92b4da8b87dd9fb0d Issue-ID: SDC-1358 Signed-off-by: Piotr Darosz --- .../java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'asdctool/src/main/java') diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java index 496eb1864e..fe117d1a1a 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java @@ -16,6 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= + * Modifications copyright (c) 2018 Nokia + * ================================================================================ */ package org.openecomp.sdc.asdctool.main; @@ -23,6 +25,7 @@ package org.openecomp.sdc.asdctool.main; import org.openecomp.sdc.asdctool.impl.TitanGraphInitializer; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaBuilder; +import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; @@ -34,7 +37,7 @@ public class DataSchemaMenu { public static void main(String[] args) { - String operation = args[0]; + String operation = args[0]; String appConfigDir = args[1]; @@ -45,10 +48,13 @@ public class DataSchemaMenu { ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); + SdcSchemaBuilder sdcSchemaBuilder = new SdcSchemaBuilder(new SdcSchemaUtils(), + ConfigurationManager.getConfigurationManager().getConfiguration()::getCassandraConfig); + switch (operation.toLowerCase()) { case "create-cassandra-structures": log.debug("Start create cassandra keyspace, tables and indexes"); - if (SdcSchemaBuilder.createSchema()) { + if (sdcSchemaBuilder.createSchema()) { log.debug("create cassandra keyspace, tables and indexes successfull"); System.exit(0); } else { @@ -69,7 +75,7 @@ public class DataSchemaMenu { break; case "clean-cassndra": log.debug("Start clean keyspace, tables"); - if (SdcSchemaBuilder.deleteSchema()) { + if (sdcSchemaBuilder.deleteSchema()) { log.debug(" successfull"); System.exit(0); } else { -- cgit 1.2.3-korg