aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2020-04-21 10:03:54 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-21 10:03:54 +0000
commitdcfbed79c6da8b9c737c979b9a0410d37142499d (patch)
treee812ea74e760c9c33e9cd0f1dc95a44cd3e1348d /src/test/java/org/onap
parent3bb0a519c63cc629f5d36b29d8eeced99109353f (diff)
parentbd6abe51f90936ecb4a7de92a3f40978675a2886 (diff)
Merge "Payload attributes are not displayed in operational policy"
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java58
-rw-r--r--src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java13
2 files changed, 71 insertions, 0 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
new file mode 100644
index 000000000..ec39fc3db
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ * ================================================================================
+ *
+ */
+
+package org.onap.clamp.clds.client;
+
+import com.google.gson.JsonObject;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.onap.clamp.clds.util.JsonUtils;
+import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+public class CdsServicesTest {
+
+ @Test
+ public void testParseCdsListTypeProperties() throws IOException {
+ String cdsResponse = ResourceFileUtil
+ .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-workflow.json");
+ CdsServices services = new CdsServices();
+ JsonObject output = services.parseCdsResponse(cdsResponse);
+ JSONAssert.assertEquals(ResourceFileUtil
+ .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json"),
+ JsonUtils.GSON.toJson(output), true);
+ }
+
+ @Test
+ public void testParseCdsResponse() throws IOException {
+ String cdsResponse = ResourceFileUtil
+ .getResourceAsString("example/cds-response/vFW-CDS-modify-config-workflow.json");
+ CdsServices services = new CdsServices();
+ JsonObject output = services.parseCdsResponse(cdsResponse);
+ JSONAssert.assertEquals(ResourceFileUtil
+ .getResourceAsString("example/cds-response/vFW-CDS-modify-config-wf-expected-result.json"),
+ JsonUtils.GSON.toJson(output), true);
+ }
+
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
index 4e9b56206..a6a496821 100644
--- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
+++ b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
@@ -50,4 +50,17 @@ public class OperationalPolicyRepresentationBuilderTest {
new GsonBuilder().create().toJson(jsonSchema), false);
}
+ @Test
+ public void testOperationalPolicyPayloadConstructionForCds() throws IOException {
+ JsonObject jsonModel = new GsonBuilder().create()
+ .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class);
+ Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
+ jsonModel.get("resourceDetails").getAsJsonObject(),
+ "1.0");
+
+ JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service);
+ assertThat(jsonSchema).isNotNull();
+ JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"),
+ new GsonBuilder().create().toJson(jsonSchema), false);
+ }
}