aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/util/ValidationManagerUtilTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/util/ValidationManagerUtilTest.java')
-rw-r--r--openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/util/ValidationManagerUtilTest.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/util/ValidationManagerUtilTest.java b/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/util/ValidationManagerUtilTest.java
new file mode 100644
index 0000000000..b151ea2e8b
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/util/ValidationManagerUtilTest.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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=========================================================
+ */
+package org.openecomp.sdc.validation.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+
+public class ValidationManagerUtilTest {
+
+ private FileContentHandler fileContentMap;
+ private Map<String, List<ErrorMessage>> errors;
+
+ @Before
+ public void setUp() throws Exception {
+ fileContentMap = new FileContentHandler();
+ errors = new HashMap<>();
+ }
+
+ @Test
+ public void shouldHandleNonMissingManifest() throws IOException {
+ fileContentMap.addFile(SdcCommon.MANIFEST_NAME, this.getClass().getClassLoader().getResourceAsStream("MANIFEST.json"));
+ ValidationManagerUtil.handleMissingManifest(fileContentMap, errors);
+ assertTrue(errors.isEmpty());
+ }
+
+ @Test
+ public void shouldHandleMissingManifest() throws IOException {
+ fileContentMap.addFile("ANY", this.getClass().getClassLoader().getResourceAsStream("vfw.zip"));
+ ValidationManagerUtil.handleMissingManifest(fileContentMap, errors);
+ assertEquals(errors.get(SdcCommon.MANIFEST_NAME).size(), 1);
+ assertEquals(errors.get(SdcCommon.MANIFEST_NAME).get(0).getMessage(), "Manifest doesn't exist");
+ }
+
+} \ No newline at end of file