summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2018-10-10 10:58:39 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-10-10 09:24:45 +0000
commit1eda33de6c88b9c1d6259e74b50c55ab1bb9357a (patch)
tree13ba8ee7905d3eca067fef9616afa2e2ce77b92f /openecomp-be/lib/openecomp-sdc-versioning-lib
parent30bcbe8f02ea5fec868d0986c0b5185f8af7a5c7 (diff)
Increased UT coverage -versioning-api-types
Increased UT coverage openecomp-sdc-versioning-api-types Change-Id: I28098e79848315076e75777e957a5dfe6f1eb481 Issue-ID: SDC-1673 Signed-off-by: mojahidi <mojahidul.islam@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/src/main/java/org/openecomp/sdc/versioning/types/Item.java101
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java52
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java43
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionInfoDaoImplStub.java51
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionableEntityImplStub.java53
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersioningUtilTest.java159
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/types/ItemTest.java56
8 files changed, 354 insertions, 188 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
index 161c22c389..154bc40dad 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
@@ -1,5 +1,24 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
package org.openecomp.sdc.versioning.types;
+import lombok.Getter;
+import lombok.Setter;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import java.util.Date;
@@ -7,6 +26,8 @@ import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
+@Getter
+@Setter
public class Item {
private String id;
private String type;
@@ -19,74 +40,10 @@ public class Item {
private Date creationTime;
private Date modificationTime;
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- public ItemStatus getStatus() {
- return status;
- }
-
- public void setStatus(ItemStatus status) {
- this.status = status;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
public void addProperty(String key, Object value) {
properties.put(key, value);
}
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
- public Map<VersionStatus, Integer> getVersionStatusCounters() {
- return versionStatusCounters;
- }
-
- public void setVersionStatusCounters(Map<VersionStatus, Integer> versionStatusCounters) {
- this.versionStatusCounters = versionStatusCounters;
- }
-
public void addVersionStatus(VersionStatus versionStatus) {
Integer counter = versionStatusCounters.get(versionStatus);
versionStatusCounters
@@ -103,20 +60,4 @@ public class Item {
}
}
}
-
- public Date getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Date creationTime) {
- this.creationTime = creationTime;
- }
-
- public Date getModificationTime() {
- return modificationTime;
- }
-
- public void setModificationTime(Date modificationTime) {
- this.modificationTime = modificationTime;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java
index 21d42299fa..e12a42e2c4 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java
@@ -20,30 +20,15 @@
package org.openecomp.sdc.versioning.types;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
import java.util.List;
+@Getter
+@Setter
+@AllArgsConstructor
public class UniqueValueMetadata {
private String type;
private List<String> uniqueConstraintIdentifiers;
-
- public UniqueValueMetadata(String type, List<String> contextIdentifierNames) {
- this.type = type;
- this.uniqueConstraintIdentifiers = contextIdentifierNames;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public List<String> getUniqueConstraintIdentifiers() {
- return uniqueConstraintIdentifiers;
- }
-
- public void setUniqueConstraintIdentifiers(List<String> uniqueConstraintIdentifiers) {
- this.uniqueConstraintIdentifiers = uniqueConstraintIdentifiers;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java
index 02b5aaa3bd..a56c73d356 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java
@@ -20,12 +20,16 @@
package org.openecomp.sdc.versioning.types;
+import lombok.Getter;
+import lombok.Setter;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import java.util.ArrayList;
import java.util.List;
+@Getter
+@Setter
public class VersionInfo {
private Version activeVersion;
private Version latestFinalVersion;
@@ -34,54 +38,6 @@ public class VersionInfo {
private VersionStatus status;
private String lockingUser;
- public Version getActiveVersion() {
- return activeVersion;
- }
-
- public void setActiveVersion(Version activeVersion) {
- this.activeVersion = activeVersion;
- }
-
- public Version getLatestFinalVersion() {
- return latestFinalVersion;
- }
-
- public void setLatestFinalVersion(Version latestFinalVersion) {
- this.latestFinalVersion = latestFinalVersion;
- }
-
- public List<Version> getViewableVersions() {
- return viewableVersions;
- }
-
- public void setViewableVersions(List<Version> viewableVersions) {
- this.viewableVersions = viewableVersions;
- }
-
- public List<Version> getFinalVersions() {
- return finalVersions;
- }
-
- public void setFinalVersions(List<Version> finalVersions) {
- this.finalVersions = finalVersions;
- }
-
- public VersionStatus getStatus() {
- return status;
- }
-
- public void setStatus(VersionStatus status) {
- this.status = status;
- }
-
- public String getLockingUser() {
- return lockingUser;
- }
-
- public void setLockingUser(String lockingUser) {
- this.lockingUser = lockingUser;
- }
-
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("VersionInfo{");
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 8ec54c9980..fcc02afd52 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
@@ -20,9 +20,13 @@
package org.openecomp.sdc.versioning.types;
+import lombok.Getter;
+import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
+@Getter
+@Setter
public class VersionableEntityMetadata {
private VersionableEntityStoreType storeType;
@@ -44,43 +48,4 @@ public class VersionableEntityMetadata {
this.versionIdentifierName = versionIdentifierName;
}
- public VersionableEntityStoreType getStoreType() {
- return storeType;
- }
-
- public void setStoreType(VersionableEntityStoreType storeType) {
- this.storeType = storeType;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getIdentifierName() {
- return identifierName;
- }
-
- public void setIdentifierName(String idColumnName) {
- this.identifierName = idColumnName;
- }
-
- public String getVersionIdentifierName() {
- return versionIdentifierName;
- }
-
- public void setVersionIdentifierName(String versionColumnName) {
- this.versionIdentifierName = versionColumnName;
- }
-
- public List<UniqueValueMetadata> getUniqueValuesMetadata() {
- return uniqueValuesMetadata;
- }
-
- public void setUniqueValuesMetadata(List<UniqueValueMetadata> uniqueValuesMetadata) {
- this.uniqueValuesMetadata = uniqueValuesMetadata;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionInfoDaoImplStub.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionInfoDaoImplStub.java
new file mode 100644
index 0000000000..d5799b11fe
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionInfoDaoImplStub.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.openecomp.sdc.versioning;
+
+import org.openecomp.core.dao.BaseDao;
+
+import java.util.Collection;
+
+public class VersionInfoDaoImplStub implements BaseDao<VersionableEntityImplStub> {
+
+ @Override
+ public Collection<VersionableEntityImplStub> list(VersionableEntityImplStub entity) {
+ return null;
+ }
+
+ @Override
+ public void create(VersionableEntityImplStub entity) {
+
+ }
+
+ @Override
+ public void update(VersionableEntityImplStub entity) {
+
+ }
+
+ @Override
+ public VersionableEntityImplStub get(VersionableEntityImplStub entity) {
+ return null;
+ }
+
+ @Override
+ public void delete(VersionableEntityImplStub entity) {
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionableEntityImplStub.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionableEntityImplStub.java
new file mode 100644
index 0000000000..4c429be1b2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersionableEntityImplStub.java
@@ -0,0 +1,53 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.openecomp.sdc.versioning;
+
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
+
+public class VersionableEntityImplStub implements VersionableEntity {
+ @Override
+ public String getEntityType() {
+ return "entityType";
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return "firstClassCitizenId";
+ }
+
+ @Override
+ public String getId() {
+ return "id";
+ }
+
+ @Override
+ public void setId(String id) {
+ }
+
+ @Override
+ public Version getVersion() {
+ return new Version();
+ }
+
+ @Override
+ public void setVersion(Version version) {
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersioningUtilTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersioningUtilTest.java
new file mode 100644
index 0000000000..7448100792
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/VersioningUtilTest.java
@@ -0,0 +1,159 @@
+
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.openecomp.sdc.versioning;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionInfo;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class VersioningUtilTest {
+
+ @Test
+ public void testResolveVersion() {
+ Version version = new Version();
+ version.setMajor(1);
+ version.setMinor(1);
+
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setActiveVersion(version);
+ versionInfo.setViewableVersions(Arrays.asList(version));
+ versionInfo.setLockingUser("user");
+ Version resolveVersion = VersioningUtil.resolveVersion(version, versionInfo, "user");
+ Assert.assertNotNull(resolveVersion);
+ Assert.assertEquals(1,resolveVersion.getMajor());
+ Assert.assertEquals(1,resolveVersion.getMinor());
+
+ }
+
+ @Test(expected = CoreException.class)
+ public void testResolveVersionNegative() {
+ Version version = new Version();
+ version.setMajor(1);
+ version.setMinor(1);
+
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setActiveVersion(version);
+ versionInfo.setViewableVersions(Arrays.asList(new Version()));
+ versionInfo.setLockingUser("user");
+ VersioningUtil.resolveVersion(null, versionInfo, "user");
+
+ }
+
+ @Test
+ public void testResolveVersionFinalOnly() {
+ Version version = new Version();
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setActiveVersion(version);
+ versionInfo.setViewableVersions(Arrays.asList(version));
+ versionInfo.setLatestFinalVersion(version);
+ Assert.assertNotNull(VersioningUtil.resolveVersion(null, versionInfo, true));
+
+ }
+
+ @Test(expected = CoreException.class)
+ public void testResolveVersionWithNonFinalVersions() {
+ Version version = new Version();
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setActiveVersion(version);
+ versionInfo.setViewableVersions(Arrays.asList(new Version()));
+ versionInfo.setLatestFinalVersion(version);
+ VersioningUtil.resolveVersion(version, versionInfo,true);
+ }
+
+ @Test
+ public void testResolveVersionWithoutFinal() {
+ Version version = new Version();
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setActiveVersion(version);
+ versionInfo.setViewableVersions(Arrays.asList(version));
+ Assert.assertNotNull(VersioningUtil.resolveVersion(null, versionInfo, false));
+
+ }
+
+ @Test(expected = CoreException.class)
+ public void testResolveVersionWithoutFinalVersion() {
+ Version version = new Version();
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setActiveVersion(version);
+ versionInfo.setViewableVersions(Arrays.asList(version));
+ VersioningUtil.resolveVersion(null, versionInfo, true);
+
+ }
+
+ @Test(expected = CoreException.class)
+ public void testResolveVersionFinalOnlyNegative() {
+ Version version = new Version();
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setActiveVersion(version);
+ versionInfo.setViewableVersions(Arrays.asList(version));
+ versionInfo.setLatestFinalVersion(version);
+ VersioningUtil.resolveVersion(version, versionInfo, true);
+
+ }
+
+ @Test(expected = CoreException.class)
+ public void testValidateEntityExistence() {
+ VersioningUtil.validateEntityExistence(null, new VersionableEntityImplStub(), "firstClassCitizenType");
+ }
+
+ @Test(expected = CoreException.class)
+ public void testValidateEntitiesExistence() {
+ Set<String> entityIds = new HashSet<>();
+ entityIds.add("id1");
+ entityIds.add("id2");
+ VersioningUtil.validateEntitiesExistence(entityIds, new VersionableEntityImplStub(),
+ new VersionInfoDaoImplStub(),"firstClassCitizenType");
+ }
+
+ @Test(expected = CoreException.class)
+ public void testValidateEntitiesExistenceSizeOne() {
+ Set<String> entityIds = new HashSet<>();
+ entityIds.add("id1");
+ VersioningUtil.validateEntitiesExistence(entityIds, new VersionableEntityImplStub(),
+ new VersionInfoDaoImplStub(),"firstClassCitizenType");
+ }
+
+ @Test(expected = CoreException.class)
+ public void testValidateContainedEntitiesExistence() {
+ Set<String> inputContainedEntityIds = new HashSet<>();
+ inputContainedEntityIds.add("id1");
+ inputContainedEntityIds.add("id2");
+ Set<String> retrievedContainedEntityIds = new HashSet<>();
+ VersioningUtil.validateContainedEntitiesExistence("containedEntityType",
+ inputContainedEntityIds, new VersionableEntityImplStub(), retrievedContainedEntityIds);
+ }
+
+ @Test(expected = CoreException.class)
+ public void testValidateContainedEntitiesExistenceWithIdOne() {
+ Set<String> inputContainedEntityIds = new HashSet<>();
+ inputContainedEntityIds.add("id1");
+ inputContainedEntityIds.add("id2");
+ Set<String> retrievedContainedEntityIds = new HashSet<>();
+ retrievedContainedEntityIds.add("id1");
+ VersioningUtil.validateContainedEntitiesExistence("containedEntityType",
+ inputContainedEntityIds, new VersionableEntityImplStub(), retrievedContainedEntityIds);
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/types/ItemTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/types/ItemTest.java
new file mode 100644
index 0000000000..f69cfcce59
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/types/ItemTest.java
@@ -0,0 +1,56 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.openecomp.sdc.versioning.types;
+
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ItemTest {
+
+ @Test
+ public void testAddVersionStatus() {
+ Item item = new Item();
+ item.addVersionStatus(VersionStatus.Draft);
+ Assert.assertEquals(1, item.getVersionStatusCounters().size());
+ }
+
+ @Test
+ public void testAddProperty() {
+ Item item = new Item();
+ item.setProperties(new HashMap<>());
+ item.addProperty("item1", new Object());
+ Assert.assertEquals(1, item.getProperties().size());
+ }
+ @Test
+ public void testRemoveVersionStatus() {
+ Item item = new Item();
+ Map<VersionStatus, Integer> versionStatusCounters = new EnumMap<>(VersionStatus.class);
+ versionStatusCounters.put(VersionStatus.Draft, 1);
+ item.setVersionStatusCounters(versionStatusCounters);
+ item.removeVersionStatus(VersionStatus.Draft);
+ Assert.assertEquals(0, item.getVersionStatusCounters().size());
+ }
+
+} \ No newline at end of file