summaryrefslogtreecommitdiffstats
path: root/zusammen-lib/src
diff options
context:
space:
mode:
authorshrek2000 <oren.kleks@amdocs.com>2019-12-03 08:40:41 +0200
committershrek2000 <oren.kleks@amdocs.com>2019-12-03 10:43:27 +0200
commiteecd1059188582486cfd39cce2c047dc43b5f8aa (patch)
treed644f55cb8e523ad397bc80392fc2453a230b689 /zusammen-lib/src
parent7dd851e1bd56b2e89d3d83763a5646682ede859c (diff)
Increase code coverage
test ZusammenConnector Issue-ID: SDC-2690 Signed-off-by: shrek2000 <oren.kleks@amdocs.com> Change-Id: I301f7718c09491c34207908819370193b2c74b01 Signed-off-by: shrek2000 <oren.kleks@amdocs.com>
Diffstat (limited to 'zusammen-lib/src')
-rw-r--r--zusammen-lib/src/test/java/org/onap/sdc/common/zusammen/persistence/ZusammenConnectorTest.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/zusammen-lib/src/test/java/org/onap/sdc/common/zusammen/persistence/ZusammenConnectorTest.java b/zusammen-lib/src/test/java/org/onap/sdc/common/zusammen/persistence/ZusammenConnectorTest.java
index ff5ac54..b65cdc9 100644
--- a/zusammen-lib/src/test/java/org/onap/sdc/common/zusammen/persistence/ZusammenConnectorTest.java
+++ b/zusammen-lib/src/test/java/org/onap/sdc/common/zusammen/persistence/ZusammenConnectorTest.java
@@ -43,6 +43,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 com.amdocs.zusammen.datatypes.itemversion.Tag;
import com.amdocs.zusammen.datatypes.response.ErrorCode;
import com.amdocs.zusammen.datatypes.response.Module;
@@ -315,6 +316,58 @@ public class ZusammenConnectorTest {
}
+
+ @Test
+ public void testResetVersionRevision() {
+ ItemVersionAdaptor itemAdaptor = mock(ItemVersionAdaptor.class);
+ ItemVersionAdaptor itemVersionAdaptor = spy(itemAdaptor);
+ Response<Void> response = new Response<>(null);
+ Id id = new Id();
+ when(versionAdaptorFactoryMock.createInterface(sessionContext)).thenReturn(itemVersionAdaptor);
+ when(itemVersionAdaptor.resetRevision(sessionContext, id, id, id)).thenReturn(response);
+ zusammenConnector.resetVersionRevision(sessionContext, id, id, id);
+ verify(itemVersionAdaptor).resetRevision(sessionContext, id, id, id);
+
+ }
+
+ @Test
+ public void testRevertVersionRevision() {
+ ItemVersionAdaptor itemAdaptor = mock(ItemVersionAdaptor.class);
+ ItemVersionAdaptor itemVersionAdaptor = spy(itemAdaptor);
+ Response<Void> response = new Response<>(null);
+ when(versionAdaptorFactoryMock.createInterface(sessionContext)).thenReturn(itemVersionAdaptor);
+ Id id = new Id();
+ when(itemVersionAdaptor.revertRevision(sessionContext, id, id, id)).thenReturn(response);
+ zusammenConnector.revertVersionRevision(sessionContext, id, id, id);
+ verify(itemVersionAdaptor).revertRevision(sessionContext, id, id, id);
+ }
+
+
+ @Test
+ public void testListVersionRevisions() {
+ ItemVersionAdaptor itemAdaptor = mock(ItemVersionAdaptor.class);
+ ItemVersionRevisions itemVersionRevisions = new ItemVersionRevisions();
+ Response<ItemVersionRevisions> response = new Response<>(itemVersionRevisions);
+ when(versionAdaptorFactoryMock.createInterface(sessionContext)).thenReturn(itemAdaptor);
+ Id id = new Id();
+ when(itemAdaptor.listRevisions(sessionContext, id, id)).thenReturn(response);
+ ItemVersionRevisions itemVersionRevisions1 = zusammenConnector.listVersionRevisions(sessionContext, id, id);
+ assertEquals(itemVersionRevisions, itemVersionRevisions1);
+ }
+
+ @Test
+ public void testPublishVersion() {
+ ItemVersionAdaptor itemVersionAdaptor = spy(ItemVersionAdaptor.class);
+ Response<Void> response = new Response<>(null);
+ when(versionAdaptorFactoryMock.createInterface(sessionContext)).thenReturn(itemVersionAdaptor);
+ Id id = new Id();
+ String blaBla = "bla bla";
+ when(itemVersionAdaptor.publish(sessionContext, id, id, blaBla)).thenReturn(response);
+ zusammenConnector.publishVersion(sessionContext, id, id, blaBla);
+ verify(itemVersionAdaptor).publish(sessionContext, id, id, blaBla);
+ }
+
+
private void setResponseErrorReturnCode(Response response) {
response.setReturnCode(new ReturnCode(ErrorCode.CL_ELEMENT_GET, Module.ZSTM, "bla bla", null));
}