summaryrefslogtreecommitdiffstats
path: root/catalog-dao/src
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-dao/src')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDao.java7
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java21
4 files changed, 17 insertions, 15 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java
index e10930db08..9c534d0be8 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java
@@ -85,7 +85,7 @@ public abstract class ESGenericIdDAO implements IGenericIdDAO {
T ret = null;
try {
- ret = (T) jsonMapper.readValue(response.getSourceAsString(), clazz);
+ ret = jsonMapper.readValue(response.getSourceAsString(), clazz);
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java
index 0efbb9fd31..284b91ac74 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java
@@ -52,7 +52,7 @@ public abstract class CassandraDao {
Statement select = QueryBuilder.select().countAll().from(tableName).limit(10);
try {
ResultSet res = session.execute(select);
- return Either.left((res.one().getLong("count") != 0 ? false : true));
+ return Either.left(res.one().getLong("count") == 0);
} catch (Exception e) {
logger.debug("Failed check if table is empty", e);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDao.java
index 9ff82f41b1..783eb9533b 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDao.java
@@ -18,6 +18,7 @@ import java.util.List;
@Component("operational-environment-dao")
public class OperationalEnvironmentDao extends CassandraDao {
+ private static final String OPERATIONAL_ENVIRONMENT_DAO = "OperationalEnvironmentDao";
private static Logger logger = Logger.getLogger(OperationalEnvironmentDao.class.getName());
private OperationalEnvironmentsAccessor operationalEnvironmentsAccessor;
@@ -36,13 +37,13 @@ public class OperationalEnvironmentDao extends CassandraDao {
operationalEnvironmentsAccessor = manager.createAccessor(OperationalEnvironmentsAccessor.class);
logger.debug("** OperationalEnvironmentDao created");
} else {
- logger.error(EcompLoggerErrorCode.DATA_ERROR, "OperationalEnvironmentDao", "OperationalEnvironmentDao", "** OperationalEnvironmentDao failed");
+ logger.error(EcompLoggerErrorCode.DATA_ERROR, OPERATIONAL_ENVIRONMENT_DAO, OPERATIONAL_ENVIRONMENT_DAO, "** OperationalEnvironmentDao failed");
throw new RuntimeException("OperationalEnvironment keyspace [" + keyspace + "] failed to connect with error : "
+ result.right().value());
}
} else {
- logger.error(EcompLoggerErrorCode.DATA_ERROR, "OperationalEnvironmentDao", "OperationalEnvironmentDao", "** Cassandra client isn't connected");
- logger.error(EcompLoggerErrorCode.DATA_ERROR, "OperationalEnvironmentDao", "OperationalEnvironmentDao", "** OperationalEnvironmentDao created, but not connected");
+ logger.error(EcompLoggerErrorCode.DATA_ERROR, OPERATIONAL_ENVIRONMENT_DAO, OPERATIONAL_ENVIRONMENT_DAO, "** Cassandra client isn't connected");
+ logger.error(EcompLoggerErrorCode.DATA_ERROR, OPERATIONAL_ENVIRONMENT_DAO, OPERATIONAL_ENVIRONMENT_DAO, "** OperationalEnvironmentDao created, but not connected");
}
}
public CassandraOperationStatus save(OperationalEnvironmentEntry operationalEnvironmentEntry) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
index 6c74543901..5af12a8af1 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
@@ -40,6 +40,17 @@ import java.util.function.Supplier;
public class SdcSchemaBuilder {
+ /**
+ * creat key space statment for SimpleStrategy
+ */
+ private static final String CREATE_KEYSPACE_SIMPLE_STRATEGY = "CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class':'SimpleStrategy', %s};";
+ /**
+ * creat key space statment for NetworkTopologyStrategy
+ */
+ private static final String CREATE_KEYSPACE_NETWORK_TOPOLOGY_STRATEGY = "CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class':'NetworkTopologyStrategy', %s};";
+
+ private static Logger log = Logger.getLogger(SdcSchemaBuilder.class.getName());
+
private SdcSchemaUtils sdcSchemaUtils;
private Supplier<Configuration.CassandrConfig> cassandraConfigSupplier;
@@ -47,16 +58,6 @@ public class SdcSchemaBuilder {
this.sdcSchemaUtils = sdcSchemaUtils;
this.cassandraConfigSupplier = cassandraConfigSupplier;
}
- /**
- * creat key space statment for SimpleStrategy
- */
- private static final String CREATE_KEYSPACE_SIMPLE_STRATEGY = "CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class':'SimpleStrategy', %s};";
- /**
- * creat key space statment for NetworkTopologyStrategy
- */
- private static final String CREATE_KEYSPACE_NETWORK_TOPOLOGY_STRATEGY = "CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class':'NetworkTopologyStrategy', %s};";
-
- private static Logger log = Logger.getLogger(SdcSchemaBuilder.class.getName());
//TODO remove after 1707_OS migration
private static void handle1707OSMigration(Map<String, Map<String, List<String>>> cassndraMetadata, Map<String, List<ITableDescription>> schemeData){