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;
27 import java.io.IOException;
29 import org.junit.Test;
30 import org.onap.clamp.clds.util.JsonUtils;
31 import org.onap.clamp.clds.util.ResourceFileUtil;
32 import org.skyscreamer.jsonassert.JSONAssert;
34 public class CdsServicesTest {
37 public void testParseCdsListTypeProperties() throws IOException {
38 String cdsResponse = ResourceFileUtil
39 .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-workflow.json");
40 CdsServices services = new CdsServices();
41 JsonObject output = services.parseCdsResponse(cdsResponse);
42 JSONAssert.assertEquals(ResourceFileUtil
43 .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json"),
44 JsonUtils.GSON.toJson(output), true);
48 public void testParseCdsResponse() throws IOException {
49 String cdsResponse = ResourceFileUtil
50 .getResourceAsString("example/cds-response/vFW-CDS-modify-config-workflow.json");
51 CdsServices services = new CdsServices();
52 JsonObject output = services.parseCdsResponse(cdsResponse);
53 JSONAssert.assertEquals(ResourceFileUtil
54 .getResourceAsString("example/cds-response/vFW-CDS-modify-config-wf-expected-result.json"),
55 JsonUtils.GSON.toJson(output), true);