summaryrefslogtreecommitdiffstats
path: root/restconf-client/provider/src/test/java/org
diff options
context:
space:
mode:
authorVidyashree Rama <vidyashree.rama@huawei.com>2018-10-25 14:50:31 +0530
committerVidyashree Rama <vidyashree.rama@huawei.com>2018-10-25 14:55:00 +0530
commit69d612621915cf9793b5e8c5a4e9ec42187a557d (patch)
tree869baca5e4a0ffd1e1536ad17f752bb72783422e /restconf-client/provider/src/test/java/org
parent5b0d0173096c0ac635b0edef71acb3244386e51a (diff)
Add authorization header in SSE request
Add authorization header in SSE request to support https Issue-ID: CCSDK-628 Change-Id: I031cbed94e21e1f6d90bc0b00b2d70905d47bd69 Signed-off-by: Vidyashree Rama <vidyashree.rama@huawei.com>
Diffstat (limited to 'restconf-client/provider/src/test/java/org')
-rw-r--r--restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SseServerMock.java2
-rw-r--r--restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java21
2 files changed, 22 insertions, 1 deletions
diff --git a/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SseServerMock.java b/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SseServerMock.java
index 1b234a236..35ac221fb 100644
--- a/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SseServerMock.java
+++ b/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SseServerMock.java
@@ -35,7 +35,7 @@ public class SseServerMock {
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput getServerSentEvents() throws IOException {
String data = "{" +
- "\"ietf-notification:notification\" : {" +
+ "\"ietf-restconf:notification\" : {" +
" \"eventTime\" : \"2017-10-25T08:22:33.44Z\"," +
" \"ietf-yang-push:push-change-update\": {" +
"\"subscription-id\":\"89\"," +
diff --git a/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java b/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java
index b2094ca73..af354e9bf 100644
--- a/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java
+++ b/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java
@@ -57,6 +57,13 @@ public class TestRestconfDiscoveryNode {
p.put("sseConnectURL", "http://localhost:8080/events");
p.put("subscriberId", "networkId");
p.put("responsePrefix", "restapi-result");
+ p.put("restapiUser", "access");
+ p.put("restapiPassword", "abc@123");
+ p.put("customHttpHeaders", "X-ACCESS-TOKEN=x-ik2ps4ikvzupbx0486ft" +
+ "1ebzs7rt85futh9ho6eofy3wjsap7wqktemlqm4bbsmnar3vrtbyrzuk" +
+ "bv5itd6m1cftldpjarnyle3sdcqq9hftc4lebz464b5ffxmlbvg9");
+ p.put("restapiUrl", "https://localhost:8080/restconf/operations/" +
+ "ietf-subscribed-notifications:establish-subscription");
RestconfDiscoveryNode rdn = new RestconfDiscoveryNode(
new RestconfApiCallNode(new RestapiCallNode()));
rdn.establishPersistentConnection(p, ctx, "networkId");
@@ -111,4 +118,18 @@ public class TestRestconfDiscoveryNode {
assertThat(rdn.getOutputIdentifier("restapi-result", ctx),
is("89"));
}
+
+ @Test
+ public void testGetTokenId() {
+ String customHttpHeaders = "X-ACCESS-TOKEN=x-ik2ps4ikvzupbx0486ft1ebzs7rt85" +
+ "futh9ho6eofy3wjsap7wqktemlqm4bbsmnar3vrtbyrzukbv5itd6m1cftldpjarny" +
+ "le3sdcqq9hftc4lebz464b5ffxmlbvg9";
+ RestconfDiscoveryNode rdn = new RestconfDiscoveryNode(
+ new RestconfApiCallNode(new RestapiCallNode()));
+
+ assertThat(rdn.getTokenId(customHttpHeaders),
+ is("x-ik2ps4ikvzupbx0486ft1ebzs7rt85futh9ho6eofy3wjsap7wqkt" +
+ "emlqm4bbsmnar3vrtbyrzukbv5itd6m1cftldpjarnyle3sdcqq9h" +
+ "ftc4lebz464b5ffxmlbvg9"));
+ }
}