summaryrefslogtreecommitdiffstats
path: root/restconf-client/provider/src/test
diff options
context:
space:
mode:
authorjanani b <janani.b@huawei.com>2018-09-19 21:10:17 +0530
committerjanani b <janani.b@huawei.com>2018-09-19 21:10:17 +0530
commit2092b7c383f1a3280da05b71517fae6521b73327 (patch)
tree91e595d7be541ad9e06af961d11429f7aeaf80eb /restconf-client/provider/src/test
parent259eece936114ccacf9acc8f412eeed033fd10c4 (diff)
Issue fix for RestconfApiCallNode
Sonar and Issue fix Issue-ID: CCSDK-325 Change-Id: I469fcc5c4da2ec26c3a39b48d52736d45c1718d4 Signed-off-by: janani b <janani.b@huawei.com>
Diffstat (limited to 'restconf-client/provider/src/test')
-rw-r--r--restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java b/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java
index 0f46d625b..6c11206c9 100644
--- a/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java
+++ b/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java
@@ -41,6 +41,10 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.GET;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.POST;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.PUT;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.parseUrl;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.DECODE_FROM_JSON_RPC;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.DECODE_FROM_XML_RPC;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_JSON_ID;
@@ -317,6 +321,51 @@ public class DataFormatSerializerTest {
}
/**
+ * Verifies URL parser returning path with only schema information for all
+ * kind of URL.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void validateUrlParser() throws SvcLogicException {
+ String actVal = "identity-test:test";
+ String url1 = "http://echo.getpostman.com/restconf/operations/" +
+ actVal;
+ String url2 = "http://echo.getpostman.com/restconf/data/" + actVal;
+ String url3 = "https://echo.getpostman.com/restconf/operations/" +
+ actVal;
+ String url4 = "https://echo.getpostman.com/restconf/data/" + actVal +
+ "/for-put";
+ String url5 = "http://localhost:8282/restconf/operations/" + actVal;
+ String url6 = "https://localhost:8282/restconf/operations/" + actVal;
+ String url7 = "http://localhost:8282/restconf/data/" + actVal +
+ "/for-put";
+ String url8 = "https://localhost:8282/restconf/data/" + actVal;
+ String url9 = "http://182.2.61.24:2250/restconf/data/" + actVal;
+ String url10 = "https://182.2.61.24:2250/restconf/operations/" + actVal;
+ String val1 = parseUrl(url1, POST);
+ String val2 = parseUrl(url2, GET);
+ String val3 = parseUrl(url3, POST);
+ String val4 = parseUrl(url4, PUT);
+ String val5 = parseUrl(url5, GET);
+ String val6 = parseUrl(url6, POST);
+ String val7 = parseUrl(url7, PUT);
+ String val8 = parseUrl(url8, POST);
+ String val9 = parseUrl(url9, GET);
+ String val10 = parseUrl(url10, POST);
+ assertThat(val1, is(actVal));
+ assertThat(val2, is(actVal));
+ assertThat(val3, is(actVal));
+ assertThat(val4, is(actVal));
+ assertThat(val5, is(actVal));
+ assertThat(val6, is(actVal));
+ assertThat(val7, is(actVal));
+ assertThat(val8, is(actVal));
+ assertThat(val9, is(actVal));
+ assertThat(val10, is(actVal));
+ }
+
+ /**
* Creates attribute list for encoding JSON or XML with identity-ref YANG
* file.
*