9fdc727bc89d639071c019ab62acfe2d27ab6771
[clamp.git] / src / test / java / org / onap / clamp / clds / client / CdsServicesTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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  * ================================================================================
20  *
21  */
22
23 package org.onap.clamp.clds.client;
24
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.ResourceFileUtil;
30 import org.skyscreamer.jsonassert.JSONAssert;
31
32 public class CdsServicesTest {
33
34     @Test
35     public void testParseCdsListTypeProperties() throws IOException {
36         String cdsResponse = ResourceFileUtil
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(ResourceFileUtil
41                 .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json"),
42                         JsonUtils.GSON.toJson(output), true);
43     }
44
45     @Test
46     public void testParseCdsResponse() throws IOException {
47         String cdsResponse = ResourceFileUtil
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(ResourceFileUtil
52                 .getResourceAsString("example/cds-response/vFW-CDS-modify-config-wf-expected-result.json"),
53                         JsonUtils.GSON.toJson(output), true);
54     }
55
56 }