added test case to ConfigResourceNodeTest 35/77935/4
authorSandeep J <sandeejh@in.ibm.com>
Wed, 6 Feb 2019 09:50:00 +0000 (15:20 +0530)
committerTakamune Cho <takamune.cho@att.com>
Wed, 6 Feb 2019 13:03:37 +0000 (13:03 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: I69a92c10c3c2543a45ebf333e708286ffb6ac454
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/node/ConfigResourceNodeTest.java

index fd3448e..5ecdbc4 100644 (file)
@@ -25,6 +25,7 @@ package org.onap.appc.data.services.node;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.atLeastOnce;
@@ -734,4 +735,24 @@ public class ConfigResourceNodeTest {
 
         verify(contextMock, atLeastOnce()).setAttribute(anyString(), eq(AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS));
     }
+    
+    @Test
+    public void testSaveConfigTransactionLog() throws SvcLogicException
+    {
+        SvcLogicContext context = new SvcLogicContext();
+        inParams.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "test");
+        inParams.put(AppcDataServiceConstant.INPUT_PARAM_MESSAGE_TYPE, "test");
+        inParams.put(AppcDataServiceConstant.INPUT_PARAM_MESSAGE, "test");
+        
+        context.setAttribute("request-id", "test");
+        DGGeneralDBService dbServiceMock =
+                new MockDbServiceBuilder().savePrepareRelationship(PREPARE_RELATIONSHIP_PARAM, "some file id", SDC_IND,
+                        SvcLogicResource.QueryStatus.FAILURE).build();
+
+        ConfigResourceNode configResourceNode = new ConfigResourceNode(dbServiceMock);
+        configResourceNode.saveConfigTransactionLog(inParams, contextMock);
+        assertEquals(null,contextMock.getAttribute("log-message"));
+    }
+    
+    
 }