2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.sdc.impl;
23 import org.onap.sdc.tosca.parser.config.ErrorConfiguration;
24 import org.onap.sdc.tosca.parser.config.JtoscaValidationIssueConfiguration;
25 import org.testng.annotations.Test;
26 import org.onap.sdc.tosca.parser.config.Configuration;
27 import org.onap.sdc.tosca.parser.config.ConfigurationManager;
29 import static org.testng.Assert.assertEquals;
30 import static org.testng.Assert.assertNotNull;
32 public class ToscaParserConfigurationTest extends SdcToscaParserBasicTest {
35 public void testConfigurationConformanceLevel() {
36 Configuration config = ConfigurationManager.getInstance().getConfiguration();
37 assertNotNull(config);
38 assertNotNull(config.getConformanceLevel());
39 assertNotNull(config.getConformanceLevel().getMaxVersion());
40 assertNotNull(config.getConformanceLevel().getMinVersion());
45 public void testErrorConfigurations() {
46 ErrorConfiguration errorConfig = ConfigurationManager.getInstance().getErrorConfiguration();
47 assertNotNull(errorConfig);
48 assertNotNull(errorConfig.getErrors());
52 public void testSetErrorConfiguration() {
53 ConfigurationManager configurationManager = ConfigurationManager.getInstance();
55 configurationManager.setErrorConfiguration("error-configuration-test.yaml");
56 ErrorConfiguration errorConfig = configurationManager.getErrorConfiguration();
58 errorConfig.getErrorInfo("CONFORMANCE_LEVEL_ERROR").getFailOnError());
59 assertEquals(true, errorConfig.getErrorInfo("FILE_NOT_FOUND").getFailOnError());
62 // Reset the configuration for other tests
63 configurationManager.setErrorConfiguration("error-configuration.yaml");
68 public void testSetJtoscaValidationIssueConfiguration() {
69 ConfigurationManager configurationManager = ConfigurationManager.getInstance();
71 configurationManager.setJtoscaValidationIssueConfiguration(
72 "jtosca-validation-issue-configuration-test.yaml");
73 JtoscaValidationIssueConfiguration issueConfig = configurationManager
74 .getJtoscaValidationIssueConfiguration();
75 assertNotNull(issueConfig);
78 // Reset the configuration for other tests
79 configurationManager.setJtoscaValidationIssueConfiguration
80 ("jtosca-validation-issue-configuration.yaml");