2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 Huawei Technologies Co., Ltd.
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=========================================================
19 * ================================================================================
23 package org.onap.clamp.clds.client;
25 import com.google.gson.JsonObject;
26 import java.io.IOException;
27 import org.junit.Test;
28 import org.onap.clamp.clds.util.JsonUtils;
29 import org.onap.clamp.clds.util.ResourceFileUtils;
30 import org.skyscreamer.jsonassert.JSONAssert;
32 public class CdsServicesTest {
35 public void testParseCdsListTypeProperties() throws IOException {
36 String cdsResponse = ResourceFileUtils
37 .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-workflow.json");
38 CdsServices services = new CdsServices();
39 JsonObject output = services.parseCdsResponse(cdsResponse);
40 JSONAssert.assertEquals(ResourceFileUtils
41 .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json"),
42 JsonUtils.GSON.toJson(output), true);
46 public void testParseCdsResponse() throws IOException {
47 String cdsResponse = ResourceFileUtils
48 .getResourceAsString("example/cds-response/vFW-CDS-modify-config-workflow.json");
49 CdsServices services = new CdsServices();
50 JsonObject output = services.parseCdsResponse(cdsResponse);
51 JSONAssert.assertEquals(ResourceFileUtils
52 .getResourceAsString("example/cds-response/vFW-CDS-modify-config-wf-expected-result.json"),
53 JsonUtils.GSON.toJson(output), true);