aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-09-24 02:43:20 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-09-24 02:43:29 +0530
commitdd40efb6c50b80695a4bc645b3227e73ddc4c67d (patch)
tree40a75e09d91f4037ca87fc4aa0202067cf026a89
parent9e8138f54edbf4cc8a0309f9e149953e08d3280e (diff)
added test case to Dme2Test.java
to increase code coverage Issue-ID: CCSDK-595 Change-Id: Id3ae2ba9045d1308af2fb09f0c8aacdf5e40605b Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rw-r--r--sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java
index 9bff9483..a06def65 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java
@@ -3,7 +3,9 @@
* ONAP : CCSDK
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
+ * ================================================================================
+ * 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.
@@ -31,6 +33,8 @@ import java.util.Map;
import java.util.Properties;
import org.junit.Assert;
import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
public class Dme2Test {
public Properties makesProperties(String aafUserName, String aafPassword, String envContext, String routeOffer,
@@ -279,5 +283,20 @@ public class Dme2Test {
"http://sample.com:25055/service=sample.com/restservices/sys/v1/assetSearch/version=1.0/envContext=PROD/subContext=/mySubContext?dme2.password=fake&dme2.username=user@sample.com&partner=LPP_PROD&dme2.allowhttpcode=true";
assertEquals(expected, constructedUrl);
}
+
+ @Test
+ public void testConstructUrl() throws FileNotFoundException, IOException, SvcLogicException
+ {
+ Properties props = new Properties();
+ props.load(new FileInputStream("src/test/resources/dme2.prod.properties"));
+ DME2 dme2 = new DME2(props);
+ Map<String, String> parameters= new HashMap<>();
+ SvcLogicContext ctx= new SvcLogicContext();
+ parameters.put(DME2.SERVICE_KEY, "sample.com/services/eim/v1/rest");
+ parameters.put(DME2.OUTPUT_PATH_KEY, "tmp.test");
+ dme2.constructUrl(parameters,ctx);
+ String expected= "http://sample.com:25055/service=sample.com/services/eim/v1/rest/version=1.0/envContext=PROD?dme2.password=fake&dme2.username=user@sample.com&partner=LPP_PROD&dme2.allowhttpcode=true";
+ assertEquals(expected,ctx.getAttribute(parameters.get(DME2.OUTPUT_PATH_KEY)));
+ }
}