From dd40efb6c50b80695a4bc645b3227e73ddc4c67d Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Mon, 24 Sep 2018 02:43:20 +0530 Subject: added test case to Dme2Test.java to increase code coverage Issue-ID: CCSDK-595 Change-Id: Id3ae2ba9045d1308af2fb09f0c8aacdf5e40605b Signed-off-by: Sandeep J --- .../ccsdk/sli/core/slipluginutils/Dme2Test.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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 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))); + } } -- cgit 1.2.3-korg