X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Futil%2FArtifactTestUtils.java;h=a98b7c2a5eecb70eb28814d08cfce0f62109209f;hb=60457e41054465e9fa10c8e6bfdbfa62a45d1f0a;hp=445dd847347f2a8b016f0707e8594f1b10cf85a6;hpb=4217e6f7018d08b11291490b3ad5c54064cdc031;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 445dd84..a98b7c2 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. @@ -44,7 +44,6 @@ import org.apache.commons.io.IOUtils; import org.custommonkey.xmlunit.Diff; import org.onap.aai.babel.parser.ArtifactGeneratorToscaParser; import org.onap.aai.babel.xml.generator.data.Artifact; -import org.onap.aai.babel.xml.generator.data.WidgetConfigurationUtil; import org.xml.sax.SAXException; /** @@ -52,29 +51,26 @@ import org.xml.sax.SAXException; */ public class ArtifactTestUtils { + public static final String CSAR_INPUTS_FOLDER = "compressedArtifacts/"; private static final String JSON_REQUESTS_FOLDER = "jsonFiles/"; private static final String JSON_RESPONSES_FOLDER = "response/"; - private static final String CSAR_INPUTS_FOLDER = "compressedArtifacts/"; /** - * Initialise System Properties for test configuration files. + * 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)); } /** - * Load the Widget to UUID mappings from the Artifact Generator Properties (resource). + * Load the Widget type mappings (resource). * * @throws IOException - * if the properties file is not loaded + * if the configuration file is not loaded */ - public void loadWidgetToUuidMappings() throws IOException { - WidgetConfigurationUtil.setConfig(getResourceAsProperties(Resources.ARTIFACT_GENERATOR_CONFIG)); + public void loadWidgetMappings() throws IOException { + ArtifactGeneratorToscaParser.initToscaMappingsConfiguration(getResourcePath(Resources.TOSCA_MAPPING_CONFIG)); } /** @@ -131,7 +127,11 @@ public class ArtifactTestUtils { } public String loadResourceAsString(String resourceName) throws IOException { + try { return IOUtils.toString(getResource(resourceName), Charset.defaultCharset()); + } catch (NullPointerException e) { + throw new IllegalArgumentException("No such resource " + resourceName); + } } public String getRequestJson(String resource) throws IOException {