summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/resource-dict/src/test/java
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-28 23:58:12 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-28 23:58:12 +0000
commitafee4df36caa1a979586c8badf160c3ff49b97a0 (patch)
treeddac0e2bef036b0d8cd1c5918b2af2076342650a /ms/controllerblueprints/modules/resource-dict/src/test/java
parent7c866aaefe19df34cb0c38e1f989179cf21dc497 (diff)
Controller Blueprints Microservice
Add Resource Assignment Validation Service and their Test cases. Change-Id: I106be2bfc03115867041ca341947a4662cf126c4 Issue-ID: CCSDK-487 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/controllerblueprints/modules/resource-dict/src/test/java')
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt56
1 files changed, 56 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
new file mode 100644
index 000000000..4d8301f4e
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
+
+import org.junit.Assert
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.slf4j.LoggerFactory
+/**
+ * ResourceAssignmentValidationServiceTest.
+ *
+ * @author Brinda Santh
+ */
+class ResourceAssignmentValidationServiceTest {
+ private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceTest::class.java)
+ @Test
+ fun testValidateSuccess() {
+ log.info("**************** testValidateSuccess *****************")
+ val assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment::class.java)
+ val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ val result = resourceAssignmentValidator.validate(assignments!!)
+ Assert.assertTrue("Failed to Validate", result)
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testValidateDuplicate() {
+ log.info(" **************** testValidateDuplicate *****************")
+ val assignments = JacksonUtils.getListFromClassPathFile("validation/duplicate.json", ResourceAssignment::class.java)
+ val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ resourceAssignmentValidator.validate(assignments!!)
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testValidateCyclic() {
+ log.info(" **************** testValidateCyclic *****************")
+ val assignments = JacksonUtils.getListFromClassPathFile("validation/cyclic.json", ResourceAssignment::class.java)
+ val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ resourceAssignmentValidator.validate(assignments!!)
+ }
+} \ No newline at end of file