aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-data-services
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-08-07 15:45:05 +0530
committerTakamune Cho <tc012c@att.com>2018-08-08 13:21:52 +0000
commit73d1eb965ffa81033864609311a4dbd406c45ad9 (patch)
treecd7d38576d7b1575820f1d87dc9f022a342c0528 /appc-config/appc-data-services
parenteb552133e407378672cc72705e9261dc4e6e9637 (diff)
added test cases to TestDGGeneralDBService.java
to increase code coverage Issue-ID: APPC-1086 Change-Id: I309985d0b7d9cbfa60d3e1082afd84aaf9631ef1 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-config/appc-data-services')
-rw-r--r--appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestDGGeneralDBService.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestDGGeneralDBService.java b/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestDGGeneralDBService.java
index 875c68bd7..d1c7fdb7b 100644
--- a/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestDGGeneralDBService.java
+++ b/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestDGGeneralDBService.java
@@ -6,7 +6,7 @@
* ================================================================================
* Copyright (C) 2017 Amdocs
* ================================================================================
- * Copyright (C) 2018 IBM
+ * Modification 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.
@@ -25,6 +25,7 @@
package org.onap.appc.data.services.db;
import static org.junit.Assert.assertEquals;
+
import java.io.IOException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringEscapeUtils;
@@ -235,4 +236,27 @@ public class TestDGGeneralDBService {
assertEquals(status, QueryStatus.SUCCESS);
}
+
+ @Test
+ public void testGetTemplateByArtifactType() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("vnf-type", "test");
+ ctx.setAttribute("request-action", "Configure");
+ MockDGGeneralDBService dbService = MockDGGeneralDBService.initialise();
+ QueryStatus status = dbService.getTemplateByArtifactType(ctx, "test","XML","APPC-CONFIG");
+ assertEquals(QueryStatus.SUCCESS, status);
+
+ }
+
+ @Test
+ public void testCleanContextPropertyByPrefix()
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("vnf-type", "test");
+ ctx.setAttribute("request-action", "Configure");
+ ctx.setAttribute(".vnfc-type", "Configure");
+ MockDGGeneralDBService dbService = MockDGGeneralDBService.initialise();
+ dbService.cleanContextPropertyByPrefix(ctx, "test");
+ assertEquals(2,ctx.getAttributeKeySet().size());
+ }
}