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