diff options
Diffstat (limited to 'csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java')
-rw-r--r-- | csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java index 5827f66..5e09e0a 100644 --- a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java +++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java @@ -17,6 +17,7 @@ package org.onap.validation.yaml; +import org.onap.validation.yaml.exception.YamlProcessingException; import org.onap.validation.yaml.model.YamlDocument; import java.net.URL; @@ -32,17 +33,21 @@ public final class YamlLoadingUtils { public static final int YAML_DOCUMENT_WITH_MISSING_FIELD_INDEX = 2; public static final int YAML_DOCUMENT_WITH_MISSING_FIELD_AND_WRONG_VALUE_INDEX = 1; - private static final String PATH_TO_VALID_YAML = "yaml_schema/PM_Dictionary.yaml"; + static final String PATH_TO_VALID_YAML = "yaml_schema/PM_Dictionary.yaml"; private static final String PATH_TO_SIMPLE_VALID_SCHEMA = "yaml_schema/Simple_Valid_Schema.yaml"; private static final String PATH_TO_SIMPLE_VALID_SCHEMA_MULTI_ROOT = "yaml_schema/Simple_Valid_Schema_Multi_Root.yaml"; private static final String PATH_TO_SIMPLE_INVALID_SCHEMA = "yaml_schema/Simple_Invalid_Schema_Construction.yaml"; private static final String PATH_TO_SIMPLE_INVALID_SCHEMA_FOR_LAZY_LOADING = "yaml_schema/Simple_Invalid_Schema_LazyLoading.yaml"; - private static final String PATH_TO_MULTI_DOCUMENT_INVALID_YAML = "yaml_schema/Multi_Document_Invalid.yaml"; + static final String PATH_TO_MULTI_DOCUMENT_INVALID_YAML = "yaml_schema/Multi_Document_Invalid.yaml"; public static List<YamlDocument> loadValidMultiDocumentYamlFile() throws YamlDocumentParsingException { return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_VALID_YAML)); } + public static List<YamlDocument> loadValidMultiDocumentYamlFileUsingStringPath() throws YamlProcessingException { + return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_VALID_YAML).getPath()); + } + public static YamlDocument loadSimpleValidYamlSchemaFile() throws YamlDocumentParsingException { return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_SIMPLE_VALID_SCHEMA)).get(0); } @@ -63,6 +68,10 @@ public final class YamlLoadingUtils { return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_MULTI_DOCUMENT_INVALID_YAML)); } + public static List<YamlDocument> tryToLoadMultiDocumentInvalidYamlFileUsingStringPath() throws YamlProcessingException { + return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_MULTI_DOCUMENT_INVALID_YAML).getPath()); + } + private static URL getUrlForGivenPath(String path) { return YamlLoadingUtils.class.getClassLoader().getResource(path); } |