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.xml39
-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-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java1
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java1
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java14
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java1
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/additional-logback.xml66
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml316
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java37
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml16
-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-api/src/main/java/org/openecomp/core/factory/api/AbstractFactory.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/impl/AbstractFactoryBase.java25
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml17
-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.xml14
-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.xml19
-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/util/UniqueValueUtil.java41
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml39
-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/dao/impl/UniqueValueCassandraDaoImpl.java4
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java1
-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.java15
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java8
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml7
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java80
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/Yaml/YamlUtilTest.java30
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java23
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/InnerP.java21
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/Parameter.java21
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/YamlFile.java21
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml13
-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.xml40
-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/CommonMethods.java178
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java5
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java32
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java31
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java35
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java77
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java24
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java22
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml49
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java76
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java31
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java40
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/resources/factoryConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml85
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java51
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java31
-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.java39
-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.java200
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java59
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java27
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java35
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java228
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/resources/factoryConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml37
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/ZusammenPluginConstants.java25
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/ZusammenPluginUtil.java95
-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.java101
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/VersionCollaborationStore.java79
-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.java25
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepositoryFactory.java14
-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/CassandraDaoUtils.java27
-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.java358
-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/CassandraElementRepositoryFactory.java31
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/types/ElementEntity.java134
-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.java160
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraStateStorePluginImpl.java58
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/factoryConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/zusammen.json23
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/pom.xml24
-rw-r--r--openecomp-be/lib/openecomp-core-lib/pom.xml15
-rw-r--r--openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup22
81 files changed, 3490 insertions, 394 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml
index 5f2005d3c4..989895c9cb 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml
@@ -3,46 +3,45 @@
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-config-lib</artifactId>
<parent>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-core-lib</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>openecomp-config-lib</artifactId>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12.4</version>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.3.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.14</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-nosqldb-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>6.9.10</version>
+ <version>${testng.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-vendor-software-product-api</artifactId>
<version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency-->
</dependencies>
-
-</project> \ No newline at end of file
+</project>
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-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java
index a68c6b614a..1d5fd16ee1 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java
@@ -25,6 +25,7 @@ import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData;
import java.util.Collection;
+
public interface ApplicationConfig {
ConfigurationData getConfigurationData(String namespace, String key);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java
index e022294dfd..c751b98c7e 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java
@@ -23,6 +23,7 @@ package org.openecomp.core.utilities.applicationconfig;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
+
public abstract class ApplicationConfigFactory extends AbstractComponentFactory<ApplicationConfig> {
public static ApplicationConfigFactory getInstance() {
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java
index 7fb0e2f5ae..b7cd576557 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java
@@ -36,8 +36,10 @@ import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData;
import java.util.Collection;
import java.util.Objects;
+
public class ApplicationConfigDaoCassandraImpl extends CassandraBaseDao<ApplicationConfigEntity>
- implements ApplicationConfigDao {
+ implements
+ ApplicationConfigDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
private static final Mapper<ApplicationConfigEntity> mapper =
@@ -56,11 +58,6 @@ public class ApplicationConfigDaoCassandraImpl extends CassandraBaseDao<Applicat
}
@Override
- public Collection<ApplicationConfigEntity> list(ApplicationConfigEntity entity) {
- return accessor.list(entity.getNamespace()).all();
- }
-
- @Override
public void create(ApplicationConfigEntity entity) {
accessor.updateApplicationConfigData(entity.getNamespace(), entity.getKey(), entity.getValue());
}
@@ -76,6 +73,11 @@ public class ApplicationConfigDaoCassandraImpl extends CassandraBaseDao<Applicat
}
@Override
+ public Collection<ApplicationConfigEntity> list(ApplicationConfigEntity entity) {
+ return accessor.list(entity.getNamespace()).all();
+ }
+
+ @Override
public long getValueTimestamp(String namespace, String key) {
ResultSet resultSet = accessor.getValueAndTimestampOfConfigurationValue(namespace, key);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java
index cea49ea8d1..23dde63e18 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java
@@ -23,6 +23,7 @@ package org.openecomp.core.utilities.applicationconfig.dao.impl;
import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDao;
import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDaoFactory;
+
public class ApplicationConfigDaoFactoryImpl extends ApplicationConfigDaoFactory {
private static final ApplicationConfigDao INSTANCE = new ApplicationConfigDaoCassandraImpl();
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java
index cca07fc227..eebd3320f0 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java
@@ -23,6 +23,7 @@ package org.openecomp.core.utilities.applicationconfig.impl;
import org.openecomp.core.utilities.applicationconfig.ApplicationConfig;
import org.openecomp.core.utilities.applicationconfig.ApplicationConfigFactory;
+
public class ApplicationConfigFactoryImpl extends ApplicationConfigFactory {
private static final ApplicationConfig INSTANCE = new ApplicationConfigImpl();
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java
index ff9c9aea87..16cd1bce17 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java
@@ -32,9 +32,6 @@ import org.openecomp.sdc.common.errors.ErrorCode;
import java.util.Collection;
import java.util.Objects;
-/**
- * The type Application config.
- */
public class ApplicationConfigImpl implements ApplicationConfig {
private static final ApplicationConfigDao applicationConfigDao =
ApplicationConfigDaoFactory.getInstance().createInterface();
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java
index 53d3797e53..b41cda635d 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java
@@ -20,6 +20,7 @@
package org.openecomp.core.utilities.applicationconfig.type;
+
public class ConfigurationData {
private String value;
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/additional-logback.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/additional-logback.xml
new file mode 100644
index 0000000000..cec94f17b5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/additional-logback.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<included>
+
+ <property scope="system" name="OPENECOMP-component-name" value="ASDC" />
+ <property scope="system" name="OPENECOMP-subcomponent-name" value="ASDC-BE" />
+
+ <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <include resource="asdc_debug_logback.xml"/-->
+
+ <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)-->
+ <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)-->
+ <property name="default-log-pattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${OPENECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=&lt;%M&gt;, Desc=&lt;%msg&gt;%n" />
+
+ <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/>
+
+ <appender name="DEBUG_PACKAGE_INCLUDE"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package_include.log
+ </file>
+
+ <!-- No need to deny audit messages - they are INFO only, will be denied
+ anyway -->
+ <!-- Transaction messages filter - deny Transaction messages, there are
+ some DEBUG level messages among them -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- accept DEBUG and TRACE level -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+ <expression>
+ e.level.toInt() &lt;= DEBUG.toInt()
+ </expression>
+ </evaluator>
+ <OnMismatch>DENY</OnMismatch>
+ <OnMatch>NEUTRAL</OnMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package_include.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${asdc-debug-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.openecomp.sdc.validation.impl.validators" level="DEBUG" additivity ="false">
+ <appender-ref ref="DEBUG_PACKAGE_INCLUDE" />
+ </logger>
+
+</included> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml
index e256e0b10a..92c486e901 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml
@@ -1,23 +1,173 @@
-<!--
<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
+<configuration scan="true" scanPeriod="5 seconds">
+ <property scope="system" name="OPENECOMP-component-name" value="ASDC" />
+ <property scope="system" name="OPENECOMP-subcomponent-name" value="ASDC-BE" />
+ <property file="${config.home}/catalog-be/configuration.yaml" />
+ <property scope="context" name="enable-all-log" value="false" />
+ <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <include resource="asdc_debug_logback.xml"/-->
+
+ <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)-->
+ <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)-->
+ <property name="default-log-pattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${OPENECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=&lt;%M&gt;, Desc=&lt;%msg&gt;%n" />
+
+ <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/>
+
+ <!-- All log -->
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender name="ALL_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/all.log
+ </file>
+
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/all.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ALL_ROLLING" />
+ </appender>
+ </then>
+ </if>
+
+ <!-- Error log -->
+ <appender name="ERROR_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/Error.log
+ </file>
+
+ <!-- Audit messages filter - deny audit messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>AUDIT_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- Transaction messages filter - deny Transaction messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/Error.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Debug log -->
<appender name="DEBUG_ROLLING"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>DOX-BE.log
+ <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug.log
</file>
- &lt;!&ndash; No need to deny audit messages - they are INFO only, will be denied
- anyway &ndash;&gt;
- &lt;!&ndash; Transaction messages filter - deny Transaction messages, there are
- some DEBUG level messages among them &ndash;&gt;
+ <!-- No need to deny audit messages - they are INFO only, will be denied
+ anyway -->
+ <!-- Transaction messages filter - deny Transaction messages, there are
+ some DEBUG level messages among them -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+ <!-- accept DEBUG and TRACE level -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+ <expression>
+ e.level.toInt() &lt;= DEBUG.toInt()
+ </expression>
+ </evaluator>
+ <OnMismatch>DENY</OnMismatch>
+ <OnMatch>NEUTRAL</OnMatch>
+ </filter>
- &lt;!&ndash; accept DEBUG and TRACE level &ndash;&gt;
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Debug log -->
+ <appender name="PACKAGE_DEBUG_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package.log
+ </file>
+
+ <!-- No need to deny audit messages - they are INFO only, will be denied
+ anyway -->
+ <!-- Transaction messages filter - deny Transaction messages, there are
+ some DEBUG level messages among them -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- accept DEBUG and TRACE level -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+ <expression>
+ e.level.toInt() &lt;= DEBUG.toInt()
+ </expression>
+ </evaluator>
+ <OnMismatch>DENY</OnMismatch>
+ <OnMatch>NEUTRAL</OnMatch>
+ </filter>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>/DOX-BE.log.%i
+ <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package.log.%i
</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>10</maxIndex>
@@ -28,63 +178,107 @@
<maxFileSize>20MB</maxFileSize>
</triggeringPolicy>
<encoder>
- <pattern>%level [%d{yyyy-MM-dd'T'HH:mm:ss}] - Method=%M, Desc=&lt;%msg&gt;%n</pattern>
+ <pattern>${asdc-debug-log-pattern}</pattern>
</encoder>
</appender>
+ <!-- Audit log -->
+ <appender name="AUDIT_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
- <root level="info">
+ <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/audit.log
+ </file>
+
+ <!-- Audit messages filter - accept audit messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>AUDIT_MARKER</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/audit.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- SdncTransaction log -->
+ <appender name="TRANSACTION_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+
+ <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/transaction.log
+ </file>
+
+ <!-- Transaction messages filter - accept audit messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/transaction.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Asynchronicity Configurations -->
+ <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="DEBUG_ROLLING" />
+ </appender>
+
+ <appender name="ASYNC_TRANSACTION" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="TRANSACTION_ROLLING" />
+ </appender>
+
+ <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ERROR_ROLLING" />
+ </appender>
+
+
+ <root level="INFO">
+ <appender-ref ref="ASYNC_ERROR" />
+ <appender-ref ref="ASYNC_DEBUG" />
+ <appender-ref ref="AUDIT_ROLLING" />
+ <appender-ref ref="ASYNC_TRANSACTION" />
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender-ref ref="ALL_ROLLING" />
+ </then>
+ </if>
</root>
-</configuration>-->
-<configuration scan="true" scanPeriod="3 seconds">
-
- <property name="logDir" value="logs"/>
- <property name="componentName" value="ASDC"/>
- <property name="ECOMP-subcomponent-name" value="ASDC-BE"/>
-
- <property name="defaultPattern"
- value="%msg%n"/>
-
- <!--<property name="MetricsLogPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{CategoryLogLevel}|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIP}|%logger%n" />
- <property name="AuditLogPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{CategoryLogLevel}|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIP}%n" />
- <property name="ErrorLogPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS, GMT}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDescription}|%msg%n"/>
- <property name="DebugLogPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS, GMT}|%X{RequestId}||%logger|%msg%n"/>-->
-
- <!-- new pattern -->
- <property name="default-log-pattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{BeginTimestamp}|%X{EndTimestamp}|%X{uuid}|%X{serviceInstanceID}|%thread|%X{ServerName}|%X{ServiceName}|${ECOMP-subcomponent-name}|%X{userId}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDescription}|%level|%X{alarmSeverity}|%X{localAddr}|%X{ElapsedTime}|%X{beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=&lt;%M&gt;, Desc=&lt;%msg&gt;%n"/>
-
- <property name="logDirectory" value="${logDir}/${componentName}"/>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="DISPATCHER" class="ch.qos.logback.classic.sift.SiftingAppender">
- <discriminator class="org.openecomp.core.logging.logback.EventTypeDiscriminator"/>
- <sift>
- <appender name="${eventType}" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${eventType}.log</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/${eventType}.%i.log.zip</fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
- </sift>
- </appender>
-
- <root level="DEBUG">
- <appender-ref ref="DISPATCHER"/>
- </root>
+ <logger name="org.openecomp.sdc" level="INFO" />
+
+ <logger name="org.openecomp.sdc.vendorsoftwareproduct" level="DEBUG" additivity ="false">
+ <appender-ref ref="PACKAGE_DEBUG_ROLLING" />
+ </logger>
+
+ <logger name="org.openecomp.sdc.vendorlicense" level="DEBUG" additivity ="false">
+ <appender-ref ref="PACKAGE_DEBUG_ROLLING" />
+ </logger>
</configuration> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java
index 40cde1ecb2..de41bb8202 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java
@@ -1,9 +1,25 @@
+/*-
+ * ============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.sdc.applicationconfig.dao;
-import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ErrorCategory;
-import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
import org.openecomp.core.utilities.applicationconfig.ApplicationConfig;
import org.openecomp.core.utilities.applicationconfig.ApplicationConfigFactory;
import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDao;
@@ -11,6 +27,9 @@ import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDaoFa
import org.openecomp.core.utilities.applicationconfig.dao.type.ApplicationConfigEntity;
import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -27,7 +46,7 @@ public class ApplicationConfigImplDaoTest {
private static ApplicationConfig applicationConfig =
ApplicationConfigFactory.getInstance().createInterface();
-// @BeforeClass
+ @BeforeClass
public static void init() {
try {
@@ -55,17 +74,17 @@ public class ApplicationConfigImplDaoTest {
return new String(FileUtils.toByteArray(FileUtils.loadFileToInputStream(path)));
}
-// @Test
+ @Test
public void testApplicationConfigTimestampValue() {
ConfigurationData configurationData = applicationConfig
- .getConfigurationData("test - namespace", CompositionEntityType.vsp.name());
+ .getConfigurationData("test - namespace", "vsp");
Assert.assertNotNull(configurationData);
Assert.assertNotEquals(configurationData.getTimeStamp(), 0);
}
-// @Test(dependsOnMethods = "testApplicationConfigTimestampValue")
+ @Test(dependsOnMethods = "testApplicationConfigTimestampValue")
public void testNotExistingApplicationConfigTimestampValue() {
try {
applicationConfig.getConfigurationData("test - namespace", "aaa");
@@ -76,7 +95,7 @@ public class ApplicationConfigImplDaoTest {
}
-// @Test(dependsOnMethods = "testApplicationConfigTimestampValue")
+ @Test(dependsOnMethods = "testApplicationConfigTimestampValue")
public void testInsertApplicationConfiguration() {
String testTemplate = loadFileToString("questionnaire/testTemplate.txt");
applicationConfig.insertValue("test_namespace", "test_key", testTemplate);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml
index b71c0b957e..4e15df1202 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml
@@ -2,29 +2,29 @@
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.1.0-SNAPSHOT</version>
- <relativePath>../../..</relativePath>
+ <relativePath>../../../</relativePath>
</parent>
- <name>openecomp-facade-api</name>
- <artifactId>openecomp-facade-api</artifactId>
-
-
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-utilities-lib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-common-lib</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
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-api/src/main/java/org/openecomp/core/factory/api/AbstractFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/api/AbstractFactory.java
index 53b8f00fc0..12956417dd 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/api/AbstractFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/api/AbstractFactory.java
@@ -54,7 +54,7 @@ import org.openecomp.core.factory.impl.AbstractFactoryBase;
* static {
* registerFactory(ConcreteFactory.class, BaselineFactoryImpl.class);
* }
- * public static ConcreteFactory getInstance() {
+ * public static ConcreteFactory getInstance() {
* return AbstractFactory.&lt;IUnknown, ConcreteFactory.class&gt;getInstance(ConcreteFactory.class);
* }
* }
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/impl/AbstractFactoryBase.java b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/impl/AbstractFactoryBase.java
index e19d9e972f..9353de662b 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/impl/AbstractFactoryBase.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/src/main/java/org/openecomp/core/factory/impl/AbstractFactoryBase.java
@@ -20,6 +20,7 @@
package org.openecomp.core.factory.impl;
+
import static org.openecomp.core.utilities.CommonMethods.isEmpty;
import static org.openecomp.core.utilities.CommonMethods.newInstance;
@@ -27,20 +28,16 @@ import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-/**
- * The type Abstract factory base.
- */
public abstract class AbstractFactoryBase {
/**
* Temporary registry of default implementations. The map keeps class names rather then class
- * types to allow unloading of those classes from memory by garbage collector if
- * factory is not actually used.
+ * types to allow unloading of those classes from memory by garbage collector if factory is not
+ * actually used.
*/
private static Map<String, String> registry = new ConcurrentHashMap<String, String>();
@@ -51,8 +48,8 @@ public abstract class AbstractFactoryBase {
new ConcurrentHashMap<String, AbstractFactoryBase>();
/**
- * Registers implementor for an abstract factory. The method accepts Java classes rather
- * then class names to ensure type safety at compilation time.
+ * Registers implementor for an abstract factory. The method accepts Java classes rather then
+ * class names to ensure type safety at compilation time.
*
* @param <I> Java interface type instantiated by abstract factory
* @param <F> Type specific abstract factory for concrete Java interface
@@ -78,12 +75,6 @@ public abstract class AbstractFactoryBase {
registry.put(factory.getName(), impl.getName());
} // registerFactory
- /**
- * Register factory.
- *
- * @param factoryName the factory name
- * @param implName the impl name
- */
// TODO: Remove
protected static void registerFactory(String factoryName, String implName) {
registry.put(factoryName, implName);
@@ -197,15 +188,9 @@ public abstract class AbstractFactoryBase {
}
}
- /**
- * Init.
- */
protected void init() {
}
- /**
- * Stop.
- */
protected void stop() {
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml
index fdd7dab8bc..62a1eeca89 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml
@@ -2,6 +2,10 @@
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>
@@ -9,28 +13,23 @@
<relativePath>../../..</relativePath>
</parent>
- <artifactId>openecomp-facade-core</artifactId>
- <name>openecomp-facade-core</name>
-
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-utilities-lib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-common-lib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
-
-
-</project> \ No newline at end of file
+</project>
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 b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml
index c8ee00372c..aa90996e23 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml
@@ -2,16 +2,16 @@
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.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <packaging>pom</packaging>
- <artifactId>openecomp-facade-lib</artifactId>
- <name>openecomp-facade-lib</name>
-
<modules>
<module>openecomp-facade-api</module>
<module>openecomp-facade-core</module>
@@ -19,13 +19,13 @@
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-core</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
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 b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml
index 4ff52e5e33..bce553cfde 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml
@@ -2,6 +2,10 @@
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>
@@ -9,13 +13,9 @@
<relativePath>../../..</relativePath>
</parent>
- <name>openecomp-nosqldb-api</name>
- <artifactId>openecomp-nosqldb-api</artifactId>
-
-
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-api</artifactId>
<version>${project.version}</version>
</dependency>
@@ -30,11 +30,16 @@
<version>${datasatx.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <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>${project.version}</version>
+ </dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
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/util/UniqueValueUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java
index a82c97c51c..d2dee5e512 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java
@@ -27,21 +27,18 @@ import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.common.utils.CommonUtil;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import java.util.Optional;
-/**
- * The type Unique value util.
- */
public class UniqueValueUtil {
- /**
- * The constant UNIQUE_VALUE_VIOLATION.
- */
public static final String UNIQUE_VALUE_VIOLATION = "UNIQUE_VALUE_VIOLATION";
private static final String UNIQUE_VALUE_VIOLATION_MSG = "%s with the value '%s' already exists.";
private static final UniqueValueDao uniqueValueDao =
UniqueValueDaoFactory.getInstance().createInterface();
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
/**
* Create unique value.
@@ -50,12 +47,18 @@ public class UniqueValueUtil {
* @param uniqueCombination the unique combination
*/
public static void createUniqueValue(String type, String... uniqueCombination) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
Optional<String> value = formatValue(uniqueCombination);
if (!value.isPresent()) {
return;
}
validateUniqueValue(type, value.get(), uniqueCombination);
uniqueValueDao.create(new UniqueValueEntity(type, value.get()));
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
/**
@@ -65,11 +68,17 @@ public class UniqueValueUtil {
* @param uniqueCombination the unique combination
*/
public static void deleteUniqueValue(String type, String... uniqueCombination) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
Optional<String> value = formatValue(uniqueCombination);
if (!value.isPresent()) {
return;
}
uniqueValueDao.delete(new UniqueValueEntity(type, value.get()));
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
/**
@@ -82,12 +91,18 @@ public class UniqueValueUtil {
*/
public static void updateUniqueValue(String type, String oldValue, String newValue,
String... uniqueContext) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
if ((newValue != null && oldValue != null
&& !newValue.toLowerCase().equals(oldValue.toLowerCase()))
|| newValue == null || oldValue == null) {
createUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{newValue}));
deleteUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{oldValue}));
}
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
/**
@@ -97,14 +112,20 @@ public class UniqueValueUtil {
* @param uniqueCombination the unique combination
*/
public static void validateUniqueValue(String type, String... uniqueCombination) {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
Optional<String> value = formatValue(uniqueCombination);
if (!value.isPresent()) {
return;
}
validateUniqueValue(type, value.get(), uniqueCombination);
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
private static void validateUniqueValue(String type, String value, String... uniqueCombination) {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
if (uniqueValueDao.get(new UniqueValueEntity(type, value)) != null) {
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
.withCategory(ErrorCategory.APPLICATION)
@@ -112,9 +133,15 @@ public class UniqueValueUtil {
.withMessage(String.format(UNIQUE_VALUE_VIOLATION_MSG, type,
uniqueCombination[uniqueCombination.length - 1])).build());
}
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
private static Optional<String> formatValue(String[] uniqueCombination) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
if (uniqueCombination == null || uniqueCombination.length == 0
|| uniqueCombination[uniqueCombination.length - 1] == null) {
return Optional.empty();
@@ -122,6 +149,8 @@ public class UniqueValueUtil {
uniqueCombination[uniqueCombination.length - 1] =
uniqueCombination[uniqueCombination.length - 1].toLowerCase();
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
return Optional.of(CommonMethods.arrayToSeparatedString(uniqueCombination, '_'));
}
}
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 3922acdc7f..f091f47bfd 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
@@ -2,6 +2,10 @@
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>
@@ -9,33 +13,30 @@
<relativePath>../../..</relativePath>
</parent>
- <artifactId>openecomp-nosqldb-core</artifactId>
- <name>openecomp-nosqldb-core</name>
-
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12.4</version>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-nosqldb-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.14</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.3.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
- <version>1.10.19</version>
+ <version>${mockito.all.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
@@ -53,7 +54,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- <version>RELEASE</version>
+ <version>4.11</version>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</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/dao/impl/UniqueValueCassandraDaoImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/dao/impl/UniqueValueCassandraDaoImpl.java
index 31dd602400..a2f34bd329 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/dao/impl/UniqueValueCassandraDaoImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/dao/impl/UniqueValueCassandraDaoImpl.java
@@ -31,8 +31,8 @@ import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import java.util.Collection;
-public class UniqueValueCassandraDaoImpl extends CassandraBaseDao<UniqueValueEntity>
- implements UniqueValueDao {
+public class UniqueValueCassandraDaoImpl extends CassandraBaseDao<UniqueValueEntity> implements
+ UniqueValueDao {
private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
private static Mapper<UniqueValueEntity> mapper =
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java
index 2922925171..134d341d05 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java
@@ -20,6 +20,7 @@
package org.openecomp.core.nosqldb.impl.cassandra;
+
import com.datastax.driver.core.Session;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
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 1b98f095b5..4863e3df0f 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
@@ -25,7 +25,6 @@ import com.google.common.base.Optional;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.SSLOptions;
import com.datastax.driver.core.Session;
-
import org.openecomp.core.nosqldb.util.CassandraUtils;
import java.io.FileInputStream;
@@ -56,6 +55,8 @@ public class CassandraSessionFactory {
for (String address : addresses) {
builder.addContactPoint(address);
}
+
+ //Check if ssl
Boolean isSsl = CassandraUtils.isSsl();
if (isSsl) {
builder.withSSL(getSslOptions().get());
@@ -69,7 +70,6 @@ public class CassandraSessionFactory {
if (isAuthenticate) {
builder.withCredentials(CassandraUtils.getUser(), CassandraUtils.getPassword());
}
-
Cluster cluster = builder.build();
String keyStore = CassandraUtils.getKeySpace();
return cluster.connect(keyStore);
@@ -84,8 +84,9 @@ public class CassandraSessionFactory {
try {
context = getSslContext(truststorePath.get(), truststorePassword.get());
} catch (UnrecoverableKeyException | KeyManagementException
- | NoSuchAlgorithmException | KeyStoreException | CertificateException | IOException e0) {
- throw new RuntimeException(e0);
+ | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException exception) {
+ throw new RuntimeException(exception);
}
String[] css = new String[]{"TLS_RSA_WITH_AES_128_CBC_SHA"};
return Optional.of(new SSLOptions(context, css));
@@ -109,8 +110,8 @@ public class CassandraSessionFactory {
tmf.init(ts);
ctx.init(null, tmf.getTrustManagers(), new SecureRandom());
- } catch (Exception e0) {
- e0.printStackTrace();
+ } catch (Exception exception) {
+ exception.printStackTrace();
} finally {
tsf.close();
@@ -121,4 +122,6 @@ public class CassandraSessionFactory {
private static class ReferenceHolder {
private static final Session CASSANDRA = newCassandraSession();
}
+
+
}
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 a1c0b528fb..44623ff91b 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
@@ -97,9 +97,9 @@ public class ConfigurationManager {
if (addresses != null) {
return addresses.split(",");
}
- List locAddresses = (ArrayList) cassandraConfiguration.get(cassandraHostsKey);
+ List lsAddresses = (ArrayList) cassandraConfiguration.get(cassandraHostsKey);
String[] addressesArray;
- addressesArray = (String[]) locAddresses.toArray(new String[locAddresses.size()]);
+ addressesArray = (String[]) lsAddresses.toArray(new String[lsAddresses.size()]);
return addressesArray;
}
@@ -226,8 +226,8 @@ public class ConfigurationManager {
InputStream is = null;
try {
is = new FileInputStream(file);
- } catch (FileNotFoundException e0) {
- e0.printStackTrace();
+ } catch (FileNotFoundException exception) {
+ exception.printStackTrace();
}
return is;
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml
index 0988f50237..1551d867b5 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml
@@ -7,9 +7,6 @@ identificationHeaderFields:
-# catalog backend hostname
-beFqdn: sdccatalog.att.com
-
# catalog backend http port
beHttpPort: 8080
@@ -54,7 +51,7 @@ cassandraConfig:
cassandraHosts: ['127.0.0.1']
reconnectTimeout : 30000
authenticate: false
- username: sdc_user
+ username: asdc_user
password: Aa1234%^!
ssl: false
truststorePath : /path/path
@@ -152,7 +149,7 @@ informationalServiceArtifacts:
displayName: Service Artifact Plan
type: OTHER
summaryOfImpactsToECOMPElements:
- displayName: Summary of impacts to ECOMP elements,OSSs, BSSs
+ displayName: Summary of impacts to OPENECOMP elements,OSSs, BSSs
type: OTHER
controlLoopFunctions:
displayName: Control Loop Functions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java
index e53c482b86..25bd6aa380 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java
@@ -1,48 +1,68 @@
-package org.openecomp.core.nosqldb;
-
-import org.openecomp.core.nosqldb.api.NoSqlDb;
+/*-
+ * ============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=========================================================
+ */
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+package org.openecomp.core.nosqldb;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
-
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.List;
+
public class NoSqlDbTest {
- private static NoSqlDb noSqlDb;
+ private static NoSqlDb noSqlDb;
-// @Test
- public void testNoSqlDbFactoryFactoryInit(){
- this.noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- Assert.assertNotNull(this.noSqlDb);
- Assert.assertEquals(this.noSqlDb.getClass().getName(),"org.openecomp.core.nosqldb.impl.cassandra.CassandraNoSqlDbImpl");
- }
+ @Test
+ public void testNoSqlDbFactoryFactoryInit() {
+ this.noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ Assert.assertNotNull(this.noSqlDb);
+ Assert.assertEquals(this.noSqlDb.getClass().getName(),
+ "org.openecomp.core.nosqldb.impl.cassandra.CassandraNoSqlDbImpl");
+ }
-// @Test(dependsOnMethods = {"testNoSqlDbFactoryFactoryInit"})
- public void testCreateTable(){
- this.noSqlDb.execute("test.drop",null);
- this.noSqlDb.execute("test.create",null);
- }
+ @Test(dependsOnMethods = {"testNoSqlDbFactoryFactoryInit"})
+ public void testCreateTable() {
+ this.noSqlDb.execute("test.drop", null);
+ this.noSqlDb.execute("test.create", null);
+ }
-// @Test(dependsOnMethods = {"testCreateTable"})
- public void testInsertTable(){
- this.noSqlDb.insert("test",new String[]{"name","value"},new String[]{"TestName","testValue"});
- this.noSqlDb.execute("test.insert",new String[]{"TestName2","testValue2"});
- }
+ @Test(dependsOnMethods = {"testCreateTable"})
+ public void testInsertTable() {
+ this.noSqlDb
+ .insert("test", new String[]{"name", "value"}, new String[]{"TestName", "testValue"});
+ this.noSqlDb.execute("test.insert", new String[]{"TestName2", "testValue2"});
+ }
-// @Test(dependsOnMethod`s = {"testInsertTable"})
- public void gettestSelectTable(){
- ResultSet result = this.noSqlDb.execute("test.select.all",null);
- List<Row> rows = result.all();
- Assert.assertEquals(rows.size(),2);
- for (Row row:rows){
- System.out.format("%s %s\n", row.getString("name"), row.getString("value"));
- }
+ @Test(dependsOnMethods = {"testInsertTable"})
+ public void gettestSelectTable() {
+ ResultSet result = this.noSqlDb.execute("test.select.all", null);
+ List<Row> rows = result.all();
+ Assert.assertEquals(rows.size(), 2);
+ for (Row row : rows) {
+ System.out.format("%s %s\n", row.getString("name"), row.getString("value"));
}
+ }
}
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 baf9bfb350..1e3305ef18 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
@@ -1,8 +1,28 @@
+/*-
+ * ============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.core.utilities.yaml.YamlUtil;
import org.junit.Before;
import org.junit.Test;
+import org.openecomp.core.utilities.yaml.YamlUtil;
import testobjects.yaml.YamlFile;
@@ -36,12 +56,12 @@ public class YamlUtilTest {
/*public void loadCassandraParameters(){
- YamlUtil yamlutil = new YamlUtil();
+ YamlUtil yamlUtil = new YamlUtil();
String cassandraKey = "cassandraConfig";
String configurationFile = "/configuration.yaml";
- InputStream yamlAsIS = yamlutil.loadYamlFileIs(configurationFile);
- Map<String, LinkedHashMap<String, Object>> configurationMap = yamlutil.yamlToMap(yamlAsIS);
+ InputStream yamlAsIS = yamlUtil.loadYamlFileIs(configurationFile);
+ Map<String, LinkedHashMap<String, Object>> configurationMap = yamlUtil.yamlToMap(yamlAsIS);
LinkedHashMap<String, Object> cassandraConfiguration = configurationMap.get(cassandraKey);
System.out.println(cassandraConfiguration.entrySet());
}*/
-} \ No newline at end of file
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java
index 5cf8988c06..afe2fbbbbb 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java
@@ -1,8 +1,27 @@
+/*-
+ * ============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.json;
import org.junit.Test;
-import static org.junit.Assert.*;
public class JsonUtilTest {
@Test
@@ -10,4 +29,4 @@ public class JsonUtilTest {
System.out.println("as");
}
-} \ No newline at end of file
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/InnerP.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/InnerP.java
index eda4143e3e..1a790ba439 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/InnerP.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/InnerP.java
@@ -1,5 +1,26 @@
+/*-
+ * ============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 testobjects.yaml;
+
public class InnerP {
String name;
String label;
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/Parameter.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/Parameter.java
index febcef9c40..4f6f8253cb 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/Parameter.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/Parameter.java
@@ -1,7 +1,28 @@
+/*-
+ * ============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 testobjects.yaml;
import java.util.Map;
+
public class Parameter {
String name;
String label;
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/YamlFile.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/YamlFile.java
index 1c4989da37..2eb78e0ab5 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/YamlFile.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/testobjects/yaml/YamlFile.java
@@ -1,7 +1,28 @@
+/*-
+ * ============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 testobjects.yaml;
import java.util.Map;
+
public class YamlFile {
String heat_template_version;
String description;
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml
index 63683631df..ce06d86b64 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml
@@ -2,6 +2,10 @@
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>
@@ -9,11 +13,6 @@
<relativePath>../..</relativePath>
</parent>
- <artifactId>openecomp-nosqldb-lib</artifactId>
-
- <name>openecomp-nosqldb-lib</name>
- <packaging>pom</packaging>
-
<modules>
<module>openecomp-nosqldb-api</module>
<module>openecomp-nosqldb-core</module>
@@ -21,13 +20,13 @@
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-nosqldb-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-nosqldb-core</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
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 3810896784..c139be6f00 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
@@ -2,49 +2,38 @@
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.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>openecomp-utilities-lib</artifactId>
- <name>openecomp-utilities-lib</name>
-
-
<dependencies>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.17</version>
+ <version>${snakeyaml.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.4</version>
+ <version>${commons.lang3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
- <version>4.1</version>
+ <version>${commons.collections.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
- <version>2.3.1</version>
+ <version>${gson.version}</version>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.10</version>
-
- </dependency>
- <!--<dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.17</version>
- </dependency>-->
- <dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons.codec.version}</version>
@@ -53,12 +42,12 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- <version>RELEASE</version>
+ <version>4.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
- <version>${org.codehaus.jackson.version}</version>
+ <version>${jackson.mapper.version}</version>
</dependency>
<dependency>
<groupId>org.everit.json</groupId>
@@ -77,6 +66,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
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/CommonMethods.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/CommonMethods.java
index 343636bd15..81a82c6298 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/CommonMethods.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/CommonMethods.java
@@ -21,6 +21,7 @@
package org.openecomp.core.utilities;
import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.collections4.MapUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -36,8 +37,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.UUID;
@@ -45,14 +48,12 @@ import java.util.UUID;
* This class provides auxiliary static methods.
*/
public class CommonMethods {
- //private static final Logger logger = LoggerFactory.getLogger(CommonMethods.class);
-
- private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
private static final char[] CHARS = new char[]{
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
+ private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
/**
* Private default constructor to prevent instantiation of the class objects.
@@ -73,8 +74,8 @@ public class CommonMethods {
ObjectOutputStream ds = new ObjectOutputStream(byteArray);
ds.writeObject(object);
ds.close();
- } catch (IOException e0) {
- throw new RuntimeException(e0);
+ } catch (IOException exception) {
+ throw new RuntimeException(exception);
}
return byteArray.toByteArray();
@@ -93,8 +94,8 @@ public class CommonMethods {
ObjectInputStream stream = new ObjectInputStream(new ByteArrayInputStream(bytes));
obj = (Serializable) stream.readObject();
stream.close();
- } catch (IOException | ClassNotFoundException e0) {
- throw new RuntimeException(e0);
+ } catch (IOException | ClassNotFoundException exception) {
+ throw new RuntimeException(exception);
}
return obj;
@@ -185,8 +186,8 @@ public class CommonMethods {
/**
* Converts the array with Long elements to the array with long (primitive type).
*
- * @param array input array with Long elements.
- * @return array with the same elements converted to the long type (primitive).
+ * @param array input array with Long elements
+ * @return array with the same elements converted to the long type (primitive)
*/
public static long[] toPrimitive(Long[] array) {
if (array == null) {
@@ -255,12 +256,12 @@ public class CommonMethods {
* empty.
*
* @param <T> the type parameter
- * @param left Elements of this array will be copied to positions from 0 to
- * <tt>left.length - 1</tt> in the target array.
- * @param right Elements of this array will be copied to positions from
- * <tt>left.length</tt> to <tt>left.length + right.length</tt>
- * @return A newly allocate Java array that accommodates elements of source (left/right)
- arraysor one of source arrays if another is empty, <tt>null</tt> - otherwise.
+ * @param left Elements of this array will be copied to positions from 0 to <tt>left.length -
+ * 1</tt> in the target array.
+ * @param right Elements of this array will be copied to positions from <tt>left.length</tt> to
+ * <tt>left.length + right.length</tt>
+ * @return A newly allocate Java array that accommodates elements of source (left/right) arrays
+ orone of source arrays if another is empty, <tt>null</tt> - otherwise.
*/
@SuppressWarnings("unchecked")
public static <T> T[] concat(T[] left, T[] right) {
@@ -288,25 +289,25 @@ public class CommonMethods {
*
* @param <B> the type parameter
* @param <D> the type parameter
- * @param b0 An object instance to be casted to the specified Java type.
+ * @param b1 An object instance to be casted to the specified Java type.
* @param cls Target Java type.
* @return Object instance safely casted to the requested Java type.
- * @throws ClassCastException In case which is the given object is not instance of the
- * specified Java type.
+ * @throws ClassCastException In case which is the given object is not instance of the specified
+ * Java type.
*/
@SuppressWarnings("unchecked")
- public static <B, D> D cast(B b0, Class<D> cls) {
- D d0 = null;
- if (b0 != null) {
- if (!cls.isInstance(b0)) {
+ public static <B, D> D cast(B b1, Class<D> cls) {
+ D d1 = null;
+ if (b1 != null) {
+ if (!cls.isInstance(b1)) {
throw new ClassCastException(String
- .format("Failed to cast from '%s' to '%s'", b0.getClass().getName(), cls.getName()));
+ .format("Failed to cast from '%s' to '%s'", b1.getClass().getName(), cls.getName()));
} else {
- d0 = (D) b0;
+ d1 = (D) b1;
}
}
- return d0;
+ return d1;
} // cast
/**
@@ -349,8 +350,8 @@ public class CommonMethods {
Class<? extends T> impl = (Class<? extends T>) temp;
return newInstance(impl);
- } catch (ClassNotFoundException e0) {
- throw new IllegalArgumentException(e0);
+ } catch (ClassNotFoundException exception) {
+ throw new IllegalArgumentException(exception);
}
}
@@ -364,10 +365,10 @@ public class CommonMethods {
public static <T> T newInstance(Class<T> cls) {
try {
return cls.newInstance();
- } catch (InstantiationException e0) {
- throw new RuntimeException(e0);
- } catch (IllegalAccessException e0) {
- throw new RuntimeException(e0);
+ } catch (InstantiationException exception) {
+ throw new RuntimeException(exception);
+ } catch (IllegalAccessException exception) {
+ throw new RuntimeException(exception);
}
}
@@ -388,15 +389,15 @@ public class CommonMethods {
/**
* Gets stack trace.
*
- * @param t0 the t 0
+ * @param throwable the throwable
* @return the stack trace
*/
- public static String getStackTrace(Throwable t0) {
- if (null == t0) {
+ public static String getStackTrace(Throwable throwable) {
+ if (null == throwable) {
return "";
}
StringWriter sw = new StringWriter();
- t0.printStackTrace(new PrintWriter(sw));
+ throwable.printStackTrace(new PrintWriter(sw));
return sw.toString();
}
@@ -416,8 +417,8 @@ public class CommonMethods {
String str = sw.toString();
try {
sw.close();
- } catch (IOException e0) {
- System.err.println(e0);
+ } catch (IOException exception) {
+ System.err.println(exception);
}
return str;
@@ -530,10 +531,10 @@ public class CommonMethods {
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
- int v0 = bytes[j] & 0xFF;
- int x0 = j << 1;
- hexChars[x0] = hexArray[v0 >>> 4];
- hexChars[x0 + 1] = hexArray[v0 & 0x0F];
+ int var = bytes[j] & 0xFF;
+ int x1 = j << 1;
+ hexChars[x1] = hexArray[var >>> 4];
+ hexChars[x1 + 1] = hexArray[var & 0x0F];
}
return new String(hexChars);
}
@@ -543,13 +544,106 @@ public class CommonMethods {
*
* @param <T> the class of the objects in the set
* @param element the single element to be contained in the returned Set
- * @return an immutable set containing only the specified object.The returned set is serializable.
+ * @return an immutable set containing only the specified object. The returned set is
+ serializable.
*/
public static <T> Set<T> toSingleElementSet(T element) {
return Collections.singleton(element);
}
+ /**
+ * Merge lists of map list.
+ *
+ * @param <T> the type parameter
+ * @param <S> the type parameter
+ * @param target the target
+ * @param source the source
+ * @return the list
+ */
+ public static <T, S> List<Map<T, S>> mergeListsOfMap(List<Map<T, S>> target,
+ List<Map<T, S>> source) {
+ List<Map<T, S>> retList = new ArrayList<>();
+ if (Objects.nonNull(target)) {
+ retList.addAll(target);
+ }
+
+ if (Objects.nonNull(source)) {
+ for (Map<T, S> sourceMap : source) {
+ for (Map.Entry<T, S> entry : sourceMap.entrySet()) {
+ mergeEntryInList(entry.getKey(), entry.getValue(), retList);
+ }
+ }
+ }
+ return retList;
+ }
+
+ /**
+ * Merge lists list.
+ *
+ * @param <T> the type parameter
+ * @param target the target
+ * @param source the source
+ * @return the list
+ */
+ public static <T> List<T> mergeLists(List<T> target, List<T> source) {
+ List<T> retList = new ArrayList<>();
+
+ if (Objects.nonNull(source)) {
+ retList.addAll(source);
+ }
+ if (Objects.nonNull(target)) {
+ retList.addAll(target);
+ }
+
+ return retList;
+ }
+
+ /**
+ * Merge entry in list.
+ *
+ * @param <T> the type parameter
+ * @param <S> the type parameter
+ * @param key the key
+ * @param value the value
+ * @param target the target
+ */
+ public static <T, S> void mergeEntryInList(T key, S value, List<Map<T, S>> target) {
+ boolean found = false;
+ for (Map<T, S> map : target) {
+ if (map.containsKey(key)) {
+ map.put(key, value);
+ found = true;
+ }
+ }
+
+ if (!found) {
+ Map<T, S> newMap = new HashMap<>();
+ newMap.put(key, value);
+ target.add(newMap);
+ }
+ }
+
+
+ /**
+ * Merge maps map.
+ *
+ * @param <T> the type parameter
+ * @param <S> the type parameter
+ * @param target the target
+ * @param source the source
+ * @return the map
+ */
+ public static <T, S> Map<T, S> mergeMaps(Map<T, S> target, Map<T, S> source) {
+ Map<T, S> retMap = new HashMap<>();
+ if (MapUtils.isNotEmpty(source)) {
+ retMap.putAll(source);
+ }
+ if (MapUtils.isNotEmpty(target)) {
+ retMap.putAll(target);
+ }
+ return retMap;
+ }
}
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 67a79875d4..c828505932 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
@@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Set;
public class FileContentHandler {
+
private Map<String, byte[]> files = new HashMap<>();
/**
@@ -57,6 +58,10 @@ public class FileContentHandler {
files.put(fileName, FileUtils.toByteArray(is));
}
+ public Map<String, byte[]> getFiles() {
+ return 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 72fa9ac7b8..664ccb68c6 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 java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -59,6 +59,23 @@ public class FileUtils {
}
/**
+ * Gets file input stream.
+ *
+ * @param urlFile the url file
+ * @return the file input stream
+ */
+ public static InputStream getFileInputStream(URL urlFile) {
+ InputStream is;
+ try {
+ assert urlFile != null;
+ is = urlFile.openStream();
+ } catch (IOException exception) {
+ throw new RuntimeException(exception);
+ }
+ return is;
+ }
+
+ /**
* Gets file input streams.
*
* @param fileName the file name
@@ -134,9 +151,9 @@ public class FileUtils {
* @return the input stream
*/
public static InputStream loadFileToInputStream(String fileName) {
- URL urlFile = FileUtils.class.getClassLoader().getResource(fileName);
+ URL urlFile = Thread.currentThread().getContextClassLoader().getResource(fileName);
try {
- Enumeration<URL> en = FileUtils.class.getClassLoader().getResources(fileName);
+ Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(fileName);
while (en.hasMoreElements()) {
urlFile = en.nextElement();
}
@@ -248,6 +265,7 @@ public class FileUtils {
return mapFileContent;
}
+
/**
* The enum File extension.
*/
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java
index 8968eeb323..84e4f6d7c9 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java
@@ -22,22 +22,17 @@ package org.openecomp.core.utilities.json;
import org.json.JSONException;
import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
-/**
- * The type Json schema data generator.
- */
public class JsonSchemaDataGenerator {
private static final String ROOT = "root";
- private static final Logger logger = LoggerFactory.getLogger(JsonSchemaDataGenerator.class);
- /**
- * The Include defaults.
- */
+ private static final Logger logger =
+ (Logger) LoggerFactory.getLogger(JsonSchemaDataGenerator.class);
boolean includeDefaults = true;
private JSONObject root;
private Map<String, Object> referencesData;
@@ -54,11 +49,6 @@ public class JsonSchemaDataGenerator {
root = new JSONObject(jsonSchema);
}
- /**
- * Sets include defaults.
- *
- * @param includeDefaults the include defaults
- */
public void setIncludeDefaults(boolean includeDefaults) {
this.includeDefaults = includeDefaults;
}
@@ -66,15 +56,16 @@ public class JsonSchemaDataGenerator {
/**
* Generates json data that conform to the schema according to turned on flags.
*
- * @return json that conform to the schema.
+ * @return json that conform to the schema
*/
public String generateData() {
referencesData = new HashMap<>();
JSONObject data = new JSONObject();
generateData(ROOT, root,
- data); // "root" is dummy name to represent the top level object (which, as apposed to
- // inner objects, doesn't have a name in the schema)
+ data);
+ // "root" is dummy name to represent the top level object
+ // (which, as apposed to inner objects, doesn't have a name in the schema)
return data.has(ROOT) ? data.get(ROOT).toString() : data.toString();
}
@@ -161,12 +152,12 @@ public class JsonSchemaDataGenerator {
default:
break;
}
- } catch (JSONException e0) {
+ } catch (JSONException exception) {
Object defaultValue = property.get(JsonSchemaKeyword.DEFAULT);
logger.error(String.format(
"Invalid schema: '%s' property type is '%s' but it has a default value which is not: %s.",
- propertyName, propertyType, defaultValue), e0);
- throw e0;
+ propertyName, propertyType, defaultValue), exception);
+ throw exception;
}
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java
index 6ae3677a8d..87c75fce62 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java
@@ -20,14 +20,13 @@
package org.openecomp.core.utilities.json;
-
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonIOException;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
-import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.CollectionUtils;
import org.everit.json.schema.EnumSchema;
import org.everit.json.schema.Schema;
import org.everit.json.schema.ValidationException;
@@ -82,17 +81,17 @@ public class JsonUtil {
* @return the t
*/
public static <T> T json2Object(String json, Class<T> classOfT) {
- T type;
+ T typ;
try {
try (Reader br = new StringReader(json)) {
- type = new Gson().fromJson(br, classOfT);
- } catch (IOException e0) {
- throw e0;
+ typ = new Gson().fromJson(br, classOfT);
+ } catch (IOException exception) {
+ throw exception;
}
- } catch (JsonIOException | JsonSyntaxException | IOException e0) {
- throw new RuntimeException(e0);
+ } catch (JsonIOException | JsonSyntaxException | IOException exception) {
+ throw new RuntimeException(exception);
}
- return type;
+ return typ;
}
/**
@@ -109,8 +108,8 @@ public class JsonUtil {
try (Reader br = new BufferedReader(new InputStreamReader(is))) {
type = new Gson().fromJson(br, classOfT);
}
- } catch (JsonIOException | JsonSyntaxException | IOException e0) {
- throw new RuntimeException(e0);
+ } catch (JsonIOException | JsonSyntaxException | IOException exception) {
+ throw new RuntimeException(exception);
} finally {
if (is != null) {
try {
@@ -153,16 +152,16 @@ public class JsonUtil {
.collect(Collectors.toList());
}
- private static String mapValidationExceptionToMessage(ValidationException e0) {
- if (e0.getViolatedSchema() instanceof EnumSchema) {
- return mapEnumViolationToMessage(e0);
+ private static String mapValidationExceptionToMessage(ValidationException exception) {
+ if (exception.getViolatedSchema() instanceof EnumSchema) {
+ return mapEnumViolationToMessage(exception);
}
- return e0.getMessage();
+ return exception.getMessage();
}
- private static String mapEnumViolationToMessage(ValidationException e1) {
- Set<Object> possibleValues = ((EnumSchema) e1.getViolatedSchema()).getPossibleValues();
- return e1.getMessage().replaceFirst("enum value", possibleValues.size() == 1
+ private static String mapEnumViolationToMessage(ValidationException exception) {
+ Set<Object> possibleValues = ((EnumSchema) exception.getViolatedSchema()).getPossibleValues();
+ return exception.getMessage().replaceFirst("enum value", possibleValues.size() == 1
? String.format("value. %s is the only possible value for this field",
possibleValues.iterator().next())
: String.format("value. Possible values: %s", CommonMethods
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
index 56261f08de..d38bf484e4 100644
--- 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
@@ -20,9 +20,9 @@
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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Yaml;
@@ -45,19 +45,20 @@ import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
+
/**
* The type Yaml util.
*/
public class YamlUtil {
- private static Logger logger = LoggerFactory.getLogger(YamlUtil.class);
+ 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 typ class
+ * @param typClass the t class
* @return the t
*/
public <T> T yamlToObject(String yamlContent, Class<T> typClass) {
@@ -76,7 +77,7 @@ public class YamlUtil {
*
* @param <T> the type parameter
* @param yamlContent the yaml content
- * @param typClass the typ class
+ * @param typClass the t class
* @return the t
*/
public <T> T yamlToObject(InputStream yamlContent, Class<T> typClass) {
@@ -102,7 +103,7 @@ public class YamlUtil {
yamlContent.close();
}
} catch (IOException ignore) {
- //nothing to dd
+ //do nothing
}
}
}
@@ -111,8 +112,8 @@ public class YamlUtil {
/**
* Gets constructor.
*
- * @param <T> the type parameter
- * @param typClass the typ class
+ * @param <T> the type parameter
+ * @param typClass the t class
* @return the constructor
*/
public <T> Constructor getConstructor(Class<T> typClass) {
@@ -128,6 +129,7 @@ public class YamlUtil {
return new MyPropertyUtils();
}
+
/**
* Yaml to map map.
*
@@ -145,7 +147,7 @@ public class YamlUtil {
* Object to yaml string.
*
* @param <T> the type parameter
- * @param obj the obj
+ * @param obj the obj
* @return the string
*/
public <T> String objectToYaml(Object obj) {
@@ -192,6 +194,16 @@ public class YamlUtil {
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) {
@@ -205,16 +217,6 @@ public class YamlUtil {
: defaultNode;
}
}
-
- @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);
- }
}
@@ -222,6 +224,14 @@ public class YamlUtil {
* 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")) {
@@ -230,14 +240,6 @@ public class YamlUtil {
return super.getProperty(type, name);
}
- //Unsorted properties
- @Override
- protected Set<Property> createPropertySet(Class<? extends Object> type, BeanAccess beanAccess)
- throws IntrospectionException {
- return new LinkedHashSet<Property>(getPropertiesMap(type,
- BeanAccess.FIELD).values());
- }
-
}
/**
@@ -255,16 +257,6 @@ public class YamlUtil {
}
@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());
- }
- }
-
- @Override
protected Map<Object, Object> createDefaultMap() {
final Map<Object, Object> delegate = super.createDefaultMap();
return new AbstractMap<Object, Object>() {
@@ -282,6 +274,17 @@ public class YamlUtil {
}
};
}
+
+ @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-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java
index 83c87737d2..ba34d07034 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java
@@ -1,8 +1,28 @@
+/*-
+ * ============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.json;
-import org.openecomp.core.utilities.file.FileUtils;
import org.json.JSONException;
import org.json.JSONObject;
+import org.openecomp.core.utilities.file.FileUtils;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -47,4 +67,4 @@ public class JsonSchemaDataGeneratorTest {
JSONObject dataJson = new JSONObject(data);
Assert.assertTrue(expectedData.similar(dataJson));
}
-} \ No newline at end of file
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java
index e232f72f38..6b8805797a 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.json;
@@ -37,4 +57,4 @@ public class JsonUtilTest {
Assert.assertEquals(validationErrors.get(2),
"#/phoneNumber/0/code: expected type: Number, found: String");
}
-} \ No newline at end of file
+}
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
new file mode 100644
index 0000000000..37930ff9b3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml
@@ -0,0 +1,49 @@
+<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-zusammen-api</name>
+ <artifactId>openecomp-zusammen-api</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen</groupId>
+ <artifactId>zusammen-adaptor-inbound-api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
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
new file mode 100644
index 0000000000..1495ed27a8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
@@ -0,0 +1,76 @@
+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.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+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.itemversion.Tag;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+
+import java.util.Collection;
+import java.util.Optional;
+
+public interface ZusammenAdaptor {
+
+ Collection<Item> listItems(SessionContext context);
+
+ Id createItem(SessionContext context, Info info);
+
+ void updateItem(SessionContext context, Id itemId, Info info);
+
+ // TODO: 4/4/2017 fix this workaround when versionId will be recieved from UI
+ Optional<ItemVersion> getFirstVersion(SessionContext context, Id itemId);
+
+ Id createVersion(SessionContext context, Id itemId, Id baseVersionId,
+ ItemVersionData itemVersionData);
+
+ void updateVersion(SessionContext context, Id itemId, Id versionId,
+ ItemVersionData itemVersionData);
+
+ void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag);
+
+ void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String changeRef);
+
+ Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext,
+ Id elementId);
+
+ Optional<Element> getElement(SessionContext context, ElementContext elementContext,
+ String elementId); // TODO: 4/3/2017 change to Id
+
+ Optional<Element> getElementByName(
+ SessionContext context, ElementContext elementContext, Id parentElementId,
+ String elementName);
+
+ Collection<ElementInfo> listElements(SessionContext context,
+ ElementContext elementContext,
+ Id parentElementId);
+
+ Collection<Element> listElementData(SessionContext context,
+ ElementContext elementContext,
+ Id parentElementId);
+
+ /**
+ * Lists the sub elements of the element named <elementName> which is a sub element of <parentElementId>
+ * @param context
+ * @param elementContext
+ * @param parentElementId
+ * @param elementName
+ * @return
+ */
+ Collection<ElementInfo> listElementsByName(
+ SessionContext context, ElementContext elementContext, Id parentElementId,
+ String elementName);
+
+ Optional<ElementInfo> getElementInfoByName(
+ SessionContext context, ElementContext elementContext, Id parentElementId,
+ String elementName);
+
+ Optional<Element> saveElement(SessionContext context, ElementContext elementContext,
+ ZusammenElement element, String message);
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java
new file mode 100644
index 0000000000..53981ba478
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java
@@ -0,0 +1,31 @@
+/*-
+ * ============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.zusammen.api;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ZusammenAdaptorFactory extends AbstractComponentFactory<ZusammenAdaptor> {
+
+ public static ZusammenAdaptorFactory getInstance() {
+ return AbstractFactory.getInstance(ZusammenAdaptorFactory.class);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java
new file mode 100644
index 0000000000..3df6151fae
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java
@@ -0,0 +1,40 @@
+package org.openecomp.core.zusammen.api;
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.UserInfo;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.ItemVersionData;
+
+public class ZusammenUtil {
+ // TODO: 3/19/2017 add user and tenant args
+ public static SessionContext createSessionContext() {
+ SessionContext sessionContext = new SessionContext();
+ sessionContext.setUser(new UserInfo("GLOBAL_USER"));
+ sessionContext.setTenant("dox");
+ return sessionContext;
+ }
+
+ public static ZusammenElement buildStructuralElement(String structureElementName,
+ Action action) {
+ ZusammenElement element = new ZusammenElement();
+ Info info = new Info();
+ info.setName(structureElementName);
+ element.setInfo(info);
+ if (action != null) {
+ element.setAction(action);
+ }
+ return element;
+ }
+
+ // TODO: 4/24/2017 remove upon working with more than one single version
+ public static ItemVersionData createFirstVersionData() {
+ Info info = new Info();
+ info.setName("main version");
+ ItemVersionData itemVersionData = new ItemVersionData();
+ itemVersionData.setInfo(info);
+ return itemVersionData;
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/resources/factoryConfiguration.json
new file mode 100644
index 0000000000..30abb9bfed
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/resources/factoryConfiguration.json
@@ -0,0 +1,3 @@
+{
+ "org.openecomp.core.zusammen.api.ZusammenAdaptorFactory": "org.openecomp.core.zusammen.impl.ZusammenAdaptorFactoryImpl"
+} \ No newline at end of file
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
new file mode 100644
index 0000000000..eb418eae8f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
@@ -0,0 +1,85 @@
+<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-zusammen-core</name>
+ <artifactId>openecomp-zusammen-core</artifactId>
+
+ <parent>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen</groupId>
+ <artifactId>zusammen-commons-utils</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen</groupId>
+ <artifactId>zusammen-adaptor-inbound-api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen</groupId>
+ <artifactId>zusammen-adaptor-inbound-impl</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-plugin</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-mapping</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen.plugin</groupId>
+ <artifactId>zusammen-search-index-empty-plugin</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-nosqldb-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
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
new file mode 100644
index 0000000000..f746d706e1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
@@ -0,0 +1,51 @@
+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.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+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.itemversion.Tag;
+import com.amdocs.zusammen.datatypes.response.Response;
+
+import java.util.Collection;
+import java.util.Optional;
+
+public interface ZusammenConnector {
+
+ Collection<Item> listItems(SessionContext context);
+
+ Id createItem(SessionContext context, Info info);
+
+ void updateItem(SessionContext context, Id itemId, Info info);
+
+
+ Collection<ItemVersion> listVersions(SessionContext context, Id itemId);
+
+ Id createVersion(SessionContext context, Id itemId, Id baseVersionId,
+ ItemVersionData itemVersionData);
+
+ void updateVersion(SessionContext context, Id itemId, Id versionId,
+ ItemVersionData itemVersionData);
+
+ void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag);
+
+ void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String changeRef);
+
+
+ Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext,
+ Id parentElementId);
+
+ Response<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext, Id
+ elementId);
+
+ Response<Element> getElement(SessionContext context, ElementContext elementContext, Id elementId);
+
+ Optional<Element> saveElement(SessionContext context, ElementContext elementContext,
+ ZusammenElement element, String message);
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java
new file mode 100644
index 0000000000..31a8bf598d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java
@@ -0,0 +1,31 @@
+/*-
+ * ============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.zusammen.db;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ZusammenConnectorFactory extends AbstractComponentFactory<ZusammenConnector> {
+
+ public static ZusammenConnectorFactory getInstance() {
+ return AbstractFactory.getInstance(ZusammenConnectorFactory.class);
+ }
+}
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
new file mode 100644
index 0000000000..f3916521dd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java
@@ -0,0 +1,39 @@
+/*-
+ * ============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.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 org.openecomp.core.zusammen.db.ZusammenConnector;
+import org.openecomp.core.zusammen.db.ZusammenConnectorFactory;
+
+public class ZusammenConnectorFactoryImpl extends ZusammenConnectorFactory {
+ private static final ZusammenConnector INSTANCE =
+ new ZusammenConnectorImpl(ItemAdaptorFactory.getInstance(),
+ ItemVersionAdaptorFactory.getInstance(),
+ ElementAdaptorFactory.getInstance());
+
+ @Override
+ public ZusammenConnector createInterface() {
+ return INSTANCE;
+ }
+}
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
new file mode 100644
index 0000000000..8aa8e129df
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
@@ -0,0 +1,200 @@
+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.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.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.Space;
+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.itemversion.Tag;
+import com.amdocs.zusammen.datatypes.response.Response;
+import com.amdocs.zusammen.datatypes.response.ReturnCode;
+import org.openecomp.core.zusammen.db.ZusammenConnector;
+import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
+import org.openecomp.core.zusammen.impl.ItemElementLoggerTargetServiceName;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+
+import java.util.Collection;
+import java.util.Optional;
+
+public class ZusammenConnectorImpl implements ZusammenConnector {
+
+ private ItemAdaptorFactory itemAdaptorFactory;
+ private ItemVersionAdaptorFactory versionAdaptorFactory;
+ private ElementAdaptorFactory elementAdaptorFactory;
+
+ public ZusammenConnectorImpl(
+ ItemAdaptorFactory itemAdaptorFactory,
+ ItemVersionAdaptorFactory versionAdaptorFactory,
+ ElementAdaptorFactory elementAdaptorFactory) {
+ this.itemAdaptorFactory = itemAdaptorFactory;
+ this.versionAdaptorFactory = versionAdaptorFactory;
+ this.elementAdaptorFactory = elementAdaptorFactory;
+ CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
+ }
+
+ @Override
+ public Collection<Item> listItems(SessionContext context) {
+ Response<Collection<Item>> response =
+ itemAdaptorFactory.createInterface(context).list(context);
+ if (response.isSuccessful()) {
+ return response.getValue();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Id createItem(SessionContext context, Info info) {
+ Response<Id> response = itemAdaptorFactory.createInterface(context).create(context, info);
+ if (response.isSuccessful()) {
+ return response.getValue();
+ } else {
+ throw new RuntimeException(
+ "failed to create Item. message:" + response.getReturnCode().getMessage());
+ }
+ }
+
+ @Override
+ public void updateItem(SessionContext context, Id itemId, Info info) {
+ Response<Void> response =
+ itemAdaptorFactory.createInterface(context).update(context, itemId, info);
+
+ if (!response.isSuccessful()) {
+ throw new RuntimeException("failed to update Item . ItemId:" + itemId + "" +
+ " message:" + response.getReturnCode().getMessage());
+ }
+ }
+
+ @Override
+ public Collection<ItemVersion> listVersions(SessionContext context, Id itemId) {
+ Response<Collection<ItemVersion>> versions =
+ versionAdaptorFactory.createInterface(context).list(context, Space.PRIVATE, itemId);
+ if (!versions.isSuccessful()) {
+ logErrorMessageToMdc(ItemElementLoggerTargetServiceName.ITEM_VERSION_RETRIEVAL, versions
+ .getReturnCode());
+ throw new RuntimeException(versions.getReturnCode().getMessage()); // TODO: 3/26/2017
+ }
+ return versions.getValue();
+ }
+
+ @Override
+ public Id createVersion(SessionContext context, Id itemId, Id baseVersionId,
+ ItemVersionData itemVersionData) {
+ Response<Id> response = versionAdaptorFactory.createInterface(context).create(context, itemId,
+ baseVersionId, itemVersionData);
+ if (response.isSuccessful()) {
+ return response.getValue();
+ } else {
+ throw new RuntimeException("failed to create Item Version. ItemId:" + itemId + " based " +
+ "on:" + baseVersionId +
+ " message:" + response
+ .getReturnCode().getMessage());
+ }
+ }
+
+ @Override
+ public void updateVersion(SessionContext context, Id itemId, Id versionId,
+ ItemVersionData itemVersionData) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context)
+ .update(context, itemId, versionId, itemVersionData);
+ if (!response.isSuccessful()) {
+ throw new RuntimeException(
+ String.format("failed to create Item Version. ItemId: %s, versionId: %s, message: %s",
+ itemId.getValue(), versionId.getValue(), response.getReturnCode().getMessage()));
+ }
+ }
+
+ @Override
+ public void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context)
+ .tag(context, itemId, versionId, null, tag);
+ if (!response.isSuccessful()) {
+ throw new RuntimeException(String.format(
+ "failed to tag Item Version with tag %s. ItemId: %s, versionId: %s, message: %s",
+ tag.getName(), itemId.getValue(), versionId.getValue(), response.getReturnCode()
+ .getMessage()));
+ }
+ }
+
+ @Override
+ public void resetVersionHistory(SessionContext context, Id itemId, Id versionId,
+ String changeRef) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context)
+ .resetHistory(context, itemId, versionId, changeRef);
+ if (!response.isSuccessful()) {
+ throw new RuntimeException(String.format(
+ "failed to reset Item Version back to %s. ItemId: %s, versionId: %s, message: %s",
+ changeRef, itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().getMessage()));
+ }
+ }
+
+ @Override
+ public Collection<ElementInfo> listElements(SessionContext context,
+ ElementContext elementContext,
+ Id parentElementId) {
+ Response<Collection<ElementInfo>> elementInfosResponse = elementAdaptorFactory
+ .createInterface(context).list(context, elementContext, parentElementId);
+ if (elementInfosResponse.isSuccessful()) {
+ return elementInfosResponse.getValue();
+ } else {
+ logErrorMessageToMdc(ItemElementLoggerTargetServiceName.ELEMENT_GET_BY_PROPERTY,
+ elementInfosResponse.getReturnCode());
+ throw new RuntimeException(elementInfosResponse.getReturnCode().getMessage());
+ }
+ }
+
+ @Override
+ public Response<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext,
+ Id elementId) {
+ return elementAdaptorFactory.createInterface(context)
+ .getInfo(context, elementContext, elementId);
+ }
+
+
+ @Override
+ public Response<Element> getElement(SessionContext context, ElementContext elementContext,
+ Id elementId) {
+ return elementAdaptorFactory.createInterface(context).get(context, elementContext, elementId);
+ }
+
+ @Override
+ public Optional<Element> saveElement(SessionContext context, ElementContext elementContext,
+ ZusammenElement element, String message) {
+ Response<Element> saveResponse = elementAdaptorFactory.createInterface(context)
+ .save(context, elementContext, element, message);
+ return saveResponse.isSuccessful()
+ ? Optional.of(saveResponse.getValue())
+ : Optional.empty(); // TODO: 3/21/2017 error?
+ }
+
+ private void logErrorMessageToMdc(ItemElementLoggerTargetServiceName
+ itemElementLoggerTargetServiceName,
+ ReturnCode returnCode) {
+ logErrorMessageToMdc(itemElementLoggerTargetServiceName, returnCode.toString());
+ }
+
+ private void logErrorMessageToMdc(ItemElementLoggerTargetServiceName
+ itemElementLoggerTargetServiceName,
+ String message) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ itemElementLoggerTargetServiceName.getDescription(),
+ ErrorLevel.ERROR.name(),
+ LoggerErrorCode.BUSINESS_PROCESS_ERROR.getErrorCode(),
+ message);
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java
new file mode 100644
index 0000000000..47cb57c5f7
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java
@@ -0,0 +1,59 @@
+package org.openecomp.core.zusammen.impl;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.core.nosqldb.util.CassandraUtils;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+/**
+ * @author Avrahamg
+ * @since April 25, 2017
+ */
+
+public class CassandraConnectionInitializer implements ServletContextListener {
+ @Override
+ public void contextInitialized(ServletContextEvent servletContextEvent) {
+ setCassandraConnectionPropertiesToSystem();
+ }
+
+ public static void setCassandraConnectionPropertiesToSystem() {
+ if (!System.getProperties().containsKey("cassandra.nodes")) {
+ System.setProperty("cassandra.nodes", StringUtils.join(CassandraUtils.getAddresses(), ','));
+ }
+ if (!System.getProperties().containsKey("cassandra.authenticate")) {
+ System
+ .setProperty("cassandra.authenticate",
+ CassandraUtils.isAuthenticate() ? "true" : "false");
+ }
+ if (!System.getProperties().containsKey("cassandra.ssl")) {
+ System.setProperty("cassandra.ssl",
+ CassandraUtils.isSsl() ? "true" : "false");
+ }
+ if (!System.getProperties().containsKey("cassandra.truststore")) {
+ System.setProperty("cassandra.truststore", CassandraUtils.getTruststore());
+ }
+ if (!System.getProperties().containsKey("cassandra.truststore.password")) {
+ System.setProperty("cassandra.truststore.password", CassandraUtils.getTruststorePassword());
+ }
+ if (!System.getProperties().containsKey("cassandra.user")) {
+ System.setProperty("cassandra.user", CassandraUtils.getUser());
+ }
+ if (!System.getProperties().containsKey("cassandra.password")) {
+ System.setProperty("cassandra.password", CassandraUtils.getPassword());
+ }
+ if (!System.getProperties().containsKey("cassandra.keyspace")) {
+ System.setProperty("cassandra.keyspace", "zusammen");
+ }
+ }
+
+ // -Dcassandra.nodes=10.147.97.145 -Dcassandra.keyspace=zusammen -Dcassandra.authenticate=true -Dcassandra.ssl=true
+ // -Dcassandra.truststore=/apps/jetty/base/be/config/.truststore -Dcassandra.truststore.password=Aa123456
+ // -Dcassandra.user=asdc_user -Dcassandra.password=Aa1234%^!
+
+ @Override
+ public void contextDestroyed(ServletContextEvent servletContextEvent) {
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java
new file mode 100644
index 0000000000..1a4466a3c5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java
@@ -0,0 +1,27 @@
+package org.openecomp.core.zusammen.impl;
+
+/**
+ * @author Avrahamg.
+ * @since February 19, 2017
+ */
+public enum ItemElementLoggerTargetServiceName {
+ ITEM_CREATION("Item Creation"),
+ ITEM_VERSION_CREATION("Item Version Creation"),
+ ELEMENT_CREATION("Element Creation"),
+ ELEMENT_UPDATE("Element Update"),
+ ELEMENT_LIST("Element List"),
+ ELEMENT_GET("Element Get"),
+ ELEMENT_GET_BY_PROPERTY("Element Get By Property"),
+ ITEM_RETRIEVAL("Item retrieval"),
+ ITEM_VERSION_RETRIEVAL("Item version retrieval)");
+
+ private final String description;
+
+ public String getDescription() {
+ return description;
+ }
+
+ ItemElementLoggerTargetServiceName(String description) {
+ this.description = description;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java
new file mode 100644
index 0000000000..edc1abf108
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.zusammen.impl;
+
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.core.zusammen.db.ZusammenConnectorFactory;
+
+public class ZusammenAdaptorFactoryImpl extends ZusammenAdaptorFactory {
+ private static final ZusammenAdaptor INSTANCE =
+ new ZusammenAdaptorImpl(ZusammenConnectorFactory.getInstance().createInterface());
+
+ @Override
+ public ZusammenAdaptor createInterface() {
+ return INSTANCE;
+ }
+}
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
new file mode 100644
index 0000000000..ad4839bd00
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
@@ -0,0 +1,228 @@
+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.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.itemversion.Tag;
+import com.amdocs.zusammen.datatypes.response.Response;
+import com.amdocs.zusammen.datatypes.response.ReturnCode;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.db.ZusammenConnector;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+public class ZusammenAdaptorImpl implements ZusammenAdaptor {
+
+ private ZusammenConnector connector;
+
+ public ZusammenAdaptorImpl(ZusammenConnector connector) {
+ this.connector = connector;
+ }
+
+ @Override
+ public Optional<ItemVersion> getFirstVersion(SessionContext context, Id itemId) {
+ Collection<ItemVersion> versions = connector.listVersions(context, itemId);
+ if(versions == null || versions.size()==0) {
+ return Optional.empty();
+ }
+ List<ItemVersion> itemVersions = new ArrayList<>(versions);
+ sortItemVersionListByModificationTimeDescOrder(itemVersions);
+ ItemVersion itemVersion = itemVersions.iterator().next();
+
+ return Optional.ofNullable(itemVersion);
+ }
+
+ @Override
+ public Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext,
+ Id elementId) {
+ Response<ElementInfo> response = connector.getElementInfo(context, elementContext, elementId);
+ return response.isSuccessful() ? Optional.ofNullable(response.getValue()) : Optional.empty();
+ }
+
+ @Override
+ public Optional<Element> getElement(SessionContext context, ElementContext elementContext,
+ String elementId) {
+ Response<Element> response = connector.getElement(context, elementContext, new Id(elementId));
+ return response.isSuccessful() ? Optional.ofNullable(response.getValue()) : Optional.empty();
+ }
+
+ @Override
+ public Optional<Element> getElementByName(
+ SessionContext context, ElementContext elementContext, Id parentElementId,
+ String elementName) {
+ Collection<ElementInfo> elementInfos =
+ connector.listElements(context, elementContext, parentElementId);
+ Predicate<ElementInfo> elementInfoPredicate = elementInfo -> elementInfo.getInfo() != null
+ && elementName.equals(elementInfo.getInfo().getName());
+ return getFirstElementInfo(elementInfos, elementInfoPredicate)
+ .map(elementInfo -> getElement(context, elementContext, elementInfo.getId().getValue()))
+ .orElse(Optional.empty());
+ }
+
+ @Override
+ public Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext,
+ Id parentElementId) {
+ return connector.listElements(context, elementContext, parentElementId);
+ }
+
+ @Override
+ public Collection<Element> listElementData(SessionContext context,
+ ElementContext elementContext,
+ Id parentElementId) {
+
+ Collection<ElementInfo> elementInfoList = connector.listElements(context, elementContext,
+ parentElementId);
+ if (elementInfoList != null) {
+ return elementInfoList.stream().map(elementInfo -> connector.getElement(context,
+ elementContext, elementInfo.getId()).getValue()).collect(Collectors.toList());
+ }
+
+ return new ArrayList<>();
+
+ }
+
+
+ @Override
+ public Collection<ElementInfo> listElementsByName(
+ SessionContext context, ElementContext elementContext, Id parentElementId,
+ String elementName) {
+ Optional<ElementInfo> elementInfoByName =
+ getElementInfoByName(context, elementContext, parentElementId, elementName);
+
+ return elementInfoByName.isPresent()
+ ? connector.listElements(context, elementContext, elementInfoByName.get().getId())
+ : new ArrayList<>();
+ }
+
+ @Override
+ public Optional<ElementInfo> getElementInfoByName(
+ SessionContext context, ElementContext elementContext, Id parentElementId,
+ String elementName) {
+ Collection<ElementInfo> elementInfos =
+ connector.listElements(context, elementContext, parentElementId);
+ return getFirstElementInfo(elementInfos,
+ elementInfo -> elementInfo.getInfo() != null &&
+ elementName.equals(elementInfo.getInfo().getName()));
+ }
+
+ @Override
+ public Optional<Element> saveElement(SessionContext context, ElementContext elementContext,
+ ZusammenElement element, String message) {
+ enrichElementHierarchyRec(context, elementContext, null, element);
+ return connector.saveElement(context, elementContext, element, message);
+ }
+
+ private void enrichElementHierarchyRec(SessionContext context, ElementContext
+ elementContext, Id parentElementId, ZusammenElement element) {
+ if (element.getAction() == Action.CREATE) {
+ return;
+ }
+ locateElementAndUpdateAction(context, elementContext, parentElementId, element);
+ element.getSubElements().forEach(subElement -> enrichElementHierarchyRec(
+ context, elementContext, element.getElementId(), (ZusammenElement) subElement));
+ }
+
+ // should be applied only for structural elements
+ private void locateElementAndUpdateAction(SessionContext context, ElementContext elementContext,
+ Id parentElementId, ZusammenElement element) {
+ if (element.getElementId() != null) {
+ return;
+ }
+ Optional<ElementInfo> elementInfo =
+ getElementInfoByName(context, elementContext, parentElementId, element.getInfo().getName());
+ if (elementInfo.isPresent()) {
+ element.setElementId(elementInfo.get().getId());
+ if (element.getAction() == null) {
+ element.setAction(Action.IGNORE);
+ }
+ } else {
+ element.setAction(Action.CREATE);
+ }
+ }
+
+ private Optional<ElementInfo> getFirstElementInfo(Collection<ElementInfo> elementInfos,
+ Predicate<ElementInfo> elementInfoPredicate) {
+ return elementInfos.stream()
+ .filter(elementInfoPredicate)
+ .findFirst();
+ }
+
+ private void logErrorMessageToMdc(ItemElementLoggerTargetServiceName
+ itemElementLoggerTargetServiceName,
+ ReturnCode returnCode) {
+ logErrorMessageToMdc(itemElementLoggerTargetServiceName, returnCode.toString());
+ }
+
+ private void logErrorMessageToMdc(ItemElementLoggerTargetServiceName
+ itemElementLoggerTargetServiceName,
+ String message) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ itemElementLoggerTargetServiceName.getDescription(),
+ ErrorLevel.ERROR.name(),
+ LoggerErrorCode.BUSINESS_PROCESS_ERROR.getErrorCode(),
+ message);
+ }
+
+ @Override
+ public Id createItem(SessionContext context, Info info) {
+ return connector.createItem(context, info);
+ }
+
+ @Override
+ public Id createVersion(SessionContext context, Id itemId, Id baseVersionId, ItemVersionData
+ itemVersionData) {
+ return connector.createVersion(context, itemId, baseVersionId, itemVersionData);
+
+ }
+
+ @Override
+ public Collection<Item> listItems(SessionContext context) {
+ return connector.listItems(context);
+ }
+
+ @Override
+ public void updateVersion(SessionContext context, Id itemId, Id versionId,
+ ItemVersionData itemVersionData) {
+ connector.updateVersion(context, itemId, versionId, itemVersionData);
+ }
+
+ @Override
+ public void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag) {
+ connector.tagVersion(context, itemId, versionId, tag);
+ }
+
+ @Override
+ public void resetVersionHistory(SessionContext context, Id itemId, Id versionId,
+ String changeRef) {
+ connector.resetVersionHistory(context, itemId, versionId, changeRef);
+ }
+
+ @Override
+ public void updateItem(SessionContext context, Id itemId, Info info) {
+ connector.updateItem(context, itemId, info);
+ }
+
+ private static void sortItemVersionListByModificationTimeDescOrder(
+ List<ItemVersion> itemVersions) {
+ itemVersions.sort((o1, o2) -> ((Integer)o2.getId().getValue().length())
+ .compareTo( (o1.getId().getValue().length())));
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/resources/factoryConfiguration.json
new file mode 100644
index 0000000000..eb20b04531
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/resources/factoryConfiguration.json
@@ -0,0 +1,3 @@
+{
+ "org.openecomp.core.zusammen.db.ZusammenConnectorFactory": "org.openecomp.core.zusammen.db.impl.ZusammenConnectorFactoryImpl"
+} \ No newline at end of file
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
new file mode 100644
index 0000000000..7c41ca730c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml
@@ -0,0 +1,37 @@
+<?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>
+
+ <parent>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openecomp-zusammen-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>com.amdocs.zusammen</groupId>
+ <artifactId>zusammen-sdk</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen</groupId>
+ <artifactId>zusammen-commons-db-api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen</groupId>
+ <artifactId>zusammen-commons-db-impl</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen.plugin</groupId>
+ <artifactId>zusammen-state-store-cassandra-plugin</artifactId>
+ <version>0.0.1-SNAPSHOT</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/ZusammenPluginConstants.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/ZusammenPluginConstants.java
new file mode 100644
index 0000000000..f9e6091fb0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/ZusammenPluginConstants.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.core.zusammen.plugin;
+
+
+import com.amdocs.zusammen.datatypes.Id;
+
+public class ZusammenPluginConstants {
+ public static final String PUBLIC_SPACE = "public";
+ public static final Id ROOT_ELEMENTS_PARENT_ID = Id.ZERO;
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/ZusammenPluginUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/ZusammenPluginUtil.java
new file mode 100644
index 0000000000..59afa70e9a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/ZusammenPluginUtil.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.core.zusammen.plugin;
+
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.Space;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
+import com.amdocs.zusammen.utils.fileutils.FileUtils;
+import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
+
+import java.io.ByteArrayInputStream;
+import java.nio.ByteBuffer;
+
+public class ZusammenPluginUtil {
+
+ public static String getSpaceName(SessionContext context, Space space) {
+ switch (space) {
+ case PUBLIC:
+ return ZusammenPluginConstants.PUBLIC_SPACE;
+ case PRIVATE:
+ return ZusammenPluginUtil.getPrivateSpaceName(context);
+ default:
+ throw new IllegalArgumentException(String.format("Space %s is not supported.", space));
+ }
+ }
+
+ public static String getPrivateSpaceName(SessionContext context) {
+ return context.getUser().getUserName();
+ }
+
+ public static ElementEntity getElementEntity(CollaborationElement element) {
+ ElementEntity elementEntity = new ElementEntity(element.getId());
+ elementEntity.setNamespace(element.getNamespace());
+ elementEntity.setParentId(element.getParentId() == null
+ ? ZusammenPluginConstants.ROOT_ELEMENTS_PARENT_ID
+ : element.getParentId());
+ elementEntity.setInfo(element.getInfo());
+ elementEntity.setRelations(element.getRelations());
+ if (element.getData() != null) {
+ elementEntity.setData(ByteBuffer.wrap(FileUtils.toByteArray(element.getData())));
+ }
+ if (element.getSearchableData() != null) {
+ elementEntity.setSearchableData(
+ ByteBuffer.wrap(FileUtils.toByteArray(element.getSearchableData())));
+ }
+ if (element.getVisualization() != null) {
+ elementEntity.setVisualization(
+ ByteBuffer.wrap(FileUtils.toByteArray(element.getVisualization())));
+ }
+ return elementEntity;
+ }
+
+ public static CollaborationElement getCollaborationElement(
+ ElementEntityContext elementEntityContext, ElementEntity elementEntity) {
+ Id parentId =
+ ZusammenPluginConstants.ROOT_ELEMENTS_PARENT_ID.equals(elementEntity.getParentId())
+ ? null
+ : elementEntity.getParentId();
+ CollaborationElement element = new CollaborationElement(elementEntityContext.getItemId(),
+ elementEntityContext.getVersionId(), elementEntity.getNamespace(), elementEntity.getId());
+
+ element.setParentId(parentId);
+ element.setInfo(elementEntity.getInfo());
+ element.setRelations(elementEntity.getRelations());
+
+ if (elementEntity.getData() != null) {
+ element.setData(new ByteArrayInputStream(elementEntity.getData().array()));
+ }
+ if (elementEntity.getSearchableData() != null) {
+ element.setSearchableData(
+ new ByteArrayInputStream(elementEntity.getSearchableData().array()));
+ }
+ if (elementEntity.getVisualization() != null) {
+ element.setVisualization(new ByteArrayInputStream(elementEntity.getVisualization().array()));
+ }
+ element.setSubElements(elementEntity.getSubElementIds());
+ return element;
+ }
+}
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
new file mode 100644
index 0000000000..93ee2d058b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java
@@ -0,0 +1,101 @@
+package org.openecomp.core.zusammen.plugin.collaboration;
+
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
+import org.openecomp.core.zusammen.plugin.ZusammenPluginConstants;
+import org.openecomp.core.zusammen.plugin.ZusammenPluginUtil;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepository;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepositoryFactory;
+import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static org.openecomp.core.zusammen.plugin.ZusammenPluginUtil.getSpaceName;
+
+
+public class ElementCollaborationStore {
+
+ public Collection<CollaborationElement> listElements(SessionContext context,
+ ElementContext elementContext,
+ Id elementId) {
+ ElementEntityContext elementEntityContext =
+ new ElementEntityContext(ZusammenPluginUtil.getPrivateSpaceName(context), elementContext);
+
+ if (elementId == null) {
+ elementId = ZusammenPluginConstants.ROOT_ELEMENTS_PARENT_ID;
+ }
+
+ ElementRepository elementRepository = getElementRepository(context);
+ return elementRepository.get(context, elementEntityContext, new ElementEntity(elementId))
+ .map(ElementEntity::getSubElementIds).orElse(new HashSet<>()).stream()
+ .map(subElementId -> elementRepository
+ .get(context, elementEntityContext, new ElementEntity(subElementId)).get())
+ .filter(Objects::nonNull)
+ .map(subElement -> ZusammenPluginUtil
+ .getCollaborationElement(elementEntityContext, subElement))
+ .collect(Collectors.toList());
+ }
+
+ public CollaborationElement getElement(SessionContext context, ElementContext elementContext,
+ Id elementId) {
+ ElementEntityContext elementEntityContext =
+ new ElementEntityContext(ZusammenPluginUtil.getPrivateSpaceName(context), elementContext);
+ return getElementRepository(context)
+ .get(context, elementEntityContext, new ElementEntity(elementId))
+ .map(elementEntity -> ZusammenPluginUtil
+ .getCollaborationElement(elementEntityContext, elementEntity))
+ .orElse(null);
+ }
+
+ public void createElement(SessionContext context, CollaborationElement element) {
+ getElementRepository(context)
+ .create(context,
+ new ElementEntityContext(getSpaceName(context, element.getSpace()),
+ element.getItemId(), element.getVersionId()),
+ ZusammenPluginUtil.getElementEntity(element));
+ }
+
+ public void updateElement(SessionContext context, CollaborationElement element) {
+ getElementRepository(context)
+ .update(context,
+ new ElementEntityContext(getSpaceName(context, element.getSpace()),
+ element.getItemId(), element.getVersionId()),
+ ZusammenPluginUtil.getElementEntity(element));
+ }
+
+ public void deleteElement(SessionContext context, CollaborationElement element) {
+ deleteElementHierarchy(getElementRepository(context),
+ context,
+ new ElementEntityContext(getSpaceName(context, element.getSpace()),
+ element.getItemId(), element.getVersionId()),
+ ZusammenPluginUtil.getElementEntity(element));
+ }
+
+ private void deleteElementHierarchy(ElementRepository elementRepository, SessionContext context,
+ ElementEntityContext elementEntityContext,
+ ElementEntity elementEntity) {
+ Optional<ElementEntity> retrieved =
+ elementRepository.get(context, elementEntityContext, elementEntity);
+ if (!retrieved.isPresent()) {
+ return;
+ }
+ retrieved.get().getSubElementIds().stream()
+ .map(ElementEntity::new)
+ .forEach(subElementEntity -> deleteElementHierarchy(
+ elementRepository, context, elementEntityContext, subElementEntity));
+
+ // only for the first one the parentId will populated (so it'll be removed from its parent)
+ elementRepository.delete(context, elementEntityContext, elementEntity);
+ }
+
+ protected ElementRepository getElementRepository(SessionContext context) {
+ return ElementRepositoryFactory.getInstance().createInterface(context);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/VersionCollaborationStore.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/VersionCollaborationStore.java
new file mode 100644
index 0000000000..ae23b6e8a9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/VersionCollaborationStore.java
@@ -0,0 +1,79 @@
+package org.openecomp.core.zusammen.plugin.collaboration;
+
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.Space;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.itemversion.Tag;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElementChange;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationMergeChange;
+import org.openecomp.core.zusammen.plugin.ZusammenPluginUtil;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepository;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepositoryFactory;
+import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
+
+import java.util.Collection;
+
+import static org.openecomp.core.zusammen.plugin.ZusammenPluginUtil.getSpaceName;
+
+public class VersionCollaborationStore {
+
+ public void tagItemVersion(SessionContext context, Id itemId, Id versionId, Id changeId,
+ Tag tag) {
+ if (changeId != null) {
+ throw new UnsupportedOperationException(
+ "In this plugin implementation tag is supported only on versionId");
+ }
+ copyElements(context, getSpaceName(context, Space.PRIVATE), itemId, versionId, tag.getName());
+ }
+
+ public CollaborationMergeChange resetItemVersionHistory(SessionContext context, Id itemId,
+ Id versionId, String changeRef) {
+ ElementRepository elementRepository = getElementRepository(context);
+ ElementEntityContext elementContext =
+ new ElementEntityContext(getSpaceName(context, Space.PRIVATE), itemId, versionId);
+
+ CollaborationMergeChange resetChange = new CollaborationMergeChange();
+
+ Collection<ElementEntity> versionElements = elementRepository.list(context, elementContext);
+ versionElements.stream()
+ .map(elementEntity ->
+ convertElementEntityToElementChange(elementEntity, elementContext, Action.DELETE))
+ .forEach(resetChange.getChangedElements()::add);
+
+ elementContext.setChangeRef(changeRef);
+ Collection<ElementEntity> changeRefElements = elementRepository.list(context, elementContext);
+ changeRefElements.stream()
+ .map(elementEntity ->
+ convertElementEntityToElementChange(elementEntity, elementContext, Action.CREATE))
+ .forEach(resetChange.getChangedElements()::add);
+
+ return resetChange; // TODO: 4/19/2017 version change...
+ }
+
+ private void copyElements(SessionContext context, String space, Id itemId, Id sourceVersionId,
+ String targetTag) {
+ ElementRepository elementRepository = getElementRepository(context);
+ ElementEntityContext elementContext = new ElementEntityContext(space, itemId, sourceVersionId);
+
+ Collection<ElementEntity> versionElements = elementRepository.list(context, elementContext);
+
+ elementContext.setChangeRef(targetTag);
+ versionElements
+ .forEach(elementEntity -> elementRepository.create(context, elementContext, elementEntity));
+ }
+
+ private CollaborationElementChange convertElementEntityToElementChange(
+ ElementEntity elementEntity, ElementEntityContext elementContext, Action action) {
+ CollaborationElementChange elementChange = new CollaborationElementChange();
+ elementChange
+ .setElement(ZusammenPluginUtil.getCollaborationElement(elementContext, elementEntity));
+ elementChange.setAction(action);
+ return elementChange;
+ }
+
+ protected ElementRepository getElementRepository(SessionContext context) {
+ return ElementRepositoryFactory.getInstance().createInterface(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/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
new file mode 100644
index 0000000000..468b6f0a28
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java
@@ -0,0 +1,25 @@
+package org.openecomp.core.zusammen.plugin.dao;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
+import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
+
+import java.util.Collection;
+import java.util.Optional;
+
+public interface ElementRepository {
+
+ Collection<ElementEntity> list(SessionContext context, ElementEntityContext elementContext);
+
+ void create(SessionContext context, ElementEntityContext elementContext, ElementEntity element);
+
+ void update(SessionContext context, ElementEntityContext elementContext, ElementEntity element);
+
+ void delete(SessionContext context, ElementEntityContext elementContext, ElementEntity element);
+
+ Optional<ElementEntity> get(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element);
+
+ void createNamespace(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element);
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepositoryFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepositoryFactory.java
new file mode 100644
index 0000000000..c541302d97
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepositoryFactory.java
@@ -0,0 +1,14 @@
+package org.openecomp.core.zusammen.plugin.dao;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.utils.facade.api.AbstractComponentFactory;
+import com.amdocs.zusammen.utils.facade.api.AbstractFactory;
+
+public abstract class ElementRepositoryFactory extends AbstractComponentFactory<ElementRepository> {
+ public static ElementRepositoryFactory getInstance() {
+ return AbstractFactory.getInstance(ElementRepositoryFactory.class);
+ }
+
+ public abstract ElementRepository createInterface(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/CassandraDaoUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraDaoUtils.java
new file mode 100644
index 0000000000..20a1e1803f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraDaoUtils.java
@@ -0,0 +1,27 @@
+package org.openecomp.core.zusammen.plugin.dao.impl;
+
+import com.datastax.driver.core.Session;
+import com.amdocs.zusammen.commons.db.api.cassandra.CassandraConnectorFactory;
+import com.amdocs.zusammen.commons.db.api.cassandra.types.CassandraContext;
+import com.amdocs.zusammen.datatypes.SessionContext;
+
+class CassandraDaoUtils {
+
+ static <T> T getAccessor(SessionContext context, Class<T> classOfT) {
+ return CassandraConnectorFactory.getInstance().createInterface(getCassandraContext(context))
+ .getMappingManager()
+ .createAccessor(classOfT);
+ }
+
+ static Session getSession(SessionContext context) {
+ return CassandraConnectorFactory.getInstance().createInterface(getCassandraContext(context))
+ .getMappingManager()
+ .getSession();
+ }
+
+ private static CassandraContext getCassandraContext(SessionContext context) {
+ CassandraContext cassandraContext = new CassandraContext();
+ cassandraContext.setTenant(context.getTenant());
+ return cassandraContext;
+ }
+}
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
new file mode 100644
index 0000000000..12fd2dabba
--- /dev/null
+++ 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
@@ -0,0 +1,358 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.core.zusammen.plugin.dao.impl;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.Row;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Param;
+import com.datastax.driver.mapping.annotations.Query;
+import com.google.gson.reflect.TypeToken;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.Namespace;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.Relation;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
+import com.amdocs.zusammen.utils.fileutils.json.JsonUtil;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepository;
+import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
+
+import java.lang.reflect.Type;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class CassandraElementRepository implements ElementRepository {
+
+ @Override
+ public Collection<ElementEntity> list(SessionContext context,
+ ElementEntityContext elementContext) {
+ Set<String> elementIds = getVersionElementIds(context, elementContext);
+
+ return elementIds.stream()
+ .map(elementId -> get(context, elementContext, new ElementEntity(new Id(elementId))).get())
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void create(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ createElement(context, elementContext, element);
+ addElementToParent(context, elementContext, element);
+ }
+
+ @Override
+ public void update(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ updateElement(context, elementContext, element);
+ }
+
+ @Override
+ public void delete(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ removeElementFromParent(context, elementContext, element);
+ deleteElement(context, elementContext, element);
+ }
+
+ @Override
+ public Optional<ElementEntity> get(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ Row row = getElementAccessor(context).get(
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ getVersionId(elementContext),
+ element.getId().toString()).one();
+
+ return row == null ? Optional.empty() : Optional.of(getElementEntity(element, row));
+ }
+
+ @Override
+ public void createNamespace(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ getElementNamespaceAccessor(context).create(
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ element.getId().toString(),
+ element.getNamespace().toString());
+ }
+
+ private String getVersionId(ElementEntityContext elementContext) {
+ return elementContext.getChangeRef() == null
+ ? elementContext.getVersionId().toString()
+ : elementContext.getChangeRef();
+ }
+
+ private ElementNamespaceAccessor getElementNamespaceAccessor(SessionContext context) {
+ return CassandraDaoUtils.getAccessor(context, ElementNamespaceAccessor.class);
+ }
+
+ private ElementAccessor getElementAccessor(SessionContext context) {
+ return CassandraDaoUtils.getAccessor(context, ElementAccessor.class);
+ }
+
+ private VersionElementsAccessor getVersionElementsAccessor(SessionContext context) {
+ return CassandraDaoUtils.getAccessor(context, VersionElementsAccessor.class);
+ }
+
+ private void createElement(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ Set<String> subElementIds =
+ element.getSubElementIds().stream().map(Id::toString).collect(Collectors.toSet());
+ String versionId = getVersionId(elementContext);
+
+ getElementAccessor(context).create(
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ versionId,
+ element.getId().toString(),
+ element.getParentId().toString(),
+ element.getNamespace().toString(),
+ JsonUtil.object2Json(element.getInfo()),
+ JsonUtil.object2Json(element.getRelations()),
+ element.getData(),
+ element.getSearchableData(),
+ element.getVisualization(),
+ subElementIds);
+
+ getVersionElementsAccessor(context).addElements(
+ Collections.singleton(element.getId().toString()),
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ versionId);
+ }
+
+ private void updateElement(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ getElementAccessor(context).update(
+ JsonUtil.object2Json(element.getInfo()),
+ JsonUtil.object2Json(element.getRelations()),
+ element.getData(),
+ element.getSearchableData(),
+ element.getVisualization(),
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ elementContext.getVersionId().toString(),
+ element.getId().toString());
+ }
+
+ private void deleteElement(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ String versionId = getVersionId(elementContext);
+
+ getElementAccessor(context).delete(
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ versionId,
+ element.getId().toString());
+
+ getVersionElementsAccessor(context).removeElements(
+ Collections.singleton(element.getId().toString()),
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ versionId);
+ }
+
+ private void addElementToParent(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ getElementAccessor(context).addSubElements(
+ Collections.singleton(element.getId().toString()),
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ getVersionId(elementContext),
+ element.getParentId().toString());
+ }
+
+ private void removeElementFromParent(SessionContext context, ElementEntityContext elementContext,
+ ElementEntity element) {
+ if (element.getParentId() == null) {
+ return;
+ }
+ getElementAccessor(context).removeSubElements(
+ Collections.singleton(element.getId().toString()),
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ getVersionId(elementContext),
+ element.getParentId().toString());
+ }
+
+ private ElementEntity getElementEntity(ElementEntity element, Row row) {
+ element.setNamespace(getNamespace(row.getString(ElementField.NAMESPACE)));
+ element.setParentId(new Id(row.getString(ElementField.PARENT_ID)));
+ element.setInfo(json2Object(row.getString(ElementField.INFO), Info.class));
+ element.setRelations(
+ json2Object(row.getString(ElementField.RELATIONS), new TypeToken<ArrayList<Relation>>() {
+ }.getType()));
+ element.setData(row.getBytes(ElementField.DATA));
+ element.setSearchableData(row.getBytes(ElementField.SEARCHABLE_DATA));
+ element.setVisualization(row.getBytes(ElementField.VISUALIZATION));
+ element.setSubElementIds(row.getSet(ElementField.SUB_ELEMENT_IDS, String.class)
+ .stream().map(Id::new).collect(Collectors.toSet()));
+ return element;
+ }
+
+ private Namespace getNamespace(String namespaceStr) {
+ Namespace namespace = new Namespace();
+ if (namespaceStr != null) {
+ namespace.setValue(namespaceStr);
+ }
+ return namespace;
+ }
+
+ private static <T> T json2Object(String json, Type typeOfT) {
+ return json == null ? null : JsonUtil.json2Object(json, typeOfT);
+ }
+
+ private Set<String> getVersionElementIds(SessionContext context,
+ ElementEntityContext elementContext) {
+ Row row = getVersionElementsAccessor(context).get(
+ elementContext.getSpace(),
+ elementContext.getItemId().toString(),
+ getVersionId(elementContext)).one();
+ return row == null
+ ? new HashSet<>()
+ : row.getSet(CassandraElementRepository.VersionElementsField.ELEMENT_IDS, String.class);
+ }
+
+ /*
+CREATE TABLE IF NOT EXISTS element_namespace (
+ space text,
+ item_id text,
+ element_id text,
+ namespace text,
+ PRIMARY KEY (( space, item_id, element_id ))
+);
+ */
+ @Accessor
+ interface ElementNamespaceAccessor {
+ @Query(
+ "UPDATE element_namespace SET namespace=:ns " +
+ "WHERE space=:space AND item_id=:item AND element_id=:id ")
+ void create(@Param("space") String space,
+ @Param("item") String itemId,
+ @Param("id") String elementId,
+ @Param("ns") String namespace);
+ }
+
+ /*
+CREATE TABLE IF NOT EXISTS element (
+ space text,
+ item_id text,
+ version_id text,
+ element_id text,
+ parent_id text,
+ namespace text,
+ info text,
+ relations text,
+ data blob,
+ searchable_data blob,
+ visualization blob,
+ sub_element_ids set<text>,
+ PRIMARY KEY (( space, item_id, version_id, element_id ))
+);
+ */
+ @Accessor
+ interface ElementAccessor {
+ @Query(
+ "UPDATE element SET parent_id=:parentId, namespace=:ns, info=:info, relations=:rels, " +
+ "data=:data, searchable_data=:searchableData, visualization=:visualization, " +
+ "sub_element_ids=sub_element_ids+:subs " +
+ "WHERE space=:space AND item_id=:item AND version_id=:ver AND element_id=:id ")
+ void create(@Param("space") String space,
+ @Param("item") String itemId,
+ @Param("ver") String versionId,
+ @Param("id") String elementId,
+ @Param("parentId") String parentElementId,
+ @Param("ns") String namespace,
+ @Param("info") String info,
+ @Param("rels") String relations,
+ @Param("data") ByteBuffer data,
+ @Param("searchableData") ByteBuffer searchableData,
+ @Param("visualization") ByteBuffer visualization,
+ @Param("subs") Set<String> subElementIds);
+
+ @Query("UPDATE element SET info=?, relations=?, data=?, searchable_data=?, visualization=?" +
+ " WHERE space=? AND item_id=? AND version_id=? AND element_id=? ")
+ void update(String info, String relations, ByteBuffer data, ByteBuffer searchableData,
+ ByteBuffer visualization, String space, String itemId, String versionId,
+ String elementId);
+
+ @Query("DELETE FROM element WHERE space=? AND item_id=? AND version_id=? AND element_id=?")
+ void delete(String space, String itemId, String versionId, String elementId);
+
+ @Query("SELECT parent_id, namespace, info, relations, data, searchable_data, visualization, " +
+ "sub_element_ids FROM element " +
+ "WHERE space=? AND item_id=? AND version_id=? AND element_id=? ")
+ ResultSet get(String space, String itemId, String versionId, String elementId);
+
+ @Query("UPDATE element SET sub_element_ids=sub_element_ids+? " +
+ " WHERE space=? AND item_id=? AND version_id=? AND element_id=? ")
+ void addSubElements(Set<String> subElementIds, String space, String itemId, String versionId,
+ String elementId);
+
+ @Query("UPDATE element SET sub_element_ids=sub_element_ids-? " +
+ " WHERE space=? AND item_id=? AND version_id=? AND element_id=? ")
+ void removeSubElements(Set<String> subElementIds, String space, String itemId, String versionId,
+ String elementId);
+ }
+
+ private static final class ElementField {
+ private static final String NAMESPACE = "namespace";
+ private static final String PARENT_ID = "parent_id";
+ private static final String INFO = "info";
+ private static final String RELATIONS = "relations";
+ private static final String DATA = "data";
+ private static final String SEARCHABLE_DATA = "searchable_data";
+ private static final String VISUALIZATION = "visualization";
+ private static final String SUB_ELEMENT_IDS = "sub_element_ids";
+ }
+
+ /*
+ CREATE TABLE IF NOT EXISTS version_elements (
+ space text,
+ item_id text,
+ version_id text,
+ element_ids set<text>,
+ PRIMARY KEY (( space, item_id, version_id ))
+ );
+ */
+ @Accessor
+ interface VersionElementsAccessor {
+
+ @Query("UPDATE version_elements SET element_ids=element_ids+? " +
+ "WHERE space=? AND item_id=? AND version_id=?")
+ void addElements(Set<String> elementIds, String space, String itemId, String versionId);
+
+ @Query("UPDATE version_elements SET element_ids=element_ids-? " +
+ "WHERE space=? AND item_id=? AND version_id=?")
+ void removeElements(Set<String> elementIds, String space, String itemId, String versionId);
+
+ @Query("SELECT element_ids FROM version_elements WHERE space=? AND item_id=? AND version_id=?")
+ ResultSet get(String space, String itemId, String versionId);
+ }
+
+ private static final class VersionElementsField {
+ private static final String ELEMENT_IDS = "element_ids";
+ }
+}
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/CassandraElementRepositoryFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepositoryFactory.java
new file mode 100644
index 0000000000..f3072a6502
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepositoryFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.core.zusammen.plugin.dao.impl;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepository;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepositoryFactory;
+
+public class CassandraElementRepositoryFactory extends ElementRepositoryFactory {
+
+ private static final ElementRepository INSTANCE = new CassandraElementRepository();
+
+ @Override
+ public ElementRepository createInterface(SessionContext context) {
+ return INSTANCE;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/types/ElementEntity.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/types/ElementEntity.java
new file mode 100644
index 0000000000..1663d83427
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/types/ElementEntity.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.core.zusammen.plugin.dao.types;
+
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.Namespace;
+import com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.Relation;
+
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+public class ElementEntity {
+ private Id id;
+ private Id parentId;
+ private Namespace namespace;
+ private Info info;
+ private Collection<Relation> relations = Collections.emptyList();
+ private ByteBuffer data;
+ private ByteBuffer searchableData;
+ private ByteBuffer visualization;
+ private Set<Id> subElementIds = Collections.emptySet();
+
+ public ElementEntity(Id id) {
+ this.id = id;
+ }
+
+ public Id getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(Id parentId) {
+ this.parentId = parentId;
+ }
+
+ public Id getId() {
+ return id;
+ }
+
+ public void setId(Id id) {
+ this.id = id;
+ }
+
+ public Namespace getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(Namespace namespace) {
+ this.namespace = namespace;
+ }
+
+ public Info getInfo() {
+ return info;
+ }
+
+ public void setInfo(Info info) {
+ this.info = info;
+ }
+
+ public Collection<Relation> getRelations() {
+ return relations;
+ }
+
+ public void setRelations(Collection<Relation> relations) {
+ this.relations = relations;
+ }
+
+ public ByteBuffer getData() {
+ return data;
+ }
+
+ public void setData(ByteBuffer data) {
+ this.data = data;
+ }
+
+ public ByteBuffer getSearchableData() {
+ return searchableData;
+ }
+
+ public void setSearchableData(ByteBuffer searchableData) {
+ this.searchableData = searchableData;
+ }
+
+ public ByteBuffer getVisualization() {
+ return visualization;
+ }
+
+ public void setVisualization(ByteBuffer visualization) {
+ this.visualization = visualization;
+ }
+
+ public Set<Id> getSubElementIds() {
+ return subElementIds;
+ }
+
+ public void setSubElementIds(Set<Id> subElementIds) {
+ this.subElementIds = subElementIds;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ ElementEntity that = (ElementEntity) o;
+
+ return id.equals(that.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+}
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
new file mode 100644
index 0000000000..4bf9a8d25e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.core.zusammen.plugin.main;
+
+import com.amdocs.zusammen.commons.health.data.HealthInfo;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.Namespace;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.ItemVersionData;
+import com.amdocs.zusammen.datatypes.itemversion.ItemVersionHistory;
+import com.amdocs.zusammen.datatypes.itemversion.Tag;
+import com.amdocs.zusammen.datatypes.response.Response;
+import com.amdocs.zusammen.datatypes.response.ZusammenException;
+import com.amdocs.zusammen.sdk.collaboration.CollaborationStore;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationMergeChange;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationMergeResult;
+import com.amdocs.zusammen.sdk.collaboration.types.CollaborationPublishResult;
+import org.openecomp.core.zusammen.plugin.collaboration.ElementCollaborationStore;
+import org.openecomp.core.zusammen.plugin.collaboration.VersionCollaborationStore;
+
+import java.util.Collection;
+
+public class CassandraCollaborationStorePluginImpl implements CollaborationStore {
+
+ private VersionCollaborationStore versionCollaborationStore = new VersionCollaborationStore();
+ private ElementCollaborationStore elementCollaborationStore = new ElementCollaborationStore();
+
+ @Override
+ public Response<Void> createItem(SessionContext context, Id id, Info info) {
+ // done by state store
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> deleteItem(SessionContext context, Id id) {
+ // done by state store
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> createItemVersion(SessionContext context, Id itemId, Id versionId, Id id2,
+ ItemVersionData itemVersionData) {
+ // done by state store
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> updateItemVersion(SessionContext context, Id itemId, Id versionId,
+ ItemVersionData itemVersionData) {
+ // done by state store
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> deleteItemVersion(SessionContext context, Id itemId, Id versionId) {
+ // done by state store
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> tagItemVersion(SessionContext context, Id itemId, Id versionId, Id changeId,
+ Tag tag) {
+ versionCollaborationStore.tagItemVersion(context, itemId, versionId, changeId, tag);
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<CollaborationPublishResult> publishItemVersion(SessionContext context,
+ Id itemId, Id versionId,
+ String s) {
+ throw new UnsupportedOperationException("publishItemVersion");
+ }
+
+ @Override
+ public Response<CollaborationMergeResult> syncItemVersion(SessionContext context, Id id,
+ Id id1) {
+ throw new UnsupportedOperationException("syncItemVersion");
+ }
+
+ @Override
+ public Response<CollaborationMergeResult> mergeItemVersion(SessionContext context, Id id,
+ Id id1, Id id2) {
+ throw new UnsupportedOperationException("mergeItemVersion");
+ }
+
+ @Override
+ public Response<ItemVersionHistory> listItemVersionHistory(SessionContext context, Id id,
+ Id id1) {
+ throw new UnsupportedOperationException("listItemVersionHistory");
+ }
+
+ @Override
+ public Response<CollaborationMergeChange> resetItemVersionHistory(SessionContext context,
+ Id itemId, Id versionId,
+ String changeRef) {
+ return new Response<>(versionCollaborationStore.resetItemVersionHistory(context, itemId, versionId, changeRef));
+ }
+
+ @Override
+ public Response<Collection<CollaborationElement>> listElements(SessionContext context,
+ ElementContext elementContext,
+ Namespace namespace,
+ Id elementId) {
+ return new Response<>(
+ elementCollaborationStore.listElements(context, elementContext, elementId));
+ }
+
+ @Override
+ public Response<CollaborationElement> getElement(SessionContext context,
+ ElementContext elementContext,
+ Namespace namespace, Id elementId) {
+ return new Response<>(elementCollaborationStore.getElement(context, elementContext, elementId));
+ }
+
+ @Override
+ public Response<Void> createElement(SessionContext context, CollaborationElement element) {
+ elementCollaborationStore.createElement(context, element);
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> updateElement(SessionContext context, CollaborationElement element) {
+ elementCollaborationStore.updateElement(context, element);
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> deleteElement(SessionContext context, CollaborationElement element) {
+ elementCollaborationStore.deleteElement(context, element);
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> commitElements(SessionContext context, Id itemId, Id versionId, String s) {
+ // not needed
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<HealthInfo> checkHealth(SessionContext sessionContext) throws ZusammenException {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraStateStorePluginImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraStateStorePluginImpl.java
new file mode 100644
index 0000000000..b4767b2872
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraStateStorePluginImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.core.zusammen.plugin.main;
+
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.response.Response;
+import com.amdocs.zusammen.plugin.statestore.cassandra.StateStoreImpl;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
+import com.amdocs.zusammen.sdk.state.types.StateElement;
+import org.openecomp.core.zusammen.plugin.dao.ElementRepositoryFactory;
+import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
+
+import static org.openecomp.core.zusammen.plugin.ZusammenPluginUtil.getSpaceName;
+
+public class CassandraStateStorePluginImpl extends StateStoreImpl {
+
+ @Override
+ public Response<Void> createElement(SessionContext context, StateElement element) {
+ ElementEntity elementEntity = new ElementEntity(element.getId());
+ elementEntity.setNamespace(element.getNamespace());
+
+ ElementRepositoryFactory.getInstance().createInterface(context)
+ .createNamespace(context,
+ new ElementEntityContext(getSpaceName(context, element.getSpace()),
+ element.getItemId(), element.getVersionId()),
+ elementEntity);
+ // create element is done by collaboration store
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> updateElement(SessionContext context, StateElement element) {
+ // done by collaboration store
+ return new Response(Void.TYPE);
+ }
+
+ @Override
+ public Response<Void> deleteElement(SessionContext context, StateElement element) {
+ // done by collaboration store
+ return new Response(Void.TYPE);
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/factoryConfiguration.json
new file mode 100644
index 0000000000..cd1e293b4b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/factoryConfiguration.json
@@ -0,0 +1,3 @@
+{
+ "org.openecomp.core.zusammen.plugin.dao.ElementRepositoryFactory": "org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepositoryFactory"
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/zusammen.json b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/zusammen.json
new file mode 100644
index 0000000000..e90d80f016
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/resources/zusammen.json
@@ -0,0 +1,23 @@
+{
+ "configuration": {
+ "level": 10,
+ "plugins": {
+ "zusammen_state_store": {
+ "implementationClass": "org.openecomp.core.zusammen.plugin.main.CassandraStateStorePluginImpl"
+ },
+ "zusammen_collaborative_store": {
+ "implementationClass": "org.openecomp.core.zusammen.plugin.main.CassandraCollaborationStorePluginImpl",
+ "properties": {
+ "master.branch": "main",
+ "private.path": "C:\\git\\private",
+ "public.path": "C:\\git\\public",
+ "blueprint.path": "C:\\git\\BP",
+ "public.url": "C:\\git\\public"
+ }
+ }
+ },
+ "properties": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/pom.xml
new file mode 100644
index 0000000000..6cded9524b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/pom.xml
@@ -0,0 +1,24 @@
+<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-zusammen-lib</name>
+ <artifactId>openecomp-zusammen-lib</artifactId>
+ <groupId>org.openecomp.core</groupId>
+ <packaging>pom</packaging>
+ <parent>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-core-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+
+ </parent>
+
+ <modules>
+ <module>openecomp-zusammen-api</module>
+ <module>openecomp-zusammen-core</module>
+ <module>openecomp-zusammen-plugin</module>
+ </modules>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-core-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/pom.xml
index 95a6ce7c45..2c8726e802 100644
--- a/openecomp-be/lib/openecomp-core-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/pom.xml
@@ -2,22 +2,23 @@
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.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
</parent>
-
- <artifactId>openecomp-core-lib</artifactId>
- <name>openecomp-core-lib</name>
-
- <packaging>pom</packaging>
-
<modules>
<module>/openecomp-facade-lib</module>
<module>/openecomp-nosqldb-lib</module>
<module>/openecomp-utilities-lib</module>
<module>/openecomp-config-lib</module>
+ <module>/openecomp-zusammen-lib</module>
</modules>
-</project> \ No newline at end of file
+</project>
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