aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup36
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup35
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup41
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup34
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup45
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/nosqldb/api/NoSqlDb.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml7
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup46
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java133
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java6
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/Yaml/YamlUtilTest.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup35
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml7
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup83
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java4
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java12
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java292
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml4
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java5
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml8
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java5
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java18
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java18
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml8
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java4
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java9
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java12
-rw-r--r--openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup22
31 files changed, 555 insertions, 385 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..7d6cd8f980
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-nosqldb-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.9.10</version>
+ <scope>test</scope>
+ </dependency>
+ <!--dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-software-product-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency-->
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-core-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openecomp-config-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup
new file mode 100644
index 0000000000..be88b2799a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-facade-api</name>
+ <artifactId>openecomp-facade-api</artifactId>
+ <groupId>org.openecomp.core</groupId>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../..</relativePath>
+ </parent>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-common-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup
new file mode 100644
index 0000000000..72ce7fab94
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup
@@ -0,0 +1,41 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>openecomp-facade-core</artifactId>
+ <name>openecomp-facade-core</name>
+ <groupId>org.openecomp.core</groupId>
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../..</relativePath>
+ </parent>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-common-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..c4d0d1faf0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-facade-lib</name>
+ <artifactId>openecomp-facade-lib</artifactId>
+
+ <packaging>pom</packaging>
+ <parent>
+ <artifactId>openecomp-core-lib</artifactId>
+ <groupId>org.openecomp.core</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>openecomp-facade-api</module>
+ <module>openecomp-facade-core</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup
new file mode 100644
index 0000000000..288274d728
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup
@@ -0,0 +1,45 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-nosqldb-api</name>
+ <artifactId>openecomp-nosqldb-api</artifactId>
+ <groupId>org.openecomp.core</groupId>
+
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-core</artifactId>
+ <version>${datasatx.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-mapping</artifactId>
+ <version>${datasatx.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/nosqldb/api/NoSqlDb.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/nosqldb/api/NoSqlDb.java
index 6b13ee71e4..56d15a88d4 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/nosqldb/api/NoSqlDb.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/nosqldb/api/NoSqlDb.java
@@ -34,4 +34,6 @@ public interface NoSqlDb {
ResultSet execute(String statementName, Object... values);
MappingManager getMappingManager();
+
+ String getVersion();
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml
index 8270e1bf79..fdbb1ec2a4 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml
@@ -28,6 +28,11 @@
<dependencies>
<dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-tosca-datatype</artifactId>
+ <version>${openecomp.sdc.common.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.openecomp.sdc.core</groupId>
<artifactId>openecomp-nosqldb-api</artifactId>
<version>${project.version}</version>
@@ -54,7 +59,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- <version>4.11</version>
+ <version>${junit.version}</version>
</dependency>
</dependencies>
</project>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup
new file mode 100644
index 0000000000..fa859a0db8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup
@@ -0,0 +1,46 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-nosqldb-core</name>
+ <artifactId>openecomp-nosqldb-core</artifactId>
+ <groupId>org.openecomp.core</groupId>
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-nosqldb-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ <version>1.10.19</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <version>6.8.5</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>snakeyaml</artifactId>
+ <groupId>org.yaml</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.11</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java
index bcac5f8d79..4ecc26879a 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java
@@ -20,10 +20,7 @@
package org.openecomp.core.nosqldb.impl.cassandra;
-import com.datastax.driver.core.BoundStatement;
-import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.Session;
+import com.datastax.driver.core.*;
import com.datastax.driver.mapping.MappingManager;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.util.CassandraUtils;
@@ -32,73 +29,87 @@ import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-class CassandraNoSqlDbImpl implements NoSqlDb {
+import java.util.Set;
+import java.util.stream.Collectors;
- private final Session session;
- private final String keySpace;
- private final MappingManager mappingManager;
+class CassandraNoSqlDbImpl implements NoSqlDb {
+ private final Session session;
+ private final String keySpace;
+ private final MappingManager mappingManager;
- public CassandraNoSqlDbImpl(Session session) {
- this.session = session;
- this.keySpace = this.session.getLoggedKeyspace();
- this.mappingManager = new MappingManager(this.session);
- }
+ public CassandraNoSqlDbImpl(Session session) {
+ this.session = session;
+ this.keySpace = this.session.getLoggedKeyspace();
+ this.mappingManager = new MappingManager(this.session);
- @Override
- public void insert(String tableName, String[] colNames, Object[] values) {
- if (colNames.length != values.length) {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
- "number of colmuns[" + colNames.length + "] is not equal to the number of values["
- + values.length + "].").withId("E0005").withCategory(ErrorCategory.APPLICATION)
- .build());
}
- StringBuilder sb = new StringBuilder();
- sb.append("insert into ")
- .append(tableName)
- .append(" (")
- .append(CommonMethods.arrayToCommaSeparatedString(colNames))
- .append(") values (")
- .append(CommonMethods.duplicateStringWithDelimiter("?", ',', values.length))
- .append(")");
- System.out.println(sb.toString());
- PreparedStatement prepared = session.prepare(sb.toString());
-
- BoundStatement bound;
- bound = prepared.bind(values);
- session.execute(bound);
-
- }
-
- @Override
- public ResultSet execute(String statement) {
- return session.execute(statement);
- }
-
- @Override
- public ResultSet execute(String statementName, Object... values) {
-
- String statement = CassandraUtils.getStatement(statementName);
- if (statement == null) {
- statement = statementName;
+ @Override
+ public void insert(String tableName, String[] colNames, Object[] values) {
+ if (colNames.length != values.length) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
+ "number of colmuns[" + colNames.length + "] is not equal to the number of values["
+ + values.length + "].").withId("E0005").withCategory(ErrorCategory.APPLICATION)
+ .build());
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("insert into ")
+ .append(tableName)
+ .append(" (")
+ .append(CommonMethods.arrayToCommaSeparatedString(colNames))
+ .append(") values (")
+ .append(CommonMethods.duplicateStringWithDelimiter("?", ',', values.length))
+ .append(")");
+ System.out.println(sb.toString());
+ PreparedStatement prepared = session.prepare(sb.toString());
+
+ BoundStatement bound;
+ bound = prepared.bind(values);
+ session.execute(bound);
+
}
- if (values != null) {
- PreparedStatement prepared = session.prepare(statement);
-
- BoundStatement bound;
- bound = prepared.bind(values);
- return session.execute(bound);
- } else {
- return session.execute(statement);
+
+ @Override
+ public ResultSet execute(String statement) {
+ return session.execute(statement);
}
- }
+ @Override
+ public ResultSet execute(String statementName, Object... values) {
+
+ String statement = CassandraUtils.getStatement(statementName);
+ if (statement == null) {
+ statement = statementName;
+ }
+ if (values != null) {
+ PreparedStatement prepared = session.prepare(statement);
- @Override
- public MappingManager getMappingManager() {
- return mappingManager;
- }
+ BoundStatement bound;
+ bound = prepared.bind(values);
+ return session.execute(bound);
+ } else {
+ return session.execute(statement);
+ }
+ }
+
+ @Override
+ public MappingManager getMappingManager() {
+ return mappingManager;
+ }
+
+ @Override
+ public String getVersion() {
+ try {
+ Set<Host> allHosts = this.session.getCluster().getMetadata().getAllHosts();
+ Set<String> versions = allHosts.stream().map(host -> host.getCassandraVersion().toString())
+ .collect(Collectors.toSet());
+ return versions.stream().collect(Collectors.joining(","));
+ } catch (Exception e){
+ return "Failed to retrieve version";
+ }
+ }
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
index 4863e3df0f..7b9b2ca84f 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
@@ -36,6 +36,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
+import java.util.Objects;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
@@ -113,8 +114,9 @@ public class CassandraSessionFactory {
} catch (Exception exception) {
exception.printStackTrace();
} finally {
- tsf.close();
-
+ if (tsf != null) {
+ tsf.close();
+ }
}
return ctx;
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
index 44623ff91b..c00db41ed9 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
@@ -20,7 +20,7 @@
package org.openecomp.core.nosqldb.util;
-import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.openecomp.sdc.tosca.services.YamlUtil;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/Yaml/YamlUtilTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/Yaml/YamlUtilTest.java
index 1e3305ef18..578f3e4c4a 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/Yaml/YamlUtilTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/Yaml/YamlUtilTest.java
@@ -22,7 +22,7 @@ package org.openecomp.core.utilities.Yaml;
import org.junit.Before;
import org.junit.Test;
-import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.openecomp.sdc.tosca.services.YamlUtil;
import testobjects.yaml.YamlFile;
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..3a4bfd4ba0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-nosqldb-lib</name>
+ <artifactId>openecomp-nosqldb-lib</artifactId>
+ <groupId>org.openecomp.core</groupId>
+ <packaging>pom</packaging>
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <modules>
+ <module>openecomp-nosqldb-api</module>
+ <module>openecomp-nosqldb-core</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-nosqldb-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-nosqldb-core</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml
index f7f6ea65f6..76d6ff6b74 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml
@@ -14,6 +14,11 @@
<dependencies>
<dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-tosca-datatype</artifactId>
+ <version>${openecomp.sdc.common.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
@@ -42,7 +47,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- <version>4.11</version>
+ <version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..1e448f5a61
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup
@@ -0,0 +1,83 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-utilities-lib</name>
+ <artifactId>openecomp-utilities-lib</artifactId>
+
+
+ <parent>
+ <artifactId>openecomp-core-lib</artifactId>
+ <groupId>org.openecomp.core</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.17</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.11</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>org.everit.json</groupId>
+ <artifactId>org.everit.json.schema</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <version>6.8.5</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>snakeyaml</artifactId>
+ <groupId>org.yaml</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java
index c828505932..8de222e688 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java
@@ -62,6 +62,10 @@ public class FileContentHandler {
return files;
}
+ public void setFiles(Map<String, byte[]> files) {
+ this.files = files;
+ }
+
public void setFiles(FileContentHandler extFiles) {
extFiles.getFileList().stream()
.forEach(fileName -> this.addFile(fileName, extFiles.getFileContent(fileName)));
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
index 664ccb68c6..08d9bd8a41 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
@@ -20,14 +20,14 @@
package org.openecomp.core.utilities.file;
-import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.core.utilities.yaml.YamlUtil;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorDescription;
-import org.slf4j.MDC;
+import org.openecomp.sdc.tosca.services.YamlUtil;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java
deleted file mode 100644
index d38bf484e4..0000000000
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.utilities.yaml;
-
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.core.utilities.CommonMethods;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.TypeDescription;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-import org.yaml.snakeyaml.introspector.BeanAccess;
-import org.yaml.snakeyaml.introspector.Property;
-import org.yaml.snakeyaml.introspector.PropertyUtils;
-import org.yaml.snakeyaml.nodes.MappingNode;
-import org.yaml.snakeyaml.nodes.NodeTuple;
-import org.yaml.snakeyaml.nodes.Tag;
-import org.yaml.snakeyaml.parser.ParserException;
-import org.yaml.snakeyaml.representer.Representer;
-
-import java.beans.IntrospectionException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.AbstractMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * The type Yaml util.
- */
-public class YamlUtil {
-
- private static Logger logger = (Logger) LoggerFactory.getLogger(YamlUtil.class);
-
- /**
- * Yaml to object t.
- *
- * @param <T> the type parameter
- * @param yamlContent the yaml content
- * @param typClass the t class
- * @return the t
- */
- public <T> T yamlToObject(String yamlContent, Class<T> typClass) {
- Constructor constructor = getConstructor(typClass);
- constructor.setPropertyUtils(getPropertyUtils());
- TypeDescription yamlFileDescription = new TypeDescription(typClass);
- constructor.addTypeDescription(yamlFileDescription);
- Yaml yaml = new Yaml(constructor);
- T yamlObj = (T) yaml.load(yamlContent);
- yamlObj.toString();
- return yamlObj;
- }
-
- /**
- * Yaml to object t.
- *
- * @param <T> the type parameter
- * @param yamlContent the yaml content
- * @param typClass the t class
- * @return the t
- */
- public <T> T yamlToObject(InputStream yamlContent, Class<T> typClass) {
- try {
- Constructor constructor = getConstructor(typClass);
- constructor.setPropertyUtils(getPropertyUtils());
- TypeDescription yamlFileDescription = new TypeDescription(typClass);
- constructor.addTypeDescription(yamlFileDescription);
- Yaml yaml = new Yaml(constructor);
- T yamlObj = (T) yaml.load(yamlContent);
- if (yamlObj != null) {
- yamlObj.toString();
- return yamlObj;
- } else {
- throw new RuntimeException();
- }
- } catch (Exception exception) {
- logger.error("Error will trying to convert yaml to object:" + exception.getMessage());
- throw new RuntimeException(exception);
- } finally {
- try {
- if (yamlContent != null) {
- yamlContent.close();
- }
- } catch (IOException ignore) {
- //do nothing
- }
- }
- }
-
-
- /**
- * Gets constructor.
- *
- * @param <T> the type parameter
- * @param typClass the t class
- * @return the constructor
- */
- public <T> Constructor getConstructor(Class<T> typClass) {
- return new StrictMapAppenderConstructor(typClass);
- }
-
- /**
- * Gets property utils.
- *
- * @return the property utils
- */
- protected PropertyUtils getPropertyUtils() {
- return new MyPropertyUtils();
- }
-
-
- /**
- * Yaml to map map.
- *
- * @param yamlContent the yaml content
- * @return the map
- */
- public Map<String, LinkedHashMap<String, Object>> yamlToMap(InputStream yamlContent) {
- Yaml yaml = new Yaml();
- Map<String, LinkedHashMap<String, Object>> yamlData =
- (Map<String, LinkedHashMap<String, Object>>) yaml.load(yamlContent);
- return yamlData;
- }
-
- /**
- * Object to yaml string.
- *
- * @param <T> the type parameter
- * @param obj the obj
- * @return the string
- */
- public <T> String objectToYaml(Object obj) {
- DumperOptions options = new DumperOptions();
- options.setPrettyFlow(true);
- options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- Representer representer = new CustomRepresenter();
- representer.addClassTag(obj.getClass(), Tag.MAP);
- representer.setPropertyUtils(new MyPropertyUtils());
-
- Yaml yaml = new Yaml(representer, options);
- return yaml.dump(obj);
- }
-
- /**
- * Load yaml file is input stream.
- *
- * @param yamlFullFileName the yaml full file name
- * @return the input stream
- */
- public InputStream loadYamlFileIs(String yamlFullFileName) {
- return CommonMethods.class.getResourceAsStream(yamlFullFileName);
- }
-
- /**
- * Is yaml file content valid boolean.
- *
- * @param yamlFullFileName the yaml full file name
- * @return the boolean
- */
- public boolean isYamlFileContentValid(String yamlFullFileName) {
- Yaml yaml = new Yaml();
- try {
- Object loadResult = yaml.load(yamlFullFileName);
- if (loadResult == null) {
- return false;
- }
- return true;
- } catch (Exception exception) {
- return false;
- }
- }
-
-
- private class CustomRepresenter extends Representer {
- @Override
- protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
- //remove the bean type from the output yaml (!! ...)
- if (!classTags.containsKey(javaBean.getClass())) {
- addClassTag(javaBean.getClass(), Tag.MAP);
- }
-
- return super.representJavaBean(properties, javaBean);
- }
-
- @Override
- protected NodeTuple representJavaBeanProperty(Object javaBean, Property property,
- Object propertyValue, Tag customTag) {
- if (propertyValue == null) {
- return null;
- } else {
- NodeTuple defaultNode =
- super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
-
- return property.getName().equals("_default")
- ? new NodeTuple(representData("default"), defaultNode.getValueNode())
- : defaultNode;
- }
- }
- }
-
-
- /**
- * The type My property utils.
- */
- public class MyPropertyUtils extends PropertyUtils {
- //Unsorted properties
- @Override
- protected Set<Property> createPropertySet(Class<? extends Object> type, BeanAccess bnAccess)
- throws IntrospectionException {
- return new LinkedHashSet<Property>(getPropertiesMap(type,
- BeanAccess.FIELD).values());
- }
-
- @Override
- public Property getProperty(Class<?> type, String name) throws IntrospectionException {
- if (name.equals("default")) {
- name = "_default";
- }
- return super.getProperty(type, name);
- }
-
- }
-
- /**
- * The type Strict map appender constructor.
- */
- protected class StrictMapAppenderConstructor extends Constructor {
-
- /**
- * Instantiates a new Strict map appender constructor.
- *
- * @param theRoot the the root
- */
- public StrictMapAppenderConstructor(Class<?> theRoot) {
- super(theRoot);
- }
-
- @Override
- protected Map<Object, Object> createDefaultMap() {
- final Map<Object, Object> delegate = super.createDefaultMap();
- return new AbstractMap<Object, Object>() {
- @Override
- public Object put(Object key, Object value) {
- if (delegate.containsKey(key)) {
- throw new IllegalStateException("duplicate key: " + key);
- }
- return delegate.put(key, value);
- }
-
- @Override
- public Set<Entry<Object, Object>> entrySet() {
- return delegate.entrySet();
- }
- };
- }
-
- @Override
- protected Map<Object, Object> constructMapping(MappingNode node) {
- try {
- return super.constructMapping(node);
- } catch (IllegalStateException exception) {
- throw new ParserException("while parsing MappingNode",
- node.getStartMark(), exception.getMessage(),
- node.getEndMark());
- }
- }
- }
-}
-
-
-
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml
index 08a09273c6..bc05097e07 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml
@@ -31,14 +31,14 @@
<dependency>
<groupId>com.amdocs.zusammen</groupId>
<artifactId>zusammen-adaptor-inbound-api</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
</dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-datatypes-lib</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
index 1495ed27a8..f4e8688d63 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
@@ -3,6 +3,7 @@ package org.openecomp.core.zusammen.api;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.commons.health.data.HealthInfo;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.ElementContext;
@@ -73,4 +74,8 @@ public interface ZusammenAdaptor {
Optional<Element> saveElement(SessionContext context, ElementContext elementContext,
ZusammenElement element, String message);
+
+ Collection<HealthInfo> checkHealth(SessionContext context);
+
+ String getVersion(SessionContext sessionContext);
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
index c1870d8c64..4227f41374 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
@@ -21,17 +21,17 @@
<dependency>
<groupId>com.amdocs.zusammen</groupId>
<artifactId>zusammen-commons-utils</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
</dependency>
<dependency>
<groupId>com.amdocs.zusammen</groupId>
<artifactId>zusammen-adaptor-inbound-api</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
</dependency>
<dependency>
<groupId>com.amdocs.zusammen</groupId>
<artifactId>zusammen-adaptor-inbound-impl</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -53,7 +53,7 @@
<dependency>
<groupId>com.amdocs.zusammen.plugin</groupId>
<artifactId>zusammen-search-index-empty-plugin</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
index f746d706e1..6381b2efd2 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
@@ -3,6 +3,7 @@ package org.openecomp.core.zusammen.db;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.commons.health.data.HealthInfo;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.ElementContext;
@@ -48,4 +49,8 @@ public interface ZusammenConnector {
Optional<Element> saveElement(SessionContext context, ElementContext elementContext,
ZusammenElement element, String message);
+
+ Collection<HealthInfo> checkHealth(SessionContext sessionContext);
+
+ String getVersion(SessionContext sessionContext);
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java
index f3916521dd..e6f9380c2b 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java
@@ -20,6 +20,7 @@
package org.openecomp.core.zusammen.db.impl;
+import com.amdocs.zusammen.adaptor.inbound.api.health.HealthAdaptorFactory;
import com.amdocs.zusammen.adaptor.inbound.api.item.ElementAdaptorFactory;
import com.amdocs.zusammen.adaptor.inbound.api.item.ItemAdaptorFactory;
import com.amdocs.zusammen.adaptor.inbound.api.item.ItemVersionAdaptorFactory;
@@ -30,7 +31,7 @@ public class ZusammenConnectorFactoryImpl extends ZusammenConnectorFactory {
private static final ZusammenConnector INSTANCE =
new ZusammenConnectorImpl(ItemAdaptorFactory.getInstance(),
ItemVersionAdaptorFactory.getInstance(),
- ElementAdaptorFactory.getInstance());
+ ElementAdaptorFactory.getInstance(), HealthAdaptorFactory.getInstance());
@Override
public ZusammenConnector createInterface() {
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
index 8aa8e129df..fa08ba49a8 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
@@ -3,9 +3,11 @@ package org.openecomp.core.zusammen.db.impl;
import com.amdocs.zusammen.adaptor.inbound.api.item.ElementAdaptorFactory;
import com.amdocs.zusammen.adaptor.inbound.api.item.ItemAdaptorFactory;
import com.amdocs.zusammen.adaptor.inbound.api.item.ItemVersionAdaptorFactory;
+import com.amdocs.zusammen.adaptor.inbound.api.health.HealthAdaptorFactory;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.commons.health.data.HealthInfo;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.Space;
@@ -33,18 +35,30 @@ public class ZusammenConnectorImpl implements ZusammenConnector {
private ItemAdaptorFactory itemAdaptorFactory;
private ItemVersionAdaptorFactory versionAdaptorFactory;
private ElementAdaptorFactory elementAdaptorFactory;
-
+ private HealthAdaptorFactory healthAdaptorFactory;
public ZusammenConnectorImpl(
ItemAdaptorFactory itemAdaptorFactory,
ItemVersionAdaptorFactory versionAdaptorFactory,
- ElementAdaptorFactory elementAdaptorFactory) {
+ ElementAdaptorFactory elementAdaptorFactory,
+ HealthAdaptorFactory healthAdaptorFactory) {
this.itemAdaptorFactory = itemAdaptorFactory;
this.versionAdaptorFactory = versionAdaptorFactory;
this.elementAdaptorFactory = elementAdaptorFactory;
+ this.healthAdaptorFactory = healthAdaptorFactory;
CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
}
@Override
+ public Collection<HealthInfo> checkHealth(SessionContext sessionContext) {
+ return healthAdaptorFactory.createInterface(sessionContext).getHealthStatus(sessionContext);
+ }
+
+ @Override
+ public String getVersion(SessionContext sessionContext) {
+ return healthAdaptorFactory.createInterface(sessionContext).getVersion();
+ }
+
+ @Override
public Collection<Item> listItems(SessionContext context) {
Response<Collection<Item>> response =
itemAdaptorFactory.createInterface(context).list(context);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
index ad4839bd00..41ce0283a1 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
@@ -3,14 +3,10 @@ package org.openecomp.core.zusammen.impl;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.commons.health.data.HealthInfo;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.Action;
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.datatypes.item.Item;
-import com.amdocs.zusammen.datatypes.item.ItemVersion;
-import com.amdocs.zusammen.datatypes.item.ItemVersionData;
+import com.amdocs.zusammen.datatypes.item.*;
import com.amdocs.zusammen.datatypes.itemversion.Tag;
import com.amdocs.zusammen.datatypes.response.Response;
import com.amdocs.zusammen.datatypes.response.ReturnCode;
@@ -219,10 +215,20 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor {
connector.updateItem(context, itemId, info);
}
+
+ @Override
+ public Collection<HealthInfo> checkHealth(SessionContext context) {
+ return connector.checkHealth(context);
+ }
+
private static void sortItemVersionListByModificationTimeDescOrder(
List<ItemVersion> itemVersions) {
itemVersions.sort((o1, o2) -> ((Integer)o2.getId().getValue().length())
.compareTo( (o1.getId().getValue().length())));
}
+ @Override
+ public String getVersion(SessionContext sessionContext) {
+ return connector.getVersion(sessionContext);
+ }
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml
index 57f92f1b09..b3bd790bd5 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml
@@ -15,23 +15,23 @@
<dependency>
<groupId>com.amdocs.zusammen</groupId>
<artifactId>zusammen-sdk</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
</dependency>
<dependency>
<groupId>com.amdocs.zusammen</groupId>
<artifactId>zusammen-commons-db-api</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
</dependency>
<dependency>
<groupId>com.amdocs.zusammen</groupId>
<artifactId>zusammen-commons-db-impl</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.amdocs.zusammen.plugin</groupId>
<artifactId>zusammen-state-store-cassandra-plugin</artifactId>
- <version>0.0.1</version>
+ <version>${zusammen.version}</version>
</dependency>
</dependencies>
</project>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java
index 93ee2d058b..76b0a900c1 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java
@@ -78,6 +78,10 @@ public class ElementCollaborationStore {
ZusammenPluginUtil.getElementEntity(element));
}
+ public boolean checkHealth(SessionContext sessionContext){
+ return getElementRepository(sessionContext).checkHealth(sessionContext);
+ }
+
private void deleteElementHierarchy(ElementRepository elementRepository, SessionContext context,
ElementEntityContext elementEntityContext,
ElementEntity elementEntity) {
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java
index 468b6f0a28..967814c4d8 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java
@@ -22,4 +22,6 @@ public interface ElementRepository {
void createNamespace(SessionContext context, ElementEntityContext elementContext,
ElementEntity element);
+
+ boolean checkHealth(SessionContext context);
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java
index 12fd2dabba..c19e8799d1 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java
@@ -98,6 +98,12 @@ public class CassandraElementRepository implements ElementRepository {
element.getNamespace().toString());
}
+ @Override
+ public boolean checkHealth(SessionContext context) {
+ ResultSet resultSet = getVersionElementsAccessor(context).checkHealth();
+ return resultSet.getColumnDefinitions().contains("element_ids");
+ }
+
private String getVersionId(ElementEntityContext elementContext) {
return elementContext.getChangeRef() == null
? elementContext.getVersionId().toString()
@@ -350,6 +356,9 @@ CREATE TABLE IF NOT EXISTS element (
@Query("SELECT element_ids FROM version_elements WHERE space=? AND item_id=? AND version_id=?")
ResultSet get(String space, String itemId, String versionId);
+
+ @Query("SELECT element_ids FROM version_elements LIMIT 1")
+ ResultSet checkHealth();
}
private static final class VersionElementsField {
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java
index 4bf9a8d25e..90fd3366fe 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java
@@ -17,6 +17,7 @@
package org.openecomp.core.zusammen.plugin.main;
import com.amdocs.zusammen.commons.health.data.HealthInfo;
+import com.amdocs.zusammen.commons.health.data.HealthStatus;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.Namespace;
import com.amdocs.zusammen.datatypes.SessionContext;
@@ -155,6 +156,15 @@ public class CassandraCollaborationStorePluginImpl implements CollaborationStore
@Override
public Response<HealthInfo> checkHealth(SessionContext sessionContext) throws ZusammenException {
- return null;
+
+ boolean health = elementCollaborationStore.checkHealth(sessionContext);
+ HealthInfo healthInfo ;
+ if (health){
+ healthInfo = new HealthInfo("Collaboration", HealthStatus.UP,"");
+ } else {
+ healthInfo = new HealthInfo("Collaboration", HealthStatus.DOWN,"No Schema Available");
+ }
+ return new Response<HealthInfo>(healthInfo);
+
}
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..d02ce28af6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.openecomp.core</groupId>
+ <name>openecomp-core-lib</name>
+ <artifactId>openecomp-core-lib</artifactId>
+
+ <packaging>pom</packaging>
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>/openecomp-facade-lib</module>
+ <module>/openecomp-nosqldb-lib</module>
+ <module>/openecomp-utilities-lib</module>
+ <module>/openecomp-config-lib</module>
+ </modules>
+</project> \ No newline at end of file