aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
diff options
context:
space:
mode:
authorm.kowalski3 <m.kowalski3@partner.samsung.com>2019-06-24 14:53:49 +0200
committerOren Kleks <orenkle@amdocs.com>2019-06-25 12:19:01 +0000
commitd761b7ce6d662e2d23410ef7f2dec3350eac05b5 (patch)
treee32491946e145da38b6c01d673ec831211040277 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
parentb0f83a8400973be1be2b8fadafd1b3da740f12ad (diff)
Add unit tests for:
-ComponentErrorBuilder -ComputeErrorBuilder -CreatePackageForNonFinalVendorSoftwareProductErrorBuilder Issue-ID: SDC-2327 Signed-off-by: Marcin Kowalski <m.kowalski3@partner.samsung.com> Change-Id: I465619c8e4b9819c4706a38633a9e1d6bf5551ab
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilderTest.java43
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilderTest.java42
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilderTest.java49
3 files changed, 134 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilderTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilderTest.java
new file mode 100644
index 0000000000..daf7a3d0fd
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilderTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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.vendorsoftwareproduct.errors;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class ComponentErrorBuilderTest {
+
+ @Test
+ public void testVfcMissingImageErrorBuilder() {
+ //when
+ ErrorCode errorCode = ComponentErrorBuilder.vfcMissingImageErrorBuilder();
+
+ //then
+ assertEquals(VendorSoftwareProductErrorCodes.VFC_INVALID, errorCode.id());
+ assertEquals(ErrorCategory.APPLICATION, errorCode.category());
+ assertEquals(
+ "All VFC need to have atleast a single Image specified. Please fix the VFC Images and re-submit the VSP",
+ errorCode.message());
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilderTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilderTest.java
new file mode 100644
index 0000000000..08c1c8c930
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilderTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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.vendorsoftwareproduct.errors;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class ComputeErrorBuilderTest {
+
+ @Test
+ public void testGetComputeNameFormatErrorBuilder() {
+ //when
+ ErrorCode errorCode = ComputeErrorBuilder.getComputeNameFormatErrorBuilder("");
+
+ //then
+ assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED, errorCode.id());
+ assertEquals(ErrorCategory.APPLICATION, errorCode.category());
+ assertEquals("Field does not conform to predefined criteria: name : must match ", errorCode.message());
+
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilderTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilderTest.java
new file mode 100644
index 0000000000..7fbf1ee7da
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilderTest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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.vendorsoftwareproduct.errors;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+public class CreatePackageForNonFinalVendorSoftwareProductErrorBuilderTest {
+
+ @Test
+ public void testBuild() {
+ //given
+ CreatePackageForNonFinalVendorSoftwareProductErrorBuilder
+ createPackageForNonFinalVendorSoftwareProductErrorBuilder =
+ new CreatePackageForNonFinalVendorSoftwareProductErrorBuilder("1", Version.valueOf("1.1"));
+
+ //when
+ ErrorCode errorCode = createPackageForNonFinalVendorSoftwareProductErrorBuilder.build();
+
+ //then
+ assertEquals(VendorSoftwareProductErrorCodes.CREATE_PACKAGE_FOR_NON_FINAL_VSP, errorCode.id());
+ assertEquals(ErrorCategory.APPLICATION, errorCode.category());
+ assertEquals(
+ "Package creation for vendor software product with id 1 and version 1.1 is not allowed since it is not final (submitted).",
+ errorCode.message());
+ }
+}