9db9071efe9fa16d73d81ad84494f75c2ec41e69
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START========================================================================
3  * ONAP : ccsdk feature sdnr wt
4  * =================================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6  * Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
7  * =================================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software distributed under the License
14  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
15  * or implied. See the License for the specific language governing permissions and limitations under
16  * the License.
17  * ============LICENSE_END==========================================================================
18  */
19
20 package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test;
21
22 import static org.junit.Assert.assertTrue;
23 import java.io.IOException;
24 import java.util.Map;
25 import javax.annotation.Nonnull;
26 import org.junit.Test;
27 import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
28 import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointClient;
29
30 public class TestPNFMountPointClient extends PNFMountPointClient {
31
32     public static String baseUrl = "http://localhost:8181";
33     PNFMountPointClient testClient;
34
35
36     public TestPNFMountPointClient() {
37         super(baseUrl);
38
39     }
40
41     @Test
42     public void testPNFMountPointClient() {
43         testClient = new TestPNFMountPointClient();
44         testClient.setAuthorization("admin", "admin");
45         Map<String, String> payloadMap = PNFMountPointClient.createPNFNotificationPayloadMap(
46                 "TEST 50001", "127.0.0.1", "TLS", "key_id",
47                 "admin", "admin", "17380");
48         String msg = testClient.prepareMessageFromPayloadMap(payloadMap);
49
50         assertTrue(testClient.sendNotification(msg));
51         assertTrue(testClient.sendNotification(msg));
52
53     }
54
55     @Override
56     @Nonnull
57     public BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
58             throws IOException {
59         System.out.println("In overridden sendRequest in TestPNFMountPointClient, uri = "+uri);
60         return new BaseHTTPResponse(200, body);
61     }
62
63 }