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