summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-25 15:05:31 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-25 14:24:44 +0000
commit05c625fb9c3673d6c60511958f7e051257247c2b (patch)
tree28df153c7f9bdfd5b5682a6ff4cbeced23f30d3c /openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src
parent22f1220c2dda43e3dcbadd70180db521a7984d1d (diff)
Refactor list revisions api
Remove zusammen-api dependency in versioning-api, enhance version zusammen dao impl UT. Issue-ID: SDC-779 Change-Id: Ic792462eac52f1f5129f92ce80d3deb641c90916 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src')
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java33
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/TestUtil.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java252
3 files changed, 245 insertions, 54 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
index 195973bf5c..32c17dbfce 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
@@ -7,6 +7,7 @@ import com.amdocs.zusammen.datatypes.item.ItemVersion;
import com.amdocs.zusammen.datatypes.item.ItemVersionData;
import com.amdocs.zusammen.datatypes.item.ItemVersionStatus;
import com.amdocs.zusammen.datatypes.item.SynchronizationStatus;
+import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -18,6 +19,7 @@ import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionState;
+import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -110,18 +112,27 @@ public class VersionZusammenDaoImpl implements VersionDao {
@Override
public void revert(String itemId, Version version, String revisionId) {
- zusammenAdaptor.revert(createSessionContext(), itemId, version.getId(), revisionId);
+ zusammenAdaptor.revert(createSessionContext(), new Id(itemId), new Id(version.getId()),
+ new Id(revisionId));
}
@Override
public List<Revision> listRevisions(String itemId, Version version) {
- return zusammenAdaptor.listRevisions(createSessionContext(), itemId, version.getId());
+ ItemVersionRevisions itemVersionRevisions = zusammenAdaptor
+ .listRevisions(createSessionContext(), new Id(itemId), new Id(version.getId()));
+
+ return itemVersionRevisions == null || itemVersionRevisions.getItemVersionRevisions() == null ||
+ itemVersionRevisions.getItemVersionRevisions().isEmpty()
+ ? new ArrayList<>()
+ : itemVersionRevisions.getItemVersionRevisions().stream()
+ .map(this::convertRevision)
+ .sorted(this::compareRevisionsTime)
+ .collect(Collectors.toList());
}
private void updateVersionStatus(SessionContext context, Id itemId, Id versionId,
VersionState versionState, ItemVersion itemVersion) {
- if (versionState.getSynchronizationState() != SynchronizationState.UpToDate ||
- versionState.isDirty()) {
+ if (versionState.getSynchronizationState() != SynchronizationState.UpToDate) {
String versionStatus = zusammenAdaptor.getPublicVersion(context, itemId, versionId)
.getData().getInfo().getProperty(ZusammenProperty.STATUS);
itemVersion.getData().getInfo().addProperty(ZusammenProperty.STATUS, versionStatus);
@@ -162,4 +173,18 @@ public class VersionZusammenDaoImpl implements VersionDao {
.withMessage("Version state is unknown").build());
}
}
+
+ private Revision convertRevision(
+ com.amdocs.zusammen.datatypes.itemversion.Revision zusammenRevision) {
+ Revision revision = new Revision();
+ revision.setId(zusammenRevision.getRevisionId().getValue());
+ revision.setTime(zusammenRevision.getTime());
+ revision.setUser(zusammenRevision.getUser());
+ revision.setMessage(zusammenRevision.getMessage());
+ return revision;
+ }
+
+ private int compareRevisionsTime(Revision revision1, Revision revision2) {
+ return revision1.getTime().before(revision2.getTime()) ? 1 : -1;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/TestUtil.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/TestUtil.java
new file mode 100644
index 0000000000..232ded05b1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/TestUtil.java
@@ -0,0 +1,14 @@
+package org.openecomp.sdc.versioning.dao.impl.zusammen;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.UserInfo;
+
+public class TestUtil {
+
+ public static SessionContext createZusammenContext(String user) {
+ SessionContext sessionContext = new SessionContext();
+ sessionContext.setUser(new UserInfo(user));
+ sessionContext.setTenant("dox");
+ return sessionContext;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java
index 1f1efdf6cb..76e1fe56b6 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java
@@ -2,35 +2,37 @@ package org.openecomp.sdc.versioning.dao.impl.zusammen;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.UserInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.ItemVersion;
import com.amdocs.zusammen.datatypes.item.ItemVersionData;
import com.amdocs.zusammen.datatypes.item.ItemVersionStatus;
import com.amdocs.zusammen.datatypes.item.SynchronizationStatus;
+import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.common.session.SessionContextProviderFactory;
+import org.openecomp.sdc.versioning.dao.types.Revision;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
+import static org.openecomp.sdc.versioning.dao.impl.zusammen.TestUtil.createZusammenContext;
public class VersionZusammenDaoImplTest {
@@ -47,6 +49,18 @@ public class VersionZusammenDaoImplTest {
}
@Test
+ public void testListWhenNone() throws Exception {
+ String itemId = "itemId";
+
+ doReturn(new ArrayList<>()).when(zusammenAdaptorMock)
+ .listPublicVersions(eq(createZusammenContext(USER)), eq(new Id(itemId)));
+
+ List<Version> versions = versionDao.list(itemId);
+
+ Assert.assertTrue(versions.isEmpty());
+ }
+
+ @Test
public void testList() throws Exception {
String itemId = "itemId";
Id versionId1 = new Id("v1_id");
@@ -55,12 +69,12 @@ public class VersionZusammenDaoImplTest {
List<ItemVersion> zusammenVersions = Stream.of(
createZusammenVersion(versionId1, null, "version desc", "1.0", VersionStatus.Certified),
- createZusammenVersion(versionId2, versionId1, "version desc", "2.0", VersionStatus.Certified
- ),
+ createZusammenVersion(versionId2, versionId1, "version desc", "2.0",
+ VersionStatus.Certified),
createZusammenVersion(versionId3, versionId2, "version desc", "3.0", VersionStatus.Draft))
.collect(Collectors.toList());
doReturn(zusammenVersions).when(zusammenAdaptorMock)
- .listPublicVersions(eq(createZusammenContext()), eq(new Id(itemId)));
+ .listPublicVersions(eq(createZusammenContext(USER)), eq(new Id(itemId)));
List<Version> versions = versionDao.list(itemId);
Assert.assertEquals(versions.size(), 3);
@@ -72,7 +86,7 @@ public class VersionZusammenDaoImplTest {
: versionId2.getValue().equals(version.getId())
? 1
: 2;
- assetVersionEquals(version, zusammenVersions.get(zusammenVersionIndex));
+ assetVersionEquals(version, zusammenVersions.get(zusammenVersionIndex), null);
}
}
@@ -94,20 +108,20 @@ public class VersionZusammenDaoImplTest {
version.setDescription("version description");
version.setStatus(VersionStatus.Draft);
- doReturn(new Id("versionId")).when(zusammenAdaptorMock)
- .createVersion(eq(createZusammenContext()), eq(new Id(itemId)),
- baseId == null ? isNull(Id.class) : eq(new Id(baseId)), any(ItemVersionData.class));
-
ArgumentCaptor<ItemVersionData> capturedZusammenVersion =
ArgumentCaptor.forClass(ItemVersionData.class);
- versionDao.create(itemId, version);
-
- verify(zusammenAdaptorMock)
- .createVersion(eq(createZusammenContext()), eq(new Id(itemId)),
+ String versionId = "versionId";
+ doReturn(new Id(versionId)).when(zusammenAdaptorMock)
+ .createVersion(eq(createZusammenContext(USER)), eq(new Id(itemId)),
baseId == null ? isNull(Id.class) : eq(new Id(baseId)),
capturedZusammenVersion.capture());
+
+ versionDao.create(itemId, version);
+
+ Assert.assertEquals(version.getId(), versionId);
+
Info capturedInfo = capturedZusammenVersion.getValue().getInfo();
Assert.assertEquals(capturedInfo.getName(), version.getName());
Assert.assertEquals(capturedInfo.getDescription(), version.getDescription());
@@ -134,8 +148,8 @@ public class VersionZusammenDaoImplTest {
versionDao.update(itemId, version);
verify(zusammenAdaptorMock)
- .updateVersion(eq(createZusammenContext()), eq(new Id(itemId)), eq(new Id(version.getId())),
- capturedZusammenVersion.capture());
+ .updateVersion(eq(createZusammenContext(USER)), eq(new Id(itemId)),
+ eq(new Id(version.getId())), capturedZusammenVersion.capture());
Info capturedInfo = capturedZusammenVersion.getValue().getInfo();
Assert.assertEquals(capturedInfo.getName(), version.getName());
@@ -155,11 +169,11 @@ public class VersionZusammenDaoImplTest {
}
@Test
- public void testGet() throws Exception {
+ public void testGetSynced() throws Exception {
String itemId = "itemId";
String versionId = "versionId";
- SessionContext zusammenContext = createZusammenContext();
+ SessionContext zusammenContext = createZusammenContext(USER);
Id itemIdObj = new Id(itemId);
Id versionIdObj = new Id(versionId);
@@ -169,13 +183,41 @@ public class VersionZusammenDaoImplTest {
doReturn(zusammenPrivateVersion).when(zusammenAdaptorMock)
.getVersion(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
- doReturn(new ItemVersionStatus(SynchronizationStatus.UP_TO_DATE, true))
- .when(zusammenAdaptorMock)
+ ItemVersionStatus zusammenVersionStatus =
+ new ItemVersionStatus(SynchronizationStatus.UP_TO_DATE, true);
+ doReturn(zusammenVersionStatus).when(zusammenAdaptorMock)
.getVersionStatus(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
+ Optional<Version> version = versionDao.get(itemId, new Version(versionId));
+
+ Assert.assertTrue(version.isPresent());
+ assetVersionEquals(version.get(), zusammenPrivateVersion, zusammenVersionStatus);
+ }
+
+ @Test
+ public void testGetOutOfSync() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
+
+ SessionContext zusammenContext = createZusammenContext(USER);
+ Id itemIdObj = new Id(itemId);
+ Id versionIdObj = new Id(versionId);
+
+ ItemVersion zusammenPrivateVersion =
+ createZusammenVersion(versionIdObj, new Id("baseId"), "version desc updated", "2.0",
+ VersionStatus.Draft);
+ doReturn(zusammenPrivateVersion).when(zusammenAdaptorMock)
+ .getVersion(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
+
+ ItemVersionStatus zusammenVersionStatus =
+ new ItemVersionStatus(SynchronizationStatus.OUT_OF_SYNC, true);
+ doReturn(zusammenVersionStatus).when(zusammenAdaptorMock)
+ .getVersionStatus(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
+
+ VersionStatus statusOnPublic = VersionStatus.Certified;
ItemVersion zusammenPublicVersion =
createZusammenVersion(versionIdObj, new Id("baseId"), "version desc", "2.0",
- VersionStatus.Certified);
+ statusOnPublic);
doReturn(zusammenPublicVersion).when(zusammenAdaptorMock)
.getPublicVersion(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
@@ -183,58 +225,129 @@ public class VersionZusammenDaoImplTest {
Assert.assertTrue(version.isPresent());
zusammenPrivateVersion.getData().getInfo()
- .addProperty(VersionZusammenDaoImpl.ZusammenProperty.STATUS,
- VersionStatus.Certified.name());
- assetVersionEquals(version.get(), zusammenPrivateVersion);
+ .addProperty(VersionZusammenDaoImpl.ZusammenProperty.STATUS, statusOnPublic.name());
+ assetVersionEquals(version.get(), zusammenPrivateVersion, zusammenVersionStatus);
}
- // TODO: 12/20/2017 complete tests
- /* @Test
- public void testDelete() throws Exception {
+ @Test
+ public void testGetMerging() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
+
+ SessionContext zusammenContext = createZusammenContext(USER);
+ Id itemIdObj = new Id(itemId);
+ Id versionIdObj = new Id(versionId);
+
+ ItemVersion zusammenPrivateVersion =
+ createZusammenVersion(versionIdObj, new Id("baseId"), "version desc", "2.0",
+ VersionStatus.Draft);
+ doReturn(zusammenPrivateVersion).when(zusammenAdaptorMock)
+ .getVersion(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
+
+ ItemVersionStatus zusammenVersionStatus =
+ new ItemVersionStatus(SynchronizationStatus.MERGING, true);
+ doReturn(zusammenVersionStatus).when(zusammenAdaptorMock)
+ .getVersionStatus(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
+ ItemVersion zusammenPublicVersion =
+ createZusammenVersion(versionIdObj, new Id("baseId"), "version desc", "2.0",
+ VersionStatus.Draft);
+ doReturn(zusammenPublicVersion).when(zusammenAdaptorMock)
+ .getPublicVersion(eq(zusammenContext), eq(itemIdObj), eq(versionIdObj));
+
+ Optional<Version> version = versionDao.get(itemId, new Version(versionId));
+
+ Assert.assertTrue(version.isPresent());
+ assetVersionEquals(version.get(), zusammenPrivateVersion, zusammenVersionStatus);
}
@Test
public void testPublish() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
+ String message = "publish message";
+
+ versionDao.publish(itemId, new Version(versionId), message);
+ verify(zusammenAdaptorMock)
+ .publishVersion(eq(createZusammenContext(USER)), eq(new Id(itemId)), eq(new Id(versionId)),
+ eq(message));
}
@Test
public void testSync() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
+
+ versionDao.sync(itemId, new Version(versionId));
+ verify(zusammenAdaptorMock)
+ .syncVersion(eq(createZusammenContext(USER)), eq(new Id(itemId)), eq(new Id(versionId)));
}
@Test
public void testForceSync() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
+
+ versionDao.forceSync(itemId, new Version(versionId));
+ verify(zusammenAdaptorMock)
+ .forceSyncVersion(eq(createZusammenContext(USER)), eq(new Id(itemId)),
+ eq(new Id(versionId)));
}
@Test
public void testRevert() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
+ String revisionId = "revisionId";
+
+ versionDao.revert(itemId, new Version(versionId), revisionId);
+ verify(zusammenAdaptorMock)
+ .revert(eq(createZusammenContext(USER)), eq(new Id(itemId)), eq(new Id(versionId)),
+ eq(new Id(revisionId)));
}
@Test
- public void testListRevisions() throws Exception {
+ public void testListRevisionsWhenNone() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
- }*/
+ List<Revision> revisions = versionDao.listRevisions(itemId, new Version(versionId));
- private void assetVersionEquals(Version version, ItemVersion zusammenVersion) {
- Assert.assertEquals(version.getId(), zusammenVersion.getId().getValue());
- Assert.assertEquals(version.getBaseId(),
- zusammenVersion.getBaseId() == null ? null : zusammenVersion.getBaseId().getValue());
- Info info = zusammenVersion.getData().getInfo();
- Assert.assertEquals(version.getName(), info.getName());
- Assert.assertEquals(version.getDescription(), info.getDescription());
- Assert.assertEquals(version.getStatus(),
- VersionStatus.valueOf(info.getProperty(VersionZusammenDaoImpl.ZusammenProperty.STATUS)));
- String label = info.getProperty(VersionZusammenDaoImpl.ZusammenProperty.LABEL).toString();
- Assert
- .assertEquals(version.getMajor(), Integer.parseInt(label.substring(0, label.indexOf('.'))));
- Assert.assertEquals(version.getMinor(),
- Integer.parseInt(label.substring(label.indexOf('.') + 1, label.length())));
- Assert.assertEquals(version.getCreationTime(), zusammenVersion.getCreationTime());
- Assert.assertEquals(version.getModificationTime(), zusammenVersion.getModificationTime());
+ Assert.assertTrue(revisions.isEmpty());
+ }
+
+ @Test
+ public void testListRevisions() throws Exception {
+ String itemId = "itemId";
+ String versionId = "versionId";
+
+ long currentTime = System.currentTimeMillis();
+ Date rev4time = new Date(currentTime); // latest
+ Date rev3time = new Date(currentTime - 1);
+ Date rev2time = new Date(currentTime - 2);
+ Date rev1time = new Date(currentTime - 3); // oldest
+ List<com.amdocs.zusammen.datatypes.itemversion.Revision> zusammenRevisions = Stream.of(
+ createZusammenRevision("rev4", "forth rev", "user1", rev4time),
+ createZusammenRevision("rev1", "first rev", "user2", rev1time),
+ createZusammenRevision("rev3", "third rev", "user2", rev3time),
+ createZusammenRevision("rev2", "second rev", "user1", rev2time))
+ .collect(Collectors.toList());
+ ItemVersionRevisions toBeReturned = new ItemVersionRevisions();
+ toBeReturned.setItemVersionRevisions(zusammenRevisions);
+ doReturn(toBeReturned).when(zusammenAdaptorMock)
+ .listRevisions(eq(createZusammenContext(USER)), eq(new Id(itemId)), eq(new Id(versionId)));
+
+ List<Revision> revisions = versionDao.listRevisions(itemId, new Version(versionId));
+
+ Assert.assertEquals(revisions.size(), 4);
+ assertRevisionEquals(revisions.get(0), zusammenRevisions.get(0)); // rev4 - latest
+ assertRevisionEquals(revisions.get(1), zusammenRevisions.get(2)); // rev3
+ assertRevisionEquals(revisions.get(2), zusammenRevisions.get(3)); // rev2
+ assertRevisionEquals(revisions.get(3), zusammenRevisions.get(1)); // rev1 - oldest
}
private ItemVersion createZusammenVersion(Id id, Id baseId, String description, String label,
@@ -255,11 +368,50 @@ public class VersionZusammenDaoImplTest {
return version;
}
- private SessionContext createZusammenContext() {
- SessionContext sessionContext = new SessionContext();
- sessionContext.setUser(new UserInfo(USER));
- sessionContext.setTenant("dox");
- return sessionContext;
+ private void assetVersionEquals(Version version, ItemVersion zusammenVersion,
+ ItemVersionStatus zusammenVersionStatus) {
+ Assert.assertEquals(version.getId(), zusammenVersion.getId().getValue());
+ Assert.assertEquals(version.getBaseId(),
+ zusammenVersion.getBaseId() == null ? null : zusammenVersion.getBaseId().getValue());
+ Info info = zusammenVersion.getData().getInfo();
+ Assert.assertEquals(version.getName(), info.getName());
+ Assert.assertEquals(version.getDescription(), info.getDescription());
+ Assert.assertEquals(version.getStatus(),
+ VersionStatus.valueOf(info.getProperty(VersionZusammenDaoImpl.ZusammenProperty.STATUS)));
+ String label = info.getProperty(VersionZusammenDaoImpl.ZusammenProperty.LABEL).toString();
+ Assert
+ .assertEquals(version.getMajor(), Integer.parseInt(label.substring(0, label.indexOf('.'))));
+ Assert.assertEquals(version.getMinor(),
+ Integer.parseInt(label.substring(label.indexOf('.') + 1, label.length())));
+ Assert.assertEquals(version.getCreationTime(), zusammenVersion.getCreationTime());
+ Assert.assertEquals(version.getModificationTime(), zusammenVersion.getModificationTime());
+
+ if (zusammenVersionStatus != null) {
+ Assert.assertEquals(version.getState().isDirty(), zusammenVersionStatus.isDirty());
+ Assert.assertEquals(version.getState().getSynchronizationState().toString(),
+ zusammenVersionStatus.getSynchronizationStatus().toString());
+ }
+ }
+
+ private com.amdocs.zusammen.datatypes.itemversion.Revision createZusammenRevision(String id,
+ String message,
+ String user,
+ Date time) {
+ com.amdocs.zusammen.datatypes.itemversion.Revision revision = new com.amdocs.zusammen
+ .datatypes.itemversion.Revision();
+ revision.setRevisionId(new Id(id));
+ revision.setMessage(message);
+ revision.setUser(user);
+ revision.setTime(time);
+ return revision;
}
+ private void assertRevisionEquals(
+ Revision revision,
+ com.amdocs.zusammen.datatypes.itemversion.Revision zusammenRevision) {
+ Assert.assertEquals(revision.getId(), zusammenRevision.getRevisionId().getValue());
+ Assert.assertEquals(revision.getMessage(), zusammenRevision.getMessage());
+ Assert.assertEquals(revision.getUser(), zusammenRevision.getUser());
+ Assert.assertEquals(revision.getTime(), zusammenRevision.getTime());
+ }
} \ No newline at end of file