From afee4df36caa1a979586c8badf160c3ff49b97a0 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 28 Aug 2018 23:58:12 +0000 Subject: 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) --- .../ResourceAssignmentValidationServiceTest.kt | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt (limited to 'ms/controllerblueprints/modules/resource-dict/src/test/java') 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 -- cgit 1.2.3-korg