2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2018 Huawei. All rights reserved.
4 * Modifications Copyright (C) 2019 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ============LICENSE_END=========================================================
20 package org.onap.policy.sdnc;
22 import java.util.LinkedList;
24 import org.junit.Test;
25 import org.onap.policy.sdnc.util.Serialization;
27 public class DemoTest {
31 SdncRequest request = new SdncRequest();
33 request.setNsInstanceId("100");
34 request.setHealRequest(new SdncHealRequest());
36 request.getHealRequest().setRequestHeaderInfo(new SdncHealRequestHeaderInfo());
37 request.getHealRequest().getRequestHeaderInfo().setSvcRequestId("service-req-01");
38 request.getHealRequest().getRequestHeaderInfo().setSvcAction("servive-action");
40 request.getHealRequest().setRequestInfo(new SdncHealRequestInfo());
41 request.getHealRequest().getRequestInfo().setRequestAction("request-action");
43 request.getHealRequest().setServiceInfo(new SdncHealServiceInfo());
44 request.getHealRequest().getServiceInfo().setServiceInstanceId("service-instance-01");
46 request.getHealRequest().setNetworkInfo(new SdncHealNetworkInfo());
47 request.getHealRequest().getNetworkInfo().setNetworkId("network-5555");
50 String body = Serialization.gsonPretty.toJson(request);
51 System.out.println(body);
53 SdncResponse response = new SdncResponse();
55 body = Serialization.gsonPretty.toJson(response);
56 System.out.println(body);
58 response.setRequestId("request-01");
59 response.setResponseOutput(new SdncResponseOutput());
60 response.getResponseOutput().setSvcRequestId("service-req-01");
61 response.getResponseOutput().setResponseCode("200");
62 response.getResponseOutput().setAckFinalIndicator("final-indicator-00");
64 body = Serialization.gsonPretty.toJson(response);
65 System.out.println(body);
67 response = Serialization.gsonPretty.fromJson(body, SdncResponse.class);
68 body = Serialization.gsonPretty.toJson(response);
69 System.out.println(body);