summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java
diff options
context:
space:
mode:
authorFrancis Toth <francis.toth@yoppworks.com>2020-05-08 08:27:25 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-05-10 06:24:23 +0000
commitfeb112c63e395bd682b09a43d6a03d13eb29dcd4 (patch)
treee5939f1d8620d63012f5ec2081c78dbf7ee23c85 /catalog-be/src/test/java
parent4a98c7efa0e8103b4e14c1d521b7963d095495e0 (diff)
Moved ArtifactsBusinessLogic::buildJsonStringForCsarVfcArtifact to JsonUtils
Signed-off-by: Francis Toth <francis.toth@yoppworks.com> Change-Id: Ia3bb9fe9f97e1759e4e5b70eb5e5396ed87d716d Issue-ID: SDC-2961
Diffstat (limited to 'catalog-be/src/test/java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java12
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactUtilsTest.java72
2 files changed, 72 insertions, 12 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
index cfbc06234c..cd171d9b65 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
@@ -845,17 +845,6 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
}
@Test
- public void testBuildJsonStringForCsarVfcArtifact() throws Exception {
- ArtifactsBusinessLogic testSubject;
- ArtifactDefinition artifact = new ArtifactDefinition();
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = Deencapsulation.invoke(testSubject, "buildJsonStringForCsarVfcArtifact", new Object[]{artifact});
- }
-
- @Test
public void testCheckArtifactInComponent() throws Exception {
ArtifactsBusinessLogic testSubject;
Component component = new Resource();
@@ -869,7 +858,6 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
new Object[]{component, artifactId});
}
-
@Test
public void testCheckCreateFields() throws Exception {
ArtifactsBusinessLogic testSubject;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactUtilsTest.java
new file mode 100644
index 0000000000..137af04ef3
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactUtilsTest.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
+
+package org.openecomp.sdc.be.components.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.be.components.utils.ArtifactUtils.buildJsonStringForCsarVfcArtifact;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+
+public class ArtifactUtilsTest {
+
+ private static final String JSON =
+ "{\n"
+ + " \"artifactType\": \"artifactType\",\n"
+ + " \"artifactDisplayName\": \"displayName\",\n"
+ + " \"artifactName\": \"artifactName\",\n"
+ + " \"artifactGroupType\": \"DEPLOYMENT\",\n"
+ + " \"description\": \"description\",\n"
+ + " \"payloadData\": [\n"
+ + " 112,\n"
+ + " 97,\n"
+ + " 121,\n"
+ + " 108,\n"
+ + " 111,\n"
+ + " 97,\n"
+ + " 100,\n"
+ + " 68,\n"
+ + " 97,\n"
+ + " 116,\n"
+ + " 97\n"
+ + " ],\n"
+ + " \"artifactLabel\": \"label\"\n"
+ + "}";
+
+ @Test
+ public void artifactDefinitionShouldBeDeserializedProperly() {
+ ArtifactDefinition ad = new ArtifactDefinition();
+ ad.setArtifactName("artifactName");
+ ad.setArtifactLabel("label");
+ ad.setArtifactType("artifactType");
+ ad.setDescription("description");
+ ad.setPayloadData("payloadData");
+ ad.setArtifactDisplayName("displayName");
+ ad.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT);
+
+ String actual = buildJsonStringForCsarVfcArtifact(ad);
+
+ assertEquals(actual, JSON);
+ }
+}