diff options
Diffstat (limited to 'common-app-api/src')
4 files changed, 186 insertions, 0 deletions
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java new file mode 100644 index 0000000000..513c237035 --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP SDC + * ================================================================================ + * Copyright (C) 2019 Samsung. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.openecomp.sdc.be.config; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.config.EcompErrorConfiguration; +import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.impl.FSConfigurationSource; + +public class ConfigurationManagerTest { + + private ConfigurationManager configurationManager; + + @Before + public void setConfigurationSource() { + String appConfigDir = "src/test/resources/config/common"; + ConfigurationSource configurationSource = + new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + configurationManager = new ConfigurationManager(configurationSource); + } + + @Test + public void testGetConfiguration() { + assertEquals(configurationManager.getConfiguration(), + ConfigurationManager.getConfigurationManager().configurations.get(Configuration.class.getSimpleName())); + } + + @Test + public void testGetErrorConfiguration() { + assertEquals(configurationManager.getErrorConfiguration(), + ConfigurationManager.getConfigurationManager().configurations + .get(ErrorConfiguration.class.getSimpleName())); + } + + @Test + public void testGetEcompErrorConfiguration() { + assertEquals(configurationManager.getEcompErrorConfiguration(), + ConfigurationManager.getConfigurationManager().configurations + .get(EcompErrorConfiguration.class.getSimpleName())); + } + + @Test + public void testGetDistributionEngineConfiguration() { + assertEquals(configurationManager.getDistributionEngineConfiguration(), + ConfigurationManager.getConfigurationManager().configurations + .get(DistributionEngineConfiguration.class.getSimpleName())); + } + +} diff --git a/common-app-api/src/test/resources/config/common/configuration.yaml b/common-app-api/src/test/resources/config/common/configuration.yaml new file mode 100644 index 0000000000..59d4121116 --- /dev/null +++ b/common-app-api/src/test/resources/config/common/configuration.yaml @@ -0,0 +1,62 @@ +identificationHeaderFields: + - HTTP_IV_USER + +# catalog backend hostname +beFqdn: localhost +# sdccatalog.com + +# catalog backend http port +beHttpPort: 8080 + +# catalog backend http context +beContext: /sdc/rest/config/get + +# catalog backend protocol +beProtocol: http + +# catalog backend ssl port +beSslPort: 8443 + +version: 1.1.0 +released: 2012-11-30 +toscaConformanceLevel: 8.0 +minToscaConformanceLevel: 3.0 + +titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties +titanInMemoryGraph: false +titanLockTimeout: 1800 + +# The interval to try and reconnect to titan DB when it is down during ASDC startup: +titanReconnectIntervalInSeconds: 3 + +# The read timeout towards Titan DB when health check is invoked: +titanHealthCheckReadTimeout: 1 + +# The interval to try and reconnect to Elasticsearch when it is down during ASDC startup: +esReconnectIntervalInSeconds: 3 +uebHealthCheckReconnectIntervalInSeconds: 15 +uebHealthCheckReadTimeout: 4 + +# Protocols +protocols: + - http + - https + +# Default imports +defaultImports: + - nodes: + file: nodes.yml + - datatypes: + file: data.yml + - capabilities: + file: capabilities.yml + - relationships: + file: relationships.yml + - groups: + file: groups.yml + - policies: + file: policies.yml + +# Users +users: + tom: passwd diff --git a/common-app-api/src/test/resources/config/common/ecomp-error-configuration.yaml b/common-app-api/src/test/resources/config/common/ecomp-error-configuration.yaml new file mode 100644 index 0000000000..64bd77e0bb --- /dev/null +++ b/common-app-api/src/test/resources/config/common/ecomp-error-configuration.yaml @@ -0,0 +1,25 @@ +errors: + + BeRestApiGeneralError: { + type: SYSTEM_ERROR, + code: ASDC_4000, + severity: ERROR, + description: "Unexpected error during BE REST API execution", + alarmSeverity: CRITICAL + } + + BeHealthCheckError: { + type: SYSTEM_ERROR, + code: ASDC_3010, + severity: ERROR, + description: "Error during BE Health Check", + alarmSeverity: CRITICAL + } + + BeInitializationError: { + type: SYSTEM_ERROR, + code: ASDC_4019, + severity: ERROR, + description: "Catalog-BE was not initialized properly", + alarmSeverity: CRITICAL + }
\ No newline at end of file diff --git a/common-app-api/src/test/resources/config/common/error-configuration.yaml b/common-app-api/src/test/resources/config/common/error-configuration.yaml new file mode 100644 index 0000000000..9db9bbdc58 --- /dev/null +++ b/common-app-api/src/test/resources/config/common/error-configuration.yaml @@ -0,0 +1,26 @@ +# Errors +errors: + OK: { + code: 200, + message: "OK" + } + CREATED: { + code: 201, + message: "OK" + } + NO_CONTENT: { + code: 204, + message: "No Content" + } +#--------POL4050----------------------------- + NOT_ALLOWED: { + code: 405, + message: "Error: Method not allowed.", + messageId: "POL4050" + } +#--------POL5000----------------------------- + GENERAL_ERROR: { + code: 500, + message: "Error: Internal Server Error. Please try again later.", + messageId: "POL5000" + } |