Added test cases to ConfigResourceNodeTest.java 15/59415/2
authorSandeep J <sandeejh@in.ibm.com>
Tue, 7 Aug 2018 10:32:18 +0000 (16:02 +0530)
committerTakamune Cho <tc012c@att.com>
Tue, 7 Aug 2018 15:22:40 +0000 (15:22 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: Iebffd1a614c286f50fca9b3159107d6e08a06670
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 776acda..bdb2b7c 100644 (file)
@@ -155,6 +155,31 @@ public class ConfigResourceNodeTest {
         configResourceNode.getVnfcReference(inParams, contextMock);
         verify(contextMock).setAttribute(anyString(), eq(AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS));
     }
+    
+    @Test
+    public void testGetCapability() throws Exception {
+        DGGeneralDBService dbServiceMock = new MockDbServiceBuilder().build();
+        ConfigResourceNode configResourceNode = new ConfigResourceNode(dbServiceMock);
+        contextMock.setAttribute("responsePrefix", "testResponsePrefix");
+        contextMock.setAttribute("caplevel", "testCapLevel");
+        contextMock.setAttribute("checkCapability", "testCheckCapability");
+        contextMock.setAttribute("vServerId", "testVServerId");
+        contextMock.setAttribute("vnf-type", "testVnfType");
+        configResourceNode.getCapability(inParams, contextMock);
+        verify(contextMock).setAttribute(anyString(), eq(AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS));
+    }
+    
+    @Test
+    public void testGetConfigFilesByVnfVmNCategory() throws Exception {
+        DGGeneralDBService dbServiceMock = new MockDbServiceBuilder().build();
+        ConfigResourceNode configResourceNode = new ConfigResourceNode(dbServiceMock);
+        contextMock.setAttribute("responsePrefix", "testResponsePrefix");
+        contextMock.setAttribute("fileCategory", "testFileCategory");
+        contextMock.setAttribute("vnfId", "testVnfId");
+        contextMock.setAttribute("vmName", "testVmName");
+        configResourceNode.getConfigFilesByVnfVmNCategory(inParams, contextMock);
+        verify(contextMock).setAttribute(anyString(), eq(AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS));
+    }
 
     @Test
     public void should_add_attribute_with_success_if_save_config_files_succeed() throws SvcLogicException {