added test case to ConfigResourceNodeTest 13/65413/2
authorSandeep J <sandeejh@in.ibm.com>
Sun, 9 Sep 2018 21:15:59 +0000 (02:45 +0530)
committerTakamune Cho <tc012c@att.com>
Mon, 10 Sep 2018 16:59:42 +0000 (16:59 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: I1e8948ed3009704bf4f118b2ac6a6b94aa96178c
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 bdb2b7c..5707aaa 100644 (file)
@@ -4,7 +4,7 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
- * Modification Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2018 IBM.
  * =============================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -700,5 +700,20 @@ public class ConfigResourceNodeTest {
         verify(configResourceNode).saveConfigBlock(inParams, contextMock);
         verify(contextMock, atLeastOnce()).setAttribute(anyString(), eq(AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS));
     }
+    
+    @Test
+    public void testSaveTemplateConfig() throws SvcLogicException
+    {
+        SvcLogicContext context = new SvcLogicContext();
+        context.setAttribute(CONFIG_FILE_ID_PARAM, "some file id");
+
+        DGGeneralDBService dbServiceMock =
+                new MockDbServiceBuilder().savePrepareRelationship(PREPARE_RELATIONSHIP_PARAM, "some file id", SDC_IND,
+                        SvcLogicResource.QueryStatus.FAILURE).build();
+
+        ConfigResourceNode configResourceNode = new ConfigResourceNode(dbServiceMock);
+        configResourceNode.saveTemplateConfig(inParams, contextMock);
 
+        verify(contextMock, atLeastOnce()).setAttribute(anyString(), eq(AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS));
+    }
 }