2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * =============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.openecomp.appc.instar.interfaceImpl;
27 import org.junit.Test;
28 import org.openecomp.sdnc.config.params.data.ResponseKey;
29 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
31 public class TestInstarResponseHandlerImpl {
34 public void testProcessResponseForIpv4(){
35 ResponseKey resKey = new ResponseKey();
36 resKey.setUniqueKeyValue("x");
37 SvcLogicContext svc = new SvcLogicContext();
38 svc.setAttribute("vnf-name", "fqdn");
39 resKey.setFieldKeyName("ipaddress-v4");
40 String instarKey = "key";
41 String instarRes ="{\"vnfConfigurationParameterDetails\":"
42 + "[{\"fqdn\":\"fqdnx\",\"v4IPAddress\":\"value2\"}]}";
43 InstarResponseHandlerImpl impl = new InstarResponseHandlerImpl(resKey,svc);
44 impl.processResponse(instarRes, instarKey);
48 public void testProcessResponseForIpv6(){
49 ResponseKey resKey = new ResponseKey();
50 resKey.setUniqueKeyValue("x");
51 SvcLogicContext svc = new SvcLogicContext();
52 svc.setAttribute("vnf-name", "fqdn");
53 resKey.setFieldKeyName("ipaddress-v6");
54 String instarKey = "key";
55 String instarRes ="{\"vnfConfigurationParameterDetails\":"
56 + "[{\"fqdn\":\"fqdnx\",\"v6IPAddress\":\"value2\"}]}";
57 InstarResponseHandlerImpl impl = new InstarResponseHandlerImpl(resKey,svc);
58 impl.processResponse(instarRes, instarKey);
62 public void testProcessResponseInstarKeyValues(){
64 ResponseKey resKey = new ResponseKey();
65 resKey.setUniqueKeyValue("x");
66 String json ="{\"vnfConfigurationParameterDetails\":"
67 + "[{\"fqdn\":\"fqdnx\",\"v4IPAddress\":\"value2\"}]}";
68 SvcLogicContext svc = new SvcLogicContext();
69 svc.setAttribute("vnf-name", "fqdn");
70 svc.setAttribute("INSTAR-KEY-VALUES", json);
71 resKey.setFieldKeyName("ipaddress-v6");
72 String instarKey = "key";
73 String instarRes ="{\"vnfConfigurationParameterDetails\":"
74 + "[{\"fqdn\":\"fqdnx\",\"v6IPAddress\":\"value2\"}]}";
75 InstarResponseHandlerImpl impl = new InstarResponseHandlerImpl(resKey,svc);
76 impl.processResponse(instarRes, instarKey);