summaryrefslogtreecommitdiffstats
path: root/sliPluginUtils
diff options
context:
space:
mode:
Diffstat (limited to 'sliPluginUtils')
-rw-r--r--sliPluginUtils/features/ccsdk-sliPluginUtils/pom.xml19
-rw-r--r--sliPluginUtils/features/features-sliPluginUtils/pom.xml4
-rwxr-xr-xsliPluginUtils/features/pom.xml4
-rwxr-xr-xsliPluginUtils/installer/pom.xml25
-rwxr-xr-xsliPluginUtils/pom.xml4
-rwxr-xr-xsliPluginUtils/provider/pom.xml14
-rw-r--r--sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java259
7 files changed, 203 insertions, 126 deletions
diff --git a/sliPluginUtils/features/ccsdk-sliPluginUtils/pom.xml b/sliPluginUtils/features/ccsdk-sliPluginUtils/pom.xml
index 78f5f1e1..3e15fa44 100644
--- a/sliPluginUtils/features/ccsdk-sliPluginUtils/pom.xml
+++ b/sliPluginUtils/features/ccsdk-sliPluginUtils/pom.xml
@@ -5,13 +5,13 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sliPluginUtils</artifactId>
- <version>0.3.0-SNAPSHOT</version>
+ <version>0.3.1-SNAPSHOT</version>
<packaging>feature</packaging>
<name>ccsdk-sli-core :: sliPluginUtils :: ${project.artifactId}</name>
@@ -32,6 +32,21 @@
<type>pom</type>
<scope>import</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
diff --git a/sliPluginUtils/features/features-sliPluginUtils/pom.xml b/sliPluginUtils/features/features-sliPluginUtils/pom.xml
index 23e54fe5..60d563f7 100644
--- a/sliPluginUtils/features/features-sliPluginUtils/pom.xml
+++ b/sliPluginUtils/features/features-sliPluginUtils/pom.xml
@@ -5,13 +5,13 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>features-sliPluginUtils</artifactId>
- <version>0.3.0-SNAPSHOT</version>
+ <version>0.3.1-SNAPSHOT</version>
<packaging>feature</packaging>
<name>ccsdk-sli-core :: sliPluginUtils :: ${project.artifactId}</name>
diff --git a/sliPluginUtils/features/pom.xml b/sliPluginUtils/features/pom.xml
index 5b4b70fd..2194f8ec 100755
--- a/sliPluginUtils/features/pom.xml
+++ b/sliPluginUtils/features/pom.xml
@@ -5,13 +5,13 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliPluginUtils-features</artifactId>
- <version>0.3.0-SNAPSHOT</version>
+ <version>0.3.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ccsdk-sli-core :: sliPluginUtils :: ${project.artifactId}</name>
diff --git a/sliPluginUtils/installer/pom.xml b/sliPluginUtils/installer/pom.xml
index 5a22e495..e30e9d26 100755
--- a/sliPluginUtils/installer/pom.xml
+++ b/sliPluginUtils/installer/pom.xml
@@ -5,13 +5,13 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliPluginUtils-installer</artifactId>
- <version>0.3.0-SNAPSHOT</version>
+ <version>0.3.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ccsdk-sli-core :: sliPluginUtils :: ${project.artifactId}</name>
@@ -23,6 +23,27 @@
<include.transitive.dependencies>false</include.transitive.dependencies>
</properties>
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
diff --git a/sliPluginUtils/pom.xml b/sliPluginUtils/pom.xml
index 8ecdf397..da646177 100755
--- a/sliPluginUtils/pom.xml
+++ b/sliPluginUtils/pom.xml
@@ -5,13 +5,13 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliPluginUtils</artifactId>
- <version>0.3.0-SNAPSHOT</version>
+ <version>0.3.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ccsdk-sli-core :: sliPluginUtils</name>
diff --git a/sliPluginUtils/provider/pom.xml b/sliPluginUtils/provider/pom.xml
index 411c1453..4b7fe952 100755
--- a/sliPluginUtils/provider/pom.xml
+++ b/sliPluginUtils/provider/pom.xml
@@ -5,13 +5,13 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliPluginUtils-provider</artifactId>
- <version>0.3.0-SNAPSHOT</version>
+ <version>0.3.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>ccsdk-sli-core :: sliPluginUtils :: ${project.artifactId}</name>
@@ -20,7 +20,15 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
-
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
index 266603d1..a7cc1bde 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
@@ -35,119 +35,152 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.gson.JsonObject;
+
public class CheckParametersTest {
- @Test
- public void nullRequiredParameters() throws Exception {
- Map<String, String> parametersMap = new HashMap<String, String>();
- String[] requiredParams = null;
- Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
- SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
- }
-
- @Test(expected = SvcLogicException.class)
- public void emptyParametersMap() throws Exception {
- Map<String, String> parametersMap = new HashMap<String, String>();
- String[] requiredParams = new String[] { "param1", "param2", "param3" };
- Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
- SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
- }
-
- @Test(expected = SvcLogicException.class)
- public void paramNotFound() throws Exception {
- Map<String, String> parametersMap = new HashMap<String, String>();
- parametersMap.put("tst", "me");
- String[] requiredParams = new String[] { "param1", "parm2", "param3" };
- Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
- SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
- }
-
- @Test
- public void testSunnyRequiredParameters() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute("param1", "hello");
- ctx.setAttribute("param2", "world");
- ctx.setAttribute("param3", "!");
-
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("param1", "dog");
- parameters.put("param2", "cat");
- parameters.put("param3", "fish");
-
- SliPluginUtils.requiredParameters(parameters, ctx);
- }
-
- @Test
- public void testSunnyRequiredParametersWithPrefix() throws Exception {
- String prefixValue = "my.unique.path.";
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute(prefixValue + "param1", "hello");
- ctx.setAttribute(prefixValue + "param2", "world");
- ctx.setAttribute(prefixValue + "param3", "!");
-
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("prefix", prefixValue);
- parameters.put("param1", "dog");
- parameters.put("param2", "cat");
- parameters.put("param3", "fish");
-
- SliPluginUtils.requiredParameters(parameters, ctx);
- }
-
- @Test(expected = SvcLogicException.class)
- public void testRainyMissingRequiredParameters() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute("param1", "hello");
- ctx.setAttribute("param3", "!");
-
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("param1", null);
- parameters.put("param2", null);
- parameters.put("param3", null);
-
- SliPluginUtils.requiredParameters(parameters, ctx);
- }
-
- @Test(expected = SvcLogicException.class)
- public void testEmptyRequiredParameters() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute("param1", "hello");
- ctx.setAttribute("param3", "!");
-
- Map<String, String> parameters = new HashMap<String, String>();
-
- SliPluginUtils.requiredParameters(parameters, ctx);
- }
-
- @Test(expected = SvcLogicException.class)
- public void testJsonStringToCtx() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("outputPath", "testPath");
- parameters.put("isEscaped", "true");
- parameters.put("source", "//{/name1/:value1/}//");
- SliPluginUtils.jsonStringToCtx(parameters, ctx);
- }
-
- @Test
- public void testGetAttributeValue() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("outputPath", "testPath");
- parameters.put("source", "testSource");
- SliPluginUtils.getAttributeValue(parameters, ctx);
- assertNull(ctx.getAttribute(parameters.get("outputPath")));
- }
-
- @Test
- public void testCtxListContains() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("list", "10_length");
- parameters.put("keyName", "testName");
- parameters.put("keyValue", "testValue");
- ctx.setAttribute("10_length", "10");
- assertEquals("false", SliPluginUtils.ctxListContains(parameters, ctx));
-
- }
+ @Test
+ public void nullRequiredParameters() throws Exception {
+ Map<String, String> parametersMap = new HashMap<String, String>();
+ String[] requiredParams = null;
+ Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
+ SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void emptyParametersMap() throws Exception {
+ Map<String, String> parametersMap = new HashMap<String, String>();
+ String[] requiredParams = new String[] { "param1", "param2", "param3" };
+ Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
+ SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void paramNotFound() throws Exception {
+ Map<String, String> parametersMap = new HashMap<String, String>();
+ parametersMap.put("tst", "me");
+ String[] requiredParams = new String[] { "param1", "parm2", "param3" };
+ Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
+ SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
+ }
+
+ @Test
+ public void testSunnyRequiredParameters() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("param1", "hello");
+ ctx.setAttribute("param2", "world");
+ ctx.setAttribute("param3", "!");
+
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("param1", "dog");
+ parameters.put("param2", "cat");
+ parameters.put("param3", "fish");
+
+ SliPluginUtils.requiredParameters(parameters, ctx);
+ }
+
+ @Test
+ public void testSunnyRequiredParametersWithPrefix() throws Exception {
+ String prefixValue = "my.unique.path.";
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute(prefixValue + "param1", "hello");
+ ctx.setAttribute(prefixValue + "param2", "world");
+ ctx.setAttribute(prefixValue + "param3", "!");
+
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("prefix", prefixValue);
+ parameters.put("param1", "dog");
+ parameters.put("param2", "cat");
+ parameters.put("param3", "fish");
+
+ SliPluginUtils.requiredParameters(parameters, ctx);
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void testRainyMissingRequiredParameters() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("param1", "hello");
+ ctx.setAttribute("param3", "!");
+
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("param1", null);
+ parameters.put("param2", null);
+ parameters.put("param3", null);
+
+ SliPluginUtils.requiredParameters(parameters, ctx);
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void testEmptyRequiredParameters() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("param1", "hello");
+ ctx.setAttribute("param3", "!");
+
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ SliPluginUtils.requiredParameters(parameters, ctx);
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void testJsonStringToCtx() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("outputPath", "testPath");
+ parameters.put("isEscaped", "true");
+ parameters.put("source", "//{/name1/:value1/}//");
+ SliPluginUtils.jsonStringToCtx(parameters, ctx);
+ }
+
+ @Test
+ public void testGetAttributeValue() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("outputPath", "testPath");
+ parameters.put("source", "testSource");
+ SliPluginUtils.getAttributeValue(parameters, ctx);
+ assertNull(ctx.getAttribute(parameters.get("outputPath")));
+ }
+
+ @Test
+ public void testCtxListContains() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("list", "10_length");
+ parameters.put("keyName", "testName");
+ parameters.put("keyValue", "testValue");
+ ctx.setAttribute("10_length", "10");
+ assertEquals("false", SliPluginUtils.ctxListContains(parameters, ctx));
+
+ }
+
+ @Test(expected= SvcLogicException.class)
+ public void testPrintContextForNullParameters() throws SvcLogicException
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> parameters = new HashMap<String, String>();
+ SliPluginUtils.printContext(parameters, ctx);
+ }
+
+ @Test
+ public void testPrintContext() throws SvcLogicException
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("filename","testFileName");
+ SliPluginUtils.printContext(parameters, ctx);
+ }
+
+ @Test
+ public void testWriteJsonObject() throws SvcLogicException
+ {
+ JsonObject obj=new JsonObject();
+ obj.addProperty("name","testName");
+ obj.addProperty("age",27);
+ obj.addProperty("salary",600000);
+ SvcLogicContext ctx = new SvcLogicContext();
+ SliPluginUtils.writeJsonObject(obj, ctx,"root");
+ assertEquals("testName", ctx.getAttribute("root.name"));
+ assertEquals("27", ctx.getAttribute("root.age"));
+ assertEquals("600000", ctx.getAttribute("root.salary"));
+ }
}