X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Futil%2FArtifactTestUtils.java;h=df27c22fcb1f018a0e4c58657f814f0ee05fdb5b;hb=ff0718120f36e14b065047f0b3f29665f2191e53;hp=6608c0096ffa79b20eb26a5f6d33a1dfd1beb76d;hpb=7fcc74469c941c1834cd02b54ff5ca88a53bf83b;p=aai%2Fbabel.git diff --git a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java index 6608c00..df27c22 100644 --- a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java +++ b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2019 European Software Marketing Ltd. + * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,12 +56,15 @@ public class ArtifactTestUtils { private static final String JSON_RESPONSES_FOLDER = "response/"; private static final String CSAR_INPUTS_FOLDER = "compressedArtifacts/"; + /** + * Initialize System Properties for test configuration files. + */ public void setGeneratorSystemProperties() { System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE, getResourcePath(Resources.ARTIFACT_GENERATOR_CONFIG)); - System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_GROUP_FILTERS_CONFIG_FILE, - getResourcePath(Resources.FILTER_TYPES_CONFIG)); + System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_TOSCA_MAPPING_FILE, + getResourcePath(Resources.TOSCA_MAPPING_CONFIG)); } /** @@ -74,6 +77,16 @@ public class ArtifactTestUtils { WidgetConfigurationUtil.setConfig(getResourceAsProperties(Resources.ARTIFACT_GENERATOR_CONFIG)); } + /** + * Load the Widget type mappings (resource). + * + * @throws IOException + * if the configuration file is not loaded + */ + public void loadWidgetMappings() throws IOException { + ArtifactGeneratorToscaParser.initToscaMappingsConfiguration(getResourcePath(Resources.TOSCA_MAPPING_CONFIG)); + } + /** * Specific test method for the YAML Extractor test. * @@ -143,6 +156,15 @@ public class ArtifactTestUtils { return Files.lines(Paths.get(getResource(resourceFile).toURI())).collect(Collectors.joining()); } + /** + * Create Properties from the content of the named resource (e.g. a file on the classpath). + * + * @param resourceName + * the resource name + * @return Properties loaded from the named resource + * @throws IOException + * if an error occurred when reading from the named resource + */ public Properties getResourceAsProperties(String resourceName) throws IOException { final Properties properties = new Properties(); InputStream in = ArtifactTestUtils.class.getClassLoader().getResourceAsStream(resourceName);