diff options
author | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2020-06-02 19:21:04 +0000 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2020-06-04 14:53:46 +0000 |
commit | e3c51b7c05dd8197f000eccfd0a3da567f7da7ba (patch) | |
tree | f4ceccd9edb9dc98ab52028e0b01a90be29e9dac /restapi-call-node/provider/src/test | |
parent | 3a39845f917b7d2b104d56646f3cf431aee96bdd (diff) |
restapicallnode fix
restapicallnode should support commas in urls
Issue-ID: CCSDK-2399
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: If177498b6f854aaa6f89811ab8a134f696e7e700
(cherry picked from commit ad5c70ad6ab8514c5a5e4ed87d76877b1b451ccd)
Diffstat (limited to 'restapi-call-node/provider/src/test')
-rwxr-xr-x | restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index b2f75bcd..a993bb94 100755 --- a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -22,8 +22,11 @@ package org.onap.ccsdk.sli.plugins.restapicall; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import java.util.HashMap; import java.util.Map; import org.codehaus.jettison.json.JSONObject; @@ -562,5 +565,40 @@ public class TestRestapiCallNode { //This will throw a JSONException and fail the test case if rest api call node doesn't form valid JSON assertNotNull(new JSONObject(request)); } + + @Test + public void testGetMultipleUrls() throws Exception{ + String[] urls = RestapiCallNode.getMultipleUrls("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana,https://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Potato"); + assertEquals("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana",urls[0]); + assertEquals("https://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Potato",urls[1]); + + urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/,http://localhost:7001/,http://wiki.onap.org/"); + assertEquals("https://wiki.onap.org/",urls[0]); + assertEquals("http://localhost:7001/",urls[1]); + assertEquals("http://wiki.onap.org/",urls[2]); + + urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/test=4,5,6,http://localhost:7001/test=1,2,3,http://wiki.onap.org/test=7,8,9,10"); + assertEquals("https://wiki.onap.org/test=4,5,6",urls[0]); + assertEquals("http://localhost:7001/test=1,2,3",urls[1]); + assertEquals("http://wiki.onap.org/test=7,8,9,10",urls[2]); + + urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/,https://readthedocs.org/projects/onap/"); + assertEquals("https://wiki.onap.org/",urls[0]); + assertEquals("https://readthedocs.org/projects/onap/",urls[1]); + } + + @Test + public void testContainsMultipleUrls() throws Exception{ + assertFalse(RestapiCallNode.containsMultipleUrls("https://wiki.onap.org/")); + assertFalse(RestapiCallNode.containsMultipleUrls("http://wiki.onap.org/")); + assertFalse(RestapiCallNode.containsMultipleUrls("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana")); + assertFalse(RestapiCallNode.containsMultipleUrls("https://localhost:8008/params=1,2,3,4,5,6")); + + assertTrue(RestapiCallNode.containsMultipleUrls("https://wiki.onap.org/,https://readthedocs.org/projects/onap/")); + assertTrue(RestapiCallNode.containsMultipleUrls("http://localhost:7001/,http://localhost:7002")); + assertTrue(RestapiCallNode.containsMultipleUrls("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana,https://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Potato")); + assertTrue(RestapiCallNode.containsMultipleUrls("https://wiki.onap.org/,http://localhost:7001/,http://wiki.onap.org/")); + assertTrue(RestapiCallNode.containsMultipleUrls("https://wiki.onap.org/test=4,5,6,http://localhost:7001/test=1,2,3,http://wiki.onap.org/test=7,8,9,10")); + } } |