* limitations under the License.\r
*/\r
\r
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict;\r
\r
import org.junit.Assert;\r
import org.junit.Test;\r
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
public class ResourceDictionaryValidationServiceTest {
private String basePath = "load/model_type";
String dictionaryPath = "load/resource_dictionary";
+ BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath);
@Test
- public void testValidate() throws Exception {
- BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath);
+ public void testValidateSource() throws Exception {
+
+ String inputFileName = dictionaryPath + "/db-source.json";
+ testValidate(inputFileName);
+
+ String dbFileName = dictionaryPath + "/db-source.json";
+ testValidate(dbFileName);
+
+ String defaultFileName = dictionaryPath + "/default-source.json";
+ testValidate(defaultFileName);
+
+ String restFileName = dictionaryPath + "/mdsal-source.json";
+ testValidate(restFileName);
+ }
+
+ private void testValidate(String fileName) throws Exception {
- String fileName = dictionaryPath + "/db-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition);
ResourceDictionaryValidationService resourceDictionaryValidationService =
new ResourceDictionaryDefaultValidationService(bluePrintRepoFileService);
resourceDictionaryValidationService.validate(resourceDefinition);
-
+ Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition);
}
}