summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib
diff options
context:
space:
mode:
authorAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
committerAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
commit280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch)
tree9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-sdc-versioning-lib
parentfd3821dad11780d33c5373d74c957c442489945e (diff)
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml27
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup75
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java37
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java3
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java29
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml38
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup54
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java3
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java21
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java55
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java216
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/VersioningManagerTest.java364
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java558
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/resources/logback.xml15
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml14
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup24
36 files changed, 1134 insertions, 534 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml
index 130cc69b87..978adf4eb5 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml
@@ -1,7 +1,10 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
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-sdc-versioning-api</name>
+ <artifactId>openecomp-sdc-versioning-api</artifactId>
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-lib</artifactId>
@@ -9,22 +12,19 @@
<relativePath>../..</relativePath>
</parent>
- <artifactId>openecomp-sdc-versioning-api</artifactId>
- <name>openecomp-sdc-versioning-api</name>
-
<dependencies>
<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>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-nosqldb-core</artifactId>
<version>${project.version}</version>
</dependency>
@@ -41,13 +41,13 @@
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
- <version>2.2.4</version>
+ <version>${javax.el.version}</version>
</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>
@@ -65,7 +65,12 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- <version>RELEASE</version>
+ <version>4.11</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-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup
new file mode 100644
index 0000000000..3c9a34a189
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup
@@ -0,0 +1,75 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ 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-sdc-versioning-api</name>
+ <artifactId>openecomp-sdc-versioning-api</artifactId>
+ <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-facade-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-nosqldb-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>${hibernate.validator.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>javax.el-api</artifactId>
+ <version>${javax.el-api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>javax.el</artifactId>
+ <version>2.2.4</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>
+ <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-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java
index d51f8c0a2b..c4479d7105 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.versioning;
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder;
import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
@@ -47,9 +48,13 @@ public class VersioningUtil {
* @param firstClassCitizenType the first class citizen type
*/
public static <T extends VersionableEntity> void validateEntityExistence(Object retrievedEntity,
- T inputEntity,
- String firstClassCitizenType) {
+ T inputEntity,
+ String firstClassCitizenType) {
if (retrievedEntity == null) {
+ //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName
+ // .getServiceName(LoggerServiceName.Submit_Entity),
+ // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY,
+ // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY);
throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
inputEntity.getEntityType(),
inputEntity.getId(),
@@ -84,6 +89,10 @@ public class VersioningUtil {
}
if (nonExistingIds.size() > 0) {
+ //MdcDataErrorMessage.createErrorMessageAndUpdateMDC
+ // (LoggerServiceName.getServiceName(LoggerServiceName.Submit_Entity),
+ // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY,
+ // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY);
if (nonExistingIds.size() == 1) {
throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
entity.getEntityType(),
@@ -123,6 +132,10 @@ public class VersioningUtil {
if (nonExistingIds.size() > 0) {
if (nonExistingIds.size() == 1) {
+ //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName
+ // .getServiceName(LoggerServiceName.Submit_Entity), LoggerConstants.TARGET_ENTITY_DB,
+ // LoggerTragetServiceName.ENTIT, ErrorLevel.ERROR.name(),
+ // null, LoggerErrorDescription.SUBMIT_ENTITY);
throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
containedEntityType,
nonExistingIds.get(0),
@@ -130,6 +143,10 @@ public class VersioningUtil {
containingEntity.getId(),
containingEntity.getVersion()).build());
}
+ //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName
+ // .getServiceName(LoggerServiceName.Submit_Entity),
+ // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY,
+ // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY);
throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
containedEntityType,
nonExistingIds,
@@ -168,19 +185,23 @@ public class VersioningUtil {
}
/**
- * Resolve version version.
+ * Resolve version.
*
* @param requestedVersion the requested version
* @param versionInfo the version info
* @return the version
*/
- public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo) {
+ public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo,
+ String user) {
if (requestedVersion == null) {
requestedVersion = versionInfo.getActiveVersion();
- } else {
- if (!versionInfo.getViewableVersions().contains(requestedVersion)) {
- throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
- }
+ }
+ if (versionInfo.getActiveVersion().equals(requestedVersion)
+ && user.equals(versionInfo.getLockingUser())) {
+ requestedVersion.setStatus(VersionStatus.Locked);
+ }
+ if (!versionInfo.getViewableVersions().contains(requestedVersion)) {
+ throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
}
return requestedVersion;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java
index cb6c050520..ca09cdb532 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java
@@ -20,7 +20,6 @@
package org.openecomp.sdc.versioning.dao;
-
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java
index 8709a983a3..9ba042ba27 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java
@@ -29,6 +29,8 @@ public interface VersionableEntityDao {
Version baseVersion, Version newVersion);
void deleteVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version versionToDelete);
+ Version versionToDelete, Version backToVersion);
+ void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
+ Version versionToClose);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java
index be3c635be2..870a7892ac 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java
@@ -22,10 +22,13 @@ package org.openecomp.sdc.versioning.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
+import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
public abstract class VersionableEntityDaoFactory
extends AbstractComponentFactory<VersionableEntityDao> {
public static VersionableEntityDaoFactory getInstance() {
return AbstractFactory.getInstance(VersionableEntityDaoFactory.class);
}
+
+ public abstract VersionableEntityDao createInterface(VersionableEntityStoreType storeType);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
index e6ac799fd4..f0f67cf064 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
@@ -20,16 +20,18 @@
package org.openecomp.sdc.versioning.dao.types;
+import com.datastax.driver.mapping.annotations.Transient;
import com.datastax.driver.mapping.annotations.UDT;
@UDT(name = "version", keyspace = "dox")
public class Version {
- public static final String VERSION_REGEX = "^\\d+\\.\\d+$";
public static final String VERSION_STRING_VIOLATION_MSG =
"Version string must be in the format of: {integer}.{integer}";
private int major;
private int minor;
+ @Transient
+ private VersionStatus status = VersionStatus.Available;
public Version() {
}
@@ -56,7 +58,7 @@ public class Version {
}
try {
version = new Version(Integer.parseInt(versionLevels[0]), Integer.parseInt(versionLevels[1]));
- } catch (Exception exception) {
+ } catch (Exception ex) {
throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
}
@@ -79,6 +81,14 @@ public class Version {
this.minor = minor;
}
+ public VersionStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(VersionStatus status) {
+ this.status = status;
+ }
+
public Version calculateNextCandidate() {
return new Version(major, minor + 1);
}
@@ -92,6 +102,13 @@ public class Version {
}
@Override
+ public int hashCode() {
+ int result = major;
+ result = 31 * result + minor;
+ return result;
+ }
+
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -101,18 +118,10 @@ public class Version {
}
Version version = (Version) obj;
-
return major == version.major && minor == version.minor;
}
@Override
- public int hashCode() {
- int result = major;
- result = 31 * result + minor;
- return result;
- }
-
- @Override
public String toString() {
return major + "." + minor;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java
index 1fb68540d6..cf980d6b51 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java
@@ -24,5 +24,4 @@ public enum VersionStatus {
Available,
Locked,
Final
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java
index 5a395c6172..befbae6631 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java
@@ -22,5 +22,5 @@ package org.openecomp.sdc.versioning.dao.types;
public enum VersionType {
Draft,
- Finalized
+ Finalized;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java
index 829ce2691b..f0d80513f6 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java
@@ -20,9 +20,6 @@
package org.openecomp.sdc.versioning.errors;
-import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes
- .CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER;
-
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -32,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
public class CheckinOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder {
private static final String CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
- "Can not check in versionable entity %s with id %s since it is "
- + "checked out by other user: %s.";
+ "Can not check in versionable entity %s with id %s since it is checked out by other "
+ + "user: %s.";
/**
* Instantiates a new Checkin on entity locked by other error builder.
@@ -44,7 +41,7 @@ public class CheckinOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder {
*/
public CheckinOnEntityLockedByOtherErrorBuilder(String entityType, String entityId,
String lockingUser) {
- getErrorCodeBuilder().withId(CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER);
+ getErrorCodeBuilder().withId(VersioningErrorCodes.CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER);
getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
getErrorCodeBuilder().withMessage(String
.format(CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId, lockingUser));
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java
index 60c02474ad..9784782c70 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java
@@ -29,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
public class CheckoutOnLockedEntityErrorBuilder extends BaseErrorBuilder {
private static final String CHECKOT_ON_LOCKED_ENTITY_MSG =
- "Can not check out versionable entity %s with id %s since it is "
- + "checked out by other user: %s.";
+ "Can not check out versionable entity %s with id %s since it is checked out by "
+ + "other user: %s.";
/**
* Instantiates a new Checkout on locked entity error builder.
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java
index fb61cce1f0..4de5618e75 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.versioning.errors;
+import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY;
+
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -38,7 +40,7 @@ public class EditOnUnlockedEntityErrorBuilder extends BaseErrorBuilder {
* @param entityId the entity id
*/
public EditOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY);
+ getErrorCodeBuilder().withId(EDIT_ON_UNLOCKED_ENTITY);
getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
getErrorCodeBuilder()
.withMessage(String.format(EDIT_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java
index 22643ddc26..bff3e82f87 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java
@@ -20,9 +20,6 @@
package org.openecomp.sdc.versioning.errors;
-import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes
- .SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED;
-
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -41,7 +38,7 @@ public class EntityAlreadyFinalizedErrorBuilder extends BaseErrorBuilder {
* @param entityId the entity id
*/
public EntityAlreadyFinalizedErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED);
+ getErrorCodeBuilder().withId(VersioningErrorCodes.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED);
getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
getErrorCodeBuilder()
.withMessage(String.format(SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG, entityType, entityId));
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java
index 7d3afcb94a..d44b2c488b 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java
@@ -37,4 +37,12 @@ public class RequestedVersionInvalidErrorBuilder extends BaseErrorBuilder {
getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
getErrorCodeBuilder().withMessage(REQUESTED_VERSION_INVALID_MSG);
}
+
+/* private static List<String> toStringList(Set<Version> versions) {
+ List<String> versionStrings = new ArrayList<>(versions.size());
+ for (Version version : versions) {
+ versionStrings.add(version.toString());
+ }
+ return versionStrings;
+ }*/
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java
index 3f4fc81b76..959c277005 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java
@@ -29,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
public class SubmitLockedEntityNotAllowedErrorBuilder extends BaseErrorBuilder {
private static final String SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG =
- "Versionable entity %s with id %s can not be submitted since it is currently "
- + "locked by user %s.";
+ "Versionable entity %s with id %s can not be submitted since it is currently"
+ + " locked by user %s.";
/**
* Instantiates a new Submit locked entity not allowed error builder.
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java
index 5e2be13d61..2b90338ae2 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java
@@ -20,9 +20,6 @@
package org.openecomp.sdc.versioning.errors;
-import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes
- .UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER;
-
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -32,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
public class UndoCheckoutOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder {
private static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
- "Can not undo checkout on versionable entity %s with id %s since it is checked out by "
- + "other user: %s.";
+ "Can not undo checkout on versionable entity %s with id %s since it is checked "
+ + "out by other user: %s.";
/**
* Instantiates a new Undo checkout on entity locked by other error builder.
@@ -44,7 +41,8 @@ public class UndoCheckoutOnEntityLockedByOtherErrorBuilder extends BaseErrorBuil
*/
public UndoCheckoutOnEntityLockedByOtherErrorBuilder(String entityType, String entityId,
String lockingUser) {
- getErrorCodeBuilder().withId(UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER);
+ getErrorCodeBuilder().withId(
+ VersioningErrorCodes.UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER);
getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
getErrorCodeBuilder().withMessage(String
.format(UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId,
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java
index 36ca5b5c41..d56473f297 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java
@@ -20,13 +20,9 @@
package org.openecomp.sdc.versioning.errors;
-import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes
- .UNDO_CHECKOUT_ON_UNLOCKED_ENTITY;
-
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
-
/**
* The type Undo checkout on unlocked entity error builder.
*/
@@ -42,7 +38,7 @@ public class UndoCheckoutOnUnlockedEntityErrorBuilder extends BaseErrorBuilder {
* @param entityId the entity id
*/
public UndoCheckoutOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(UNDO_CHECKOUT_ON_UNLOCKED_ENTITY);
+ getErrorCodeBuilder().withId(VersioningErrorCodes.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY);
getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
getErrorCodeBuilder()
.withMessage(String.format(UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java
index c7413858e5..ef9fef2bda 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java
@@ -22,5 +22,5 @@ package org.openecomp.sdc.versioning.types;
public enum VersionableEntityAction {
Read,
- Write
+ Write;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java
index 161221abe3..8ec54c9980 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java
@@ -25,25 +25,33 @@ import java.util.List;
public class VersionableEntityMetadata {
+ private VersionableEntityStoreType storeType;
private String name;
private String identifierName;
private String versionIdentifierName;
private List<UniqueValueMetadata> uniqueValuesMetadata = new ArrayList<>();
- /**
- * Instantiates a new Versionable entity metadata.
- *
- * @param name the name
- * @param identifierName the identifier name
- * @param versionIdentifierName the version identifier name
- */
public VersionableEntityMetadata(String name, String identifierName,
String versionIdentifierName) {
+ this(VersionableEntityStoreType.Cassandra, name, identifierName, versionIdentifierName);
+ }
+
+ public VersionableEntityMetadata(VersionableEntityStoreType storeType, String name,
+ String identifierName, String versionIdentifierName) {
+ this.storeType = storeType;
this.name = name;
this.identifierName = identifierName;
this.versionIdentifierName = versionIdentifierName;
}
+ public VersionableEntityStoreType getStoreType() {
+ return storeType;
+ }
+
+ public void setStoreType(VersionableEntityStoreType storeType) {
+ this.storeType = storeType;
+ }
+
public String getName() {
return name;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java
new file mode 100644
index 0000000000..72c5ecdba1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java
@@ -0,0 +1,6 @@
+package org.openecomp.sdc.versioning.types;
+
+public enum VersionableEntityStoreType {
+ Cassandra,
+ Zusammen
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json
index f36c2d5a43..e38ad1a8b4 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json
@@ -1,7 +1,6 @@
{
"org.openecomp.sdc.versioning.VersioningManagerFactory": "org.openecomp.sdc.versioning.impl.VersioningManagerFactoryImpl",
- "org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory" : "org.openecomp.sdc.versioning.dao.impl.VersionableEntityDaoFactoryImpl",
+ "org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionableEntityDaoFactoryImpl",
"org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionInfoDaoFactoryImpl",
"org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionInfoDeletedDaoFactoryImpl"
-
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml
index 89e53b20d8..fa693dc03f 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml
@@ -1,7 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
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-sdc-versioning-core</name>
+ <artifactId>openecomp-sdc-versioning-core</artifactId>
+
+
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-lib</artifactId>
@@ -9,10 +14,6 @@
<relativePath>../..</relativePath>
</parent>
- <name>openecomp-sdc-versioning-core</name>
- <artifactId>openecomp-sdc-versioning-core</artifactId>
-
-
<dependencies>
<dependency>
<groupId>org.openecomp.sdc</groupId>
@@ -20,23 +21,21 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.3.1</version>
- <scope>test</scope>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-api</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.14</version>
- <scope>test</scope>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-core</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</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>
@@ -54,8 +53,13 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- <version>RELEASE</version>
+ <version>4.11</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-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup
new file mode 100644
index 0000000000..ce41a59e20
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup
@@ -0,0 +1,54 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ 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-sdc-versioning-core</name>
+ <artifactId>openecomp-sdc-versioning-core</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-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>
+ <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-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java
index a50a8b7beb..b364da0772 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java
@@ -36,7 +36,8 @@ import org.openecomp.sdc.versioning.dao.types.VersionableEntityId;
import java.util.Collection;
public class VersionHistoryCassandraDaoImpl extends CassandraBaseDao<VersionHistoryEntity>
- implements VersionHistoryDao {
+ implements
+ VersionHistoryDao {
private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
private static Mapper<VersionHistoryEntity> mapper =
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
index a45c211f94..7bc73ce3d5 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
@@ -40,8 +40,6 @@ public class VersionInfoDaoImpl extends CassandraBaseDao<VersionInfoEntity>
noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
private static VersionInfoAccessor accessor =
noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
- //private static UDTMapper<VersionableEntityId> versionedEntityIdMapper = noSqlDb
- //.getMappingManager().udtMapper(VersionableEntityId.class);
@Override
protected Mapper<VersionInfoEntity> getMapper() {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java
index 82e4edcd80..af6b20252e 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.versioning.dao.impl;
+
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java
index f02ea89e34..5673da7070 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java
@@ -24,6 +24,8 @@ import com.datastax.driver.core.ColumnDefinitions;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.mapping.UDTMapper;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.core.util.UniqueValueUtil;
@@ -33,8 +35,6 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-import org.slf4j.LoggerFactory;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -45,8 +45,8 @@ import java.util.stream.Collectors;
class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static org.slf4j.Logger Logger =
- LoggerFactory.getLogger(VersionableEntityDaoCassandraImpl.class);
+ private static Logger Logger =
+ (Logger) LoggerFactory.getLogger(VersionableEntityDaoCassandraImpl.class);
private static UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
@@ -96,6 +96,22 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
}
}
+ @Override
+ public void deleteVersion(VersionableEntityMetadata metadata, String entityId,
+ Version versionToDelete, Version backToVersion) {
+ deleteRowsUniqueValues(metadata, entityId, versionToDelete);
+
+ String deleteCql = String.format("delete from %s where %s=? and %s=?", metadata.getName(),
+ metadata.getIdentifierName(), metadata.getVersionIdentifierName());
+ noSqlDb.execute(deleteCql, entityId, versionMapper.toUDT(versionToDelete));
+ }
+
+ @Override
+ public void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
+ Version versionToClose) {
+ // redundant in cassandra impl.
+ }
+
private ResultSet loadVersionRows(VersionableEntityMetadata metadata, String entityId,
Version version) {
String selectCql = String.format("select * from %s where %s=? and %s=?", metadata.getName(),
@@ -107,16 +123,6 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
return noSqlDb.execute(selectCql, entityId, versionMapper.toUDT(version));
}
- @Override
- public void deleteVersion(VersionableEntityMetadata metadata, String entityId,
- Version versionToDelete) {
- deleteRowsUniqueValues(metadata, entityId, versionToDelete);
-
- String deleteCql = String.format("delete from %s where %s=? and %s=?", metadata.getName(),
- metadata.getIdentifierName(), metadata.getVersionIdentifierName());
- noSqlDb.execute(deleteCql, entityId, versionMapper.toUDT(versionToDelete));
- }
-
private void initRowUniqueValues(List<UniqueValueMetadata> metadata,
Map<String, Object> columnNameToValue) {
for (UniqueValueMetadata uniqueMetadata : metadata) {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
index 8ec0814fc9..3ab6560c71 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
@@ -20,14 +20,31 @@
package org.openecomp.sdc.versioning.dao.impl;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.sdc.versioning.dao.VersionableEntityDao;
import org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory;
+import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
public class VersionableEntityDaoFactoryImpl extends VersionableEntityDaoFactory {
- private static VersionableEntityDao INSTANCE = new VersionableEntityDaoCassandraImpl();
+ private static VersionableEntityDao CASSANDRA_INSTANCE = new VersionableEntityDaoCassandraImpl();
+ private static VersionableEntityDao ZUSAMMEN_INSTANCE =
+ new VersionableEntityDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
@Override
public VersionableEntityDao createInterface() {
- return INSTANCE;
+ throw new UnsupportedOperationException
+ ("Please use createInterface api with VersionableEntityStoreType argument.");
+ }
+
+ @Override
+ public VersionableEntityDao createInterface(VersionableEntityStoreType storeType) {
+ switch (storeType) {
+ case Cassandra:
+ return CASSANDRA_INSTANCE;
+ case Zusammen:
+ return ZUSAMMEN_INSTANCE;
+ default:
+ throw new IllegalArgumentException("Unssported state store");
+ }
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java
new file mode 100644
index 0000000000..9e12d0dec9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java
@@ -0,0 +1,55 @@
+package org.openecomp.sdc.versioning.dao.impl;
+
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.ItemVersion;
+import com.amdocs.zusammen.datatypes.itemversion.Tag;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.versioning.dao.VersionableEntityDao;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+
+import java.util.Optional;
+
+public class VersionableEntityDaoZusammenImpl implements VersionableEntityDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public VersionableEntityDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void initVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
+ Version baseVersion, Version newVersion) {
+ // redundant in zusammen impl.
+ }
+
+ @Override
+ public void deleteVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
+ Version versionToDelete, Version backToVersion) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(entityId);
+ Id versionId = getItemVersionId(itemId, context);
+ zusammenAdaptor.resetVersionHistory(context, itemId, versionId, backToVersion.toString());
+ }
+
+ @Override
+ public void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
+ Version versionToClose) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(entityId);
+ Id versionId = getItemVersionId(itemId, context);
+ zusammenAdaptor
+ .tagVersion(context, itemId, versionId, new Tag(versionToClose.toString(), null));
+ }
+
+ // TODO: 3/19/2017 move to a common util
+ private Id getItemVersionId(Id itemId, SessionContext context) {
+ Optional<ItemVersion> itemVersionOptional = zusammenAdaptor.getFirstVersion(context, itemId);
+ ItemVersion itemVersion = itemVersionOptional.orElseThrow(() ->
+ new RuntimeException(String.format("No version was found for item %s.", itemId)));
+ return itemVersion.getId();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
index f7065cfda4..8ab5c608bf 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
@@ -22,9 +22,14 @@ package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
+import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
public class VersioningManagerFactoryImpl extends VersioningManagerFactory {
- private static final VersioningManager INSTANCE = new VersioningManagerImpl();
+ private static final VersioningManager INSTANCE = new VersioningManagerImpl(
+ VersionInfoDaoFactory.getInstance().createInterface(),
+ VersionInfoDeletedDaoFactory.getInstance().createInterface()
+ );
@Override
public VersioningManager createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
index 6aa2a9f63c..0bbe3f81e7 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
@@ -21,12 +21,16 @@
package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerErrorDescription;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.dao.VersionInfoDao;
-import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
-import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
-import org.openecomp.sdc.versioning.dao.VersionableEntityDao;
import org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory;
import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -51,6 +55,7 @@ import org.openecomp.sdc.versioning.errors.UndoCheckoutOnUnlockedEntityErrorBuil
import org.openecomp.sdc.versioning.types.VersionInfo;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+import org.slf4j.MDC;
import java.util.Collection;
import java.util.HashMap;
@@ -63,15 +68,18 @@ import java.util.stream.Collectors;
public class VersioningManagerImpl implements VersioningManager {
private static final Version INITIAL_ACTIVE_VERSION = new Version(0, 0);
- private static VersionInfoDao versionInfoDao =
- VersionInfoDaoFactory.getInstance().createInterface();
- private static VersionInfoDeletedDao versionInfoDeletedDao =
- VersionInfoDeletedDaoFactory.getInstance().createInterface();
- private static VersionableEntityDao versionableEntityDao =
- VersionableEntityDaoFactory.getInstance().createInterface();
-
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private static Map<String, Set<VersionableEntityMetadata>> versionableEntities = new HashMap<>();
+ private VersionInfoDao versionInfoDao;
+ private VersionInfoDeletedDao versionInfoDeletedDao;
+
+ public VersioningManagerImpl(VersionInfoDao versionInfoDao,
+ VersionInfoDeletedDao versionInfoDeletedDao) {
+ this.versionInfoDao = versionInfoDao;
+ this.versionInfoDeletedDao = versionInfoDeletedDao;
+ }
+
private static VersionInfo getVersionInfo(VersionInfoEntity versionInfoEntity, String user,
VersionableEntityAction action) {
return getVersionInfo(versionInfoEntity.getEntityId(),
@@ -103,6 +111,10 @@ public class VersioningManagerImpl implements VersioningManager {
Version latestFinalVersion,
Set<Version> viewableVersions,
VersionableEntityAction action, String user) {
+
+
+ mdcDataDebugMessage.debugEntryMessage("entity Id", entityId);
+
Version activeVersion;
if (action == VersionableEntityAction.Write) {
@@ -110,11 +122,17 @@ public class VersioningManagerImpl implements VersioningManager {
if (user.equals(candidate.getUser())) {
activeVersion = candidate.getVersion();
} else {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.GET_VERSION_INFO, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't get entity version info");
throw new CoreException(
new EditOnEntityLockedByOtherErrorBuilder(entityType, entityId, candidate.getUser())
.build());
}
} else {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.GET_VERSION_INFO, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't get entity version info");
throw new CoreException(new EditOnUnlockedEntityErrorBuilder(entityType, entityId).build());
}
} else {
@@ -126,17 +144,23 @@ public class VersioningManagerImpl implements VersioningManager {
}
VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setStatus(status);
+ activeVersion.setStatus(status);
+ if(latestFinalVersion!= null) latestFinalVersion.setStatus(status);
+ if(viewableVersions != null) viewableVersions.forEach(version->version.setStatus(status));
versionInfo.setActiveVersion(activeVersion);
versionInfo.setLatestFinalVersion(latestFinalVersion);
versionInfo.setViewableVersions(toSortedList(viewableVersions));
versionInfo.setFinalVersions(getFinalVersions(viewableVersions));
- versionInfo.setStatus(status);
if (candidate != null) {
+ candidate.getVersion().setStatus(status);
versionInfo.setLockingUser(candidate.getUser());
if (user.equals(candidate.getUser())) {
versionInfo.getViewableVersions().add(candidate.getVersion());
}
}
+
+ mdcDataDebugMessage.debugExitMessage("entity Id", entityId);
return versionInfo;
}
@@ -150,24 +174,24 @@ public class VersioningManagerImpl implements VersioningManager {
}
private static List<Version> getFinalVersions(Set<Version> versions) {
- return versions.stream().filter(version -> version.isFinal()).collect(Collectors.toList());
+ return versions.stream().filter(Version::isFinal).collect(Collectors.toList());
}
@Override
public void register(String entityType, VersionableEntityMetadata entityMetadata) {
- Set<VersionableEntityMetadata> entitiesMetadata = versionableEntities.get(entityType);
- if (entitiesMetadata == null) {
- entitiesMetadata = new HashSet<>();
- versionableEntities.put(entityType, entitiesMetadata);
- }
+ Set<VersionableEntityMetadata> entitiesMetadata =
+ versionableEntities.computeIfAbsent(entityType, k -> new HashSet<>());
entitiesMetadata.add(entityMetadata);
}
@Override
public Version create(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ VersionInfoEntity
+ versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
if (versionInfoEntity != null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CREATE_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't create versionable entity");
throw new CoreException(new EntityAlreadyExistErrorBuilder(entityType, entityId).build());
}
@@ -180,16 +204,63 @@ public class VersioningManagerImpl implements VersioningManager {
}
@Override
+ public void delete(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity =
+ versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.DELETE_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't delete versionable entity");
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ switch (versionInfoEntity.getStatus()) {
+ case Locked:
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.DELETE_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete versionable entity");
+ throw new CoreException(new DeleteOnLockedEntityErrorBuilder(entityType, entityId,
+ versionInfoEntity.getCandidate().getUser()).build());
+ default:
+ //do nothing
+ break;
+ }
+
+ doDelete(versionInfoEntity);
+ }
+
+ @Override
+ public void undoDelete(String entityType, String entityId, String user) {
+ VersionInfoDeletedEntity versionInfoDeletedEntity =
+ versionInfoDeletedDao.get(new VersionInfoDeletedEntity(entityType, entityId));
+ if (versionInfoDeletedEntity == null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.UNDO_DELETE_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't undo delete for versionable entity");
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ doUndoDelete(versionInfoDeletedEntity);
+ }
+
+ @Override
public Version checkout(String entityType, String entityId, String user) {
VersionInfoEntity versionInfoEntity =
versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ MDC.put(LoggerConstants.TARGET_SERVICE_NAME, LoggerTragetServiceName.CHECKOUT_ENTITY);
if (versionInfoEntity == null) {
+ MDC.put(LoggerConstants.ERROR_CATEGORY, ErrorLevel.ERROR.name());
+ MDC.put(LoggerConstants.TARGET_ENTITY, LoggerConstants.TARGET_ENTITY_DB);
+ MDC.put(LoggerConstants.ERROR_DESCRIPTION, LoggerErrorDescription.CHECKOUT_ENTITY);
throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
}
Version checkoutVersion = null;
switch (versionInfoEntity.getStatus()) {
case Locked:
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CHECKOUT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't checkout versionable entity");
throw new CoreException(new CheckoutOnLockedEntityErrorBuilder(entityType, entityId,
versionInfoEntity.getCandidate().getUser()).build());
case Final:
@@ -197,7 +268,10 @@ public class VersioningManagerImpl implements VersioningManager {
checkoutVersion = doCheckout(versionInfoEntity, user);
break;
default:
+ //do nothing
+ break;
}
+
return checkoutVersion;
}
@@ -206,6 +280,9 @@ public class VersioningManagerImpl implements VersioningManager {
VersionInfoEntity versionInfoEntity =
versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
if (versionInfoEntity == null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.UNDO_CHECKOUT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't undo checkout for versionable entity");
throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
}
@@ -213,6 +290,10 @@ public class VersioningManagerImpl implements VersioningManager {
switch (versionInfoEntity.getStatus()) {
case Locked:
if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.UNDO_CHECKOUT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+ "Can't undo checkout for versionable entity");
throw new CoreException(
new UndoCheckoutOnEntityLockedByOtherErrorBuilder(entityType, entityId,
versionInfoEntity.getCandidate().getUser()).build());
@@ -221,16 +302,23 @@ public class VersioningManagerImpl implements VersioningManager {
break;
case Final:
case Available:
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.UNDO_CHECKOUT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+ "Can't undo checkout for versionable entity");
throw new CoreException(
new UndoCheckoutOnUnlockedEntityErrorBuilder(entityType, entityId).build());
default:
+ //do nothing
+ break;
}
+
return activeVersion;
}
private Version undoCheckout(VersionInfoEntity versionInfoEntity) {
deleteVersionFromEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getCandidate().getVersion());
+ versionInfoEntity.getCandidate().getVersion(), versionInfoEntity.getActiveVersion());
versionInfoEntity.setStatus(versionInfoEntity.getActiveVersion().isFinal() ? VersionStatus.Final
: VersionStatus.Available);
@@ -245,6 +333,9 @@ public class VersioningManagerImpl implements VersioningManager {
VersionInfoEntity versionInfoEntity =
versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
if (versionInfoEntity == null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CHECKIN_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't checkin versionable entity");
throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
}
@@ -252,17 +343,26 @@ public class VersioningManagerImpl implements VersioningManager {
switch (versionInfoEntity.getStatus()) {
case Available:
case Final:
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CHECKIN_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't checkin versionable entity");
throw new CoreException(
new CheckinOnUnlockedEntityErrorBuilder(entityType, entityId).build());
case Locked:
if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CHECKIN_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't checkin versionable entity");
throw new CoreException(new CheckinOnEntityLockedByOtherErrorBuilder(entityType, entityId,
versionInfoEntity.getCandidate().getUser()).build());
}
checkedInVersion = doCheckin(versionInfoEntity, checkinDescription);
break;
default:
+ //do nothing
+ break;
}
+
return checkedInVersion;
}
@@ -271,22 +371,34 @@ public class VersioningManagerImpl implements VersioningManager {
VersionInfoEntity versionInfoEntity =
versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
if (versionInfoEntity == null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't submit versionable entity");
throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
}
Version submitVersion = null;
switch (versionInfoEntity.getStatus()) {
case Final:
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't submit versionable entity");
throw new CoreException(
new EntityAlreadyFinalizedErrorBuilder(entityType, entityId).build());
case Locked:
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't submit versionable entity");
throw new CoreException(new SubmitLockedEntityNotAllowedErrorBuilder(entityType, entityId,
versionInfoEntity.getCandidate().getUser()).build());
case Available:
submitVersion = doSubmit(versionInfoEntity, user, submitDescription);
break;
default:
+ //do nothing
+ break;
}
+
return submitVersion;
}
@@ -296,6 +408,9 @@ public class VersioningManagerImpl implements VersioningManager {
VersionInfoEntity versionInfoEntity =
versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
if (versionInfoEntity == null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.GET_VERSION_INFO, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get entity version info");
throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
}
return getVersionInfo(versionInfoEntity, user, action);
@@ -329,35 +444,6 @@ public class VersioningManagerImpl implements VersioningManager {
return activeVersions;
}
- @Override
- public void delete(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- switch (versionInfoEntity.getStatus()) {
- case Locked:
- throw new CoreException(new DeleteOnLockedEntityErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- default:
- }
-
- doDelete(versionInfoEntity, user);
- }
-
- @Override
- public void undoDelete(String entityType, String entityId, String user) {
- VersionInfoDeletedEntity versionInfoDeletedEntity =
- versionInfoDeletedDao.get(new VersionInfoDeletedEntity(entityType, entityId));
- if (versionInfoDeletedEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- doUndoDelete(versionInfoDeletedEntity, user);
- }
-
private void markAsCheckedOut(VersionInfoEntity versionInfoEntity, String checkingOutUser) {
versionInfoEntity.setStatus(VersionStatus.Locked);
versionInfoEntity.setCandidate(new UserCandidateVersion(checkingOutUser,
@@ -374,8 +460,7 @@ public class VersioningManagerImpl implements VersioningManager {
return versionInfoEntity.getCandidate().getVersion();
}
- private void doDelete(VersionInfoEntity versionInfoEntity, String user) {
-
+ private void doDelete(VersionInfoEntity versionInfoEntity) {
VersionInfoDeletedEntity versionInfoDeletedEntity = new VersionInfoDeletedEntity();
versionInfoDeletedEntity.setStatus(versionInfoEntity.getStatus());
versionInfoDeletedEntity.setViewableVersions(versionInfoEntity.getViewableVersions());
@@ -386,11 +471,9 @@ public class VersioningManagerImpl implements VersioningManager {
versionInfoDeletedEntity.setLatestFinalVersion(versionInfoEntity.getLatestFinalVersion());
versionInfoDeletedDao.create(versionInfoDeletedEntity);
versionInfoDao.delete(versionInfoEntity);
-
}
- private void doUndoDelete(VersionInfoDeletedEntity versionInfoDeletedEntity, String user) {
-
+ private void doUndoDelete(VersionInfoDeletedEntity versionInfoDeletedEntity) {
VersionInfoEntity versionInfoEntity = new VersionInfoEntity();
versionInfoEntity.setStatus(versionInfoDeletedEntity.getStatus());
versionInfoEntity.setViewableVersions(versionInfoDeletedEntity.getViewableVersions());
@@ -401,7 +484,6 @@ public class VersioningManagerImpl implements VersioningManager {
versionInfoEntity.setLatestFinalVersion(versionInfoDeletedEntity.getLatestFinalVersion());
versionInfoDao.create(versionInfoEntity);
versionInfoDeletedDao.delete(versionInfoDeletedEntity);
-
}
private Version doCheckin(VersionInfoEntity versionInfoEntity, String checkinDescription) {
@@ -412,6 +494,9 @@ public class VersioningManagerImpl implements VersioningManager {
versionInfoEntity.setStatus(VersionStatus.Available);
versionInfoDao.update(versionInfoEntity);
+ closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
+ versionInfoEntity.getActiveVersion());
+
return versionInfoEntity.getActiveVersion();
}
@@ -420,6 +505,8 @@ public class VersioningManagerImpl implements VersioningManager {
Version finalVersion = versionInfoEntity.getActiveVersion().calculateNextFinal();
initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
versionInfoEntity.getActiveVersion(), finalVersion);
+ closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
+ finalVersion);
Set<Version> viewableVersions = new HashSet<>();
for (Version version : versionInfoEntity.getViewableVersions()) {
@@ -444,6 +531,7 @@ public class VersioningManagerImpl implements VersioningManager {
versionHistory.setUser(user);
versionHistory.setDescription(description);
versionHistory.setType(type);
+ //versionHistoryDao.create(versionHistory);
}
private void initVersionOnEntity(String entityType, String entityId, Version baseVersion,
@@ -451,17 +539,29 @@ public class VersioningManagerImpl implements VersioningManager {
Set<VersionableEntityMetadata> entityMetadatas = versionableEntities.get(entityType);
if (entityMetadatas != null) {
for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- versionableEntityDao.initVersion(entityMetadata, entityId, baseVersion, newVersion);
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .initVersion(entityMetadata, entityId, baseVersion, newVersion);
}
}
}
private void deleteVersionFromEntity(String entityType, String entityId,
- Version versionToDelete) {
+ Version versionToDelete, Version backToVersion) {
+ Set<VersionableEntityMetadata> entityMetadatas = versionableEntities.get(entityType);
+ if (entityMetadatas != null) {
+ for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .deleteVersion(entityMetadata, entityId, versionToDelete, backToVersion);
+ }
+ }
+ }
+
+ private void closeVersionOnEntity(String entityType, String entityId, Version versionToClose) {
Set<VersionableEntityMetadata> entityMetadatas = versionableEntities.get(entityType);
if (entityMetadatas != null) {
for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- versionableEntityDao.deleteVersion(entityMetadata, entityId, versionToDelete);
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .closeVersion(entityMetadata, entityId, versionToClose);
}
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/VersioningManagerTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/VersioningManagerTest.java
deleted file mode 100644
index 3695f9ef2d..0000000000
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/VersioningManagerTest.java
+++ /dev/null
@@ -1,364 +0,0 @@
-package org.openecomp.sdc.versioning;
-
-
-import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.versioning.dao.VersionInfoDao;
-import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
-import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
-import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.mapping.UDTMapper;
-
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-public class VersioningManagerTest {
- private static final VersioningManager versioningManager =
- VersioningManagerFactory.getInstance().createInterface();
- private static final VersionInfoDao versionInfoDao =
- VersionInfoDaoFactory.getInstance().createInterface();
- private static final VersionInfoDeletedDao versionInfoDeletedDao =
- VersionInfoDeletedDaoFactory.getInstance().createInterface();
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final String USR1 = "usr1";
- private static final String USR2 = "usr2";
- private static final String USR3 = "usr3";
- private static final String TYPE1 = "Type1";
- private static final String TYPE2 = "Type2";
- private static final String ID1 = "Id1";
- private static final String ID2 = "Id2";
- private static final String ID3 = "Id3";
- private static final String TYPE1_TABLE_NAME = "vendor_license_model";
- private static final String TYPE1_ID_NAME = "vlm_id";
- private static final String TYPE1_VERSION_NAME = "version";
- private static final String TYPE2_TABLE_NAME = "feature_group";
- private static final String TYPE2_ID_NAME = "vlm_id";
- private static final String TYPE2_VERSION_NAME = "version";
- private static final Version VERSION01 = new Version(0, 1);
- private static final Version VERSION02 = new Version(0, 2);
- private static final Version VERSION10 = new Version(1, 0);
- private static final Version VERSION11 = new Version(1, 1);
- private static UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
- private static Set<Version> expectedViewableVersionsType1Id1 = new HashSet<>();
-
- private static void assretVersionInfoEntity(VersionInfoEntity actual, String entityType,
- String entityId, Version activeVersion,
- Version candidateVersion, String candidateUser,
- VersionStatus status, Set<Version> viewbleVersions,
- Version latestFinalVersion) {
- Assert.assertNotNull(actual);
- Assert.assertEquals(actual.getEntityType(), entityType);
- Assert.assertEquals(actual.getEntityId(), entityId);
- Assert.assertEquals(actual.getActiveVersion(), activeVersion);
- if (candidateVersion != null && candidateUser != null) {
- Assert.assertEquals(actual.getCandidate().getVersion(), candidateVersion);
- Assert.assertEquals(actual.getCandidate().getUser(), candidateUser);
- } else {
- Assert.assertNull(actual.getCandidate());
- }
- Assert.assertEquals(actual.getStatus(), status);
- Assert.assertEquals(actual.getViewableVersions().size(), viewbleVersions.size());
- Assert.assertEquals(actual.getViewableVersions(), viewbleVersions);
- Assert.assertEquals(actual.getLatestFinalVersion(), latestFinalVersion);
- }
-
- private static void assretVersionInfo(VersionInfo actual, Version activeVersion,
- VersionStatus status, String lockingUser,
- Set<Version> viewableVersions, Version latestFinalVersion) {
- Assert.assertNotNull(actual);
- Assert.assertEquals(actual.getActiveVersion(), activeVersion);
- Assert.assertEquals(actual.getStatus(), status);
- Assert.assertEquals(actual.getLockingUser(), lockingUser);
- Assert.assertEquals(actual.getViewableVersions().size(), viewableVersions.size());
- Assert.assertEquals(actual.getViewableVersions(), viewableVersions);
- Assert.assertEquals(actual.getLatestFinalVersion(), latestFinalVersion);
- }
-
-// @BeforeClass
- private void init() {
- versionInfoDao.delete(new VersionInfoEntity(TYPE1, ID1));
- versionInfoDao.delete(new VersionInfoEntity(TYPE1, ID2));
- versionInfoDao.delete(new VersionInfoEntity(TYPE2, ID3));
- String deleteFromType1 = String
- .format("delete from %s where %s=? and %s=?", TYPE1_TABLE_NAME, TYPE1_ID_NAME,
- TYPE1_VERSION_NAME);
- noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION01));
- noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION02));
- noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION11));
-
- versioningManager.register(TYPE1,
- new VersionableEntityMetadata(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME));
- versioningManager.register(TYPE2,
- new VersionableEntityMetadata(TYPE2_TABLE_NAME, TYPE2_ID_NAME, TYPE2_VERSION_NAME));
- }
-
-// @Test
- public void createTest() {
- Version version = versioningManager.create(TYPE1, ID1, USR1);
- createVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
- version);
-
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, new Version(0, 0), VERSION01, USR1,
- VersionStatus.Locked, expectedViewableVersionsType1Id1, null);
- }
-
-// @Test(dependsOnMethods = "createTest")
- public void checkinTest() {
- Version version = versioningManager.checkin(TYPE1, ID1, USR1, "checkin 0.1");
- Assert.assertEquals(version, VERSION01);
-
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- expectedViewableVersionsType1Id1.add(VERSION01);
- assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, null, null,
- VersionStatus.Available, expectedViewableVersionsType1Id1, null);
- }
-
-// @Test(dependsOnMethods = "checkinTest")
- public void getVersionInfoForReadOnAvailableTest() {
- VersionInfo versionInfo =
- versioningManager.getEntityVersionInfo(TYPE1, ID1, USR2, VersionableEntityAction.Read);
- assretVersionInfo(versionInfo, VERSION01, VersionStatus.Available, null,
- expectedViewableVersionsType1Id1, null);
- }
-
-// @Test(dependsOnMethods = "getVersionInfoForReadOnAvailableTest",
-// expectedExceptions = CoreException.class)
- public void getVersionInfoForWriteOnAvailableTest() {
- versioningManager.getEntityVersionInfo(TYPE1, ID1, USR2, VersionableEntityAction.Write);
- }
-
-// @Test(dependsOnMethods = "getVersionInfoForWriteOnAvailableTest",
-// expectedExceptions = CoreException.class)
- public void checkinOnAvailableTest() {
- versioningManager.checkin(TYPE1, ID1, USR1, "fail checkin");
- }
-
-// @Test(dependsOnMethods = "checkinOnAvailableTest", expectedExceptions = CoreException.class)
- public void undoCheckoutOnAvailableTest() {
- versioningManager.undoCheckout(TYPE1, ID1, USR1);
- }
-
-// @Test(dependsOnMethods = "undoCheckoutOnAvailableTest")
- public void checkoutTest() {
- Version version = versioningManager.checkout(TYPE1, ID1, USR2);
- Assert.assertEquals(version, VERSION02);
-
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, VERSION02, USR2,
- VersionStatus.Locked, expectedViewableVersionsType1Id1, null);
-
- ResultSet results =
- loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
- VERSION02);
- Assert.assertTrue(results.iterator().hasNext());
- }
-
-// @Test(dependsOnMethods = "checkoutTest")
- public void getVersionInfoForReadOnLockedSameUserTest() {
- VersionInfo versionInfo =
- versioningManager.getEntityVersionInfo(TYPE1, ID1, USR2, VersionableEntityAction.Read);
- Set<Version> expectedViewableVersions = new HashSet<>();
- expectedViewableVersions.addAll(expectedViewableVersionsType1Id1);
- expectedViewableVersions.add(VERSION02);
- assretVersionInfo(versionInfo, VERSION02, VersionStatus.Locked, USR2, expectedViewableVersions,
- null);
- }
-
-// @Test(dependsOnMethods = "getVersionInfoForReadOnLockedSameUserTest")
- public void getVersionInfoForReadOnLockedOtherUserTest() {
- VersionInfo entityVersionInfo =
- versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read);
- Assert.assertEquals(entityVersionInfo.getActiveVersion(), VERSION01);
- }
-
-// @Test(dependsOnMethods = "getVersionInfoForReadOnLockedOtherUserTest",
-// expectedExceptions = CoreException.class)
- public void getVersionInfoForWriteOnLockedOtherUserTest() {
- versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Write)
- .getActiveVersion();
- }
-
-// @Test(dependsOnMethods = "getVersionInfoForWriteOnLockedOtherUserTest")
- public void getVersionInfoForWriteOnLockedSameUserTest() {
- Version activeVersion =
- versioningManager.getEntityVersionInfo(TYPE1, ID1, USR2, VersionableEntityAction.Write)
- .getActiveVersion();
- Assert.assertEquals(activeVersion, VERSION02);
- }
-
-// @Test(dependsOnMethods = "getVersionInfoForWriteOnLockedSameUserTest",
-// expectedExceptions = CoreException.class)
- public void checkoutOnLockedSameUserTest() {
- versioningManager.checkout(TYPE1, ID1, USR2);
- }
-
-// @Test(dependsOnMethods = "checkoutOnLockedSameUserTest", expectedExceptions = CoreException.class)
- public void checkoutOnLockedOtherUserTest() {
- versioningManager.checkout(TYPE1, ID1, USR1);
- }
-
-// @Test(dependsOnMethods = "checkoutOnLockedSameUserTest", expectedExceptions = CoreException.class)
- public void undoCheckoutOnLockedOtherUserTest() {
- versioningManager.undoCheckout(TYPE1, ID1, USR1);
- }
-
-// @Test(dependsOnMethods = "undoCheckoutOnLockedOtherUserTest",
-// expectedExceptions = CoreException.class)
- public void submitOnLockedTest() {
- versioningManager.submit(TYPE1, ID1, USR2, "failed submit");
- }
-
-// @Test(dependsOnMethods = "submitOnLockedTest")
- public void undoCheckoutTest() {
- Version version = versioningManager.undoCheckout(TYPE1, ID1, USR2);
- Assert.assertEquals(version, VERSION01);
-
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, null, null,
- VersionStatus.Available, expectedViewableVersionsType1Id1, null);
-
- ResultSet results =
- loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
- VERSION02);
- Assert.assertFalse(results.iterator().hasNext());
- }
-
-// @Test(dependsOnMethods = "undoCheckoutTest")
- public void submitTest() {
- Version version = versioningManager.submit(TYPE1, ID1, USR3, "submit msg");
- Assert.assertEquals(version, VERSION10);
- expectedViewableVersionsType1Id1 = new HashSet<>();
- expectedViewableVersionsType1Id1.add(version);
-
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION10, null, null,
- VersionStatus.Final, expectedViewableVersionsType1Id1, VERSION10);
-
- ResultSet results =
- loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
- VERSION10);
- Assert.assertTrue(results.iterator().hasNext());
- }
-
-// @Test(dependsOnMethods = "submitTest", expectedExceptions = CoreException.class)
- public void checkinOnFinalizedTest() {
- versioningManager.checkin(TYPE1, ID1, USR2, "failed checkin");
- }
-
-// @Test(dependsOnMethods = "checkinOnFinalizedTest", expectedExceptions = CoreException.class)
- public void undoCheckouOnFinalizedTest() {
- versioningManager.undoCheckout(TYPE1, ID1, USR2);
- }
-
-// @Test(dependsOnMethods = "undoCheckouOnFinalizedTest", expectedExceptions = CoreException.class)
- public void submitOnFinalizedTest() {
- versioningManager.submit(TYPE1, ID1, USR2, "failed submit");
- }
-
-// @Test(dependsOnMethods = "submitOnFinalizedTest")
- public void checkoutOnFinalizedTest() {
- Version version = versioningManager.checkout(TYPE1, ID1, USR3);
- Assert.assertEquals(version, VERSION11);
-
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION10, VERSION11, USR3,
- VersionStatus.Locked, expectedViewableVersionsType1Id1, VERSION10);
-
- ResultSet results =
- loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
- VERSION11);
- Assert.assertTrue(results.iterator().hasNext());
- }
-
-// @Test(dependsOnMethods = "checkoutOnFinalizedTest")
- public void viewableVersionsTest() {
- versioningManager.checkin(TYPE1, ID1, USR3, "check in 1.1");
- versioningManager.checkout(TYPE1, ID1, USR3);
- versioningManager.checkin(TYPE1, ID1, USR3, "check in 1.2");
- versioningManager.submit(TYPE1, ID1, USR3, "submit in 2.0");
- versioningManager.checkout(TYPE1, ID1, USR3);
- versioningManager.checkin(TYPE1, ID1, USR3, "check in 2.1");
- versioningManager.submit(TYPE1, ID1, USR3, "submit in 3.0");
- versioningManager.checkout(TYPE1, ID1, USR3);
- versioningManager.checkin(TYPE1, ID1, USR3, "check in 3.1");
- versioningManager.checkout(TYPE1, ID1, USR3);
- versioningManager.checkin(TYPE1, ID1, USR3, "check in 3.2");
- versioningManager.checkout(TYPE1, ID1, USR2);
-
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- HashSet<Version> expectedViewableVersions = new HashSet<>();
- expectedViewableVersions.add(VERSION10);
- expectedViewableVersions.add(new Version(2, 0));
- expectedViewableVersions.add(new Version(3, 0));
- expectedViewableVersions.add(new Version(3, 1));
- expectedViewableVersions.add(new Version(3, 2));
- assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, new Version(3, 2), new Version(3, 3),
- USR2, VersionStatus.Locked, expectedViewableVersions, new Version(3, 0));
- }
-
-// @Test(dependsOnMethods = "viewableVersionsTest")
- public void listActiveVersionsTest() {
- versioningManager.create(TYPE1, ID2, USR3);
- versioningManager.checkin(TYPE1, ID2, USR3, "check in 0.1");
-
- versioningManager.create(TYPE2, ID3, USR3);
- versioningManager.checkin(TYPE2, ID3, USR3, "check in 0.1");
-
- Map<String, VersionInfo> idToVersionInfo =
- versioningManager.listEntitiesVersionInfo(TYPE1, USR2, VersionableEntityAction.Read);
- Assert.assertEquals(idToVersionInfo.size(), 2);
- Assert.assertEquals(idToVersionInfo.get(ID1).getActiveVersion(), new Version(3, 3));
- Assert.assertEquals(idToVersionInfo.get(ID2).getActiveVersion(), VERSION01);
- }
-
-// @Test(dependsOnMethods = "listActiveVersionsTest")
- public void deleteTest() {
- versioningManager.checkin(TYPE1, ID1, USR2, "check in for delete");
- versioningManager.delete(TYPE1, ID1, USR1);
-
- VersionInfoDeletedEntity versionInfoDeletedEntity =
- versionInfoDeletedDao.get(new VersionInfoDeletedEntity(TYPE1, ID1));
- Assert.assertNotNull(versionInfoDeletedEntity);
-
- Map<String, VersionInfo> entitiesInfoMap =
- versioningManager.listDeletedEntitiesVersionInfo(TYPE1, USR2, null);
- Assert.assertEquals(entitiesInfoMap.size(), 1);
- VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- Assert.assertNull(versionInfoEntity);
- versioningManager.undoDelete(TYPE1, ID1, USR1);
- versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(TYPE1, ID1));
- Assert.assertNotNull(versionInfoEntity);
-
-
- }
-
- private void createVersionableEntityRecord(String tableName, String idName, String versionName,
- String id, Version version) {
- noSqlDb.execute(
- String.format("insert into %s (%s,%s) values (?,?)", tableName, idName, versionName), id,
- versionMapper.toUDT(version));
- }
-
- private ResultSet loadVersionableEntityRecord(String tableName, String idName, String versionName,
- String id, Version version) {
- return noSqlDb.execute(
- String.format("select * from %s where %s=? and %s=?", tableName, idName, versionName), id,
- versionMapper.toUDT(version));
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java
new file mode 100644
index 0000000000..d4bccc677b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java
@@ -0,0 +1,558 @@
+/*-
+ * ============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.versioning.impl;
+
+
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.versioning.dao.VersionInfoDao;
+import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
+import org.openecomp.sdc.versioning.dao.VersionableEntityDao;
+import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.sdc.versioning.types.VersionInfo;
+import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+public class VersioningManagerImplTest {
+ private static final String USR1 = "usr1";
+ private static final String USR2 = "usr2";
+ private static final String TYPE1 = "Type1";
+/* private static final String TYPE2 = "Type2";*/
+ private static final String ID1 = "Id1";
+/* private static final String ID2 = "Id2";
+ private static final String ID3 = "Id3";
+ private static final String TYPE1_TABLE_NAME = "vendor_license_model";
+ private static final String TYPE1_ID_NAME = "vlm_id";
+ private static final String TYPE1_VERSION_NAME = "version";
+ private static final String TYPE2_TABLE_NAME = "feature_group";
+ private static final String TYPE2_ID_NAME = "vlm_id";
+ private static final String TYPE2_VERSION_NAME = "version";*/
+ private static final Version VERSION0 = new Version(0, 0);
+ private static final Version VERSION01 = new Version(0, 1);
+ private static final Version VERSION02 = new Version(0, 2);
+ private static final Version VERSION10 = new Version(1, 0);
+ private static final Version VERSION11 = new Version(1, 1);
+
+ /* private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+
+ private static UDTMapper<Version> versionMapper =
+ noSqlDb.getMappingManager().udtMapper(Version.class);*/
+ @Mock
+ private VersionInfoDao versionInfoDaoMock;
+ @Mock
+ private VersionInfoDeletedDao versionInfoDeletedDaoMock;
+ @InjectMocks
+ private VersioningManagerImpl versioningManager;
+
+ @Captor
+ private ArgumentCaptor<VersionInfoEntity> versionInfoEntityArg;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ /* @BeforeClass
+ private void init() {
+ versionInfoDaoMock.delete(new VersionInfoEntity(TYPE1, ID1));
+ versionInfoDaoMock.delete(new VersionInfoEntity(TYPE1, ID2));
+ versionInfoDaoMock.delete(new VersionInfoEntity(TYPE2, ID3));
+ String deleteFromType1 = String
+ .format("delete from %s where %s=? and %s=?", TYPE1_TABLE_NAME, TYPE1_ID_NAME,
+ TYPE1_VERSION_NAME);
+ noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION01));
+ noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION02));
+ noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION11));
+
+ versioningManager.register(TYPE1,
+ new VersionableEntityMetadata(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME));
+ versioningManager.register(TYPE2,
+ new VersionableEntityMetadata(TYPE2_TABLE_NAME, TYPE2_ID_NAME, TYPE2_VERSION_NAME));
+ }*/
+
+/* @Test
+ public void testRegister() throws Exception {
+ VersionableEntityMetadata entityMetadata =
+ new VersionableEntityMetadata(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME);
+ versioningManager.register(TYPE1, entityMetadata);
+
+ Map<String, Set<VersionableEntityMetadata>> versionableEntities =
+ versionableEntitiesCapture.capture();
+ Set<VersionableEntityMetadata> type1Entities = versionableEntities.get(TYPE1);
+ Assert.assertNotNull(type1Entities);
+ Assert.assertTrue(type1Entities.contains(entityMetadata));
+ }*/
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCreateAlreadyExisting() {
+ doReturn(new VersionInfoEntity()).when(versionInfoDaoMock).get(anyObject());
+ versioningManager.create(TYPE1, ID1, USR1);
+ }
+
+ @Test
+ public void testCreate() {
+ Version version = versioningManager.create(TYPE1, ID1, USR1);
+ Assert.assertEquals(version, VERSION01);
+
+/* createVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
+ version);*/
+ verify(versionInfoDaoMock).create(versionInfoEntityArg.capture());
+ VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue();
+ assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, new Version(0, 0), VERSION01, USR1,
+ VersionStatus.Locked, new HashSet<>(), null);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testDeleteNonExisting() {
+ versioningManager.delete(TYPE1, ID1, USR1);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testDeleteLocked() {
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0,
+ new UserCandidateVersion(USR1, VERSION01), Collections.emptySet(), null);
+ versioningManager.delete(TYPE1, ID1, USR1);
+ }
+
+ @Test
+ public void testDelete() {
+ VersionInfoEntity versionInfoEntity = new VersionInfoEntity();
+ versionInfoEntity.setStatus(VersionStatus.Available);
+ doReturn(versionInfoEntity).when(versionInfoDaoMock).get(anyObject());
+
+ versioningManager.delete(TYPE1, ID1, USR1);
+
+ verify(versionInfoDaoMock).delete(versionInfoEntity);
+ ArgumentCaptor<VersionInfoDeletedEntity> versionInfoDeletedEntityArg =
+ ArgumentCaptor.forClass(VersionInfoDeletedEntity.class);
+ verify(versionInfoDeletedDaoMock).create(versionInfoDeletedEntityArg.capture());
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testUndoDeleteNonExisting() {
+ versioningManager.undoDelete(TYPE1, ID1, USR1);
+ }
+
+ @Test
+ public void testUndoDelete() {
+ VersionInfoDeletedEntity versionInfoDeletedEntity = new VersionInfoDeletedEntity();
+ versionInfoDeletedEntity.setStatus(VersionStatus.Available);
+ doReturn(versionInfoDeletedEntity).when(versionInfoDeletedDaoMock).get(anyObject());
+
+ versioningManager.undoDelete(TYPE1, ID1, USR1);
+
+ verify(versionInfoDeletedDaoMock).delete(versionInfoDeletedEntity);
+ verify(versionInfoDaoMock).create(versionInfoEntityArg.capture());
+/*
+ VersionInfoDeletedEntity versionInfoDeletedEntity =
+ versionInfoDeletedDaoMock.get(new VersionInfoDeletedEntity(TYPE1, ID1));
+ Assert.assertNotNull(versionInfoDeletedEntity);
+
+ Map<String, VersionInfo> entitiesInfoMap =
+ versioningManager.listDeletedEntitiesVersionInfo(TYPE1, USR2, null);
+ Assert.assertEquals(entitiesInfoMap.size(), 1);
+ VersionInfoEntity versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1));
+ Assert.assertNull(versionInfoEntity);
+ versioningManager.undoDelete(TYPE1, ID1, USR1);
+ versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1));
+ Assert.assertNotNull(versionInfoEntity);*/
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCheckoutNonExisting() {
+ versioningManager.checkout(TYPE1, ID1, USR2);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCheckoutOnLockedSameUser() {
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0,
+ new UserCandidateVersion(USR1, VERSION01), Collections.emptySet(), null);
+ versioningManager.checkout(TYPE1, ID1, USR1);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCheckoutOnLockedOtherUser() {
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0,
+ new UserCandidateVersion(USR2, VERSION01), Collections.emptySet(), null);
+ versioningManager.checkout(TYPE1, ID1, USR1);
+ }
+
+ @Test
+ public void testCheckoutOnFinalized() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION10);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Final, VERSION10, null, viewableVersions,
+ VERSION10);
+
+ Version version = versioningManager.checkout(TYPE1, ID1, USR1);
+ Assert.assertEquals(version, VERSION11);
+
+ VersionInfoEntity versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1));
+ assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION10, VERSION11, USR1,
+ VersionStatus.Locked, viewableVersions, VERSION10);
+/*
+ ResultSet results =
+ loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
+ VERSION11);
+ Assert.assertTrue(results.iterator().hasNext());*/
+ }
+
+ @Test
+ public void testCheckout() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Available, VERSION01, null, viewableVersions,
+ null);
+
+ Version version = versioningManager.checkout(TYPE1, ID1, USR1);
+ Assert.assertEquals(version, VERSION02);
+
+ verify(versionInfoDaoMock).update(versionInfoEntityArg.capture());
+ VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue();
+
+ assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, VERSION02, USR1,
+ VersionStatus.Locked, viewableVersions, null);
+
+/* ResultSet results =
+ loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
+ VERSION02);
+ Assert.assertTrue(results.iterator().hasNext());*/
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testUndoCheckoutNonExisting() {
+ versioningManager.undoCheckout(TYPE1, ID1, USR1);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testUndoCheckoutOnAvailable() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Available, VERSION01, null, viewableVersions,
+ null);
+
+ versioningManager.undoCheckout(TYPE1, ID1, USR1);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testUndoCheckouOnFinalized() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION10);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Final, VERSION10, null, viewableVersions,
+ VERSION10);
+ versioningManager.undoCheckout(TYPE1, ID1, USR2);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testUndoCheckoutOnLockedOtherUser() {
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0,
+ new UserCandidateVersion(USR2, VERSION01), Collections.emptySet(), null);
+
+ versioningManager.undoCheckout(TYPE1, ID1, USR1);
+ }
+
+ @Test
+ public void testUndoCheckout() {
+ HashSet<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01,
+ new UserCandidateVersion(USR1, VERSION02), viewableVersions, null);
+
+ Version version = versioningManager.undoCheckout(TYPE1, ID1, USR1);
+ Assert.assertEquals(version, VERSION01);
+
+ VersionInfoEntity versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1));
+ assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, null, null,
+ VersionStatus.Available, viewableVersions, null);
+
+/* ResultSet results =
+ loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
+ VERSION02);
+ Assert.assertFalse(results.iterator().hasNext());*/
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCheckinNonExisting() {
+ versioningManager.checkin(TYPE1, ID1, USR1, "");
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCheckinOnAvailable() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Available, VERSION01, null, viewableVersions,
+ null);
+
+ versioningManager.checkin(TYPE1, ID1, USR1, "fail checkin");
+ }
+
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCheckinOnFinalized() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION10);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Final, VERSION10, null, viewableVersions,
+ VERSION10);
+
+ versioningManager.checkin(TYPE1, ID1, USR1, "failed checkin");
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testCheckinOnLockedOtherUser() {
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0,
+ new UserCandidateVersion(USR2, VERSION01), Collections.emptySet(), null);
+
+ versioningManager.checkin(TYPE1, ID1, USR1, "");
+ }
+
+ @Test
+ public void testCheckin() {
+ HashSet<Version> viewableVersions = new HashSet<>();
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0,
+ new UserCandidateVersion(USR1, VERSION01), viewableVersions, null);
+
+ Version version = versioningManager.checkin(TYPE1, ID1, USR1, "checkin 0.1");
+ Assert.assertEquals(version, VERSION01);
+
+ verify(versionInfoDaoMock).update(versionInfoEntityArg.capture());
+ VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue();
+
+ viewableVersions.add(VERSION01);
+ assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, null, null,
+ VersionStatus.Available, viewableVersions, null);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testSubmitNonExisting() {
+ versioningManager.submit(TYPE1, ID1, USR2, "failed submit");
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testSubmitOnLocked() {
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0,
+ new UserCandidateVersion(USR1, VERSION01), Collections.emptySet(), null);
+ versioningManager.submit(TYPE1, ID1, USR2, "failed submit");
+ }
+
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testSubmitOnFinalized() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION10);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Final, VERSION10, null, viewableVersions,
+ VERSION10);
+ versioningManager.submit(TYPE1, ID1, USR2, "failed submit");
+ }
+
+ @Test
+ public void testSubmit() {
+ Version version32 = new Version(3, 2);
+ Version version40 = new Version(4, 0);
+
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION10);
+ viewableVersions.add(new Version(2, 0));
+ viewableVersions.add(new Version(3, 0));
+ viewableVersions.add(new Version(3, 1));
+ viewableVersions.add(version32);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Available, version32, null, viewableVersions,
+ new Version(3, 0));
+
+ Version version = versioningManager.submit(TYPE1, ID1, USR1, "submit msg");
+ Assert.assertEquals(version, version40);
+ viewableVersions.remove(new Version(3, 1));
+ viewableVersions.remove(version32);
+ viewableVersions.add(version40);
+
+ verify(versionInfoDaoMock).update(versionInfoEntityArg.capture());
+ VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue();
+
+ assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, version40, null, null,
+ VersionStatus.Final, viewableVersions, version40);
+
+/* ResultSet results =
+ loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1,
+ VERSION10);
+ Assert.assertTrue(results.iterator().hasNext());*/
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testGetVersionInfoOnNonExistingEntity() {
+ versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read);
+ }
+
+ @Test
+ public void testGetVersionInfoForReadOnAvailable() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Available, VERSION01, null, viewableVersions,
+ null);
+
+ VersionInfo versionInfo =
+ versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read);
+ assertVersionInfo(versionInfo, VERSION01, VersionStatus.Available, null,
+ viewableVersions, null);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testGetVersionInfoForWriteOnAvailable() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Available, VERSION01, null, viewableVersions,
+ null);
+
+ versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Write);
+ }
+
+ @Test
+ public void testGetVersionInfoForReadOnLockedSameUser() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01,
+ new UserCandidateVersion(USR1, VERSION02), viewableVersions, null);
+
+ VersionInfo versionInfo =
+ versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read);
+ viewableVersions.add(VERSION02);
+ assertVersionInfo(versionInfo, VERSION02, VersionStatus.Locked, USR1, viewableVersions, null);
+ }
+
+ @Test
+ public void testGetVersionInfoForReadOnLockedOtherUser() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01,
+ new UserCandidateVersion(USR2, VERSION02), viewableVersions, null);
+
+ VersionInfo versionInfo =
+ versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read);
+ Assert.assertEquals(versionInfo.getActiveVersion(), VERSION01);
+ assertVersionInfo(versionInfo, VERSION01, VersionStatus.Locked, USR2, viewableVersions, null);
+ }
+
+ @Test(expectedExceptions = CoreException.class)
+ public void testGetVersionInfoForWriteOnLockedOtherUser() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01,
+ new UserCandidateVersion(USR2, VERSION02), viewableVersions, null);
+
+ versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Write);
+ }
+
+ @Test
+ public void testGetVersionInfoForWriteOnLockedSameUser() {
+ Set<Version> viewableVersions = new HashSet<>();
+ viewableVersions.add(VERSION01);
+ mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01,
+ new UserCandidateVersion(USR1, VERSION02), viewableVersions, null);
+
+ VersionInfo versionInfo =
+ versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Write);
+ viewableVersions.add(VERSION02);
+ assertVersionInfo(versionInfo, VERSION02, VersionStatus.Locked, USR1, viewableVersions, null);
+ }
+
+/* private void createVersionableEntityRecord(String tableName, String idName, String versionName,
+ String id, Version version) {
+ noSqlDb.execute(
+ String.format("insert into %s (%s,%s) values (?,?)", tableName, idName, versionName), id,
+ versionMapper.toUDT(version));
+ }
+
+ private ResultSet loadVersionableEntityRecord(String tableName, String idName, String versionName,
+ String id, Version version) {
+ return noSqlDb.execute(
+ String.format("select * from %s where %s=? and %s=?", tableName, idName, versionName), id,
+ versionMapper.toUDT(version));
+ }*/
+
+
+ private static void assretVersionInfoEntity(VersionInfoEntity actual, String entityType,
+ String entityId, Version activeVersion,
+ Version candidateVersion, String candidateUser,
+ VersionStatus status, Set<Version> viewbleVersions,
+ Version latestFinalVersion) {
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(actual.getEntityType(), entityType);
+ Assert.assertEquals(actual.getEntityId(), entityId);
+ Assert.assertEquals(actual.getActiveVersion(), activeVersion);
+ if (candidateVersion != null && candidateUser != null) {
+ Assert.assertEquals(actual.getCandidate().getVersion(), candidateVersion);
+ Assert.assertEquals(actual.getCandidate().getUser(), candidateUser);
+ } else {
+ Assert.assertNull(actual.getCandidate());
+ }
+ Assert.assertEquals(actual.getStatus(), status);
+ Assert.assertEquals(actual.getViewableVersions().size(), viewbleVersions.size());
+ Assert.assertEquals(actual.getViewableVersions(), viewbleVersions);
+ Assert.assertEquals(actual.getLatestFinalVersion(), latestFinalVersion);
+ }
+
+ private static void assertVersionInfo(VersionInfo actual, Version activeVersion,
+ VersionStatus status, String lockingUser,
+ Set<Version> viewableVersions, Version latestFinalVersion) {
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(actual.getActiveVersion(), activeVersion);
+ Assert.assertEquals(actual.getStatus(), status);
+ Assert.assertEquals(actual.getLockingUser(), lockingUser);
+ Assert.assertEquals(actual.getViewableVersions().size(), viewableVersions.size());
+ Assert.assertEquals(actual.getViewableVersions(), viewableVersions);
+ Assert.assertEquals(actual.getLatestFinalVersion(), latestFinalVersion);
+ }
+
+ private VersionInfoEntity mockVersionInfoEntity(String entityType, String entityId,
+ VersionStatus status, Version activeVersion,
+ UserCandidateVersion candidate,
+ Set<Version> viewableVersions,
+ Version latestFinalVersion) {
+ VersionInfoEntity mock = new VersionInfoEntity();
+ mock.setEntityType(entityType);
+ mock.setEntityId(entityId);
+ mock.setStatus(status);
+ mock.setActiveVersion(activeVersion);
+ mock.setCandidate(candidate);
+ mock.setViewableVersions(viewableVersions);
+ mock.setLatestFinalVersion(latestFinalVersion);
+
+ doReturn(mock).when(versionInfoDaoMock).get(anyObject());
+ return mock;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/resources/logback.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/resources/logback.xml
new file mode 100644
index 0000000000..c1932e31e8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/resources/logback.xml
@@ -0,0 +1,15 @@
+<configuration>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml
index 94b2729130..32c8207247 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml
@@ -1,17 +1,19 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
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-sdc-versioning-lib</name>
+ <artifactId>openecomp-sdc-versioning-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-sdc-versioning-lib</artifactId>
- <packaging>pom</packaging>
- <name>openecomp-sdc-versioning-lib</name>
-
<modules>
<module>openecomp-sdc-versioning-api</module>
<module>openecomp-sdc-versioning-core</module>
@@ -20,4 +22,4 @@
<dependencies>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..7804ebfabc
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup
@@ -0,0 +1,24 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ 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-sdc-versioning-lib</name>
+ <artifactId>openecomp-sdc-versioning-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-sdc-versioning-api</module>
+ <module>openecomp-sdc-versioning-core</module>
+ </modules>
+
+ <dependencies>
+
+ </dependencies>
+</project> \ No newline at end of file