From 42c920baf4dbb9fe8775843a6d4c9f70fa29f064 Mon Sep 17 00:00:00 2001 From: amitjai Date: Fri, 27 Apr 2018 13:28:57 +0530 Subject: Rename packages from openecomp to onap. This task is all about package name space change also make changes to pom for common module Change-Id: Ie9bda0f958a9a05826c0374830cc9cb7d6d196b6 Issue-ID: SDC-1272 Signed-off-by: amitjai --- .../openecomp-configuration-management-api/pom.xml | 15 - .../main/java/org/openecomp/config/api/Config.java | 21 - .../org/openecomp/config/api/Configuration.java | 831 -------------- .../config/api/ConfigurationChangeListener.java | 14 - .../openecomp/config/api/ConfigurationManager.java | 98 -- .../openecomp/config/api/DynamicConfiguration.java | 146 --- .../main/java/org/openecomp/config/api/Hint.java | 18 - .../openecomp-configuration-management-cli/pom.xml | 55 - .../openecomp/config/cli/app/Configuration.java | 119 -- .../openecomp/config/gui/app/Configuration.java | 623 ----------- .../pom.xml | 128 --- .../org/openecomp/config/ConfigurationUtils.java | 1143 -------------------- .../main/java/org/openecomp/config/Constants.java | 14 - .../org/openecomp/config/NonConfigResource.java | 95 -- .../config/impl/AgglomerateConfiguration.java | 33 - .../config/impl/AggregateConfiguration.java | 172 --- .../config/impl/CliConfigurationImpl.java | 354 ------ .../config/impl/ConfigurationChangeNotifier.java | 476 -------- .../config/impl/ConfigurationDataSource.java | 105 -- .../openecomp/config/impl/ConfigurationFilter.java | 39 - .../openecomp/config/impl/ConfigurationImpl.java | 684 ------------ .../config/impl/ConfigurationRepository.java | 415 ------- .../org/openecomp/config/impl/ContextListener.java | 28 - .../openecomp/config/impl/YamlConfiguration.java | 18 - .../openecomp/config/type/ConfigurationMode.java | 5 - .../openecomp/config/type/ConfigurationQuery.java | 94 -- .../openecomp/config/type/ConfigurationType.java | 5 - .../openecomp/config/type/ConfigurationUpdate.java | 33 - .../org.openecomp.config.api.ConfigurationManager | 1 - .../src/main/resources/config-system.properties | 22 - .../src/main/resources/management.properties | 7 - .../openecomp/config/ConfigurationUtilsTest.java | 32 - .../pom.xml | 84 -- .../java/org/openecomp/config/TestCMSuite.java | 58 - .../config/test/CLIFallbackAndLookupTest.java | 83 -- .../java/org/openecomp/config/test/CLITest.java | 107 -- .../config/test/ConfigSourceLocationTest.java | 53 - .../config/test/DynamicConfigurationTest.java | 66 -- .../openecomp/config/test/FallbackConfigTest.java | 39 - .../config/test/FallbackToGlobalNSTest.java | 42 - .../config/test/GlobalAndNSConfigTest.java | 45 - .../config/test/JAVAPropertiesConfigTest.java | 40 - .../org/openecomp/config/test/JSONConfigTest.java | 41 - .../config/test/LoadOrderMergeAndOverrideTest.java | 47 - .../config/test/ModeAsConfigPropTest.java | 88 -- .../config/test/MultiTenancyConfigTest.java | 55 - .../openecomp/config/test/NodeSpecificCLITest.java | 117 -- .../config/test/NotificationForNodeConfigTest.java | 85 -- .../config/test/NotificationOnPropValTest.java | 76 -- .../test/ResourceChangeNotificationTest.java | 91 -- .../config/test/UnregisterNotificationTest.java | 94 -- .../config/test/ValidateDefaultModeTest.java | 60 - .../config/test/ValidateNodeConfigTest.java | 80 -- .../org/openecomp/config/test/XMLConfigTest.java | 41 - .../org/openecomp/config/test/YAMLConfigTest.java | 41 - .../openecomp/config/util/ConfigTestConstant.java | 23 - .../java/org/openecomp/config/util/TestUtil.java | 95 -- .../src/test/resources/CLI/config-NS.properties | 12 - .../src/test/resources/CLI/config.json | 8 - .../src/test/resources/CLI/config.properties | 3 - .../src/test/resources/CLI/config.xml | 18 - .../src/test/resources/CLI/config.yaml | 8 - .../resources/CLIFallback/config-NS.properties | 12 - .../src/test/resources/CLIFallback/config.json | 8 - .../test/resources/CLIFallback/config.properties | 3 - .../src/test/resources/CLIFallback/config.xml | 18 - .../src/test/resources/CLIFallback/config.yaml | 8 - .../resources/DynamicConfiguration/config.json | 8 - .../DynamicConfiguration/config.properties | 13 - .../test/resources/DynamicConfiguration/config.xml | 18 - .../resources/DynamicConfiguration/config.yaml | 8 - .../FallbackToGlobalNS/config-NS.properties | 13 - .../test/resources/FallbackToGlobalNS/config.json | 9 - .../resources/FallbackToGlobalNS/config.properties | 3 - .../test/resources/FallbackToGlobalNS/config.xml | 19 - .../test/resources/FallbackToGlobalNS/config.yaml | 8 - .../test/resources/GlobalAndNSConfig/config.json | 10 - .../resources/GlobalAndNSConfig/config.properties | 10 - .../test/resources/GlobalAndNSConfig/config.xml | 16 - .../test/resources/GlobalAndNSConfig/config.yaml | 7 - .../test/resources/JSONConfiguration/config-M.json | 16 - .../test/resources/JSONConfiguration/config-O.json | 11 - .../test/resources/JSONConfiguration/config-U.json | 11 - .../test/resources/JSONConfiguration/config.json | 30 - .../LoadOrderConfiguration/config-M.properties | 9 - .../LoadOrderConfiguration/config-O.properties | 7 - .../LoadOrderConfiguration/config-U.properties | 5 - .../config-loadorder-M.properties | 9 - .../config-loadorder-O.properties | 7 - .../LoadOrderConfiguration/config.properties | 14 - .../MergeStrategyAsConfigProp/config.json | 8 - .../MergeStrategyAsConfigProp/config.properties | 10 - .../resources/MergeStrategyAsConfigProp/config.xml | 16 - .../MergeStrategyAsConfigProp/config.yaml | 8 - .../src/test/resources/NodeCLI/config.properties | 9 - .../test/resources/Notification/config.properties | 15 - .../test/resources/NotificationForNodeConfig.zip | Bin 1705 -> 0 bytes .../NotificationForNodeConfig/config.json | 12 - .../NotificationForNodeConfig/config.properties | 14 - .../resources/NotificationForNodeConfig/config.xml | 18 - .../NotificationForNodeConfig/config.yaml | 8 - .../NotificationOnPropVal/config-NS.properties | 13 - .../resources/NotificationOnPropVal/config.json | 9 - .../NotificationOnPropVal/config.properties | 3 - .../resources/NotificationOnPropVal/config.xml | 18 - .../resources/NotificationOnPropVal/config.yaml | 9 - .../resources/SourceLocation/appjarconfig.json | 10 - .../SourceLocation/appjarconfig.properties | 14 - .../test/resources/SourceLocation/appjarconfig.xml | 19 - .../resources/SourceLocation/appjarconfig.yaml | 8 - .../UnregisterNotification/config-NS.properties | 13 - .../resources/UnregisterNotification/config.json | 9 - .../UnregisterNotification/config.properties | 3 - .../resources/UnregisterNotification/config.xml | 18 - .../resources/UnregisterNotification/config.yaml | 9 - .../ValidateDefaultMode/config-defaultmode.json | 8 - .../config-defaultmode.properties | 2 - .../ValidateNodeConfig/config-NS.properties | 13 - .../resources/ValidateNodeConfig/config.properties | 3 - .../test/resources/XMLConfiguration/config-M.xml | 19 - .../test/resources/XMLConfiguration/config-O.xml | 14 - .../test/resources/XMLConfiguration/config-U.xml | 14 - .../src/test/resources/XMLConfiguration/config.xml | 25 - .../test/resources/YAMLConfiguration/config-M.yaml | 12 - .../test/resources/YAMLConfiguration/config-O.yaml | 8 - .../test/resources/YAMLConfiguration/config-U.yaml | 8 - .../test/resources/YAMLConfiguration/config.yaml | 27 - .../src/test/resources/config-system.properties | 22 - .../resources/fallback/config-fallback-merge.xml | 15 - .../fallback/config-fallback-override.json | 7 - .../resources/fallback/config-fallback-union.yaml | 5 - .../resources/fallback/config-fallback.properties | 13 - .../resources/java-properties/config-M.properties | 7 - .../resources/java-properties/config-O.properties | 5 - .../resources/java-properties/config-U.properties | 5 - .../resources/java-properties/config.properties | 14 - .../resources/multitenancy/config-at.properties | 11 - .../resources/multitenancy/config-tf.properties | 10 - .../resources/multitenancy/config-vf.properties | 11 - .../test/resources/multitenancy/config.properties | 11 - .../pom.xml | 30 - 141 files changed, 8445 deletions(-) delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-api/pom.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Config.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationManager.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-cli/pom.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/cli/app/Configuration.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/gui/app/Configuration.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/Constants.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/NonConfigResource.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AgglomerateConfiguration.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/CliConfigurationImpl.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationChangeNotifier.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationFilter.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationImpl.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationRepository.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ContextListener.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/YamlConfiguration.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationMode.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationQuery.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationType.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationUpdate.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/META-INF/services/org.openecomp.config.api.ConfigurationManager delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/management.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/test/java/org/openecomp/config/ConfigurationUtilsTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/pom.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/TestCMSuite.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLIFallbackAndLookupTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLITest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ConfigSourceLocationTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/DynamicConfigurationTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackToGlobalNSTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/GlobalAndNSConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JAVAPropertiesConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JSONConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/LoadOrderMergeAndOverrideTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ModeAsConfigPropTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/MultiTenancyConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NodeSpecificCLITest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationForNodeConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationOnPropValTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ResourceChangeNotificationTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/UnregisterNotificationTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateDefaultModeTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateNodeConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/XMLConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/YAMLConfigTest.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/ConfigTestConstant.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/TestUtil.java delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config-NS.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config-NS.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config-NS.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-M.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-O.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-U.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-M.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-O.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-U.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-M.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-O.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NodeCLI/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/Notification/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig.zip delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config-NS.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config-NS.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config-NS.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-M.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-O.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-U.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-M.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-O.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-U.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-merge.xml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-override.json delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-union.yaml delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-M.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-O.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-U.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-at.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-tf.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-vf.properties delete mode 100644 common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config.properties delete mode 100644 common/openecomp-common-configuration-management/pom.xml (limited to 'common/openecomp-common-configuration-management') diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/pom.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/pom.xml deleted file mode 100644 index 0a06aa3f4e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - 4.0.0 - - openecomp-configuration-management-api - openecomp-configuration-management-api - - - openecomp-common-configuration-management - org.openecomp.sdc.common - 1.2.0-SNAPSHOT - .. - - - diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Config.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Config.java deleted file mode 100644 index 2859ce639b..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Config.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openecomp.config.api; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * The interface Config. - */ -@Target({ElementType.TYPE, ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface Config { - - /** - * Key string. - * - * @return the string - */ - String key() default ""; -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java deleted file mode 100644 index 07db4ab3aa..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java +++ /dev/null @@ -1,831 +0,0 @@ -package org.openecomp.config.api; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * The interface Configuration. - */ -public interface Configuration { - /** - * The constant tenant. - */ - public static ThreadLocal tenant = new ThreadLocal<>(); - - /** - * Sets tenant id. - * - * @param id the id - */ - public static void setTenantId(String id) { - if (id != null && id.trim().length() > 0) { - tenant.set(id); - } - } - - /** - * Gets as string. - * - * @param key the key - * @return the as string - */ - public default String getAsString(String key) { - return getAsString(null, key); - } - - /** - * Gets as string. - * - * @param namespace the namespace - * @param key the key - * @return the as string - */ - public default String getAsString(String namespace, String key) { - return getAsString(tenant.get(), namespace, key); - } - - /** - * Gets as string. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as string - */ - public default String getAsString(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, String.class); - } - - /** - * Gets as byte value. - * - * @param key the key - * @return the as byte value - */ - public default Byte getAsByteValue(String key) { - return getAsByteValue(null, key); - } - - /** - * Gets as byte value. - * - * @param namespace the namespace - * @param key the key - * @return the as byte value - */ - public default Byte getAsByteValue(String namespace, String key) { - return getAsByteValue(tenant.get(), namespace, key); - } - - /** - * Gets as byte value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as byte value - */ - public default Byte getAsByteValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Byte.class); - } - - /** - * Gets as short value. - * - * @param key the key - * @return the as short value - */ - public default Short getAsShortValue(String key) { - return getAsShortValue(null, key); - } - - /** - * Gets as short value. - * - * @param namespace the namespace - * @param key the key - * @return the as short value - */ - public default Short getAsShortValue(String namespace, String key) { - return getAsShortValue(tenant.get(), namespace, key); - } - - /** - * Gets as short value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as short value - */ - public default Short getAsShortValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Short.class); - } - - /** - * Gets as integer value. - * - * @param key the key - * @return the as integer value - */ - public default Integer getAsIntegerValue(String key) { - return getAsIntegerValue(null, key); - } - - /** - * Gets as integer value. - * - * @param namespace the namespace - * @param key the key - * @return the as integer value - */ - public default Integer getAsIntegerValue(String namespace, String key) { - return getAsIntegerValue(tenant.get(), namespace, key); - } - - /** - * Gets as integer value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as integer value - */ - public default Integer getAsIntegerValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Integer.class); - } - - /** - * Gets as long value. - * - * @param key the key - * @return the as long value - */ - public default Long getAsLongValue(String key) { - return getAsLongValue(null, key); - } - - /** - * Gets as long value. - * - * @param namespace the namespace - * @param key the key - * @return the as long value - */ - public default Long getAsLongValue(String namespace, String key) { - return getAsLongValue(tenant.get(), namespace, key); - } - - /** - * Gets as long value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as long value - */ - public default Long getAsLongValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Long.class); - } - - /** - * Gets as float value. - * - * @param key the key - * @return the as float value - */ - public default Float getAsFloatValue(String key) { - return getAsFloatValue(null, key); - } - - /** - * Gets as float value. - * - * @param namespace the namespace - * @param key the key - * @return the as float value - */ - public default Float getAsFloatValue(String namespace, String key) { - return getAsFloatValue(tenant.get(), namespace, key); - } - - /** - * Gets as float value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as float value - */ - public default Float getAsFloatValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Float.class); - } - - /** - * Gets as double value. - * - * @param key the key - * @return the as double value - */ - public default Double getAsDoubleValue(String key) { - return getAsDoubleValue(null, key); - } - - /** - * Gets as double value. - * - * @param namespace the namespace - * @param key the key - * @return the as double value - */ - public default Double getAsDoubleValue(String namespace, String key) { - return getAsDoubleValue(tenant.get(), namespace, key); - } - - /** - * Gets as double value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as double value - */ - public default Double getAsDoubleValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Double.class); - } - - /** - * Gets as boolean value. - * - * @param key the key - * @return the as boolean value - */ - public default Boolean getAsBooleanValue(String key) { - return getAsBooleanValue(null, key); - } - - /** - * Gets as boolean value. - * - * @param namespace the namespace - * @param key the key - * @return the as boolean value - */ - public default Boolean getAsBooleanValue(String namespace, String key) { - return getAsBooleanValue(tenant.get(), namespace, key); - } - - /** - * Gets as boolean value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as boolean value - */ - public default Boolean getAsBooleanValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Boolean.class); - } - - /** - * Gets as char value. - * - * @param key the key - * @return the as char value - */ - public default Character getAsCharValue(String key) { - return getAsCharValue(null, key); - } - - /** - * Gets as char value. - * - * @param namespace the namespace - * @param key the key - * @return the as char value - */ - public default Character getAsCharValue(String namespace, String key) { - return getAsCharValue(tenant.get(), namespace, key); - } - - /** - * Gets as char value. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as char value - */ - public default Character getAsCharValue(String tenantId, String namespace, String key) { - return get(tenantId, namespace, key, Character.class); - } - - /** - * Populate configuration t. - * - * @param the type parameter - * @param clazz the clazz - * @return the t - */ - public default T populateConfiguration(Class clazz) { - return populateConfiguration(null, clazz); - } - - /** - * Populate configuration t. - * - * @param the type parameter - * @param namespace the namespace - * @param clazz the clazz - * @return the t - */ - public default T populateConfiguration(String namespace, Class clazz) { - return populateConfiguration(tenant.get(), namespace, clazz); - } - - /** - * Populate configuration t. - * - * @param the type parameter - * @param tenantId the tenant id - * @param namespace the namespace - * @param clazz the clazz - * @return the t - */ - public default T populateConfiguration(String tenantId, String namespace, Class clazz) { - return get(tenantId, namespace, null, clazz, Hint.EXTERNAL_LOOKUP); - } - - /** - * Gets dynamic configuration. - * - * @param the type parameter - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @return the dynamic configuration - */ - public default DynamicConfiguration getDynamicConfiguration(String key, Class clazz, - T defaultValue) { - return getDynamicConfiguration(null, key, clazz, defaultValue); - } - - /** - * Gets dynamic configuration. - * - * @param the type parameter - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @return the dynamic configuration - */ - public default DynamicConfiguration getDynamicConfiguration(String namespace, String key, - Class clazz, - T defaultValue) { - return getDynamicConfiguration(tenant.get(), namespace, key, clazz, defaultValue); - } - - /** - * Gets dynamic configuration. - * - * @param the type parameter - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @return the dynamic configuration - */ - public default DynamicConfiguration getDynamicConfiguration(String tenant, - String namespace, String key, - Class clazz, - T defaultValue) { - return DynamicConfiguration - .getDynamicConfiguration(tenant, namespace, key, clazz, defaultValue, this); - } - - /** - * Gets dynamic configuration values. - * - * @param the type parameter - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @return the dynamic configuration values - */ - public default DynamicConfiguration> getDynamicConfigurationValues(String key, - Class clazz, - T defaultValue) { - return getDynamicConfigurationValues(null, key, clazz, defaultValue); - } - - /** - * Gets dynamic configuration values. - * - * @param the type parameter - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @return the dynamic configuration values - */ - public default DynamicConfiguration> getDynamicConfigurationValues(String namespace, - String key, - Class clazz, - T defaultValue) { - return getDynamicConfigurationValues(tenant.get(), namespace, key, clazz, defaultValue); - } - - /** - * Gets dynamic configuration values. - * - * @param the type parameter - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @return the dynamic configuration values - */ - public default DynamicConfiguration> getDynamicConfigurationValues(String tenant, - String namespace, - String key, - Class clazz, - T defaultValue) { - return DynamicConfiguration - .getDynConfiguration(tenant, namespace, key, clazz, defaultValue, this); - } - - /** - * Gets as string values. - * - * @param key the key - * @return the as string values - */ - public default List getAsStringValues(String key) { - return getAsStringValues(null, key); - } - - /** - * Gets as string values. - * - * @param namespace the namespace - * @param key the key - * @return the as string values - */ - public default List getAsStringValues(String namespace, String key) { - return getAsStringValues(tenant.get(), namespace, key); - } - - /** - * Gets as string values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as string values - */ - public default List getAsStringValues(String tenantId, String namespace, String key) { - String[] tempArray = get(tenantId, namespace, key, String[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Gets as byte values. - * - * @param key the key - * @return the as byte values - */ - public default List getAsByteValues(String key) { - return getAsByteValues(null, key); - } - - /** - * Gets as byte values. - * - * @param namespace the namespace - * @param key the key - * @return the as byte values - */ - public default List getAsByteValues(String namespace, String key) { - return getAsByteValues(tenant.get(), namespace, key); - } - - /** - * Gets as byte values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as byte values - */ - public default List getAsByteValues(String tenantId, String namespace, String key) { - Byte[] tempArray = get(tenantId, namespace, key, Byte[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Gets as short values. - * - * @param key the key - * @return the as short values - */ - public default List getAsShortValues(String key) { - return getAsShortValues(null, key); - } - - /** - * Gets as short values. - * - * @param namespace the namespace - * @param key the key - * @return the as short values - */ - public default List getAsShortValues(String namespace, String key) { - return getAsShortValues(tenant.get(), namespace, key); - } - - /** - * Gets as short values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as short values - */ - public default List getAsShortValues(String tenantId, String namespace, String key) { - Short[] tempArray = get(tenantId, namespace, key, Short[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Gets as integer values. - * - * @param key the key - * @return the as integer values - */ - public default List getAsIntegerValues(String key) { - return getAsIntegerValues(null, key); - } - - /** - * Gets as integer values. - * - * @param namespace the namespace - * @param key the key - * @return the as integer values - */ - public default List getAsIntegerValues(String namespace, String key) { - return getAsIntegerValues(tenant.get(), namespace, key); - } - - /** - * Gets as integer values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as integer values - */ - public default List getAsIntegerValues(String tenantId, String namespace, String key) { - Integer[] tempArray = get(tenantId, namespace, key, Integer[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Gets as double values. - * - * @param key the key - * @return the as double values - */ - public default List getAsDoubleValues(String key) { - return getAsDoubleValues(null, key); - } - - /** - * Gets as double values. - * - * @param namespace the namespace - * @param key the key - * @return the as double values - */ - public default List getAsDoubleValues(String namespace, String key) { - return getAsDoubleValues(tenant.get(), namespace, key); - } - - /** - * Gets as double values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as double values - */ - public default List getAsDoubleValues(String tenantId, String namespace, String key) { - Double[] tempArray = get(tenantId, namespace, key, Double[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Gets as float values. - * - * @param key the key - * @return the as float values - */ - public default List getAsFloatValues(String key) { - return getAsFloatValues(null, key); - } - - /** - * Gets as float values. - * - * @param namespace the namespace - * @param key the key - * @return the as float values - */ - public default List getAsFloatValues(String namespace, String key) { - return getAsFloatValues(tenant.get(), namespace, key); - } - - /** - * Gets as float values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as float values - */ - public default List getAsFloatValues(String tenantId, String namespace, String key) { - Float[] tempArray = get(tenantId, namespace, key, Float[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Gets as boolean values. - * - * @param key the key - * @return the as boolean values - */ - public default List getAsBooleanValues(String key) { - return getAsBooleanValues(null, key); - } - - /** - * Gets as boolean values. - * - * @param namespace the namespace - * @param key the key - * @return the as boolean values - */ - public default List getAsBooleanValues(String namespace, String key) { - return getAsBooleanValues(tenant.get(), namespace, key); - } - - /** - * Gets as boolean values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as boolean values - */ - public default List getAsBooleanValues(String tenantId, String namespace, String key) { - Boolean[] tempArray = get(tenantId, namespace, key, Boolean[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Gets as character values. - * - * @param key the key - * @return the as character values - */ - public default List getAsCharacterValues(String key) { - return getAsCharacterValues(null, key); - } - - /** - * Gets as character values. - * - * @param namespace the namespace - * @param key the key - * @return the as character values - */ - public default List getAsCharacterValues(String namespace, String key) { - return getAsCharacterValues(tenant.get(), namespace, key); - } - - /** - * Gets as character values. - * - * @param tenantId the tenant id - * @param namespace the namespace - * @param key the key - * @return the as character values - */ - public default List getAsCharacterValues(String tenantId, String namespace, - String key) { - Character[] tempArray = get(tenantId, namespace, key, Character[].class); - return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray); - } - - /** - * Get t. - * - * @param the type parameter - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param hints the hints - * @return the t - */ - public T get(String tenant, String namespace, String key, Class clazz, Hint... hints); - - /** - * Add configuration change listener. - * - * @param key the key - * @param myself the myself - */ - public default void addConfigurationChangeListener(String key, - ConfigurationChangeListener myself) { - addConfigurationChangeListener(null, key, myself); - } - - /** - * Add configuration change listener. - * - * @param namespace the namespace - * @param key the key - * @param myself the myself - */ - public default void addConfigurationChangeListener(String namespace, String key, - ConfigurationChangeListener myself) { - addConfigurationChangeListener(tenant.get(), namespace, key, myself); - } - - /** - * Add configuration change listener. - * - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param myself the myself - */ - public void addConfigurationChangeListener(String tenant, String namespace, String key, - ConfigurationChangeListener myself); - - /** - * Remove configuration change listener. - * - * @param key the key - * @param myself the myself - */ - public default void removeConfigurationChangeListener(String key, - ConfigurationChangeListener myself) { - removeConfigurationChangeListener(null, key, myself); - } - - /** - * Remove configuration change listener. - * - * @param namespace the namespace - * @param key the key - * @param myself the myself - */ - public default void removeConfigurationChangeListener(String namespace, String key, - ConfigurationChangeListener myself) { - removeConfigurationChangeListener(tenant.get(), namespace, key, myself); - } - - /** - * Remove configuration change listener. - * - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param myself the myself - */ - public void removeConfigurationChangeListener(String tenant, String namespace, String key, - ConfigurationChangeListener myself); - - public default Map populateMap(String key, Class clazz){ - return populateMap(null, key, clazz); - } - public default Map populateMap(String namespace, String key, Class clazz){ - return populateMap(tenant.get(), namespace, key, clazz); - } - public Map populateMap(String tenantId, String namespace, String key, Class clazz); - - public default Map generateMap(String key){ - return generateMap(null, key); - } - public default Map generateMap(String namespace, String key){ - return generateMap(tenant.get(), namespace, key); - } - public Map generateMap(String tenantId, String namespace, String key); - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java deleted file mode 100644 index f7510aef0a..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.openecomp.config.api; - -public interface ConfigurationChangeListener { - - public default void notify(String tenantId, String component, String key, Object oldValue, - Object newValue) { - } - - public default void notify(String component, String key, Object oldValue, Object newValue) { - } - - public default void notify(String key, Object oldValue, Object newValue) { - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationManager.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationManager.java deleted file mode 100644 index ffa9255f2c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationManager.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.openecomp.config.api; - - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Proxy; -import java.util.Collection; -import java.util.Map; -import java.util.ServiceLoader; - -/** - * The interface Configuration manager. - */ -public interface ConfigurationManager extends Configuration { - - /** - * The constant config. - */ - public static final Configuration config = lookup(); - - /** - * Lookup configuration. - * - * @return the configuration - */ - public static Configuration lookup() { - if (config == null) { - ServiceLoader loader = ServiceLoader.load(ConfigurationManager.class); - for (ConfigurationManager configuration : loader) { - return (Configuration) Proxy.newProxyInstance(ConfigurationManager.class.getClassLoader(), - new Class[]{Configuration.class}, (object, method, args) -> { - try { - return method.invoke(configuration, args); - } catch (InvocationTargetException ite) { - throw ite.getTargetException(); - } - }); - } - } - return config; - } - - /** - * Gets configuration value. - * - * @param queryData the query data - * @return the configuration value - */ - public String getConfigurationValue(Map queryData); - - /** - * Update configuration value. - * - * @param updateData the update data - */ - public void updateConfigurationValue(Map updateData); - - /** - * List configuration map. - * - * @param query the query - * @return the map - */ - public Map listConfiguration(Map query); - - /** - * Update configuration values boolean. - * - * @param tenant the tenant - * @param namespace the namespace - * @param configKeyValueStore the config key value store - * @return the boolean - */ - public boolean updateConfigurationValues(String tenant, String namespace, - Map configKeyValueStore); - - /** - * Gets tenants. - * - * @return the tenants - */ - public Collection getTenants(); - - /** - * Gets namespaces. - * - * @return the namespaces - */ - public Collection getNamespaces(); - - /** - * Gets keys. - * - * @param tenant the tenant - * @param namespace the namespace - * @return the keys - */ - public Collection getKeys(String tenant, String namespace); -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java deleted file mode 100644 index 3b64fe71a9..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.openecomp.config.api; - -import java.util.Arrays; -import java.util.List; - -/** - * The type Dynamic configuration. - * - * @param the type parameter - */ -public class DynamicConfiguration { - - /** - * The Tenant. - */ - String tenant; - /** - * The Namespace. - */ - String namespace; - /** - * The Key. - */ - String key; - /** - * The Configuration. - */ - Configuration configuration; - /** - * The Clazz. - */ - Class clazz; - /** - * The Default value. - */ - T defaultValue; - - /** - * Gets dynamic configuration. - * - * @param the type parameter - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @param configuration the configuration - * @return the dynamic configuration - */ - public static DynamicConfiguration getDynamicConfiguration(String tenant, String namespace, - String key, Class clazz, - T defaultValue, - Configuration configuration) { - DynamicConfiguration dynamicConfiguration = new DynamicConfiguration<>(); - dynamicConfiguration.tenant = tenant; - dynamicConfiguration.namespace = namespace; - dynamicConfiguration.key = key; - dynamicConfiguration.clazz = clazz; - dynamicConfiguration.defaultValue = defaultValue; - dynamicConfiguration.configuration = configuration; - return dynamicConfiguration; - } - - /** - * Gets dyn configuration. - * - * @param the type parameter - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param defaultValue the default value - * @param configuration the configuration - * @return the dyn configuration - */ - public static DynamicConfiguration> getDynConfiguration(String tenant, - String namespace, String key, - Class clazz, - K defaultValue, - Configuration configuration) { - if (clazz.isPrimitive()) { - throw new RuntimeException( - "Only Wrapper classes like Integer, Long, Double, " - + "Boolean etc including String are supported."); - } - return getDynamicConfiguration(tenant, namespace, key, getArrayClass(clazz), - Arrays.asList(defaultValue), configuration); - } - - /** - * Gets array class. - * - * @param clazz the clazz - * @return the array class - */ - public static Class getArrayClass(Class clazz) { - Class arrayClass = null; - switch (clazz.getName()) { - case "java.lang.Byte": - arrayClass = Byte[].class; - break; - case "java.lang.Short": - arrayClass = Short[].class; - break; - case "java.lang.Integer": - arrayClass = Integer[].class; - break; - case "java.lang.Long": - arrayClass = Long[].class; - break; - case "java.lang.Float": - arrayClass = Float[].class; - break; - case "java.lang.Double": - arrayClass = Double[].class; - break; - case "java.lang.Boolean": - arrayClass = Boolean[].class; - break; - case "java.lang.Character": - arrayClass = Character[].class; - break; - case "java.lang.String": - arrayClass = String[].class; - break; - default: - } - return arrayClass; - } - - /** - * Get t. - * - * @return the t - */ - public T get() { - Object toReturn = configuration - .get(tenant, namespace, key, clazz, Hint.LATEST_LOOKUP, Hint.EXTERNAL_LOOKUP, - Hint.NODE_SPECIFIC); - if (toReturn != null && toReturn.getClass().isArray()) { - toReturn = Arrays.asList((Object[]) toReturn); - } - return toReturn == null ? defaultValue : (T) toReturn; - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java deleted file mode 100644 index 600c76df52..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.openecomp.config.api; - -public enum Hint { - - DEFAULT(0b0), LATEST_LOOKUP(0b1), EXTERNAL_LOOKUP(0b10), NODE_SPECIFIC(0b100); - - private final int lookupHint; - - private Hint(int hnt) { - lookupHint = hnt; - } - - public int value() { - return lookupHint; - } - - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/pom.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/pom.xml deleted file mode 100644 index 7d55d66446..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - 4.0.0 - - org.openecomp.sdc.common - openecomp-configuration-management-cli - openecomp-configuration-management-cli - - - openecomp-common-configuration-management - org.openecomp.sdc.common - 1.2.0-SNAPSHOT - .. - - - - - org.openecomp.sdc.common - openecomp-configuration-management-api - ${project.version} - - - tools - tools - 1.8 - true - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 1.5 - - - package - - shade - - - - - org.openecomp.config.gui.app.Configuration - - - - - - - - - - diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/cli/app/Configuration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/cli/app/Configuration.java deleted file mode 100644 index d43c0505a8..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/cli/app/Configuration.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.openecomp.config.cli.app; - -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; - -import java.util.HashMap; -import java.util.Map; - -import javax.management.JMX; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXServiceURL; - -/** - * The type Configuration. - */ -public class Configuration { - - /** - * The entry point of application. - * - * @param args the input arguments - * @throws Exception the exception - */ - public static void main(String[] args) throws Exception { - - String host = getValueFor("host", args); - String port = getValueFor("port", args); - - if (host == null) { - host = "127.0.0.1"; - } - if (port == null) { - port = "9999"; - } - JMXServiceURL url = - new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi"); - Map env = new HashMap<>(); - //populate dummy value. need to be changed as per impl. - String[] credentials = {"principal", "password"}; - env.put(JMXConnector.CREDENTIALS, credentials); - - try (JMXConnector jmxc = JMXConnectorFactory.connect(url, env)) { - - boolean isUpdate = isKeyPresent("update", args); - - Map input = new HashMap<>(); - input.put("ImplClass", isUpdate ? "org.openecomp.config.type.ConfigurationUpdate" - : "org.openecomp.config.type.ConfigurationQuery"); - input.put("externalLookup", isKeyPresent("lookup", args)); - input.put("nodeOverride", isKeyPresent("nodeOverride", args)); - input.put("nodeSpecific", isKeyPresent("nodeSpecific", args)); - input.put("fallback", isKeyPresent("fallback", args)); - input.put("latest", isKeyPresent("latest", args)); - input.put("tenant", getValueFor("tenant", args)); - input.put("namespace", getValueFor("namespace", args)); - input.put("key", getValueFor("key", args)); - input.put("value", getValueFor("value", args)); - - - if (!isKeyPresent("list", args) && getValueFor("key", args) == null) { - throw new RuntimeException("Key is missing."); - } - if (isKeyPresent("update", args) && getValueFor("value", args) == null) { - throw new RuntimeException("Value is missing."); - } - - - MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); - ObjectName mbeanName = new ObjectName("org.openecomp.jmx:name=SystemConfig"); - org.openecomp.config.api.ConfigurationManager conf = - JMX.newMBeanProxy(mbsc, mbeanName, org.openecomp.config.api.ConfigurationManager.class, - true); - - boolean isGet = isKeyPresent("get", args); - boolean isList = isKeyPresent("list", args); - if (isGet) { - System.out.println(conf.getConfigurationValue(input)); - } else if (isList) { - Map map = conf.listConfiguration(input); - for (Map.Entry entry : map.entrySet()) { - System.out.println(entry.getKey() + " : " + entry.getValue()); - } - } else if (isUpdate) { - conf.updateConfigurationValue(input); - } - } - } - - private static boolean isSwitch(String key) { - return key.startsWith("-"); - } - - private static String getValueFor(String key, String[] args) { - for (int i = 0; i < args.length; i++) { - if (isSwitch(args[i])) { - String node = args[i].substring(1); - if (node.equalsIgnoreCase(key) && i < args.length - 1) { - return args[i + 1].trim().length() == 0 ? null : args[i + 1].trim(); - } - } - } - return null; - } - - private static boolean isKeyPresent(String key, String[] args) { - for (int i = 0; i < args.length; i++) { - if (isSwitch(args[i])) { - String node = args[i].substring(1); - if (node.equalsIgnoreCase(key)) { - return true; - } - } - } - return false; - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/gui/app/Configuration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/gui/app/Configuration.java deleted file mode 100644 index 3db67c536a..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/src/main/java/org/openecomp/config/gui/app/Configuration.java +++ /dev/null @@ -1,623 +0,0 @@ -package org.openecomp.config.gui.app; - - -import com.sun.tools.attach.VirtualMachine; -import com.sun.tools.attach.VirtualMachineDescriptor; -import org.openecomp.config.api.ConfigurationManager; - -import java.awt.BorderLayout; -import java.awt.Button; -import java.awt.CardLayout; -import java.awt.Checkbox; -import java.awt.CheckboxGroup; -import java.awt.Choice; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Label; -import java.awt.Panel; -import java.awt.ScrollPane; -import java.awt.TextArea; -import java.awt.TextField; -import java.awt.Toolkit; -import java.awt.event.ItemEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import javax.management.JMX; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXServiceURL; - - -/** - * The type Configuration. - */ -public class Configuration extends Frame { - - /** - * The Vm. - */ - VirtualMachine vm = null; - private TextField host; - private TextField port; - private TextField user; - private Choice pid; - private TextField password; - private CheckboxGroup getUpdateList; - private CheckboxGroup localRemote; - private Choice tenantChoice; - private Choice namespaceChoice; - private Choice keyChoice; - private Checkbox latest; - private Checkbox lookup; - private Checkbox fallback; - private Checkbox nodeSpecific; - private Checkbox nodeSpecificForList; - private Checkbox latestForList; - private Checkbox lookupForList; - private Checkbox fallbackForList; - private Checkbox nodeOverride; - private TextArea getValue = new TextArea(1, 50); - private TextArea updateValue = new TextArea(1, 50); - private Panel table; - private CardLayout cards; - private Panel cardPanel; - private JMXConnector connector; - private ConfigurationManager manager; - private Frame container; - private Button getKeysButton; - - /** - * Instantiates a new Configuration. - * - * @param title the title - */ - public Configuration(String title) { - super(title); - setSize(300, 300); - setLayout(new GridLayout(2, 1)); - Panel firstRowPanel = new Panel(); - firstRowPanel.setLayout(new GridLayout(0, 1)); - firstRowPanel.add( - buildHostPortPanel(host = new TextField("127.0.0.1"), port = new TextField("9999"), - pid = new Choice(), localRemote = new CheckboxGroup())); - firstRowPanel - .add(buildUserPasswordPanel(user = new TextField(""), password = new TextField(""))); - firstRowPanel.add(buildGetUpdatelistPanel(getUpdateList = new CheckboxGroup())); - firstRowPanel.add( - buildTenantNamespacePanel(tenantChoice = new Choice(), namespaceChoice = new Choice())); - firstRowPanel.add(buildKeyPanel(keyChoice = new Choice())); - add(firstRowPanel); - add(cardPanel = buildCards(cards = new CardLayout())); - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent windowEvent) { - close(); - System.exit(0); - } - }); - pack(); - setVisible(true); - container = this; - centreWindow(this); - Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(() -> { - this.populateAvailablePids(); - validate(); - }, 30, 30, TimeUnit.SECONDS); - } - - /** - * The entry point of application. - * - * @param args the input arguments - */ - public static void main(String[] args) { - Configuration configuration = new Configuration("Configuration Management App"); - - } - - private void toggleLocalRemote(ItemEvent ie) { - if (ie.getStateChange() == ItemEvent.SELECTED) { - String usecase = (ie.getSource() instanceof Checkbox) ? ((Checkbox) ie.getSource()).getLabel() - : ((Checkbox) ie.getItem()).getLabel(); - pid.setEnabled(usecase.equals("Local")); - host.setEnabled(!usecase.equals("Local")); - port.setEnabled(!usecase.equals("Local")); - } - } - - private Panel buildHostPortPanel(TextField host, TextField port, Choice pid, - CheckboxGroup group) { - populateAvailablePids(); - Panel panel = new Panel(); - panel.setLayout(new GridBagLayout()); - GridBagConstraints gbc = new GridBagConstraints(); - gbc.fill = gbc.HORIZONTAL; - gbc.weightx = 0; - Checkbox checkbox = null; - panel.add(checkbox = new Checkbox("Local", group, pid.getItemCount() > 0), gbc); - checkbox.addItemListener(this::toggleLocalRemote); - gbc.weightx = 0; - panel.add(checkbox = new Checkbox("Remote", group, pid.getItemCount() == 0), gbc); - checkbox.addItemListener(this::toggleLocalRemote); - gbc.weightx = 0; - panel.add(new Label("PID:"), gbc); - gbc.weightx = 1; - panel.add(pid, gbc); - gbc.weightx = 0; - panel.add(new Label("Host:"), gbc); - gbc.weightx = 1; - panel.add(host, gbc); - gbc.weightx = 0; - panel.add(new Label("Port:"), gbc); - gbc.weightx = 1; - panel.add(port, gbc); - host.setEnabled(pid.getItemCount() == 0); - port.setEnabled(pid.getItemCount() == 0); - pid.setEnabled(pid.getItemCount() > 0); - return panel; - } - - private Panel buildUserPasswordPanel(TextField user, TextField password) { - Panel panel = new Panel(); - password.setEchoChar('*'); - panel.setLayout(new GridBagLayout()); - GridBagConstraints gbc = new GridBagConstraints(); - gbc.fill = gbc.HORIZONTAL; - gbc.weightx = 0; - panel.add(new Label("User : "), gbc); - gbc.weightx = 1; - panel.add(user, gbc); - gbc.weightx = 0; - panel.add(new Label("Password : "), gbc); - gbc.weightx = 1; - panel.add(password, gbc); - gbc.weightx = 0; - Button button = null; - panel.add(button = new Button("Connect"), gbc); - button.addActionListener((actionListener) -> connect()); - return panel; - } - - /** - * Build get updatelist panel panel. - * - * @param getUpdtaeList the get updtae list - * @return the panel - */ - public Panel buildGetUpdatelistPanel(CheckboxGroup getUpdtaeList) { - Panel panel = new Panel(); - Checkbox checkbox = null; - panel.setLayout(new GridLayout(1, 3)); - panel.add(checkbox = new Checkbox("Get", getUpdtaeList, true)); - checkbox.addItemListener(this::showCard); - panel.add(checkbox = new Checkbox("List", getUpdtaeList, false)); - checkbox.addItemListener(this::showCard); - panel.add(checkbox = new Checkbox("Update", getUpdtaeList, false)); - checkbox.addItemListener(this::showCard); - return panel; - } - - /** - * Build tenant namespace panel panel. - * - * @param tenant the tenant - * @param namespace the namespace - * @return the panel - */ - public Panel buildTenantNamespacePanel(Choice tenant, Choice namespace) { - Panel panel = new Panel(); - panel.setLayout(new GridBagLayout()); - GridBagConstraints gbc = new GridBagConstraints(); - gbc.fill = gbc.HORIZONTAL; - gbc.weightx = 0; - panel.add(new Label("Tenant"), gbc); - gbc.weightx = 1; - panel.add(tenant, gbc); - gbc.weightx = 0; - panel.add(new Label("Namespace"), gbc); - gbc.weightx = 1; - panel.add(namespace, gbc); - gbc.weightx = 0; - panel.add(getKeysButton = new Button("Get Keys"), gbc); - getKeysButton.addActionListener((actionListener) -> populateKeys( - manager.getKeys(tenantChoice.getSelectedItem(), namespaceChoice.getSelectedItem()))); - tenantChoice.addItemListener((itemListener) -> keyChoice.removeAll()); - namespaceChoice.addItemListener((itemListener) -> keyChoice.removeAll()); - return panel; - } - - private Panel buildConnectPanel() { - Button button = null; - Panel panel = new Panel(); - panel.setLayout(new GridLayout(1, 3)); - panel.add(new Label()); - panel.add(button = new Button("Connect")); - panel.add(new Label()); - button.addActionListener((actionListener) -> connect()); - return panel; - } - - /** - * Build key panel panel. - * - * @param keyChoice the key choice - * @return the panel - */ - public Panel buildKeyPanel(Choice keyChoice) { - Panel panel = new Panel(); - panel.setLayout(new GridBagLayout()); - GridBagConstraints gbc = new GridBagConstraints(); - gbc.fill = gbc.HORIZONTAL; - gbc.weightx = 0; - panel.add(new Label("Keys : "), gbc); - gbc.weightx = 1; - panel.add(keyChoice, gbc); - return panel; - } - - /** - * Build cards panel. - * - * @param cards the cards - * @return the panel - */ - public Panel buildCards(CardLayout cards) { - Panel panel = new Panel(); - panel.setLayout(cards); - panel.add(buildCardGetPanel(latest = new Checkbox("Latest"), - fallback = new Checkbox("Fallback"), - lookup = new Checkbox("External Lookup"), nodeSpecific = new Checkbox("Node Specific"), - getValue), "Get"); - panel.add(buildCardUpdatePanel(nodeOverride = new Checkbox("NodeOverride"), - updateValue), "Update"); - panel.add(buildCardListPanel(table = new Panel(), latestForList = new Checkbox("Latest"), - fallbackForList = new Checkbox("Fallback"), lookupForList = new Checkbox("External Lookup"), - nodeSpecificForList = new Checkbox("Node Specific")), "List"); - return panel; - } - - /** - * Build card get panel panel. - * - * @param latest the latest - * @param fallback the fallback - * @param lookup the lookup - * @param nodeSpecific the node specific - * @param value the value - * @return the panel - */ - public Panel buildCardGetPanel(Checkbox latest, Checkbox fallback, Checkbox lookup, - Checkbox nodeSpecific, TextArea value) { - Panel panel = new Panel(); - - panel.setLayout(new BorderLayout()); - Panel p1 = new Panel(); - p1.setLayout(new GridLayout(1, 4)); - p1.add(latest); - p1.add(fallback); - p1.add(nodeSpecific); - p1.add(lookup); - panel.add(p1, BorderLayout.NORTH); - panel.add(value, BorderLayout.CENTER); - Panel bottom = new Panel(); - bottom.setLayout(new GridLayout(1, 5)); - bottom.add(new Label()); - Button button = null; - bottom.add(button = new Button("GET")); - button.addActionListener((actionListener) -> value.setText(manager - .getConfigurationValue(buildMap("org.openecomp.config.type.ConfigurationQuery", value)))); - bottom.add(new Label()); - bottom.add(button = new Button("CLOSE")); - bottom.add(new Label()); - panel.add(bottom, BorderLayout.SOUTH); - button.addActionListener((actionListener) -> { - close(); - System.exit(0); - }); - return panel; - } - - private Map buildMap(String implClass, TextArea value) { - Map input = new HashMap<>(); - input.put("ImplClass", implClass);//:); - input.put("externalLookup", value != null ? lookup.getState() : lookupForList.getState()); - input.put("nodeOverride", nodeOverride.getState()); - input.put("latest", value != null ? latest.getState() : latestForList.getState()); - input.put("fallback", value != null ? fallback.getState() : fallbackForList.getState()); - input.put("nodeSpecific", - value != null ? nodeSpecific.getState() : nodeSpecificForList.getState()); - input.put("tenant", tenantChoice.getSelectedItem()); - input.put("namespace", namespaceChoice.getSelectedItem()); - if (keyChoice.getItemCount() == 0) { - message("Error", "Key is missing."); - throw new RuntimeException("Error"); - } - input.put("key", keyChoice.getSelectedItem()); - input.put("value", value == null ? "" : value.getText()); - return input; - } - - /** - * Build card update panel panel. - * - * @param nodeOverride the node override - * @param value the value - * @return the panel - */ - public Panel buildCardUpdatePanel(Checkbox nodeOverride, TextArea value) { - Panel panel = new Panel(); - panel.setLayout(new BorderLayout()); - Panel p1 = new Panel(); - p1.setLayout(new GridLayout(1, 1)); - p1.add(nodeOverride); - panel.add(p1, BorderLayout.NORTH); - panel.add(value, BorderLayout.CENTER); - Panel bottom = new Panel(); - bottom.setLayout(new GridLayout(1, 5)); - bottom.add(new Label()); - Button button = null; - bottom.add(button = new Button("UPDATE")); - button.addActionListener((actionListener) -> { - manager - .updateConfigurationValue(buildMap("org.openecomp.config.type.ConfigurationUpdate", value)); - message("Info", "Success"); - }); - bottom.add(new Label()); - bottom.add(button = new Button("CLOSE")); - bottom.add(new Label()); - panel.add(bottom, BorderLayout.SOUTH); - button.addActionListener((actionListener) -> { - close(); - System.exit(0); - }); - return panel; - } - - /** - * Build card list panel panel. - * - * @param table the table - * @param latest the latest - * @param fallback the fallback - * @param nodeSpecific the node specific - * @param lookup the lookup - * @return the panel - */ - public Panel buildCardListPanel(Panel table, Checkbox latest, Checkbox fallback, - Checkbox nodeSpecific, Checkbox lookup) { - Panel panel = new Panel(); - panel.setLayout(new BorderLayout()); - table.setLayout(new GridLayout(0, 2)); - ScrollPane sp = new ScrollPane(); - sp.add(table); - panel.add(sp, BorderLayout.CENTER); - Panel p1 = new Panel(); - p1.setLayout(new GridLayout(1, 4)); - p1.add(latest); - p1.add(fallback); - p1.add(lookup); - p1.add(nodeSpecific); - panel.add(p1, BorderLayout.NORTH); - Panel bottom = new Panel(); - bottom.setLayout(new GridLayout(1, 5)); - bottom.add(new Label()); - Button button = null; - bottom.add(button = new Button("List")); - button.addActionListener((actionListener) -> populateKeyValue( - manager.listConfiguration(buildMap("org.openecomp.config.type.ConfigurationQuery", null)))); - bottom.add(new Label()); - bottom.add(button = new Button("CLOSE")); - bottom.add(new Label()); - panel.add(bottom, BorderLayout.SOUTH); - button.addActionListener((actionListener) -> { - close(); - System.exit(0); - }); - return panel; - } - - private void populateKeyValue(Map collection) { - table.removeAll(); - Set keys = collection.keySet(); - for (String key : keys) { - table.add(new Label(key)); - table.add(new Label(collection.get(key))); - } - table.validate(); - } - - private void showCard(ItemEvent ie) { - if (ie.getStateChange() == ItemEvent.SELECTED) { - String usecase = (ie.getSource() instanceof Checkbox) ? ((Checkbox) ie.getSource()).getLabel() - : ((Checkbox) ie.getItem()).getLabel(); - cards.show(cardPanel, usecase); - if (usecase.equals("List")) { - keyChoice.removeAll(); - } - keyChoice.setEnabled(!usecase.equals("List")); - getKeysButton.setEnabled(!usecase.equals("List")); - } - } - - private void close() { - try { - if (connector != null) { - connector.close(); - connector = null; - vm.detach(); - } - } catch (Exception exception) { - //Do nothing - } - } - - private void connect() { - try { - close(); - if (!validateHostPort()) { - return; - } - JMXServiceURL url = null; - if (localRemote.getSelectedCheckbox().getLabel().equals("Local")) { - url = new JMXServiceURL( - (vm = VirtualMachine.attach(pid.getSelectedItem())).getAgentProperties() - .getProperty("com.sun.management.jmxremote.localConnectorAddress")); - } else { - url = new JMXServiceURL( - "service:jmx:rmi:///jndi/rmi://" + host.getText() + ":" + port.getText() + "/jmxrmi"); - } - Map env = new HashMap<>(); - String[] credentials = {user.getText(), password.getText()}; - env.put(JMXConnector.CREDENTIALS, credentials); - connector = JMXConnectorFactory.connect(url, env); - MBeanServerConnection mbsc = connector.getMBeanServerConnection(); - ObjectName mbeanName = new ObjectName("org.openecomp.jmx:name=SystemConfig"); - manager = JMX.newMBeanProxy(mbsc, mbeanName, ConfigurationManager.class, true); - message("Message", "Success!!!"); - populateTenants(manager.getTenants()); - populateNamespaces(manager.getNamespaces()); - } catch (Exception exception) { - message("Error", exception.getMessage()); - } - } - - private boolean validateHostPort() { - if (localRemote.getSelectedCheckbox().getLabel().equals("Local")) { - if (pid.getSelectedItem() == null || pid.getSelectedItem().trim().length() == 0 - || !pid.getSelectedItem().matches("^[1-9][0-9]*$")) { - message("Error", "pid is mandatory numeric value greater than 0."); - return false; - } - } else { - if (host.getText() == null || host.getText().trim().length() == 0) { - message("Error", "Host is mandatory."); - return false; - } - if (port.getText() == null || port.getText().trim().length() == 0 - || !port.getText().matches("^[1-9][0-9]*$")) { - message("Error", "Port is mandatory numeric value greater than 0."); - return false; - } - } - return true; - } - - private void populateTenants(Collection collection) { - tenantChoice.removeAll(); - for (String item : collection) { - tenantChoice.add(item); - } - } - - private void populateNamespaces(Collection collection) { - namespaceChoice.removeAll(); - keyChoice.removeAll(); - for (String item : collection) { - namespaceChoice.add(item); - } - } - - private void populateKeys(Collection collection) { - keyChoice.removeAll(); - for (String item : collection) { - keyChoice.add(item); - } - } - - private void message(String title, String text) { - Dialog dialog = new Dialog(container, title, true); - dialog.setLayout(new BorderLayout()); - dialog.add(new Label(text), BorderLayout.CENTER); - Button ok = new Button("OK"); - Panel panel = new Panel(); - panel.setLayout(new GridLayout(1, 3)); - panel.add(new Label()); - panel.add(ok); - panel.add(new Label()); - ok.addActionListener((actionListener) -> dialog.setVisible(false)); - dialog.add(panel, BorderLayout.SOUTH); - dialog.pack(); - centerDialog(dialog); - dialog.setVisible(true); - } - - private void centreWindow(Frame frame) { - Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); - int x1 = (int) ((dimension.getWidth() - frame.getWidth()) / 2); - int y1 = (int) ((dimension.getHeight() - frame.getHeight()) / 2); - frame.setLocation(x1, y1); - } - - private void centerDialog(Dialog dialog) { - Dimension dimension = container.getSize(); - container.getLocationOnScreen(); - int x1 = - container.getLocationOnScreen().x + (int) ((dimension.getWidth() - dialog.getWidth()) / 2); - int y1 = container.getLocationOnScreen().y - + (int) ((dimension.getHeight() - dialog.getHeight()) / 2); - dialog.setLocation(x1, y1); - } - - private void setWindowPosition(Frame window, int screen) { - GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice[] allDevices = env.getScreenDevices(); - int topLeftX; - int topLeftY; - int screenX; - int screenY; - int windowPosX; - int windowPosY; - - if (screen < allDevices.length && screen > -1) { - topLeftX = allDevices[screen].getDefaultConfiguration().getBounds().x; - topLeftY = allDevices[screen].getDefaultConfiguration().getBounds().y; - - screenX = allDevices[screen].getDefaultConfiguration().getBounds().width; - screenY = allDevices[screen].getDefaultConfiguration().getBounds().height; - } else { - topLeftX = allDevices[0].getDefaultConfiguration().getBounds().x; - topLeftY = allDevices[0].getDefaultConfiguration().getBounds().y; - - screenX = allDevices[0].getDefaultConfiguration().getBounds().width; - screenY = allDevices[0].getDefaultConfiguration().getBounds().height; - } - - windowPosX = ((screenX - window.getWidth()) / 2) + topLeftX; - windowPosY = ((screenY - window.getHeight()) / 2) + topLeftY; - - window.setLocation(windowPosX, windowPosY); - } - - private void populateAvailablePids() { - pid.removeAll(); - for (VirtualMachineDescriptor desc : VirtualMachine.list()) { - try { - VirtualMachine vm = null; - JMXServiceURL url = new JMXServiceURL( - (vm = VirtualMachine.attach(desc.id())).getAgentProperties() - .getProperty("com.sun.management.jmxremote.localConnectorAddress")); - Set set = JMXConnectorFactory.connect(url, null).getMBeanServerConnection() - .queryMBeans(new ObjectName("org.openecomp.jmx:name=SystemConfig"), null); - if (!set.isEmpty()) { - pid.add(desc.id()); - } - vm.detach(); - } catch (Exception exception) { - //do nothing - } - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml deleted file mode 100644 index a7a55c5b2d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml +++ /dev/null @@ -1,128 +0,0 @@ - - 4.0.0 - - openecomp-configuration-management-core - org.openecomp.sdc.common - openecomp-configuration-management-core - - - openecomp-common-configuration-management - org.openecomp.sdc.common - 1.2.0-SNAPSHOT - .. - - - - - com.fasterxml.jackson.core - jackson-databind - 2.5.4 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - ${jackson.version} - - - org.apache.commons - commons-configuration2 - 2.1 - - - commons-logging - commons-logging - 1.2 - - - commons-beanutils - commons-beanutils - ${commons.beanutils.version} - - - org.apache.commons - commons-lang3 - 3.3.2 - - - com.github.adejanovski - cassandra-jdbc-wrapper - ${cassandra.version} - - - org.apache.commons - commons-dbcp2 - 2.0 - - - org.apache.commons - commons-pool2 - 2.4.2 - - - commons-io - commons-io - ${commons.io.version} - - - net.sf.corn - corn-cps - 1.1.7 - - - com.sun - tools - - - - - com.virtlink.commons - commons-configuration2-jackson - 0.6.1 - - - org.apache.logging.log4j - log4j-core - 2.7 - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - org.slf4j - slf4j-ext - ${slf4j.version} - - - org.openecomp.sdc.common - openecomp-configuration-management-api - 1.2.0-SNAPSHOT - - - javax.servlet - javax.servlet-api - 3.1.0 - true - - - com.fasterxml.jackson.core - jackson-annotations - 2.8.1 - - - junit - junit - test - ${junit.version} - - - - - diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java deleted file mode 100644 index e8dc16efb6..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java +++ /dev/null @@ -1,1143 +0,0 @@ -package org.openecomp.config; - -import com.google.common.collect.ImmutableMap; -import com.virtlink.commons.configuration2.jackson.JsonConfiguration; -import net.sf.corn.cps.CPScanner; -import net.sf.corn.cps.ResourceFilter; -import org.apache.commons.configuration2.CompositeConfiguration; -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.FileBasedConfiguration; -import org.apache.commons.configuration2.PropertiesConfiguration; -import org.apache.commons.configuration2.XMLConfiguration; -import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; -import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder; -import org.apache.commons.configuration2.builder.fluent.Configurations; -import org.apache.commons.configuration2.builder.fluent.Parameters; -import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler; -import org.apache.commons.configuration2.ex.ConfigurationException; -import org.apache.commons.io.IOUtils; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.impl.AgglomerateConfiguration; -import org.openecomp.config.impl.ConfigurationDataSource; -import org.openecomp.config.impl.ConfigurationRepository; -import org.openecomp.config.impl.YamlConfiguration; -import org.openecomp.config.type.ConfigurationMode; -import org.openecomp.config.type.ConfigurationType; - -import javax.sql.DataSource; -import java.io.File; -import java.lang.reflect.Field; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.LinkedTransferQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TransferQueue; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static com.google.common.collect.ImmutableMap.builder; -import static org.openecomp.config.api.Hint.EXTERNAL_LOOKUP; -import static org.openecomp.config.api.Hint.LATEST_LOOKUP; -import static org.openecomp.config.api.Hint.NODE_SPECIFIC; - -/** - * The type Configuration utils. - */ -public class ConfigurationUtils { - - private ConfigurationUtils() { - } - - private static ImmutableMap arrayClassMap; - - static { - ImmutableMap.Builder builder = builder(); - builder.put(Byte.class,Byte[].class).put(Short.class, Short[].class) - .put(Integer.class,Integer[].class).put(Long.class,Long[].class) - .put(Float.class,Float[].class).put(Double.class,Double[].class) - .put(Boolean.class,Boolean[].class).put(Character.class,Character[].class) - .put(String.class,String[].class); - arrayClassMap = builder.build(); - } - - /** - * Gets thread factory. - * - * @return the thread factory - */ - public static ThreadFactory getThreadFactory() { - return (r1) -> { - Thread thread = Executors.privilegedThreadFactory().newThread(r1); - thread.setDaemon(true); - return thread; - }; - } - - /** - * Gets all files. - * - * @param file the file - * @param recursive the recursive - * @param onlyDirectory the only directory - * @return the all files - */ - public static Collection getAllFiles(File file, boolean recursive, boolean onlyDirectory) { - ArrayList collection = new ArrayList<>(); - if (file.isDirectory() && file.exists()) { - File[] files = file.listFiles(); - for (File innerFile : files) { - if (innerFile.isFile() && !onlyDirectory) { - collection.add(innerFile); - } else if (innerFile.isDirectory()) { - collection.add(innerFile); - if (recursive) { - collection.addAll(getAllFiles(innerFile, recursive, onlyDirectory)); - } - } - } - } - return collection; - } - - /** - * Gets comma saperated list. - * - * @param list the list - * @return the comma separated list - */ - public static String getCommaSeparatedList(List list) { - return ((Stream) list.stream().filter(o -> o != null && !o.toString().trim().isEmpty()).map(o -> o.toString().trim())).collect(Collectors.joining(",")); - } - - /** - * Gets comma saperated list. - * - * @param list the list - * @return the comma saperated list - */ - public static String getCommaSeparatedList(String[] list) { - return getCommaSeparatedList(list == null ? Arrays.asList() : Arrays.asList(list)); - } - - /** - * Gets config type. - * - * @param url the url - * @return the config type - */ - public static ConfigurationType getConfigType(URL url) { - return Enum.valueOf(ConfigurationType.class, - url.getFile().substring(url.getFile().lastIndexOf('.') + 1).toUpperCase()); - } - - /** - * Gets config type. - * - * @param file the file - * @return the config type - */ - public static ConfigurationType getConfigType(File file) { - return Enum.valueOf(ConfigurationType.class, - file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf('.') + 1) - .toUpperCase()); - } - - /** - * Is config boolean. - * - * @param url the url - * @return the boolean - */ - public static boolean isConfig(URL url) { - return isConfig(url.getFile()); - } - - /** - * Is config boolean. - * - * @param file the file - * @return the boolean - */ - public static boolean isConfig(File file) { - return file != null && file.exists() && isConfig(file.getName()); - } - - /** - * Is config boolean. - * - * @param file the file - * @return the boolean - */ - public static boolean isConfig(String file) { - file = file.toUpperCase().substring(file.lastIndexOf('!') + 1); - file = file.substring(file.lastIndexOf('/') + 1); - return file.matches( - "CONFIG(-\\w*){0,1}(-" + "(" + ConfigurationMode.OVERRIDE + "|" + ConfigurationMode.MERGE - + "|" + ConfigurationMode.UNION + ")){0,1}" + "\\.(" - + ConfigurationType.PROPERTIES.name() + "|" + ConfigurationType.XML.name() + "|" - + ConfigurationType.JSON.name() + "|" + ConfigurationType.YAML.name() + ")$") - || file.matches("CONFIG(.)*\\.(" + ConfigurationType.PROPERTIES.name() + "|" - + ConfigurationType.XML.name() + "|" + ConfigurationType.JSON.name() + "|" - + ConfigurationType.YAML.name() + ")$"); - } - - /** - * Gets namespace. - * - * @param url the url - * @return the namespace - */ - public static String getNamespace(URL url) { - String namespace = getNamespace(getConfiguration(url)); - if (namespace != null) { - return namespace.toUpperCase(); - } - return getNamespace(url.getFile().toUpperCase()); - } - - /** - * Gets namespace. - * - * @param file the file - * @return the namespace - */ - public static String getNamespace(File file) { - String namespace = getNamespace(getConfiguration(file)); - if (namespace != null) { - return namespace.toUpperCase(); - } - return getNamespace(file.getName().toUpperCase()); - } - - private static String getNamespace(Configuration config) { - return config.getString(Constants.NAMESPACE_KEY) == null ? null - : config.getString(Constants.NAMESPACE_KEY).toUpperCase(); - } - - /** - * Gets namespace. - * - * @param file the file - * @return the namespace - */ - public static String getNamespace(String file) { - file = file.toUpperCase().substring(file.lastIndexOf('!') + 1); - file = file.substring(file.lastIndexOf('/') + 1); - Pattern pattern = Pattern.compile( - "CONFIG(-\\w*){0,1}(-" + "(" + ConfigurationMode.OVERRIDE + "|" + ConfigurationMode.MERGE - + "|" + ConfigurationMode.UNION + ")){0,1}" + "\\.(" - + ConfigurationType.PROPERTIES.name() + "|" + ConfigurationType.XML.name() + "|" - + ConfigurationType.JSON.name() + "|" + ConfigurationType.YAML.name() + ")$"); - Matcher matcher = pattern.matcher(file); - boolean b1 = matcher.matches(); - if (b1) { - if (matcher.group(1) != null) { - String moduleName = matcher.group(1).substring(1); - return moduleName.equalsIgnoreCase(ConfigurationMode.OVERRIDE.name()) - || moduleName.equalsIgnoreCase(ConfigurationMode.UNION.name()) - || moduleName.equalsIgnoreCase(ConfigurationMode.MERGE.name()) - ? Constants.DEFAULT_NAMESPACE : moduleName; - } else { - return Constants.DEFAULT_NAMESPACE; - } - } else if (isConfig(file)) { - return Constants.DEFAULT_NAMESPACE; - } - - return null; - } - - /** - * Gets merge strategy. - * - * @param url the url - * @return the merge strategy - */ - public static ConfigurationMode getMergeStrategy(URL url) { - String configMode = getMergeStrategy(getConfiguration(url)); - if (configMode != null) { - try { - return Enum.valueOf(ConfigurationMode.class, configMode); - } catch (Exception exception) { - //do nothing - } - } - return getMergeStrategy(url.getFile().toUpperCase()); - } - - private static String getMergeStrategy(Configuration config) { - return config.getString(Constants.MODE_KEY) == null ? null - : config.getString(Constants.MODE_KEY).toUpperCase(); - } - - /** - * Gets merge strategy. - * - * @param file the file - * @return the merge strategy - */ - public static ConfigurationMode getMergeStrategy(File file) { - String configMode = getMergeStrategy(getConfiguration(file)); - if (configMode != null) { - try { - return Enum.valueOf(ConfigurationMode.class, configMode); - } catch (Exception exception) { - //do nothing - } - } - return getMergeStrategy(file.getName().toUpperCase()); - } - - /** - * Gets merge strategy. - * - * @param file the file - * @return the merge strategy - */ - public static ConfigurationMode getMergeStrategy(String file) { - file = file.toUpperCase().substring(file.lastIndexOf('!') + 1); - file = file.substring(file.lastIndexOf('/') + 1); - Pattern pattern = Pattern.compile( - "CONFIG(-\\w*){0,1}(-" + "(" + ConfigurationMode.OVERRIDE + "|" + ConfigurationMode.MERGE - + "|" + ConfigurationMode.UNION + ")){0,1}" + "\\.(" - + ConfigurationType.PROPERTIES.name() + "|" + ConfigurationType.XML.name() + "|" - + ConfigurationType.JSON.name() + "|" + ConfigurationType.YAML.name() + ")$"); - Matcher matcher = pattern.matcher(file); - boolean b1 = matcher.matches(); - if (b1) { - for (int i = 1; i <= matcher.groupCount(); i++) { - String modeName = matcher.group(i); - if (modeName != null) { - modeName = modeName.substring(1); - } - try { - return Enum.valueOf(ConfigurationMode.class, modeName); - } catch (Exception exception) { - //do nothing - } - } - } - - return null; - } - - /** - * Gets configuration. - * - * @param url the url - * @return the configuration - */ - public static FileBasedConfiguration getConfiguration(URL url) { - FileBasedConfiguration builder = null; - try { - ConfigurationType configType = ConfigurationUtils.getConfigType(url); - switch (configType) { - case PROPERTIES: - builder = new Configurations().fileBased(PropertiesConfiguration.class, url); - break; - case XML: - builder = new Configurations().fileBased(XMLConfiguration.class, url); - break; - case JSON: - builder = new Configurations().fileBased(JsonConfiguration.class, url); - break; - case YAML: - builder = new Configurations().fileBased(YamlConfiguration.class, url); - break; - default: - throw new ConfigurationException("Configuration type not supported:"+ configType); - } - } catch (ConfigurationException exception) { - exception.printStackTrace(); - } - return builder; - } - - /** - * Gets configuration. - * - * @param file the file - * @return the configuration - */ - public static FileBasedConfiguration getConfiguration(File file) { - FileBasedConfiguration builder = null; - try { - ConfigurationType configType = ConfigurationUtils.getConfigType(file); - switch (configType) { - case PROPERTIES: - builder = new Configurations().fileBased(PropertiesConfiguration.class, file); - break; - case XML: - builder = new Configurations().fileBased(XMLConfiguration.class, file); - break; - case JSON: - builder = new Configurations().fileBased(JsonConfiguration.class, file); - break; - case YAML: - builder = new Configurations().fileBased(YamlConfiguration.class, file); - break; - default: - throw new ConfigurationException("Configuration type not supported:"+ configType); - } - } catch (ConfigurationException exception) { - exception.printStackTrace(); - } - return builder; - } - - /** - * Gets collection generic type. - * - * @param field the field - * @return the collection generic type - */ - public static Class getCollectionGenericType(Field field) { - Type type = field.getGenericType(); - - if (type instanceof ParameterizedType) { - - ParameterizedType paramType = (ParameterizedType) type; - Type[] arr = paramType.getActualTypeArguments(); - - for (Type tp : arr) { - Class clzz = (Class) tp; - if (isWrapperClass(clzz)) { - return clzz; - } else { - throw new RuntimeException("Collection of type " + clzz.getName() + " not supported."); - } - } - } - return String[].class; - } - - - - /** - * Gets array class. - * - * @param clazz the clazz - * @return the array class - */ - public static Class getArrayClass(Class clazz) { - return arrayClassMap.getOrDefault(clazz, null); - } - - /** - * Gets all class path resources. - * - * @return the all class path resources - */ - public static List getAllClassPathResources() { - return CPScanner.scanResources(new ResourceFilter()); - } - - /** - * Execute ddlsql boolean. - * - * @param sql the sql - * @return the boolean - * @throws Exception the exception - */ - public static boolean executeDdlSql(String sql) throws Exception { - DataSource datasource = ConfigurationDataSource.lookup(); - if (datasource == null) { - System.err.println("DB configuration not found. Configuration management will be using " - + "in-memory persistence."); - return false; - } - try (Connection con = datasource.getConnection(); Statement stmt = con.createStatement()) { - stmt.executeQuery(sql); - } catch (Exception exception) { - System.err.println("Datasource initialization error. Configuration management will be using in-memory persistence."); - return false; - } - return true; - } - - /** - * Gets configuration builder. - * - * @param url the url - * @return the configuration builder - */ - public static BasicConfigurationBuilder getConfigurationBuilder(URL url) { - ReloadingFileBasedConfigurationBuilder builder = null; - ConfigurationType configType = ConfigurationUtils.getConfigType(url); - switch (configType) { - case PROPERTIES: - builder = new ReloadingFileBasedConfigurationBuilder( - PropertiesConfiguration.class); - break; - case XML: - builder = new ReloadingFileBasedConfigurationBuilder( - XMLConfiguration.class); - break; - case JSON: - builder = new ReloadingFileBasedConfigurationBuilder( - JsonConfiguration.class); - break; - case YAML: - builder = new ReloadingFileBasedConfigurationBuilder( - YamlConfiguration.class); - break; - default: - throw new IllegalArgumentException("Configuration type not supported:"+ configType); - } - builder.configure(new Parameters().fileBased().setURL(url) - .setListDelimiterHandler(new DefaultListDelimiterHandler(','))); - return builder; - } - - /** - * Gets configuration builder. - * - * @param file the file - * @param autoSave the auto save - * @return the configuration builder - */ - public static BasicConfigurationBuilder getConfigurationBuilder(File file, - boolean autoSave) { - ReloadingFileBasedConfigurationBuilder builder = null; - ConfigurationType configType = ConfigurationUtils.getConfigType(file); - switch (configType) { - case PROPERTIES: - builder = new ReloadingFileBasedConfigurationBuilder( - PropertiesConfiguration.class); - break; - case XML: - builder = new ReloadingFileBasedConfigurationBuilder( - XMLConfiguration.class); - break; - case JSON: - builder = new ReloadingFileBasedConfigurationBuilder( - JsonConfiguration.class); - break; - case YAML: - builder = new ReloadingFileBasedConfigurationBuilder( - YamlConfiguration.class); - break; - default: - throw new IllegalArgumentException("Configuration type not supported:"+ configType); - } - builder.configure(new Parameters().fileBased().setFile(file) - .setListDelimiterHandler(new DefaultListDelimiterHandler(','))); - builder.setAutoSave(autoSave); - return builder; - } - - - /** - * Execute select sql collection. - * - * @param sql the sql - * @param params the params - * @return the collection - * @throws Exception the exception - */ - public static Collection executeSelectSql(String sql, String[] params) throws Exception { - Collection coll = new ArrayList<>(); - DataSource datasource = ConfigurationDataSource.lookup(); - try (Connection con = datasource.getConnection(); - PreparedStatement stmt = con.prepareStatement(sql)) { - if (params != null) { - for (int i = 0; i < params.length; i++) { - stmt.setString(i + 1, params[i]); - } - } - - try (ResultSet rs = stmt.executeQuery()) { - - while (rs.next()) { - coll.add(rs.getString(1)); - } - } - - } catch (Exception exception) { - //exception.printStackTrace(); - return null; - } - - return coll; - } - - /** - * Execute insert sql boolean. - * - * @param sql the sql - * @param params the params - * @return the boolean - * @throws Exception the exception - */ - public static boolean executeInsertSql(String sql, Object[] params) throws Exception { - Collection coll = new ArrayList<>(); - DataSource datasource = ConfigurationDataSource.lookup(); - try (Connection con = datasource.getConnection(); - PreparedStatement stmt = con.prepareStatement(sql)) { - if (params != null) { - int counter = 0; - for (Object obj : params) { - if (obj == null) { - obj = ""; - } - switch (obj.getClass().getName()) { - case "java.lang.String": - stmt.setString(++counter, obj.toString()); - break; - case "java.lang.Integer": - stmt.setInt(++counter, ((Integer) obj).intValue()); - break; - case "java.lang.Long": - stmt.setLong(++counter, ((Long) obj).longValue()); - break; - default: - stmt.setString(++counter, obj.toString()); - break; - } - } - } - stmt.executeUpdate(); - return true; - } catch (Exception exception) { - exception.printStackTrace(); - } - return false; - } - - /** - * Read t. - * - * @param the type parameter - * @param config the config - * @param clazz the clazz - * @param keyPrefix the key prefix - * @return the t - * @throws Exception the exception - */ - public static T read(Configuration config, Class clazz, String keyPrefix) - throws Exception { - org.openecomp.config.api.Config confAnnot = - clazz.getAnnotation(org.openecomp.config.api.Config.class); - if (confAnnot != null) { - keyPrefix += (confAnnot.key() + "."); - } - T objToReturn = clazz.newInstance(); - for (Field field : clazz.getDeclaredFields()) { - org.openecomp.config.api.Config fieldConfAnnot = - field.getAnnotation(org.openecomp.config.api.Config.class); - if (fieldConfAnnot != null) { - field.setAccessible(true); - field.set(objToReturn, config.getProperty(keyPrefix + fieldConfAnnot.key())); - } else if (field.getType().getAnnotation(org.openecomp.config.api.Config.class) != null) { - field.set(objToReturn, read(config, field.getType(), keyPrefix)); - } - } - return objToReturn; - } - - /** - * Gets db configuration builder. - * - * @param configName the config name - * @return the db configuration builder - * @throws Exception the exception - */ - public static BasicConfigurationBuilder getDbConfigurationBuilder( - String configName) throws Exception { - Configuration dbConfig = ConfigurationRepository.lookup() - .getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE); - BasicConfigurationBuilder builder = - new BasicConfigurationBuilder(AgglomerateConfiguration.class); - builder.configure( - new Parameters().database() - .setDataSource(ConfigurationDataSource.lookup()) - .setTable(dbConfig.getString("config.Table")) - .setKeyColumn(dbConfig.getString("configKey")) - .setValueColumn(dbConfig.getString("configValue")) - .setConfigurationNameColumn(dbConfig.getString("configNameColumn")) - .setConfigurationName(configName) - .setAutoCommit(true) - ); - return builder; - } - - /** - * Gets property. - * - * @param config the config - * @param key the key - * @param processingHints the processing hints - * @return the property - */ - public static Object getProperty(Configuration config, String key, int processingHints) { - if (!isDirectLookup(processingHints)) { - if (config instanceof AgglomerateConfiguration) { - return ((AgglomerateConfiguration) config).getPropertyValue(key); - } else if (config instanceof CompositeConfiguration) { - CompositeConfiguration conf = (CompositeConfiguration) config; - for (int i = 0; i < conf.getNumberOfConfigurations(); i++) { - if (conf.getConfiguration(i) instanceof AgglomerateConfiguration) { - return ((AgglomerateConfiguration) conf.getConfiguration(i)).getPropertyValue(key); - } else if (isNodeSpecific(processingHints)) { - Object obj = conf.getConfiguration(i).getProperty(key); - if (obj != null) { - return obj; - } - } - } - } - } - return config.getProperty(key); - } - - /** - * Gets primitive array. - * - * @param collection the collection - * @param clazz the clazz - * @return the primitive array - */ - public static Object getPrimitiveArray(Collection collection, Class clazz) { - if (clazz == int.class) { - int[] array = new int[collection.size()]; - Object[] objArray = collection.toArray(); - for (int i = 0; i < collection.size(); i++) { - array[i] = (int) objArray[i]; - } - return array; - } - if (clazz == byte.class) { - byte[] array = new byte[collection.size()]; - Object[] objArray = collection.toArray(); - for (int i = 0; i < collection.size(); i++) { - array[i] = (byte) objArray[i]; - } - return array; - } - if (clazz == short.class) { - short[] array = new short[collection.size()]; - Object[] objArray = collection.toArray(); - for (int i = 0; i < collection.size(); i++) { - array[i] = (short) objArray[i]; - } - return array; - } - if (clazz == long.class) { - long[] array = new long[collection.size()]; - Object[] objArray = collection.toArray(); - for (int i = 0; i < collection.size(); i++) { - array[i] = (long) objArray[i]; - } - return array; - } - if (clazz == float.class) { - float[] array = new float[collection.size()]; - Object[] objArray = collection.toArray(); - for (int i = 0; i < collection.size(); i++) { - array[i] = (float) objArray[i]; - } - return array; - } - if (clazz == double.class) { - double[] array = new double[collection.size()]; - Object[] objArray = collection.toArray(); - for (int i = 0; i < collection.size(); i++) { - array[i] = (double) objArray[i]; - } - return array; - } - if (clazz == boolean.class) { - boolean[] array = new boolean[collection.size()]; - Object[] objArray = collection.toArray(); - for (int i = 0; i < collection.size(); i++) { - array[i] = (boolean) objArray[i]; - } - return array; - } - Object obj = null; - return obj; - } - - /** - * Is wrapper class boolean. - * - * @param clazz the clazz - * @return the boolean - */ - public static boolean isWrapperClass(Class clazz) { - return clazz == String.class || clazz == Boolean.class || clazz == Character.class - || Number.class.isAssignableFrom(clazz); - } - - /** - * Gets collection string. - * - * @param input the input - * @return the collection string - */ - public static String getCollectionString(String input) { - Pattern pattern = Pattern.compile("^\\[(.*)\\]$"); - Matcher matcher = pattern.matcher(input); - if (matcher.matches()) { - input = matcher.group(1); - } - return input; - } - - /** - * Is collection boolean. - * - * @param input the input - * @return the boolean - */ - public static boolean isCollection(String input) { - Pattern pattern = Pattern.compile("^\\[(.*)\\]$"); - Matcher matcher = pattern.matcher(input); - return matcher.matches(); - } - - /** - * Process variables if present string. - * - * @param tenant the tenant - * @param namespace the namespace - * @param data the data - * @return the string - */ - public static String processVariablesIfPresent(String tenant, String namespace, String data) { - Pattern pattern = Pattern.compile("^.*\\$\\{(.*)\\}.*"); - Matcher matcher = pattern.matcher(data); - if (matcher.matches()) { - String key = matcher.group(1); - if (key.toUpperCase().startsWith("ENV:")) { - String envValue = System.getenv(key.substring(4)); - return processVariablesIfPresent(tenant, namespace, data.replaceAll("\\$\\{" + key + "\\}", - envValue == null ? "" : envValue.replace("\\", "\\\\"))); - } else if (key.toUpperCase().startsWith("SYS:")) { - String sysValue = System.getProperty(key.substring(4)); - return processVariablesIfPresent(tenant, namespace, data.replaceAll("\\$\\{" + key + "\\}", - sysValue == null ? "" : sysValue.replace("\\", "\\\\"))); - } else { - String propertyValue = ConfigurationUtils.getCollectionString( - ConfigurationManager.lookup().getAsStringValues(tenant, namespace, key).toString()); - return processVariablesIfPresent(tenant, namespace, data.replaceAll("\\$\\{" + key + "\\}", - propertyValue == null ? "" : propertyValue.replace("\\", "\\\\"))); - } - } else { - return data; - } - } - - /** - * Gets file contents. - * - * @param path the path - * @return the file contents - */ - public static String getFileContents(String path) { - try { - if (path != null) { - return IOUtils.toString(new URL(path)); - } - } catch (Exception exception) { - exception.printStackTrace(); - } - return null; - } - - /** - * Gets file contents. - * - * @param path the path - * @return the file contents - */ - public static String getFileContents(Path path) { - try { - if (path != null) { - return new String(Files.readAllBytes(path)); - } - } catch (Exception exception) { - exception.printStackTrace(); - } - return null; - } - - /** - * Gets concrete collection. - * - * @param clazz the clazz - * @return the concrete collection - */ - public static Collection getConcreteCollection(Class clazz) { - switch (clazz.getName()) { - case "java.util.Collection": - case "java.util.List": - return new ArrayList<>(); - case "java.util.Set": - return new HashSet<>(); - case "java.util.SortedSet": - return new TreeSet<>(); - case "java.util.Queue": - return new ConcurrentLinkedQueue<>(); - case "java.util.Deque": - return new ArrayDeque<>(); - case "java.util.concurrent.TransferQueue": - return new LinkedTransferQueue<>(); - case "java.util.concurrent.BlockingQueue": - return new LinkedBlockingQueue<>(); - default: - return null; - } - } - - /** - * Gets default for. - * - * @param clazz the clazz - * @return the default for - */ - public static Object getDefaultFor(Class clazz) { - if (byte.class == clazz) { - return new Byte("0"); - } else if (short.class == clazz) { - return new Short("0"); - } else if (int.class == clazz) { - return new Integer("0"); - } else if (float.class == clazz) { - return new Float("0"); - } else if (long.class == clazz) { - return new Long("0"); - } else if (double.class == clazz) { - return new Double("0"); - } else if (boolean.class == clazz) { - return Boolean.FALSE; - } - return new Character((char) 0); - } - - /** - * Gets compatible collection for abstract def. - * - * @param clazz the clazz - * @return the compatible collection for abstract def - */ - public static Collection getCompatibleCollectionForAbstractDef(Class clazz) { - if (BlockingQueue.class.isAssignableFrom(clazz)) { - return getConcreteCollection(BlockingQueue.class); - } - if (TransferQueue.class.isAssignableFrom(clazz)) { - return getConcreteCollection(TransferQueue.class); - } - if (Deque.class.isAssignableFrom(clazz)) { - return getConcreteCollection(Deque.class); - } - if (Queue.class.isAssignableFrom(clazz)) { - return getConcreteCollection(Queue.class); - } - if (SortedSet.class.isAssignableFrom(clazz)) { - return getConcreteCollection(SortedSet.class); - } - if (Set.class.isAssignableFrom(clazz)) { - return getConcreteCollection(Set.class); - } - if (List.class.isAssignableFrom(clazz)) { - return getConcreteCollection(List.class); - } - return null; - } - - /** - * Gets configuration repository key. - * - * @param array the array - * @return the configuration repository key - */ - public static String getConfigurationRepositoryKey(String[] array) { - Deque stack = new ArrayDeque<>(); - stack.push(Constants.DEFAULT_TENANT); - for (String element : array) { - stack.push(element); - } - String toReturn = stack.pop(); - return stack.pop() + Constants.KEY_ELEMENTS_DELEMETER + toReturn; - } - - /** - * Gets configuration repository key. - * - * @param file the file - * @return the configuration repository key - */ - public static String getConfigurationRepositoryKey(File file) { - return getConfigurationRepositoryKey( - ConfigurationUtils.getNamespace(file).split(Constants.TENANT_NAMESPACE_SAPERATOR)); - } - - /** - * Gets configuration repository key. - * - * @param url the url - * @return the configuration repository key - */ - public static String getConfigurationRepositoryKey(URL url) { - return getConfigurationRepositoryKey( - ConfigurationUtils.getNamespace(url).split(Constants.TENANT_NAMESPACE_SAPERATOR)); - } - - /** - * To map linked hash map. - * - * @param config the config - * @return the linked hash map - */ - public static LinkedHashMap toMap(Configuration config) { - Iterator iterator = config.getKeys(); - LinkedHashMap map = new LinkedHashMap<>(); - while (iterator.hasNext()) { - String key = iterator.next(); - if (!(key.equals(Constants.MODE_KEY) || key.equals(Constants.NAMESPACE_KEY) - || key.equals(Constants.LOAD_ORDER_KEY))) { - map.put(key, config.getProperty(key).toString()); - } - } - - return map; - } - - /** - * Diff map. - * - * @param orig the orig - * @param latest the latest - * @return the map - */ - public static Map diff(LinkedHashMap orig, LinkedHashMap latest) { - orig = new LinkedHashMap<>(orig); - latest = new LinkedHashMap<>(latest); - List set = new ArrayList(orig.keySet()); - for (String key : set) { - if (latest.remove(key, orig.get(key))) { - orig.remove(key); - } - } - Set keys = latest.keySet(); - for (String key : keys) { - orig.remove(key); - } - set = new ArrayList(orig.keySet()); - for (String key : set) { - latest.put(key, ""); - } - return new HashMap<>(latest); - } - - /** - * Is array boolean. - * - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param processingHints the processing hints - * @return the boolean - * @throws Exception the exception - */ - public static boolean isArray(String tenant, String namespace, String key, int processingHints) - throws Exception { - Object obj = ConfigurationUtils - .getProperty(ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace), key, - processingHints); - return (obj == null) ? false : ConfigurationUtils.isCollection(obj.toString()); - } - - /** - * Is direct lookup boolean. - * - * @param hints the hints - * @return the boolean - */ - public static boolean isDirectLookup(int hints) { - return (hints & LATEST_LOOKUP.value()) == LATEST_LOOKUP.value(); - } - - /** - * Is external lookup boolean. - * - * @param hints the hints - * @return the boolean - */ - public static boolean isExternalLookup(int hints) { - return (hints & EXTERNAL_LOOKUP.value()) == EXTERNAL_LOOKUP.value(); - } - - /** - * Is node specific boolean. - * - * @param hints the hints - * @return the boolean - */ - public static boolean isNodeSpecific(int hints) { - return (hints & NODE_SPECIFIC.value()) == NODE_SPECIFIC.value(); - } - - public static boolean isZeroLengthArray(Class clazz, Object obj) { - if (clazz.isArray() && clazz.getComponentType().isPrimitive()) { - if (clazz.getComponentType() == int.class) { - return ((int[]) obj).length == 0; - } else if (clazz.getComponentType() == byte.class) { - return ((byte[]) obj).length == 0; - } else if (clazz.getComponentType() == short.class) { - return ((short[]) obj).length == 0; - } else if (clazz.getComponentType() == float.class) { - return ((float[]) obj).length == 0; - } else if (clazz.getComponentType() == boolean.class) { - return ((boolean[]) obj).length == 0; - } else if (clazz.getComponentType() == double.class) { - return ((double[]) obj).length == 0; - } else if (clazz.getComponentType() == long.class) { - return ((long[]) obj).length == 0; - } else { - return ((Object[]) obj).length == 0; - } - } - - return false; - } - - /** - * Checks if value is blank - * - * @param value - * @return - */ - public static boolean isBlank(String value) { - return value == null || value.trim().length() == 0; - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/Constants.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/Constants.java deleted file mode 100644 index b35a5a8d83..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/Constants.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.openecomp.config; - -public class Constants { - - public static final String DEFAULT_TENANT = "GLOBAL"; - public static final String DEFAULT_NAMESPACE = "COMMON"; - public static final String DB_NAMESPACE = "SYSTEM"; - public static final String KEY_ELEMENTS_DELEMETER = "-"; - public static final String TENANT_NAMESPACE_SAPERATOR = ":"; - public static final String NAMESPACE_KEY = "_config.namespace"; - public static final String MODE_KEY = "_config.mergeStrategy"; - public static final String MBEAN_NAME = "org.openecomp.jmx:name=SystemConfig"; - public final static String LOAD_ORDER_KEY="_config.loadOrder"; -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/NonConfigResource.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/NonConfigResource.java deleted file mode 100644 index f4c1c16dc5..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/NonConfigResource.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.openecomp.config; - -import java.io.File; -import java.net.URL; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Predicate; - -/** - * The type Non config resource. - */ -public class NonConfigResource { - - private static Set urls = new HashSet<>(); - private static Set files = new HashSet<>(); - - /** - * Add. - * - * @param url the url - */ - public static void add(URL url) { - urls.add(url); - } - - /** - * Add. - * - * @param file the file - */ - public static void add(File file) { - files.add(file); - } - - /** - * Locate path. - * - * @param resource the resource - * @return the path - */ - public static Path locate(String resource) { - try { - if (resource != null) { - File file = new File(resource); - if (file.exists()) { - return Paths.get(resource); - } - for (File availableFile : files) { - if (availableFile.getAbsolutePath().endsWith(resource) && availableFile.exists()) { - return Paths.get(availableFile.getAbsolutePath()); - } - } - if (System.getProperty("node.config.location") != null) { - Path path = locate(new File(System.getProperty("node.config.location")), resource); - if (path != null) { - return path; - } - } - if (System.getProperty("config.location") != null) { - Path path = locate(new File(System.getProperty("config.location")), resource); - if (path != null) { - return path; - } - } - for (URL url : urls) { - if (url.getFile().endsWith(resource)) { - return Paths.get(url.toURI()); - } - } - } - } catch (Exception exception) { - exception.printStackTrace(); - } - return null; - } - - private static Path locate(File root, String resource) { - if (root.exists()) { - Collection filesystemResources = ConfigurationUtils.getAllFiles(root, true, false); - Predicate f1 = ConfigurationUtils::isConfig; - for (File file : filesystemResources) { - if (!f1.test(file)) { - add(file); - if (file.getAbsolutePath().endsWith(resource)) { - return Paths.get(file.getAbsolutePath()); - } - } - } - } - return null; - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AgglomerateConfiguration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AgglomerateConfiguration.java deleted file mode 100644 index 9556b480c6..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AgglomerateConfiguration.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.config.impl; - -import org.apache.commons.configuration2.DatabaseConfiguration; - -import java.util.Collections; -import java.util.Map; -import java.util.WeakHashMap; - -/** - * The type Agglomerate configuration. - */ -public class AgglomerateConfiguration extends DatabaseConfiguration { - - private final Map store = - Collections.synchronizedMap(new WeakHashMap()); - - /** - * Gets property value. - * - * @param key the key - * @return the property value - */ - public Object getPropertyValue(String key) { - Object objToReturn; - objToReturn = store.get(key); - if (objToReturn == null && !store.containsKey(key)) { - objToReturn = super.getProperty(key); - store.put(key, objToReturn); - } - return objToReturn; - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java deleted file mode 100644 index e67de752ec..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.openecomp.config.impl; - -import org.apache.commons.configuration2.CombinedConfiguration; -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.tree.MergeCombiner; -import org.apache.commons.configuration2.tree.OverrideCombiner; -import org.apache.commons.configuration2.tree.UnionCombiner; -import static org.openecomp.config.Constants.LOAD_ORDER_KEY; -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.type.ConfigurationMode; - -import java.io.File; -import java.net.URL; -import java.util.HashMap; -import java.util.*; - -/** - * The type Aggregate configuration. - */ -public final class AggregateConfiguration { - - private Map rootConfig = new HashMap<>(); - private Map unionConfig = new HashMap<>(); - private Map mergeConfig = new HashMap<>(); - private Map overrideConfig = new LinkedHashMap<>(); - - /** - * Instantiates a new Aggregate configuration. - */ - public AggregateConfiguration() { - try { - Class clazz = Class.forName(Thread.currentThread().getStackTrace()[2].getClassName()); - if (!clazz.getCanonicalName() - .equals(ConfigurationImpl.class.getCanonicalName())) { - throw new RuntimeException("Illegal access."); - } - } catch (ClassNotFoundException cfe) { - throw new RuntimeException("Class not found while loading change notifier"); - } - } - - private void addConfig(String path, ConfigurationMode configMode, Configuration config) { - if (configMode != null) { - switch (configMode) { - case MERGE: - mergeConfig.put(path, config); - break; - case OVERRIDE: - overrideConfig.put(path, config); - break; - case UNION: - unionConfig.put(path, config); - break; - default: - } - } else { - rootConfig.put(path, config); - } - } - - /** - * Add config. - * - * @param file the file - * @throws Exception the exception - */ - public void addConfig(File file) throws Exception { - addConfig(file.getAbsolutePath().toUpperCase(), ConfigurationUtils.getMergeStrategy(file), - ConfigurationUtils.getConfigurationBuilder(file, false).getConfiguration()); - } - - /** - * Add config. - * - * @param url the url - * @throws Exception the exception - */ - public void addConfig(URL url) throws Exception { - addConfig(url.getFile().toUpperCase(), ConfigurationUtils.getMergeStrategy(url), - ConfigurationUtils.getConfigurationBuilder(url).getConfiguration()); - } - - /** - * Remove config. - * - * @param file the file - */ - public void removeConfig(File file) { - String key = file.getAbsolutePath().toUpperCase(); - if (rootConfig.containsKey(key)) { - rootConfig.remove(key); - } else if (mergeConfig.containsKey(key)) { - mergeConfig.remove(key); - } else if (unionConfig.containsKey(key)) { - unionConfig.remove(key); - } else if (overrideConfig.containsKey(key)) { - overrideConfig.remove(key); - } - } - - /** - * Contains config boolean. - * - * @param file the file - * @return the boolean - */ - public boolean containsConfig(File file) { - String key = file.getAbsolutePath().toUpperCase(); - return rootConfig.containsKey(key) || mergeConfig.containsKey(key) - || unionConfig.containsKey(key) || overrideConfig.containsKey(key); - } - - /** - * Gets final configuration. - * - * @return the final configuration - */ - public Configuration getFinalConfiguration() { - CombinedConfiguration ccRoot = new CombinedConfiguration(new MergeCombiner()); - ArrayList tempList = new ArrayList<>(rootConfig.values()); - Collections.sort(tempList, this::sortForMerge); - for (Configuration conf : tempList) { - ccRoot.addConfiguration(conf); - } - CombinedConfiguration ccMergeRoot = new CombinedConfiguration(new MergeCombiner()); - ccMergeRoot.addConfiguration(ccRoot); - tempList = new ArrayList<>(mergeConfig.values()); - Collections.sort(tempList, this::sortForMerge); - for (Configuration conf : tempList) { - ccMergeRoot.addConfiguration(conf); - } - CombinedConfiguration ccUnionRoot = new CombinedConfiguration(new UnionCombiner()); - ccUnionRoot.addConfiguration(ccMergeRoot); - for (Configuration conf : unionConfig.values()) { - ccUnionRoot.addConfiguration(conf); - } - ArrayList tempOverrideConfigs = new ArrayList<>(overrideConfig.values()); - Collections.reverse(tempOverrideConfigs); - Collections.sort(tempOverrideConfigs, this::sortForOverride); - CombinedConfiguration ccOverrideRoot = new CombinedConfiguration(new OverrideCombiner()); - for (Configuration conf : tempOverrideConfigs) { - ccOverrideRoot.addConfiguration(conf); - } - ccOverrideRoot.addConfiguration(ccUnionRoot); - return ccOverrideRoot; - } - - private int sortForOverride(Configuration conf1, Configuration conf2){ - String order1 = conf1.getString(LOAD_ORDER_KEY); - String order2 = conf2.getString(LOAD_ORDER_KEY); - if (ConfigurationUtils.isBlank(order1) || !order1.trim().matches("\\d+")){ - order1 = "0"; - } - if (ConfigurationUtils.isBlank(order2) || !order2.trim().matches("\\d+")){ - order2 = "0"; - } - return Integer.parseInt(order2.trim())-Integer.parseInt(order1.trim()); - } - - private int sortForMerge(Configuration conf1, Configuration conf2){ - String order1 = conf1.getString(LOAD_ORDER_KEY); - String order2 = conf2.getString(LOAD_ORDER_KEY); - if (ConfigurationUtils.isBlank(order1) || !order1.trim().matches("\\d+")){ - order1 = "0"; - } - if (ConfigurationUtils.isBlank(order2) || !order2.trim().matches("\\d+")){ - order2 = "0"; - } - return Integer.parseInt(order1.trim())-Integer.parseInt(order2.trim()); - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/CliConfigurationImpl.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/CliConfigurationImpl.java deleted file mode 100644 index 8452d2f018..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/CliConfigurationImpl.java +++ /dev/null @@ -1,354 +0,0 @@ -package org.openecomp.config.impl; - -import static org.openecomp.config.Constants.DB_NAMESPACE; -import static org.openecomp.config.Constants.DEFAULT_NAMESPACE; -import static org.openecomp.config.Constants.DEFAULT_TENANT; -import static org.openecomp.config.Constants.KEY_ELEMENTS_DELEMETER; -import static org.openecomp.config.Constants.LOAD_ORDER_KEY; -import static org.openecomp.config.Constants.MBEAN_NAME; -import static org.openecomp.config.Constants.MODE_KEY; -import static org.openecomp.config.Constants.NAMESPACE_KEY; - -import org.apache.commons.configuration2.CombinedConfiguration; -import org.apache.commons.configuration2.CompositeConfiguration; -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.FileBasedConfiguration; -import org.apache.commons.configuration2.PropertiesConfiguration; -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.Constants; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.api.Hint; -import org.openecomp.config.type.ConfigurationQuery; -import org.openecomp.config.type.ConfigurationUpdate; - -import java.io.File; -import java.io.PrintWriter; -import java.lang.management.ManagementFactory; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import javax.management.MBeanServer; -import javax.management.MBeanServerDelegate; -import javax.management.MBeanServerNotification; -import javax.management.Notification; -import javax.management.ObjectName; -import javax.management.StandardMBean; - -/** - * The type Cli configuration. - */ -public final class CliConfigurationImpl extends ConfigurationImpl implements ConfigurationManager { - - /** - * Instantiates a new Cli configuration. - * - * @throws Exception the exception - */ - public CliConfigurationImpl() throws Exception { - MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); - ObjectName name = new ObjectName(MBEAN_NAME); - if (mbs.isRegistered(name)) { - mbs.unregisterMBean(name); - } - mbs.registerMBean(new StandardMBean(this, ConfigurationManager.class), name); - //mbs.registerMBean(getMBean(), name); - mbs.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this::handleNotification, null, - null); - //mbs.addNotificationListener(name, this::handleNotification, null, null); - } - - - /** - * Handle notification. - * - * @param notification the notification - * @param handback the handback - */ - public void handleNotification(Notification notification, Object handback) { - if (notification instanceof MBeanServerNotification) { - MBeanServerNotification mbs = (MBeanServerNotification) notification; - if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(mbs.getType())) { - try { - String mbean = - ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE) - .getString("shutdown.mbean"); - if (mbs.getMBeanName() - .equals(mbean == null ? new ObjectName(MBEAN_NAME) : new ObjectName(mbean))) { - changeNotifier.shutdown(); - ConfigurationDataSource.lookup().close(); - } - } catch (Exception exception) { - //do nothing. - } - } else if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(mbs.getType())) { - mbs.getMBeanName(); - } - } - } - - public String getConfigurationValue(Map input) { - return getConfigurationValue((ConfigurationQuery) getInput(input)); - } - - private String getConfigurationValue(ConfigurationQuery queryData) { - try { - if (queryData.isFallback()) { - return ConfigurationUtils.getCommaSeparatedList( - get(queryData.getTenant(), queryData.getNamespace(), queryData.getKey(), String[].class, - queryData.isLatest() ? Hint.LATEST_LOOKUP : Hint.DEFAULT, - queryData.isExternalLookup() ? Hint.EXTERNAL_LOOKUP : Hint.DEFAULT, - queryData.isNodeSpecific() ? Hint.NODE_SPECIFIC : Hint.DEFAULT)); - } else { - String[] list = - getInternal(queryData.getTenant(), queryData.getNamespace(), queryData.getKey(), - String[].class, queryData.isLatest() ? Hint.LATEST_LOOKUP : Hint.DEFAULT, - queryData.isExternalLookup() ? Hint.EXTERNAL_LOOKUP : Hint.DEFAULT, - queryData.isNodeSpecific() ? Hint.NODE_SPECIFIC : Hint.DEFAULT); - return ConfigurationUtils - .getCommaSeparatedList(list == null ? Arrays.asList() : Arrays.asList(list)); - } - } catch (Exception exception) { - exception.printStackTrace(); - } - return null; - } - - public void updateConfigurationValue(Map input) { - updateConfigurationValue((ConfigurationUpdate) getInput(input)); - } - - private void updateConfigurationValue(ConfigurationUpdate updateData) { - - try { - if (!ConfigurationRepository.lookup().isValidTenant(updateData.getTenant())) { - throw new RuntimeException("Invalid tenantId."); - } - if (!ConfigurationRepository.lookup().isValidNamespace(updateData.getNamespace())) { - throw new RuntimeException("Invalid Namespace."); - } - } catch (NullPointerException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - try { - boolean keyPresent = - isKeyExists(updateData.getTenant(), updateData.getNamespace(), updateData.getKey()); - if (keyPresent) { - boolean isUpdated = false; - Object[] paramArray = new Object[]{ - updateData.getTenant() + KEY_ELEMENTS_DELEMETER + updateData.getNamespace(), - new Long(System.currentTimeMillis()), updateData.getKey(), - getConfigurationValue(updateData), updateData.getValue()}; - Configuration config = ConfigurationRepository.lookup() - .getConfigurationFor(updateData.getTenant(), updateData.getNamespace()); - if (config instanceof AgglomerateConfiguration || config instanceof CombinedConfiguration) { - CompositeConfiguration cc = new CompositeConfiguration(); - cc.addConfiguration(config); - config = cc; - } - CompositeConfiguration configuration = (CompositeConfiguration) config; - int overrideIndex = -1; - for (int i = 0; i < configuration.getNumberOfConfigurations(); i++) { - if (!updateData.isNodeOverride() - && (configuration.getConfiguration(i) instanceof AgglomerateConfiguration - || configuration.getConfiguration(i) instanceof CombinedConfiguration)) { - configuration.getConfiguration(i) - .setProperty(updateData.getKey(), updateData.getValue()); - isUpdated = true; - break; - } else if (updateData.isNodeOverride() - && configuration.getConfiguration(i) instanceof FileBasedConfiguration) { - configuration.getConfiguration(i) - .setProperty(updateData.getKey(), updateData.getValue()); - isUpdated = true; - overrideIndex = i; - break; - } - } - if (!isUpdated) { - if (updateData.isNodeOverride()) { - PropertiesConfiguration pc = new PropertiesConfiguration(); - pc.setProperty(NAMESPACE_KEY, - updateData.getTenant() + Constants.TENANT_NAMESPACE_SAPERATOR - + updateData.getNamespace()); - pc.setProperty(MODE_KEY, "OVERRIDE"); - pc.setProperty(updateData.getKey(), updateData.getValue()); - if (System.getProperty("node.config.location") != null - && System.getProperty("node.config.location").trim().length() > 0) { - File file = new File(System.getProperty("node.config.location"), - updateData.getTenant() + File.separator + updateData.getNamespace() - + File.separator + "config.properties"); - file.getParentFile().mkdirs(); - PrintWriter out = new PrintWriter(file); - pc.write(out); - out.close(); - ConfigurationRepository.lookup().populateOverrideConfigurtaion( - updateData.getTenant() + KEY_ELEMENTS_DELEMETER + updateData.getNamespace(), - file); - } - } else { - configuration.getConfiguration(0) - .setProperty(updateData.getKey(), updateData.getValue()); - } - } - if (!updateData.isNodeOverride()) { - ConfigurationUtils.executeInsertSql( - ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE) - .getString("insertconfigurationchangecql"), paramArray); - } else { - ConfigurationRepository.lookup().refreshOverrideConfigurtaionFor( - updateData.getTenant() + KEY_ELEMENTS_DELEMETER + updateData.getNamespace(), - overrideIndex); - } - } - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - private boolean isKeyExists(String tenant, String namespace, String key) { - boolean keyExist = false; - try { - keyExist = - ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace).containsKey(key); - if (!keyExist && !DEFAULT_TENANT.equals(tenant)) { - keyExist = ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, namespace) - .containsKey(key); - } - if (!keyExist && !DEFAULT_NAMESPACE.equals(namespace)) { - keyExist = ConfigurationRepository.lookup().getConfigurationFor(tenant, DEFAULT_NAMESPACE) - .containsKey(key); - } - if (!keyExist && !DEFAULT_TENANT.equals(tenant) && !DEFAULT_NAMESPACE.equals(namespace)) { - keyExist = - ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DEFAULT_NAMESPACE) - .containsKey(key); - } - } catch (Exception exception) { - exception.printStackTrace(); - } - return keyExist; - } - - public Map listConfiguration(Map input) { - return listConfiguration((ConfigurationQuery) getInput(input)); - } - - private Map listConfiguration(ConfigurationQuery query) { - Map map = new HashMap<>(); - try { - Collection keys = getKeys(query.getTenant(), query.getNamespace()); - for (String key : keys) { - map.put(key, getConfigurationValue(query.key(key))); - } - } catch (Exception exception) { - exception.printStackTrace(); - return null; - } - return map; - } - - @Override - public boolean updateConfigurationValues(String tenant, String namespace, - Map configKeyValueStore) { - boolean valueToReturn = true; - Iterator keys = configKeyValueStore.keySet().iterator(); - while (keys.hasNext()) { - try { - String key = keys.next(); - ConfigurationUpdate updateData = new ConfigurationUpdate(); - updateData.tenant(tenant).namespace(namespace).key(key); - updateData.value(configKeyValueStore.get(key).toString()); - updateConfigurationValue(updateData); - } catch (Exception exception) { - exception.printStackTrace(); - valueToReturn = false; - } - } - return valueToReturn; - } - - private Object getInput(Map input) { - Object toReturn = null; - try { - toReturn = Class.forName(input.get("ImplClass").toString()).newInstance(); - Method[] methods = toReturn.getClass().getMethods(); - for (Method method : methods) { - if (input.containsKey(method.getName())) { - method.invoke(toReturn, input.get(method.getName())); - } - } - } catch (Exception exception) { - exception.printStackTrace(); - } - - return toReturn; - } - - @Override - public Collection getTenants() { - return ConfigurationRepository.lookup().getTenants(); - } - - @Override - public Collection getNamespaces() { - return ConfigurationRepository.lookup().getNamespaces(); - } - - private ArrayList getInMemoryKeys(String tenant, String namespace) { - ArrayList keys = new ArrayList<>(); - - try { - Iterator iter = - ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace).getKeys(); - while (iter.hasNext()) { - String key = iter.next(); - if (!(key.equals(NAMESPACE_KEY) || key.equals(MODE_KEY) - || key.equals(LOAD_ORDER_KEY))) { - keys.add(key); - } - } - } catch (Exception exception) { - //do nothing - } - - return keys; - } - - @Override - public Collection getKeys(String tenant, String namespace) { - Set keyCollection = new HashSet<>(); - try { - keyCollection.addAll(ConfigurationUtils.executeSelectSql( - ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE) - .getString("fetchkeysql"), - new String[]{tenant + KEY_ELEMENTS_DELEMETER + DEFAULT_NAMESPACE})); - keyCollection.addAll(ConfigurationUtils.executeSelectSql( - ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE) - .getString("fetchkeysql"), - new String[]{tenant + KEY_ELEMENTS_DELEMETER + namespace})); - keyCollection.addAll(ConfigurationUtils.executeSelectSql( - ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE) - .getString("fetchkeysql"), - new String[]{DEFAULT_TENANT + KEY_ELEMENTS_DELEMETER + namespace})); - keyCollection.addAll(ConfigurationUtils.executeSelectSql( - ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE) - .getString("fetchkeysql"), - new String[]{DEFAULT_TENANT + KEY_ELEMENTS_DELEMETER + DEFAULT_NAMESPACE})); - } catch (Exception exception) { - exception.printStackTrace(); - keyCollection.addAll(getInMemoryKeys(tenant, DEFAULT_NAMESPACE)); - keyCollection.addAll(getInMemoryKeys(tenant, namespace)); - keyCollection.addAll(getInMemoryKeys(DEFAULT_TENANT, namespace)); - keyCollection.addAll(getInMemoryKeys(DEFAULT_TENANT, DEFAULT_NAMESPACE)); - } - return keyCollection; - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationChangeNotifier.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationChangeNotifier.java deleted file mode 100644 index 3922720d48..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationChangeNotifier.java +++ /dev/null @@ -1,476 +0,0 @@ -package org.openecomp.config.impl; - -import static org.openecomp.config.ConfigurationUtils.isArray; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.Constants; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.api.Hint; - -import java.io.File; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.lang.reflect.Method; -import java.nio.file.ClosedWatchServiceException; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.StandardWatchEventKinds; -import java.nio.file.WatchEvent; -import java.nio.file.WatchKey; -import java.nio.file.WatchService; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.Vector; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import javax.management.JMX; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; - - -/** - * The type Configuration change notifier. - */ -public final class ConfigurationChangeNotifier { - - private final HashMap> store = new HashMap<>(); - private final ScheduledExecutorService executor = - Executors.newScheduledThreadPool(5, ConfigurationUtils.getThreadFactory()); - private final ExecutorService notificationExecutor = - Executors.newCachedThreadPool(ConfigurationUtils.getThreadFactory()); - private final Map watchServiceCollection = - Collections.synchronizedMap(new HashMap<>()); - - static { - if (!Thread.currentThread().getStackTrace()[2].getClassName() - .equals(ConfigurationImpl.class.getName())) { - throw new RuntimeException("Illegal access."); - } - } - - /** - * Instantiates a new Configuration change notifier. - * - * @param inMemoryConfig the in memory config - */ - public ConfigurationChangeNotifier(Map inMemoryConfig) { - executor.scheduleWithFixedDelay(() -> this - .pollFilesystemAndUpdateConfigurationIfRequired(inMemoryConfig, - System.getProperty("config.location"), false), 1, 1, TimeUnit.MILLISECONDS); - executor.scheduleWithFixedDelay(() -> this - .pollFilesystemAndUpdateConfigurationIfRequired(inMemoryConfig, - System.getProperty("tenant.config.location"), true), 1, 1, TimeUnit.MILLISECONDS); - executor.scheduleWithFixedDelay(() -> this - .pollFilesystemAndUpdateNodeSpecificConfigurationIfRequired( - System.getProperty("node.config.location")), 1, 1, TimeUnit.MILLISECONDS); - } - - /** - * Shutdown. - */ - public void shutdown() { - for (WatchService watch : watchServiceCollection.values()) { - try { - watch.close(); - } catch (IOException exception) { - //do nothing - } - } - executor.shutdownNow(); - } - - /** - * Poll filesystem and update configuration if required. - * - * @param inMemoryConfig the in memory config - * @param location the location - * @param isTenantLocation the is tenant location - */ - public void pollFilesystemAndUpdateConfigurationIfRequired( - Map inMemoryConfig, String location, - boolean isTenantLocation) { - try { - Set paths = watchForChange(location); - if (paths != null) { - for (Path path : paths) { - File file = path.toAbsolutePath().toFile(); - String repositoryKey = null; - if (ConfigurationUtils.isConfig(file) && file.isFile()) { - if (isTenantLocation) { - Collection tenantsRoot = - ConfigurationUtils.getAllFiles(new File(location), false, true); - for (File tenantRoot : tenantsRoot) { - if (file.getAbsolutePath().startsWith(tenantRoot.getAbsolutePath())) { - repositoryKey = ConfigurationUtils.getConfigurationRepositoryKey( - (tenantRoot.getName() + Constants.TENANT_NAMESPACE_SAPERATOR - + ConfigurationUtils.getNamespace(file)) - .split(Constants.TENANT_NAMESPACE_SAPERATOR)); - } - } - } else { - repositoryKey = ConfigurationUtils.getConfigurationRepositoryKey(file); - } - AggregateConfiguration config = inMemoryConfig.get(repositoryKey); - if (config != null) { - LinkedHashMap origConfig = ConfigurationUtils.toMap(config.getFinalConfiguration()); - config.addConfig(file); - LinkedHashMap latestConfig = ConfigurationUtils.toMap(config.getFinalConfiguration()); - Map map = ConfigurationUtils.diff(origConfig, latestConfig); - String[] tenantNamespaceArray = - repositoryKey.split(Constants.KEY_ELEMENTS_DELEMETER); - updateConfigurationValues(tenantNamespaceArray[0], tenantNamespaceArray[1], map); - } - } else { - for (String configKey : inMemoryConfig.keySet()) { - repositoryKey = configKey; - AggregateConfiguration config = inMemoryConfig.get(repositoryKey); - if (config.containsConfig(file)) { - LinkedHashMap origConfig = ConfigurationUtils.toMap(config.getFinalConfiguration()); - config.removeConfig(file); - LinkedHashMap latestConfig = - ConfigurationUtils.toMap(config.getFinalConfiguration()); - Map map = ConfigurationUtils.diff(origConfig, latestConfig); - String[] tenantNamespaceArray = - repositoryKey.split(Constants.KEY_ELEMENTS_DELEMETER); - updateConfigurationValues(tenantNamespaceArray[0], tenantNamespaceArray[1], - map); - } - } - } - } - } - } catch (ClosedWatchServiceException exception) { - // do nothing. - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - private void updateConfigurationValues(String tenant, String namespace, Map map) - throws Exception { - MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer(); - ObjectName mbeanName = new ObjectName(Constants.MBEAN_NAME); - ConfigurationManager conf = - JMX.newMBeanProxy(mbsc, mbeanName, org.openecomp.config.api.ConfigurationManager.class, - true); - conf.updateConfigurationValues(tenant, namespace, map); - } - - /** - * Poll filesystem and update node specific configuration if required. - * - * @param location the location - */ - public void pollFilesystemAndUpdateNodeSpecificConfigurationIfRequired(String location) { - try { - Set paths = watchForChange(location); - if (paths != null) { - for (Path path : paths) { - File file = path.toAbsolutePath().toFile(); - - if (ConfigurationUtils.isConfig(file)) { - String repositoryKey = ConfigurationUtils.getConfigurationRepositoryKey(file); - ConfigurationRepository.lookup().populateOverrideConfigurtaion(repositoryKey, file); - } else { - ConfigurationRepository.lookup().removeOverrideConfigurtaion(file); - } - } - } - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - /** - * Notify changes towards. - * - * @param tenant the tenant - * @param component the component - * @param key the key - * @param myself the myself - * @throws Exception the exception - */ - public void notifyChangesTowards(String tenant, String component, String key, - ConfigurationChangeListener myself) throws Exception { - List notificationList = - store.get(tenant + Constants.KEY_ELEMENTS_DELEMETER + component); - if (notificationList == null) { - notificationList = Collections.synchronizedList(new ArrayList()); - store.put(tenant + Constants.KEY_ELEMENTS_DELEMETER + component, notificationList); - executor.scheduleWithFixedDelay( - () -> triggerScanning(tenant + Constants.KEY_ELEMENTS_DELEMETER + component), 1, 30000, - TimeUnit.MILLISECONDS); - } - notificationList.add(new NotificationData(tenant, component, key, myself)); - } - - /** - * Stop notification towards. - * - * @param tenant the tenant - * @param component the component - * @param key the key - * @param myself the myself - * @throws Exception the exception - */ - public void stopNotificationTowards(String tenant, String component, String key, - ConfigurationChangeListener myself) throws Exception { - List notificationList = - store.get(tenant + Constants.KEY_ELEMENTS_DELEMETER + component); - if (notificationList != null) { - boolean removed = - notificationList.remove(new NotificationData(tenant, component, key, myself)); - if (removed && notificationList.isEmpty()) { - store.remove(tenant + Constants.KEY_ELEMENTS_DELEMETER + component); - } - } - - } - - private void triggerScanning(String key) { - if (store.get(key) != null) { - notificationExecutor.submit(() -> scanForChanges(key)); - } else { - throw new IllegalArgumentException("Notification service for " + key + " is suspended."); - } - } - - private void scanForChanges(String key) { - List list = store.get(key); - if (list != null) { - list.stream() - .filter(NotificationData::isChanged) - .forEach(notificationData -> notificationExecutor.submit(() -> sendNotification(notificationData))); - } - } - - private void sendNotification(NotificationData notificationData) { - try { - notificationData.dispatchNotification(); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - private Set watchForChange(String location) throws Exception { - if (location == null || location.trim().length() == 0) { - return null; - } - File file = new File(location); - if (!file.exists()) { - return null; - } - Path path = file.toPath(); - Set toReturn = new HashSet<>(); - try (final WatchService watchService = FileSystems.getDefault().newWatchService()) { - watchServiceCollection.put(location, watchService); - path.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY, - StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE); - for (File dir : ConfigurationUtils.getAllFiles(file, true, true)) { - dir.toPath().register(watchService, StandardWatchEventKinds.ENTRY_MODIFY, - StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE); - } - while (true) { - final WatchKey wk = watchService.take(); - Thread.sleep(ConfigurationRepository.lookup() - .getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE) - .getLong("event.fetch.delay")); - for (WatchEvent event : wk.pollEvents()) { - Object context = event.context(); - if (context instanceof Path) { - File newFile = new File(((Path) wk.watchable()).toFile(), context.toString()); - if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) { - if (newFile.isDirectory()) { - newFile.toPath().register(watchService, StandardWatchEventKinds.ENTRY_MODIFY, - StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE); - continue; - } - } else if (event.kind() == StandardWatchEventKinds.ENTRY_MODIFY) { - if (newFile.isDirectory()) { - continue; - } - } - toReturn.add(newFile.toPath()); - } - } - if (toReturn.isEmpty()) { - continue; - } - break; - } - } - return toReturn; - } - - /** - * The type Notification data. - */ - static class NotificationData { - - /** - * The Tenant. - */ - final String tenant; - /** - * The Namespace. - */ - final String namespace; - /** - * The Key. - */ - final String key; - /** - * The Myself. - */ - final ConfigurationChangeListener myself; - /** - * The Current value. - */ - Object currentValue; - /** - * The Is array. - */ - boolean isArray; - - /** - * Instantiates a new Notification data. - * - * @param tenant the tenant - * @param component the component - * @param key the key - * @param myself the myself - * @throws Exception the exception - */ - public NotificationData(String tenant, String component, String key, - ConfigurationChangeListener myself) throws Exception { - this.tenant = tenant; - this.namespace = component; - this.key = key; - this.myself = myself; - if (!ConfigurationRepository.lookup().getConfigurationFor(tenant, component) - .containsKey(key)) { - throw new RuntimeException("Key[" + key + "] not found."); - } - isArray = isArray(tenant, component, key, Hint.DEFAULT.value()); - if (isArray) { - currentValue = ConfigurationManager.lookup().getAsStringValues(tenant, component, key); - } else { - currentValue = ConfigurationManager.lookup().getAsString(tenant, component, key); - } - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof NotificationData)) { - return false; - } - NotificationData nd = (NotificationData) obj; - return Objects.equals(tenant, nd.tenant) - && Objects.equals(namespace, nd.namespace) - && Objects.equals(key, nd.key) - && Objects.equals(myself, nd.myself) - && Objects.equals(currentValue, nd.currentValue) // it's either String or List - && isArray == nd.isArray; - } - - @Override - public int hashCode() { - return Objects.hash(tenant, namespace, key, myself, currentValue, isArray); - } - - /** - * Is changed boolean. - * - * @return the boolean - */ - public boolean isChanged() { - Object latestValue; - try { - if (isArray) { - latestValue = ConfigurationManager.lookup().getAsStringValues(tenant, namespace, key); - } else { - latestValue = ConfigurationManager.lookup().getAsString(tenant, namespace, key); - } - if (!isArray) { - return !currentValue.equals(latestValue); - } else { - Collection oldCollection = (Collection) currentValue; - Collection newCollection = (Collection) latestValue; - for (String val : oldCollection) { - if (!newCollection.remove(val)) { - return true; - } - } - return !newCollection.isEmpty(); - } - } catch (Exception exception) { - return false; - } - } - - /** - * Dispatch notification. - * - * @throws Exception the exception - */ - public void dispatchNotification() throws Exception { - Method method = null; - Vector parameters = null; - try { - Object latestValue; - if (isArray) { - latestValue = ConfigurationManager.lookup().getAsStringValues(tenant, namespace, key); - } else { - latestValue = ConfigurationManager.lookup().getAsString(tenant, namespace, key); - } - Method[] methods = myself.getClass().getDeclaredMethods(); - if (methods != null && methods.length > 0) { - method = methods[0]; - int paramCount = method.getParameterCount(); - parameters = new Vector<>(); - if (paramCount > 4) { - if (tenant.equals(Constants.DEFAULT_TENANT)) { - parameters.add(null); - } else { - parameters.add(tenant); - } - } - if (paramCount > 3) { - if (namespace.equals(Constants.DEFAULT_NAMESPACE)) { - parameters.add(null); - } else { - parameters.add(namespace); - } - } - parameters.add(key); - parameters.add(currentValue); - parameters.add(latestValue); - method.setAccessible(true); - } - } catch (Exception exception) { - exception.printStackTrace(); - } finally { - isArray = isArray(tenant, namespace, key, Hint.DEFAULT.value()); - if (isArray) { - currentValue = ConfigurationManager.lookup().getAsStringValues(tenant, namespace, key); - } else { - currentValue = ConfigurationManager.lookup().getAsString(tenant, namespace, key); - } - if (method != null && parameters != null) { - method.invoke(myself, parameters.toArray()); - } - } - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java deleted file mode 100644 index a60403e4dc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.openecomp.config.impl; - -import org.apache.commons.configuration2.ImmutableConfiguration; -import org.apache.commons.dbcp2.BasicDataSource; -import org.apache.commons.lang3.StringUtils; -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.Constants; - -import java.sql.Driver; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.ServiceLoader; -import java.util.Set; - -/** - * The type Configuration data source. - */ -public final class ConfigurationDataSource { - - private static BasicDataSource configDBDatasource = null; - private static Set validCallers = Collections.unmodifiableSet(new HashSet<>( - Arrays.asList(ConfigurationUtils.class.getName(), CliConfigurationImpl.class.getName()))); - - private ConfigurationDataSource() { - //Hide constructor to prevent instantiation using the default implicit constructor - } - - static { - try { - configDBDatasource = initDataSource(); - } catch (Exception exception) { - System.err.println("Datasource initialization error. Configuration management will be using" - + "in-memory persistence."); - } - } - - /** - * Lookup basic data source. - * - * @return the basic data source - * @throws Exception the exception - */ - public static BasicDataSource lookup() throws Exception { - if (validCallers.contains(Thread.currentThread().getStackTrace()[2].getClassName())) { - return configDBDatasource; - } else { - return null; - } - } - - /** - * Init data source basic data source. - * - * @return the basic data source - * @throws Exception the exception - */ - public static BasicDataSource initDataSource() throws Exception { - ImmutableConfiguration dbConfig = ConfigurationRepository.lookup() - .getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE); - if (StringUtils.isEmpty(dbConfig.getString("dbhost"))) { - return null; - } - BasicDataSource datasource = new BasicDataSource(); - String driverClassName = dbConfig.getString("driverClassName"); - String jdbcUrl = dbConfig.getString("jdbcURL"); - if (!isDriverSuitable(driverClassName, jdbcUrl)) { - driverClassName = getDriverFor(jdbcUrl); - } - datasource.setDriverClassName(driverClassName); - datasource.setUrl(jdbcUrl); - String dbuser = dbConfig.getString("dbuser"); - String dbpassword = dbConfig.getString("dbpassword"); - if (dbuser != null && dbuser.trim().length() > 0) { - datasource.setUsername(dbuser); - } - if (dbpassword != null && dbpassword.trim().length() > 0) { - datasource.setPassword(dbpassword); - } - return datasource; - } - - private static boolean isDriverSuitable(String driverClassName, String url) { - if (driverClassName == null || driverClassName.trim().length() == 0) { - return false; - } - try { - Driver driver = Driver.class.cast(Class.forName(driverClassName).newInstance()); - return driver.acceptsURL(url); - } catch (Exception exception) { - return false; - } - } - - private static String getDriverFor(String url) throws Exception { - ServiceLoader loader = ServiceLoader.load(Driver.class); - for (Driver driver : loader) { - if (driver.acceptsURL(url)) { - return driver.getClass().getName(); - } - } - throw new RuntimeException("No Suitable driver found for " + url); - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationFilter.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationFilter.java deleted file mode 100644 index 4aa474c9ea..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openecomp.config.impl; - -import org.openecomp.config.Constants; -import org.openecomp.config.api.Configuration; - -import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.annotation.WebFilter; - -@WebFilter("/") -public class ConfigurationFilter implements Filter { - - @Override - public void init(FilterConfig paramFilterConfig) throws ServletException { - //Use the default behavior - } - - @Override - public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse, - FilterChain paramFilterChain) throws IOException, ServletException { - Configuration.tenant.set(Constants.DEFAULT_TENANT); - try { - paramFilterChain.doFilter(paramServletRequest, paramServletResponse); - } finally { - Configuration.tenant.remove(); - } - } - - @Override - public void destroy() { - //Use the default behavior - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationImpl.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationImpl.java deleted file mode 100644 index 26e8f8e7bb..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationImpl.java +++ /dev/null @@ -1,684 +0,0 @@ -package org.openecomp.config.impl; - -import static org.openecomp.config.ConfigurationUtils.getConfigurationRepositoryKey; -import static org.openecomp.config.ConfigurationUtils.getProperty; -import static org.openecomp.config.ConfigurationUtils.isExternalLookup; -import static org.openecomp.config.ConfigurationUtils.isWrapperClass; -import static org.openecomp.config.ConfigurationUtils.isZeroLengthArray; - -import static org.openecomp.config.Constants.DB_NAMESPACE; -import static org.openecomp.config.Constants.DEFAULT_NAMESPACE; -import static org.openecomp.config.Constants.DEFAULT_TENANT; -import static org.openecomp.config.Constants.KEY_ELEMENTS_DELEMETER; - -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.DatabaseConfiguration; -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.Constants; -import org.openecomp.config.NonConfigResource; -import org.openecomp.config.api.Config; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.Hint; - -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Predicate; - -/** - * The type Configuration. - */ -public class ConfigurationImpl implements org.openecomp.config.api.Configuration { - - private static ThreadLocal tenant = new ThreadLocal() { - protected String initialValue() { - return Constants.DEFAULT_TENANT; - } - - ; - }; - private static boolean instantiated = false; - /** - * The Change notifier. - */ - ConfigurationChangeNotifier changeNotifier; - - /** - * Instantiates a new Configuration. - * - * @throws Exception the exception - */ - public ConfigurationImpl() throws Exception { - if (instantiated || !CliConfigurationImpl.class.isAssignableFrom(this.getClass())) { - throw new RuntimeException("Illegal access to configuration."); - } - Map moduleConfigStore = new HashMap<>(); - List classpathResources = ConfigurationUtils.getAllClassPathResources(); - Predicate predicate = ConfigurationUtils::isConfig; - for (URL url : classpathResources) { - if (predicate.test(url)) { - String moduleName = getConfigurationRepositoryKey(url); - AggregateConfiguration moduleConfig = moduleConfigStore.get(moduleName); - if (moduleConfig == null) { - moduleConfig = new AggregateConfiguration(); - moduleConfigStore.put(moduleName, moduleConfig); - } - moduleConfig.addConfig(url); - } else { - NonConfigResource.add(url); - } - } - String configLocation = System.getProperty("config.location"); - if (configLocation != null && configLocation.trim().length() > 0) { - File root = new File(configLocation); - Collection filesystemResources = ConfigurationUtils.getAllFiles(root, true, false); - Predicate filePredicate = ConfigurationUtils::isConfig; - for (File file : filesystemResources) { - if (filePredicate.test(file)) { - String moduleName = getConfigurationRepositoryKey(file); - AggregateConfiguration moduleConfig = moduleConfigStore.get(moduleName); - if (moduleConfig == null) { - moduleConfig = new AggregateConfiguration(); - moduleConfigStore.put(moduleName, moduleConfig); - } - moduleConfig.addConfig(file); - } else { - NonConfigResource.add(file); - } - } - } - String tenantConfigLocation = System.getProperty("tenant.config.location"); - if (tenantConfigLocation != null && tenantConfigLocation.trim().length() > 0) { - File root = new File(tenantConfigLocation); - Collection tenantsRoot = ConfigurationUtils.getAllFiles(root, false, true); - Collection filesystemResources = ConfigurationUtils.getAllFiles(root, true, false); - Predicate filePredicate = ConfigurationUtils::isConfig; - for (File file : filesystemResources) { - if (filePredicate.test(file)) { - String moduleName = ConfigurationUtils.getNamespace(file); - for (File tenanatFileRoot : tenantsRoot) { - if (file.getAbsolutePath().startsWith(tenanatFileRoot.getAbsolutePath())) { - moduleName = getConfigurationRepositoryKey( - (tenanatFileRoot.getName().toUpperCase() + Constants.TENANT_NAMESPACE_SAPERATOR - + moduleName).split(Constants.TENANT_NAMESPACE_SAPERATOR)); - } - } - AggregateConfiguration moduleConfig = moduleConfigStore.get(moduleName); - if (moduleConfig == null) { - moduleConfig = new AggregateConfiguration(); - moduleConfigStore.put(moduleName, moduleConfig); - } - moduleConfig.addConfig(file); - } - } - } - populateFinalConfigurationIncrementally(moduleConfigStore); - ConfigurationRepository.lookup().initTenantsAndNamespaces(); - String nodeConfigLocation = System.getProperty("node.config.location"); - if (nodeConfigLocation != null && nodeConfigLocation.trim().length() > 0) { - File root = new File(nodeConfigLocation); - Collection filesystemResources = ConfigurationUtils.getAllFiles(root, true, false); - Predicate filePredicate = ConfigurationUtils::isConfig; - for (File file : filesystemResources) { - if (filePredicate.test(file)) { - ConfigurationRepository.lookup().populateOverrideConfigurtaion( - getConfigurationRepositoryKey(ConfigurationUtils.getNamespace(file) - .split(Constants.TENANT_NAMESPACE_SAPERATOR)), file); - } - } - } - instantiated = true; - changeNotifier = new ConfigurationChangeNotifier(moduleConfigStore); - } - - @Override - public void addConfigurationChangeListener(String tenant, String namespace, String key, - ConfigurationChangeListener myself) { - tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() - : Constants.DEFAULT_TENANT; - namespace = - ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() - : Constants.DEFAULT_NAMESPACE; - if (key == null || key.trim().length() == 0) { - throw new IllegalArgumentException("Key can't be null."); - } - if (myself == null) { - throw new IllegalArgumentException("ConfigurationChangeListener instance is null."); - } - try { - changeNotifier.notifyChangesTowards(tenant, namespace, key, myself); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - private void populateFinalConfigurationIncrementally(Map configs) - throws Exception { - boolean isDbAccessible = false; - if (configs.get( - Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELEMETER + Constants.DB_NAMESPACE) - != null) { - ConfigurationRepository.lookup().populateConfigurtaion( - Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELEMETER + Constants.DB_NAMESPACE, - configs.remove( - Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELEMETER + Constants.DB_NAMESPACE) - .getFinalConfiguration()); - isDbAccessible = ConfigurationUtils.executeDdlSql(ConfigurationRepository.lookup() - .getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE) - .getString("createtablecql")); - if (isDbAccessible) { - ConfigurationUtils.executeDdlSql(ConfigurationRepository.lookup() - .getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE) - .getString("createmonitoringtablecql")); - } - } - - Set modules = configs.keySet(); - for (String module : modules) { - if (isDbAccessible) { - DatabaseConfiguration config = - ConfigurationUtils.getDbConfigurationBuilder(module).getConfiguration(); - Configuration currentConfig = configs.get(module).getFinalConfiguration(); - Iterator keys = currentConfig.getKeys(); - while (keys.hasNext()) { - String currentKey = keys.next(); - if (!(Constants.MODE_KEY.equals(currentKey) - || Constants.NAMESPACE_KEY.equals(currentKey) - || Constants.LOAD_ORDER_KEY.equals(currentKey))) { - if (!config.containsKey(currentKey)) { - Object propValue = currentConfig.getProperty(currentKey); - if (propValue instanceof Collection) { - config.addProperty(currentKey, propValue.toString()); - } else { - config.addProperty(currentKey, propValue); - } - } - } - } - } else { - ConfigurationRepository.lookup() - .populateConfigurtaion(module, configs.get(module).getFinalConfiguration()); - } - } - } - - @Override - public T get(String tenant, String namespace, String key, Class clazz, Hint... hints) { - - String[] tenantNamespaceArrayy = null; - if (tenant == null && namespace != null - && (tenantNamespaceArrayy = namespace.split(Constants.TENANT_NAMESPACE_SAPERATOR)).length - > 1) { - tenant = tenantNamespaceArrayy[0]; - namespace = tenantNamespaceArrayy[1]; - } - - tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() - : Constants.DEFAULT_TENANT; - namespace = - ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() - : Constants.DEFAULT_NAMESPACE; - T returnValue = null; - returnValue = (T) getInternal(tenant, namespace, key, - clazz.isPrimitive() ? getWrapperClass(clazz) : clazz, - hints == null || hints.length == 0 ? new Hint[]{Hint.EXTERNAL_LOOKUP, Hint.NODE_SPECIFIC} - : hints); - if ((returnValue == null || isZeroLengthArray(clazz, returnValue)) - && !Constants.DEFAULT_TENANT.equals(tenant)) { - returnValue = (T) getInternal(Constants.DEFAULT_TENANT, namespace, key, - clazz.isPrimitive() ? getWrapperClass(clazz) : clazz, - hints == null || hints.length == 0 ? new Hint[]{Hint.EXTERNAL_LOOKUP, Hint.NODE_SPECIFIC} - : hints); - } - if ((returnValue == null || isZeroLengthArray(clazz, returnValue)) - && !Constants.DEFAULT_NAMESPACE.equals(namespace)) { - returnValue = (T) getInternal(tenant, Constants.DEFAULT_NAMESPACE, key, - clazz.isPrimitive() ? getWrapperClass(clazz) : clazz, - hints == null || hints.length == 0 ? new Hint[]{Hint.EXTERNAL_LOOKUP, Hint.NODE_SPECIFIC} - : hints); - } - if ((returnValue == null ||isZeroLengthArray(clazz, returnValue)) - && !Constants.DEFAULT_NAMESPACE.equals(namespace) - && !Constants.DEFAULT_TENANT.equals(tenant)) { - returnValue = (T) getInternal(Constants.DEFAULT_TENANT, Constants.DEFAULT_NAMESPACE, key, - clazz.isPrimitive() ? getWrapperClass(clazz) : clazz, - hints == null || hints.length == 0 ? new Hint[]{Hint.EXTERNAL_LOOKUP, Hint.NODE_SPECIFIC} - : hints); - } - if (returnValue == null && clazz.isPrimitive()) { - return (T) ConfigurationUtils.getDefaultFor(clazz); - } else { - return returnValue; - } - } - - - /** - * Gets internal. - * - * @param the type parameter - * @param tenant the tenant - * @param namespace the namespace - * @param key the key - * @param clazz the clazz - * @param hints the hints - * @return the internal - */ - protected T getInternal(String tenant, String namespace, String key, Class clazz, - Hint... hints) { - int processingHints = Hint.DEFAULT.value(); - if (hints != null) { - for (Hint hint : hints) { - processingHints = processingHints | hint.value(); - } - } - - if (tenant == null || tenant.trim().length() == 0) { - tenant = this.tenant.get(); - } else { - tenant = tenant.toUpperCase(); - } - if (namespace == null || namespace.trim().length() == 0) { - namespace = Constants.DEFAULT_NAMESPACE; - } else { - namespace = namespace.toUpperCase(); - } - if (key == null || key.trim().length() == 0) { - if (!clazz.isAnnotationPresent(Config.class)) { - throw new IllegalArgumentException("Key can't be null."); - } - } - if (clazz == null) { - throw new IllegalArgumentException("clazz is null."); - } - if (clazz.isPrimitive()) { - clazz = getWrapperClass(clazz); - } - try { - if (isWrapperClass(clazz) || clazz.isPrimitive()) { - Object obj = - getProperty(ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace), - key, processingHints); - if (obj != null) { - if (ConfigurationUtils.isCollection(obj.toString())) { - obj = ConfigurationUtils.getCollectionString(obj.toString()); - } - String value = obj.toString().split(",")[0]; - value = ConfigurationUtils.processVariablesIfPresent(tenant, namespace, value); - return (T) getValue(value, clazz.isPrimitive() ? getWrapperClass(clazz) : clazz, - processingHints); - } else { - return null; - } - } else if (clazz.isArray() - && (clazz.getComponentType().isPrimitive() || isWrapperClass(clazz.getComponentType()))) { - Object obj = - getProperty(ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace), - key, processingHints); - if (obj != null) { - Class componentClass = clazz.getComponentType(); - if (clazz.getComponentType().isPrimitive()) { - componentClass = getWrapperClass(clazz.getComponentType()); - } - String collString = ConfigurationUtils.getCollectionString(obj.toString()); - ArrayList tempCollection = new ArrayList<>(); - for (String itemValue : collString.split(",")) { - tempCollection - .add(ConfigurationUtils.processVariablesIfPresent(tenant, namespace, itemValue)); - } - Collection collection = convert( - ConfigurationUtils.getCollectionString(Arrays.toString(tempCollection.toArray())), - componentClass, processingHints); - if (clazz.getComponentType().isPrimitive()) { - return (T) ConfigurationUtils.getPrimitiveArray(collection, clazz.getComponentType()); - } else { - return (T) collection - .toArray(getZeroLengthArrayFor(getWrapperClass(clazz.getComponentType()))); - } - } else { - return null; - } - } else if (clazz.isAnnotationPresent(Config.class)) { - return read(tenant, namespace, clazz, - (key == null || key.trim().length() == 0) ? "" : (key + "."), hints); - } else { - throw new IllegalArgumentException( - "Only pimitive classes, wrapper classes, corresponding array classes and any " - + "class decorated with @org.openecomp.config.api.Config are allowed as argument."); - } - } catch (Exception exception) { - exception.printStackTrace(); - } - return null; - } - - - private T read(String tenant, String namespace, Class clazz, String keyPrefix, - Hint... hints) throws Exception { - org.openecomp.config.api.Config confAnnot = - clazz.getAnnotation(org.openecomp.config.api.Config.class); - if (confAnnot != null && confAnnot.key().length()>0 && !keyPrefix.endsWith(".")) { - keyPrefix += (confAnnot.key() + "."); - } - Constructor constructor = clazz.getDeclaredConstructor(); - constructor.setAccessible(true); - T objToReturn = constructor.newInstance(); - for (Field field : clazz.getDeclaredFields()) { - field.setAccessible(true); - org.openecomp.config.api.Config fieldConfAnnot = - field.getAnnotation(org.openecomp.config.api.Config.class); - if (fieldConfAnnot != null) { - if (field.getType().isPrimitive() || isWrapperClass(field.getType()) - || (field.getType().isArray() && (field.getType().getComponentType().isPrimitive() - || isWrapperClass(field.getType().getComponentType()))) - || field.getType().getAnnotation(org.openecomp.config.api.Config.class) != null) { - field.set(objToReturn, - get(tenant, namespace, keyPrefix + fieldConfAnnot.key(), field.getType(), hints)); - } else if (Collection.class.isAssignableFrom(field.getType())) { - Object obj = get(tenant, namespace, keyPrefix + fieldConfAnnot.key(), - ConfigurationUtils.getArrayClass(ConfigurationUtils.getCollectionGenericType(field)), - hints); - if (obj != null) { - List list = Arrays.asList((Object[]) obj); - Class clazzToInstantiate = null; - if (field.getType().isInterface()) { - clazzToInstantiate = - ConfigurationUtils.getConcreteCollection(field.getType()).getClass(); - } else if (Modifier.isAbstract(field.getType().getModifiers())) { - clazzToInstantiate = - ConfigurationUtils.getCompatibleCollectionForAbstractDef(field.getType()) - .getClass(); - } else { - clazzToInstantiate = field.getType(); - } - Constructor construct = - getConstructorWithArguments(clazzToInstantiate, Collection.class); - if (construct != null) { - construct.setAccessible(true); - field.set(objToReturn, construct.newInstance(list)); - } else if ((construct = - getConstructorWithArguments(clazzToInstantiate, Integer.class, Boolean.class, - Collection.class)) != null) { - construct.setAccessible(true); - field.set(objToReturn, construct.newInstance(list.size(), true, list)); - } - } - }else if (Map.class.isAssignableFrom(field.getType())){ - field.set(objToReturn, generateMap(tenant, namespace, keyPrefix+fieldConfAnnot.key())); - } - } - } - return objToReturn; - } - - private Constructor getConstructorWithArguments(Class clazz, Class... classes) { - try { - return clazz.getDeclaredConstructor(classes); - } catch (Exception exception) { - return null; - } - } - - private Class getWrapperClass(Class clazz) { - if (byte.class == clazz) { - return Byte.class; - } else if (short.class == clazz) { - return Short.class; - } else if (int.class == clazz) { - return Integer.class; - } else if (long.class == clazz) { - return Long.class; - } else if (float.class == clazz) { - return Float.class; - } else if (double.class == clazz) { - return Double.class; - } else if (char.class == clazz) { - return Character.class; - } else if (boolean.class == clazz) { - return Boolean.class; - } - return clazz; - } - - private T getValue(Object obj, Class clazz, int processingHint) { - if (obj == null || obj.toString().trim().length() == 0) { - return null; - } else { - obj = obj.toString().trim(); - } - if (String.class.equals(clazz)) { - if (obj.toString().startsWith("@") && isExternalLookup(processingHint)) { - String contents = ConfigurationUtils - .getFileContents(NonConfigResource.locate(obj.toString().substring(1).trim())); - if (contents == null) { - contents = ConfigurationUtils.getFileContents(obj.toString().substring(1).trim()); - } - if (contents != null) { - obj = contents; - } - } - return (T) obj.toString(); - } else if (Number.class.isAssignableFrom(clazz)) { - Double doubleValue = Double.valueOf(obj.toString()); - switch (clazz.getName()) { - case "java.lang.Byte": - Byte byteVal = doubleValue.byteValue(); - return (T) byteVal; - case "java.lang.Short": - Short shortVal = doubleValue.shortValue(); - return (T) shortVal; - case "java.lang.Integer": - Integer intVal = doubleValue.intValue(); - return (T) intVal; - case "java.lang.Long": - Long longVal = doubleValue.longValue(); - return (T) longVal; - case "java.lang.Float": - Float floatVal = doubleValue.floatValue(); - return (T) floatVal; - case "java.lang.Double": - Double doubleVal = doubleValue.doubleValue(); - return (T) doubleVal; - default: - } - } else if (Boolean.class.equals(clazz)) { - return (T) Boolean.valueOf(obj.toString()); - } else if (Character.class.equals(clazz)) { - return (T) Character.valueOf(obj.toString().charAt(0)); - } - return null; - } - - private T[] getZeroLengthArrayFor(Class clazz) { - Object obj = null; - if (clazz == int.class) { - obj = new int[]{}; - } else if (clazz == byte.class) { - obj = new byte[]{}; - } else if (clazz == short.class) { - obj = new short[]{}; - } else if (clazz == long.class) { - obj = new long[]{}; - } else if (clazz == float.class) { - obj = new float[]{}; - } else if (clazz == double.class) { - obj = new double[]{}; - } else if (clazz == boolean.class) { - obj = new boolean[]{}; - } else if (clazz == char.class) { - obj = new char[]{}; - } else if (clazz == Byte.class) { - obj = new Byte[]{}; - } else if (clazz == Short.class) { - obj = new Short[]{}; - } else if (clazz == Integer.class) { - obj = new Integer[]{}; - } else if (clazz == Long.class) { - obj = new Long[]{}; - } else if (clazz == Float.class) { - obj = new Float[]{}; - } else if (clazz == Double.class) { - obj = new Double[]{}; - } else if (clazz == Boolean.class) { - obj = new Boolean[]{}; - } else if (clazz == Character.class) { - obj = new Character[]{}; - } else if (clazz == String.class) { - obj = new String[]{}; - } - return (T[]) obj; - } - - private Collection convert(String commaSaperatedValues, Class clazz, - int processingHints) { - ArrayList collection = new ArrayList<>(); - for (String value : commaSaperatedValues.split(",")) { - try { - T type1 = getValue(value, clazz, processingHints); - if (type1 != null) { - collection.add(type1); - } - } catch (RuntimeException re) { - // do nothing - } - } - return collection; - } - - /** - * Shutdown. - */ - public void shutdown() { - if (changeNotifier != null) { - try { - changeNotifier.shutdown(); - ConfigurationDataSource.lookup().close(); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - } - - @Override - public void removeConfigurationChangeListener(String tenant, String namespace, String key, - ConfigurationChangeListener myself) { - tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() - : Constants.DEFAULT_TENANT; - namespace = - ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() - : Constants.DEFAULT_NAMESPACE; - if (key == null || key.trim().length() == 0) { - throw new IllegalArgumentException("Key can't be null."); - } - try { - changeNotifier.stopNotificationTowards(tenant, namespace, key, myself); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - @Override - public Map populateMap(String tenantId, String namespace, String key, Class clazz){ - if (tenantId==null || tenantId.trim().length()==0){ - tenantId = this.tenant.get(); - }else{ - tenantId = tenantId.toUpperCase(); - } - if (namespace==null || namespace.trim().length()==0){ - namespace = DEFAULT_NAMESPACE; - }else{ - namespace = namespace.toUpperCase(); - } - Map map = new HashMap<>(); - Iterator keys ; - try { - if (ConfigurationRepository.lookup().isDBAccessible()){ - keys = ConfigurationUtils.executeSelectSql(ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE).getString("fetchkeysql"), new String[]{tenantId+KEY_ELEMENTS_DELEMETER+namespace}).iterator(); - }else{ - keys = ConfigurationRepository.lookup().getConfigurationFor(tenantId, namespace).getKeys(key); - } - while(keys.hasNext()){ - String k = keys.next(); - if (k.startsWith(key+".")){ - k = k.substring(key.length()+1); - String subkey = k.substring(0, k.indexOf(".")); - if (!map.containsKey(subkey)){ - map.put(subkey, get(tenantId, namespace, key+"."+subkey, clazz)); - } - } - } - }catch (Exception e){ - e.printStackTrace(); - } - return map; - } - - @Override - public Map generateMap(String tenantId, String namespace, String key){ - if (tenantId==null || tenantId.trim().length()==0){ - tenantId = this.tenant.get(); - }else{ - tenantId = tenantId.toUpperCase(); - } - if (namespace==null || namespace.trim().length()==0){ - namespace = DEFAULT_NAMESPACE; - }else{ - namespace = namespace.toUpperCase(); - } - Map map, parentMap = new HashMap<>(); - Iterator keys ; - try { - if (ConfigurationRepository.lookup().isDBAccessible()){ - keys = ConfigurationUtils.executeSelectSql(ConfigurationRepository.lookup().getConfigurationFor(DEFAULT_TENANT, DB_NAMESPACE).getString("fetchkeysql"), new String[]{tenantId+KEY_ELEMENTS_DELEMETER+namespace}).iterator(); - }else{ - if (key==null || key.trim().length()==0){ - keys = ConfigurationRepository.lookup().getConfigurationFor(tenantId, namespace).getKeys(); - }else{ - keys = ConfigurationRepository.lookup().getConfigurationFor(tenantId, namespace).getKeys(key); - } - } - while(keys.hasNext()){ - map = parentMap; - String k = keys.next(); - - if (key!=null && key.trim().length()!=0 && !k.startsWith(key+".")){ - continue; - } - String value = getAsString(tenantId, namespace, k); - if (key!=null && key.trim().length()!=0 && k.startsWith(key+".")){ - k = k.substring(key.trim().length()+1); - } - - while(k.contains(".")){ - if (k.contains(".")){ - String subkey = k.substring(0, k.indexOf(".")); - k = k.substring(k.indexOf(".")+1); - if (!map.containsKey(subkey)){ - map.put(subkey, map=new HashMap<>()); - }else{ - map = (Map)map.get(subkey); - } - } - } - map.put(k, value); - } - }catch (Exception e){ - e.printStackTrace(); - } - return parentMap; - } - - - - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationRepository.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationRepository.java deleted file mode 100644 index d67c1af06c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationRepository.java +++ /dev/null @@ -1,415 +0,0 @@ -package org.openecomp.config.impl; - -import org.apache.commons.configuration2.CombinedConfiguration; -import org.apache.commons.configuration2.CompositeConfiguration; -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.FileBasedConfiguration; -import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; -import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; -import org.apache.commons.configuration2.ex.ConfigurationException; -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.Constants; - -import java.io.File; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -/** - * The type Configuration repository. - */ -public final class ConfigurationRepository { - - /** - * The Repo. - */ - static ConfigurationRepository repo; - private static Set validCallers = Collections.unmodifiableSet(new HashSet<>(Arrays - .asList(ConfigurationChangeNotifier.NotificationData.class.getName(), - ConfigurationUtils.class.getName(), CliConfigurationImpl.class.getName(), - ConfigurationChangeNotifier.class.getName(), ConfigurationDataSource.class.getName(), - ConfigurationImpl.class.getName()))); - - static { - repo = new ConfigurationRepository(); - } - - private boolean dbAccessible = true; - private Set tenants = new HashSet<>(); - private Set namespaces = new HashSet<>(); - private LinkedHashMap store = - new LinkedHashMap(16, 0.75f, true) { - @Override - protected boolean removeEldestEntry(Map.Entry eldest) { - try { - return size() > getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE) - .getInt("config.size.max"); - } catch (Exception exception) { - return false; - } - } - }; - - private ConfigurationRepository() { - if (repo != null) { - throw new RuntimeException("Illegal access to configuration."); - } - tenants.add(Constants.DEFAULT_TENANT); - namespaces.add(Constants.DEFAULT_NAMESPACE); - } - - /** - * Lookup configuration repository. - * - * @return the configuration repository - */ - public static ConfigurationRepository lookup() { - if (validCallers.contains(Thread.currentThread().getStackTrace()[2].getClassName())) { - return repo; - } - return null; - } - - /** - * Gets tenants. - * - * @return the tenants - */ - public Set getTenants() { - return tenants; - } - - /** - * Gets namespaces. - * - * @return the namespaces - */ - public Set getNamespaces() { - return namespaces; - } - - private void populateTenantsNamespace(String key, boolean sourcedFromDb) { - String[] array = key.split(Constants.KEY_ELEMENTS_DELEMETER); - if (!array[1].equalsIgnoreCase(Constants.DB_NAMESPACE)) { - if (!sourcedFromDb) { - dbAccessible = false; - } - tenants.add(array[0]); - namespaces.add(array[1]); - } - } - - /** - * Init tenants and namespaces. - */ - public void initTenantsAndNamespaces() { - try { - Collection collection = ConfigurationUtils.executeSelectSql( - getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE) - .getString("fetchnamescql"), new String[]{}); - Iterator iterator = collection.iterator(); - while (iterator.hasNext()) { - populateTenantsNamespace(iterator.next(), true); - } - } catch (Exception exception) { - //Log this later - } - } - - /** - * Is valid tenant boolean. - * - * @param tenant the tenant - * @return the boolean - */ - public boolean isValidTenant(String tenant) { - return tenant == null ? false : tenants.contains(tenant.toUpperCase()); - } - - /** - * Is valid namespace boolean. - * - * @param namespace the namespace - * @return the boolean - */ - public boolean isValidNamespace(String namespace) { - return namespace == null ? false : namespaces.contains(namespace.toUpperCase()); - } - - /** - * Gets configuration for. - * - * @param tenant the tenant - * @param namespace the namespace - * @return the configuration for - * @throws Exception the exception - */ - public Configuration getConfigurationFor(String tenant, String namespace) throws Exception { - ConfigurationHolder config; - String module = tenant + Constants.KEY_ELEMENTS_DELEMETER + namespace; - config = store.get(module); - if (config == null) { - config = new ConfigurationHolder(ConfigurationUtils - .getDbConfigurationBuilder(tenant + Constants.KEY_ELEMENTS_DELEMETER + namespace)); - store.put(module, config); - } - return config.getConfiguration(tenant + Constants.KEY_ELEMENTS_DELEMETER + namespace); - } - - /** - * Populate configurtaion. - * - * @param key the key - * @param builder the builder - */ - public void populateConfigurtaion(String key, Configuration builder) { - store.put(key, new ConfigurationHolder(builder)); - populateTenantsNamespace(key, false); - } - - /** - * Populate configurtaion. - * - * @param key the key - * @param builder the builder - * @throws Exception the exception - */ - public void populateConfigurtaion(String key, BasicConfigurationBuilder builder) - throws Exception { - store.put(key, new ConfigurationHolder(builder)); - } - - /** - * Populate override configurtaion. - * - * @param key the key - * @param file the file - * @throws Exception the exception - */ - public void populateOverrideConfigurtaion(String key, File file) throws Exception { - ConfigurationHolder holder = store.get(key); - if (holder == null) { - if (dbAccessible) { - holder = new ConfigurationHolder(ConfigurationUtils.getDbConfigurationBuilder(key)); - } else { - holder = new ConfigurationHolder(new CombinedConfiguration()); - } - store.put(key, holder); - } - holder.addOverrideConfiguration(file.getAbsolutePath(), - ConfigurationUtils.getConfigurationBuilder(file, true)); - populateTenantsNamespace(key, true); - } - - /** - * Refresh override configurtaion for. - * - * @param key the key - * @param index the index - * @throws Exception the exception - */ - public void refreshOverrideConfigurtaionFor(String key, int index) throws Exception { - ConfigurationHolder holder = store.get(key); - if (holder != null) { - holder.refreshOverrideConfiguration(index); - } - } - - /** - * Remove override configurtaion. - * - * @param file the file - * @throws Exception the exception - */ - public void removeOverrideConfigurtaion(File file) throws Exception { - Iterator iterator = new ArrayList(store.keySet()).iterator(); - while (iterator.hasNext()) { - ConfigurationHolder holder = store.get(iterator.next()); - if (holder.containsOverrideConfiguration(file.getAbsolutePath())) { - holder.removeOverrideConfiguration(file.getAbsolutePath()); - } - } - - } - - private class ConfigurationHolder { - - /** - * The Builder. - */ - BasicConfigurationBuilder builder; - /** - * The Last configuration build time. - */ - Timestamp lastConfigurationBuildTime; - /** - * The Config. - */ - Configuration config; - /** - * The Composite. - */ - Configuration composite; - /** - * The Last config change timestamp. - */ - Timestamp lastConfigChangeTimestamp; - private Map> - overrideConfiguration = new LinkedHashMap<>(); - - - /** - * Instantiates a new Configuration holder. - * - * @param builder the builder - */ - public ConfigurationHolder(BasicConfigurationBuilder builder) { - this.builder = builder; - } - - /** - * Instantiates a new Configuration holder. - * - * @param builder the builder - */ - public ConfigurationHolder(Configuration builder) { - this.config = builder; - } - - /** - * Refresh override configuration. - * - * @param index the index - */ - public void refreshOverrideConfiguration(int index) { - int count = -1; - for (FileBasedConfigurationBuilder overrides : overrideConfiguration.values()) { - try { - if (++count == index) { - overrides.save(); - overrides.resetResult(); - } - } catch (ConfigurationException exception) { - //do nothing - } - } - } - - /** - * Add override configuration. - * - * @param path the path - * @param builder the builder - */ - public void addOverrideConfiguration(String path, - BasicConfigurationBuilder builder) { - overrideConfiguration.put(path.toUpperCase(), (FileBasedConfigurationBuilder) builder); - getEffectiveConfiguration(config, overrideConfiguration.values()); - } - - /** - * Remove override configuration. - * - * @param path the path - */ - public void removeOverrideConfiguration(String path) { - overrideConfiguration.remove(path.toUpperCase()); - getEffectiveConfiguration(config, overrideConfiguration.values()); - } - - /** - * Contains override configuration boolean. - * - * @param path the path - * @return the boolean - */ - public boolean containsOverrideConfiguration(String path) { - return overrideConfiguration.containsKey(path.toUpperCase()); - } - - /** - * Gets configuration. - * - * @param namespace the namespace - * @return the configuration - * @throws Exception the exception - */ - public Configuration getConfiguration(String namespace) throws Exception { - if (config == null) { - config = builder.getConfiguration(); - lastConfigurationBuildTime = new Timestamp(System.currentTimeMillis()); - } else if (lastConfigurationBuildTime != null - && System.currentTimeMillis() - lastConfigurationBuildTime.getTime() - > getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE) - .getInt("config.refresh.interval")) { - Timestamp temp = getLastUpdateTimestampFor(namespace); - if ((temp != null) - && (lastConfigChangeTimestamp == null - || temp.getTime() > lastConfigChangeTimestamp.getTime())) { - builder.resetResult(); - config = builder.getConfiguration(); - lastConfigChangeTimestamp = temp; - getEffectiveConfiguration(config, overrideConfiguration.values()); - } - lastConfigurationBuildTime = new Timestamp(System.currentTimeMillis()); - } - if (composite == null && overrideConfiguration.size() != 0) { - composite = getEffectiveConfiguration(config, overrideConfiguration.values()); - } - return overrideConfiguration.size() == 0 ? config : composite; - } - - private Configuration getEffectiveConfiguration(Configuration configuration, - Collection> list) { - try { - CompositeConfiguration cc = new CompositeConfiguration(); - for (FileBasedConfigurationBuilder b : list) { - cc.addConfiguration(b.getConfiguration()); - } - cc.addConfiguration(configuration); - composite = cc; - return composite; - } catch (Exception exception) { - return null; - } - } - - /** - * Gets last update timestamp for. - * - * @param namespace the namespace - * @return the last update timestamp for - */ - public Timestamp getLastUpdateTimestampFor(String namespace) { - Timestamp timestamp = null; - - try { - Collection collection = ConfigurationUtils.executeSelectSql( - getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE) - .getString("fetchlastchangecql"), new String[]{namespace}); - if (!collection.isEmpty()) { - timestamp = new Timestamp(Long.valueOf(((ArrayList) collection).get(0).toString())); - } - } catch (Exception exception) { - //Log this later - } - - return timestamp; - } - - - } - - public boolean isDBAccessible(){ - return dbAccessible; - } - - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ContextListener.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ContextListener.java deleted file mode 100644 index 06652c0843..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ContextListener.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.openecomp.config.impl; - -import static org.openecomp.config.Constants.MBEAN_NAME; - -import java.lang.management.ManagementFactory; -import javax.management.ObjectName; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; -import org.openecomp.config.api.ConfigurationManager; - -@WebListener -public class ContextListener implements ServletContextListener { - - @Override - public void contextDestroyed(ServletContextEvent arg0) { - try { - ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(MBEAN_NAME)); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - @Override - public void contextInitialized(ServletContextEvent arg0) { - ConfigurationManager.lookup(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/YamlConfiguration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/YamlConfiguration.java deleted file mode 100644 index 6e107e95c8..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/YamlConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.openecomp.config.impl; - -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import com.virtlink.commons.configuration2.jackson.JacksonConfiguration; -import org.apache.commons.configuration2.HierarchicalConfiguration; -import org.apache.commons.configuration2.tree.ImmutableNode; - -public class YamlConfiguration extends JacksonConfiguration { - - protected YamlConfiguration(HierarchicalConfiguration config) { - super(new YAMLFactory(), config); - } - - public YamlConfiguration() { - super(new YAMLFactory()); - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationMode.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationMode.java deleted file mode 100644 index 475a4cae85..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationMode.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.openecomp.config.type; - -public enum ConfigurationMode { - OVERRIDE, UNION, MERGE -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationQuery.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationQuery.java deleted file mode 100644 index 53b0eed954..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationQuery.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.openecomp.config.type; - -import org.openecomp.config.Constants; - -public class ConfigurationQuery { - - String tenant = Constants.DEFAULT_TENANT; - String namespace = Constants.DEFAULT_NAMESPACE; - String key; - boolean fallback; - boolean externalLookup; - boolean latest; - private boolean nodeSpecific; - - public ConfigurationQuery fallback(boolean fallback) { - this.fallback = fallback; - return this; - } - - public ConfigurationQuery latest(boolean val) { - this.latest = val; - return this; - } - - public ConfigurationQuery nodeSpecific(boolean val) { - this.nodeSpecific = val; - return this; - } - - public ConfigurationQuery externalLookup(boolean val) { - this.externalLookup = val; - return this; - } - - /** - * Tenant configuration query. - * - * @param id the id - * @return the configuration query - */ - public ConfigurationQuery tenant(String id) { - if (id != null) { - tenant = id; - } - return this; - } - - - /** - * Namespace configuration query. - * - * @param id the id - * @return the configuration query - */ - public ConfigurationQuery namespace(String id) { - if (id != null) { - namespace = id; - } - return this; - } - - public ConfigurationQuery key(String id) { - key = id; - return this; - } - - public String getTenant() { - return tenant.toUpperCase(); - } - - public String getNamespace() { - return namespace.toUpperCase(); - } - - public String getKey() { - return key; - } - - public boolean isFallback() { - return fallback; - } - - public boolean isNodeSpecific() { - return nodeSpecific; - } - - public boolean isExternalLookup() { - return externalLookup; - } - - public boolean isLatest() { - return latest; - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationType.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationType.java deleted file mode 100644 index d34d2e4e1c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationType.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.openecomp.config.type; - -public enum ConfigurationType { - PROPERTIES, XML, JSON, YAML -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationUpdate.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationUpdate.java deleted file mode 100644 index 9cfc980399..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/type/ConfigurationUpdate.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.config.type; - -public class ConfigurationUpdate extends ConfigurationQuery { - private String value; - private boolean nodeOverride; - - public ConfigurationUpdate value(String val) { - value = val; - return this; - } - - public ConfigurationUpdate nodeOverride(boolean val) { - nodeOverride = val; - return this; - } - - /** - * Gets value. - * - * @return the value - */ - public String getValue() { - if (value != null && value.split(",").length > 1 && !value.matches("^\\[.*\\]$")) { - return "[" + value + "]"; - } - return value; - } - - public boolean isNodeOverride() { - return nodeOverride; - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/META-INF/services/org.openecomp.config.api.ConfigurationManager b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/META-INF/services/org.openecomp.config.api.ConfigurationManager deleted file mode 100644 index 2a6c217345..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/META-INF/services/org.openecomp.config.api.ConfigurationManager +++ /dev/null @@ -1 +0,0 @@ -org.openecomp.config.impl.CliConfigurationImpl \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties deleted file mode 100644 index cfe91e6c7d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties +++ /dev/null @@ -1,22 +0,0 @@ -driverClassName=com.github.adejanovski.cassandra.jdbc.CassandraDriver -jdbcURL=jdbc:${dbname}://${dbhost}:${dbport}/${configdb} -dbuser= -dbpassword= -config.Table=configuration -config.monitor.Table=configuration_change -configKey=key -configValue=value -configNameColumn=name -configdb=dox -dbhost= -dbport=9042 -dbname=cassandra -createtablecql=create table if not exists ${configdb}.${config.Table} (name text\, key text\, value text\, PRIMARY KEY (name\, key)) with clustering order by (key asc) -createmonitoringtablecql=create table if not exists ${configdb}.${config.monitor.Table} (name text\, changed_when bigint\, key text\, old_value text\, new_value text\, PRIMARY KEY (name\, changed_when)) with clustering order by (changed_when desc) -insertconfigurationchangecql=insert into ${configdb}.${config.monitor.Table} (name\, changed_when\, key\, old_value\, new_value) values(?\, ?\, ?\, ?\, ?) -fetchkeysql=select ${configKey} from ${config.Table} where ${configNameColumn}=? -fetchlastchangecql=select changed_when from ${configdb}.${config.monitor.Table} where name=? limit 1 -fetchnamescql=select distinct name from ${configdb}.${config.Table} -config.size.max=100 -config.refresh.interval=30000 -event.fetch.delay=5000 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/management.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/management.properties deleted file mode 100644 index 9874394726..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/management.properties +++ /dev/null @@ -1,7 +0,0 @@ -com.sun.management.jmxremote=true -#com.sun.management.jmxremote.port=9999 -#com.sun.management.jmxremote.local.only=false -#com.sun.management.jmxremote.authenticate=false -#com.sun.management.jmxremote.password.file=resources/jmxremote.password -#com.sun.management.jmxremote.access.file=resources/jmxremote.access -#com.sun.management.jmxremote.ssl=false \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/test/java/org/openecomp/config/ConfigurationUtilsTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/test/java/org/openecomp/config/ConfigurationUtilsTest.java deleted file mode 100644 index b770d8677b..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/test/java/org/openecomp/config/ConfigurationUtilsTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.openecomp.config; - -import org.junit.Test; - -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -public class ConfigurationUtilsTest { - @Test - public void testCommaList() { - List list = Arrays.asList("1", "2", 3); - String commaSeparatedList = ConfigurationUtils.getCommaSeparatedList(list); - list.forEach(o -> assertTrue(commaSeparatedList.contains(o.toString()))); - } - - @Test - public void testCommaListWithNullAndEmptyStrings() { - List list = Arrays.asList(null, "", " "); - String commaSeparatedList = ConfigurationUtils.getCommaSeparatedList(list); - assertTrue(commaSeparatedList.isEmpty()); - } - - @Test - public void testGetArrayClassFunction() { - assertEquals(String[].class , ConfigurationUtils.getArrayClass(String.class)); - assertNull(ConfigurationUtils.getArrayClass(ConfigurationUtilsTest.class)); - } -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/pom.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/pom.xml deleted file mode 100644 index 2dcde64b07..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - 4.0.0 - - openecomp-configuration-management-test - org.openecomp.sdc.common - openecomp-configuration-management-test - - - openecomp-common-configuration-management - org.openecomp.sdc.common - 1.2.0-SNAPSHOT - .. - - - - - org.openecomp.sdc.common - openecomp-configuration-management-core - ${project.version} - - - - junit - junit - 4.11 - - - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${mvn.surefire.version} - - true - - ${project.basedir}/src/test/resources - ${user.home}/TestResources - - - **/TestCMSuite.java - - - - - - diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/TestCMSuite.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/TestCMSuite.java deleted file mode 100644 index 4ef46f6c9d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/TestCMSuite.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.openecomp.config; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.test.*; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * Created by sheetalm on 10/25/2016. - */ - -@RunWith(Suite.class) -@Suite.SuiteClasses({ - JAVAPropertiesConfigTest.class, - JSONConfigTest.class, - XMLConfigTest.class, - YAMLConfigTest.class, - CLIFallbackAndLookupTest.class, - CLITest.class, - ConfigSourceLocationTest.class, - DynamicConfigurationTest.class, - FallbackConfigTest.class, - FallbackToGlobalNSTest.class, - GlobalAndNSConfigTest.class, - ModeAsConfigPropTest.class, - MultiTenancyConfigTest.class, - NodeSpecificCLITest.class, - NotificationForNodeConfigTest.class, - NotificationOnPropValTest.class, - ResourceChangeNotificationTest.class, - UnregisterNotificationTest.class, - ValidateDefaultModeTest.class, - ValidateNodeConfigTest.class, - LoadOrderMergeAndOverrideTest.class - - -}) - -public class TestCMSuite extends junit.framework.TestSuite { - - private TestCMSuite() { - - } - - @AfterClass - public static void tearDown(){ - try { - ConfigurationUtils.executeDdlSql("truncate dox.configuration_change"); - ConfigurationUtils.executeDdlSql("truncate dox.configuration"); - } - catch(Exception e){ - e.printStackTrace(); - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLIFallbackAndLookupTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLIFallbackAndLookupTest.java deleted file mode 100644 index 4f7ab92dd0..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLIFallbackAndLookupTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.Constants; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.Assert; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import javax.management.JMX; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.util.HashMap; -import java.util.Map; - - - -/** - * Created by sheetalm on 10/18/2016. - * Scenario 21, Scenario 23 - * 21 - Verify the CLI fetches only the current value unless the fallback option is specified - * 23 - Fetch value using CLI for a key with underlying resource - */ -public class CLIFallbackAndLookupTest { - - public final static String NAMESPACE = "CLIFallback"; - public final static String TENANT = "OPENECOMP"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testCLIFallbackAndLookup() throws Exception{ - - //Verify without fallback - Map input = new HashMap<>(); - input.put("ImplClass", "org.openecomp.config.type.ConfigurationQuery"); - input.put("tenant", TENANT); - input.put("namespace", NAMESPACE); - input.put("key", ConfigTestConstant.ARTIFACT_MAXSIZE); - - MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer(); - ObjectName mbeanName = new ObjectName(Constants.MBEAN_NAME); - ConfigurationManager conf = JMX.newMBeanProxy(mbsc, mbeanName, org.openecomp.config.api.ConfigurationManager.class, true); - String maxSizeWithNoFallback = conf.getConfigurationValue(input); - Assert.assertEquals("",maxSizeWithNoFallback); - - //Verify underlying resource without lookup switch - input.put("key", ConfigTestConstant.ARTIFACT_JSON_SCHEMA); - String jsonSchema = conf.getConfigurationValue(input); - System.out.println("jsonSchema=="+jsonSchema); - Assert.assertEquals("@"+System.getProperty("user.home")+"/TestResources/GeneratorsList.json" , jsonSchema); - - //Verify underlying resource with lookup switch - input.put("externalLookup", true); - jsonSchema = conf.getConfigurationValue(input); - System.out.println("jsonSchema=="+jsonSchema); - Assert.assertEquals("{name:\"SCM\"}" , jsonSchema); - - //Verify with fallback - Map fallbackInput = new HashMap<>(); - fallbackInput.put("ImplClass", "org.openecomp.config.type.ConfigurationQuery"); - fallbackInput.put("fallback", true); - fallbackInput.put("tenant", TENANT); - fallbackInput.put("namespace", NAMESPACE); - fallbackInput.put("key", ConfigTestConstant.ARTIFACT_MAXSIZE); - - String maxSizeWithFallback = conf.getConfigurationValue(fallbackInput); - Assert.assertEquals("1024",maxSizeWithFallback); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLITest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLITest.java deleted file mode 100644 index ff04873b42..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/CLITest.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.Constants; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import javax.management.JMX; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.util.HashMap; -import java.util.Map; - -import static org.openecomp.config.util.ConfigTestConstant.*; - -/** - * Created by sheetalm on 10/18/2016. - * Scenario 17 - * Verify Configuration Management System - Command Line Interface for query, update and list operations - */ -public class CLITest { - - public final static String NAMESPACE = "CLI"; - public final static String TENANT = "OPENECOMP"; - private String updatedValue = ""; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testCLIApi() throws Exception{ - //Verify without fallback - Map input = new HashMap<>(); - input.put("ImplClass", "org.openecomp.config.type.ConfigurationQuery"); - input.put("tenant", TENANT); - input.put("namespace", NAMESPACE); - input.put("key", ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH); - - MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer(); - ObjectName mbeanName = new ObjectName(Constants.MBEAN_NAME); - ConfigurationManager conf = JMX.newMBeanProxy(mbsc, mbeanName, org.openecomp.config.api.ConfigurationManager.class, true); - String maxLength = conf.getConfigurationValue(input); - Assert.assertEquals("14",maxLength); - - conf.addConfigurationChangeListener(TENANT,NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, new CLIListener()); - - - //Update maxlength - input.put("ImplClass", "org.openecomp.config.type.ConfigurationUpdate"); - input.put("value", "24"); - conf.updateConfigurationValue(input); - - Thread.sleep(35000); - - Assert.assertEquals("24",updatedValue); - - //Reset value and fetch updated value again - input.put("value", ""); - input.put("ImplClass", "org.openecomp.config.type.ConfigurationQuery"); - String updatedMaxLength = conf.getConfigurationValue(input); - Assert.assertEquals("24",updatedMaxLength); - - Map outputMap = conf.listConfiguration(input); - for(Map.Entry entry : outputMap.entrySet()){ - System.out.println(entry.getKey()+" : "+entry.getValue()); - validateCLIListConfig(outputMap); - } - } - - private class CLIListener implements ConfigurationChangeListener { - @Override - public void notify(String key, Object oldValue, Object newValue) { - System.out.println("received notification::oldValue=="+oldValue+" newValue=="+newValue); - updatedValue = newValue.toString(); - } - } - - private void validateCLIListConfig(Map outputMap ) { - - Assert.assertEquals("@"+System.getProperty("user.home")+"/TestResources/GeneratorsList.json" , outputMap.get(ARTIFACT_JSON_SCHEMA)); - Assert.assertEquals("appc,catalog", outputMap.get(ARTIFACT_CONSUMER)); - Assert.assertEquals("6", outputMap.get(ARTIFACT_NAME_MINLENGTH)); - Assert.assertEquals("true", outputMap.get(ARTIFACT_ENCODED)); - Assert.assertEquals("24", outputMap.get(ARTIFACT_NAME_MAXLENGTH)); - Assert.assertEquals("pdf,zip,xml,pdf,tgz,xls", outputMap.get(ARTIFACT_EXT)); - Assert.assertEquals("Base64,MD5", outputMap.get(ARTIFACT_ENC)); - Assert.assertEquals("@"+System.getenv("Path")+"/myschema.json", outputMap.get(ARTIFACT_XML_SCHEMA)); - Assert.assertEquals("a-zA-Z_0-9", outputMap.get(ARTIFACT_NAME_UPPER)); - Assert.assertEquals("/opt/spool,"+System.getProperty("user.home")+"/asdc", outputMap.get(ARTIFACT_LOC)); - Assert.assertEquals("deleted,Deleted", outputMap.get(ARTIFACT_STATUS)); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ConfigSourceLocationTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ConfigSourceLocationTest.java deleted file mode 100644 index 731826b53c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ConfigSourceLocationTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.Assert; - -import java.io.File; -import java.io.IOException; -import java.util.Properties; -import java.io.OutputStream; -import java.io.FileOutputStream; - -/** - * Created by sheetalm on 10/14/2016. - * Scenario 11 - * Validate conventional and configurational source location - * - * Pre-requisite - set -Dconfig.location=${"user.home"}/TestResources/ while running test - */ -public class ConfigSourceLocationTest { - public final static String NAMESPACE = "SourceLocation"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - - Properties props = new Properties(); - props.setProperty("maxCachedBufferSize", "1024"); - props.setProperty("artifact.maxsize", "1024"); - File f = new File(TestUtil.jsonSchemaLoc + "config.properties"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Config Property at Conventional Resource"); - } - } - - @Test - public void testMergeStrategyInConfig() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - Assert.assertEquals("a-zA-Z_0-9", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER)); - Assert.assertEquals("1024", config.getAsString(ConfigTestConstant.ARTIFACT_MAXSIZE)); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/DynamicConfigurationTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/DynamicConfigurationTest.java deleted file mode 100644 index 2140e84873..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/DynamicConfigurationTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.api.DynamicConfiguration; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -/** - * Created by sheetalm on 10/17/2016. - * Pre-requisite - set -Dconfig.location=${"user.home"}/TestResources/ while running test - * Scenario 20 - * Update the central configuration and fetch the Dynamic Configuration - */ -public class DynamicConfigurationTest { - - public final static String NAMESPACE = "DynamicConfiguration"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testDynamicConfig() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - Properties props = new Properties(); - props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "20"); - props.setProperty("_config.namespace",NAMESPACE); - props.setProperty("_config.mergeStrategy","override"); - File f = new File(TestUtil.jsonSchemaLoc + "config.properties"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Override Config Property at Conventional Resource"); - } - - //Verify configuration with Configuration without wait. This should fetch cached value - Assert.assertEquals("14" , config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - Thread.sleep(10000); - - DynamicConfiguration dynaConfig = config.getDynamicConfiguration(NAMESPACE,ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH,String.class,"14"); - //Verify configuration with DynamicConfiguration This should fetch values from DB - Assert.assertEquals("20" , dynaConfig.get()); - - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - if(f.exists()) { - f.delete(); - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackConfigTest.java deleted file mode 100644 index 09fca879b0..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackConfigTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.ConfigurationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; - -import static org.openecomp.config.util.TestUtil.validateConfiguraton; -import static org.openecomp.config.util.TestUtil.writeFile; - -/** - * Created by ARR on 10/14/2016. - * - * Validate configuration with properties,xml,json,yaml file format with mode - */ -public class FallbackConfigTest { - - public static final String NAMESPACE = "fallback"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithFallbackFileFormat(){ - validateConfiguraton(NAMESPACE); - } - - @After - public void tearDown() throws Exception { - String data = "{name:\"SCM\"}"; - writeFile(data); - //ConfigurationUtils.executeDDLSQL("truncate dox.configuration"); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackToGlobalNSTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackToGlobalNSTest.java deleted file mode 100644 index 1efc462d4e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/FallbackToGlobalNSTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.Assert; - -import java.io.IOException; - -/** - * Scenario 12 - * Verify configuration value fallback to the global namespace if the configuraton property doesnot exist in the namespace configuration - * Created by sheetalm on 10/14/2016. - */ -public class FallbackToGlobalNSTest { - - public final static String NAMESPACE = "FallbackToGlobalNS"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testFallbackToGlobalNS() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - Assert.assertEquals("14",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - Assert.assertEquals("1024",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE)); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } - - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/GlobalAndNSConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/GlobalAndNSConfigTest.java deleted file mode 100644 index 87324aa35c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/GlobalAndNSConfigTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by sheetalm on 10/13/2016. - * Scenario 10 Verify configuration present in both global and defined namespace - */ -public class GlobalAndNSConfigTest { - - public final static String NAMESPACE = "GlobalAndNSConfig"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testNamespaceInConfig() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - Assert.assertEquals("a-zA-Z",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER )); - Assert.assertEquals("a-zA-Z_0-9",config.getAsString(ConfigTestConstant.ARTIFACT_NAME_UPPER )); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } - - - - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JAVAPropertiesConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JAVAPropertiesConfigTest.java deleted file mode 100644 index 23c5fa3130..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JAVAPropertiesConfigTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; - -import static org.openecomp.config.util.TestUtil.validateConfiguraton; -import static org.openecomp.config.util.TestUtil.writeFile; - -/** - * Created by ARR on 10/13/2016. - * - * Scenario 1 - * Validate configuration with Java Properties file format with mode - */ -public class JAVAPropertiesConfigTest { - - public static final String NAMESPACE = "javaProperties"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithPropertiesFileFormat(){ - validateConfiguraton(NAMESPACE); - } - - - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JSONConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JSONConfigTest.java deleted file mode 100644 index 5f2d24e67f..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/JSONConfigTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; - -import static org.openecomp.config.util.TestUtil.validateConfiguraton; -import static org.openecomp.config.util.TestUtil.writeFile; - -/** - * Created by ARR on 10/14/2016. - * - * Scenario 3 - * Validate configuration with JSON file format with mode - */ -public class JSONConfigTest { - - public static final String NAMESPACE = "JSONConfig"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithJSONFileFormat(){ - validateConfiguraton(NAMESPACE); - } - - - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/LoadOrderMergeAndOverrideTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/LoadOrderMergeAndOverrideTest.java deleted file mode 100644 index 7ce508a063..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/LoadOrderMergeAndOverrideTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.openecomp.config.test; - -import static org.openecomp.config.util.ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH; -import static org.openecomp.config.util.TestUtil.validateConfiguraton; -import static org.openecomp.config.util.TestUtil.writeFile; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.TestUtil; - -import java.io.IOException; - -/** - * Scenario - * Check loadorder for merge and overide. Higher loadorder takes precedence for override - * LoWer loadorder takes precedence for merge. - */ -public class LoadOrderMergeAndOverrideTest { - - public static final String NAMESPACE = "LoadOrderConfiguration"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithPropertiesFileFormat(){ - Configuration config = ConfigurationManager.lookup(); - - Assert.assertEquals(config.getAsString(NAMESPACE, ARTIFACT_NAME_MAXLENGTH ), "14"); - Assert.assertEquals("5", config.getAsString(NAMESPACE, "artifact.length")); - Assert.assertEquals("56", config.getAsString(NAMESPACE, "artifact.size")); - } - - - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ModeAsConfigPropTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ModeAsConfigPropTest.java deleted file mode 100644 index 470694e355..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ModeAsConfigPropTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Scenario 8 - * Validate configuration with mode specified as a configuration property - */ - -public class ModeAsConfigPropTest { - - String newValue = null; - - public final static String NAMESPACE = "ModeAsConfigProp"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testMergeStrategyInConfig() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - - Assert.assertEquals("14",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - Assert.assertEquals("1048",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE)); - - List expectedExtList = new ArrayList(); - expectedExtList.add("pdf"); - expectedExtList.add("zip"); - expectedExtList.add("xml"); - expectedExtList.add("pdf"); - expectedExtList.add("tgz"); - expectedExtList.add("xls"); - List extList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_EXT); - Assert.assertEquals(expectedExtList, extList); - - List expectedEncList = new ArrayList(); - expectedEncList.add("Base64"); - expectedEncList.add("MD5"); - List encList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_ENC); - Assert.assertEquals(expectedEncList, encList); - - String newValue = config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA); - Assert.assertEquals("{name:\"SCM\"}",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA)); - - Assert.assertEquals("a-zA-Z_0-9",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER )); - - Assert.assertEquals("Deleted",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS) ); - - List expectedLocList = new ArrayList(); - expectedLocList.add("/opt/spool"); - expectedLocList.add(System.getProperty("user.home")+"/asdc"); - List locList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_LOC); - Assert.assertEquals(expectedLocList, locList); - - Assert.assertEquals("@"+System.getenv("Path")+"/myschema.json",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_XML_SCHEMA)); - - List artifactConsumer = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER ); - Assert.assertEquals(config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER_APPC ), artifactConsumer); - - Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_MANDATORY_NAME ), true); - - Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH ), "6"); - - Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_ENCODED ), true); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/MultiTenancyConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/MultiTenancyConfigTest.java deleted file mode 100644 index 66feea3928..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/MultiTenancyConfigTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static org.openecomp.config.util.ConfigTestConstant.*; -import static org.openecomp.config.util.ConfigTestConstant.ARTIFACT_ENCODED; -import static org.openecomp.config.util.ConfigTestConstant.ARTIFACT_MANDATORY_NAME; -import static org.openecomp.config.util.TestUtil.validateConfiguraton; -import static org.openecomp.config.util.TestUtil.writeFile; - -/** - * Created by ARR on 10/14/2016. - * - * Scenario 17 - * Verify Configuration management System - Support for Multi-Tenancy - */ -public class MultiTenancyConfigTest { - - public static final String NAMESPACE = "tenancy"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithMultiTenancyFileFormat(){ - Configuration config = ConfigurationManager.lookup(); - - Assert.assertEquals(config.getAsString("OPENECOMP",NAMESPACE, ARTIFACT_NAME_MAXLENGTH ), "20"); - - Assert.assertEquals(config.getAsString("Telefonica",NAMESPACE, ARTIFACT_STATUS ), "Deleted"); - - Assert.assertEquals(config.getAsString("TID",NAMESPACE, ARTIFACT_NAME_MAXLENGTH ), "14"); - - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NodeSpecificCLITest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NodeSpecificCLITest.java deleted file mode 100644 index 43729cbaf2..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NodeSpecificCLITest.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.Constants; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Test; - -import javax.management.JMX; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.lang.management.ManagementFactory; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -/** - * Created by sheetalm on 10/19/2016. - * Scenario 19 - * Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test - * Verify node specific override using CLI - */ -public class NodeSpecificCLITest { - - public final static String NAMESPACE = "NodeCLI"; - private String updatedValue = ""; - - @Test - public void testCLIApi() throws Exception{ - //Verify without fallback - Map input = new HashMap<>(); - input.put("ImplClass", "org.openecomp.config.type.ConfigurationQuery"); - input.put("namespace", NAMESPACE); - input.put("key", ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH); - - MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer(); - ObjectName mbeanName = new ObjectName(Constants.MBEAN_NAME); - ConfigurationManager conf = JMX.newMBeanProxy(mbsc, mbeanName, org.openecomp.config.api.ConfigurationManager.class, true); - String maxLength = conf.getConfigurationValue(input); - - //Verify Property from Namespace configurations - Assert.assertEquals("30",maxLength); - - //Add node specific configurations - Properties props = new Properties(); - props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "50"); - props.setProperty("_config.namespace",NAMESPACE); - File f = new File(TestUtil.jsonSchemaLoc + "config.properties"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Node Config Property"); - } - - Thread.sleep(35000); - - //Verify property from node specific configuration - input.put("nodeSpecific", true); - String nodeVal = conf.getConfigurationValue(input); - Assert.assertEquals("50", nodeVal); - - //Add Change Listener - conf.addConfigurationChangeListener(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, new CLINodeListener()); - - //Update maxlength - input.put("ImplClass", "org.openecomp.config.type.ConfigurationUpdate"); - input.put("nodeOverride", true); - input.put("nodeSpecific", false); - input.put("value", "60"); - conf.updateConfigurationValue(input); - - Thread.sleep(35000); - - Assert.assertEquals("60",updatedValue); - - //Fetch the updated nodespecific value - input.put("nodeOverride", false); - input.put("nodeSpecific", true); - input.put("ImplClass", "org.openecomp.config.type.ConfigurationQuery"); - String updatedMaxLength = conf.getConfigurationValue(input); - Assert.assertEquals("60",updatedMaxLength); - - //Verify maxlength on other nodes by deleting node specific configuration - if(f.exists()) { - f.delete(); - } - - Thread.sleep(35000); - - input.put("ImplClass", "org.openecomp.config.type.ConfigurationQuery"); - input.put("nodeOverride", false); - input.put("nodeSpecific", false); - System.out.println("val on other node is::"+conf.getConfigurationValue(input)); - Assert.assertEquals("30",conf.getConfigurationValue(input)); - } - - @AfterClass - public static void tearDown() throws Exception { - TestUtil.cleanUp(); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - if(f.exists()) { - f.delete(); - } - } - - private class CLINodeListener implements ConfigurationChangeListener { - @Override - public void notify(String key, Object oldValue, Object newValue) { - System.out.println("received notification::oldValue=="+oldValue+" newValue=="+newValue); - updatedValue = newValue.toString(); - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationForNodeConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationForNodeConfigTest.java deleted file mode 100644 index 9d719103df..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationForNodeConfigTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -/** - * Scenario 15 - * Update and Verify Change Notifications for any change in the registered key for node specific configuration - * Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test - * Created by sheetalm on 10/17/2016. - */ -public class NotificationForNodeConfigTest { - public final static String NAMESPACE = "NotificationForNodeConfig"; - - private String updatedValue = null; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testNotificationForNode() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - - System.out.println(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - Properties props = new Properties(); - props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "30"); - props.setProperty("_config.namespace",NAMESPACE); - File f = new File(TestUtil.jsonSchemaLoc + "config.properties"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Node Config Property"); - } - - Thread.sleep(35000); - - //Verify property from node specific configuration - Assert.assertEquals("30", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - config.addConfigurationChangeListener(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, new NodePropValListener()); - - props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "80"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Updated Node Config Property"); - } - - Thread.sleep(35000); - - //Verify change listenere is invoked when node specific configuration is changed. - Assert.assertEquals("80", updatedValue); - - } - - private class NodePropValListener implements ConfigurationChangeListener { - @Override - public void notify(String key, Object oldValue, Object newValue) { - System.out.println("received notification::oldValue=="+oldValue+" newValue=="+newValue); - updatedValue = newValue.toString(); - } - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - if(f.exists()) { - f.delete(); - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationOnPropValTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationOnPropValTest.java deleted file mode 100644 index 7354cd19f7..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationOnPropValTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.Assert; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -/** - * Pre-requisite - set -Dconfig.location=${"user.home"}/TestResources/ while running test - * Scenario 14 - Verify Change Notifications for any change in the registered key - * Created by sheetalm on 10/14/2016. - */ -public class NotificationOnPropValTest { - - public final static String NAMESPACE = "NotificationOnPropVal"; - - private String updatedValue = null; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testNotification() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - - System.out.println(config.getAsString(NAMESPACE,ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - config.addConfigurationChangeListener(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, new PropValListener()); - - Properties props = new Properties(); - props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "20"); - props.setProperty("_config.namespace",NAMESPACE); - props.setProperty("_config.mergeStrategy","override"); - File f = new File(TestUtil.jsonSchemaLoc + "config.properties"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Override Config Property at Conventional Resource"); - } - - Thread.sleep(35000); - - System.out.println(config.getAsString(NAMESPACE,ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - Assert.assertEquals("20" , updatedValue); - } - - private class PropValListener implements ConfigurationChangeListener { - @Override - public void notify(String key, Object oldValue, Object newValue) { - System.out.println("received notification::oldValue=="+oldValue+" newValue=="+newValue); - updatedValue = newValue.toString(); - } - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - if(f.exists()) { - f.delete(); - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ResourceChangeNotificationTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ResourceChangeNotificationTest.java deleted file mode 100644 index e3e4e24f28..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ResourceChangeNotificationTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.openecomp.config.test; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.util.ConfigTestConstant; - -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; - -/** - * Scenario 7 - * Test to Validate notification on changes to the underlying source - * Resource here is GeneratorsList.json ehich is created in test itself - */ - -public class ResourceChangeNotificationTest { - - String newValue = null; - - public final static String NAMESPACE = "Notification"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testNotification() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - config.addConfigurationChangeListener(NAMESPACE,ConfigTestConstant.ARTIFACT_JSON_SCHEMA, new MyListener()); - updateJsonInFile(); - Thread.sleep(35000); - String newValue = config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA); - - Assert.assertEquals("{name:\"updated SCM\"}",newValue); - - Assert.assertEquals( "14",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH )); - - Assert.assertEquals( "a-zA-Z", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER )); - - String artifactConsumer = config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER ); - Assert.assertEquals(artifactConsumer,config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER_APPC )); - - List expectedExtList = new ArrayList(); - expectedExtList.add("pdf"); expectedExtList.add("zip"); expectedExtList.add("xml"); - List extList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_EXT); - Assert.assertEquals(expectedExtList, extList); - - List expectedEncList = new ArrayList(); - expectedEncList.add("Base64"); expectedEncList.add("MD5"); - List encList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_ENC); - Assert.assertEquals(expectedEncList, encList); - - List expectedLocList = new ArrayList(); - expectedLocList.add("/opt/spool"); expectedLocList.add(System.getProperty("user.home")+"/asdc"); - List locList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_LOC); - Assert.assertEquals(expectedLocList, locList); - - Assert.assertEquals("@"+System.getenv("Path")+"/myschema.json",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_XML_SCHEMA)); - } - - class MyListener implements ConfigurationChangeListener{ - @Override - public void notify(String key, Object oldValue, Object newValue) { - System.out.println("received notification::oldValue=="+oldValue+" newValue=="+newValue); - } - } - - private void updateJsonInFile() throws IOException{ - String data = "{name:\"updated SCM\"}"; - TestUtil.writeFile(data); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/UnregisterNotificationTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/UnregisterNotificationTest.java deleted file mode 100644 index e387f13e93..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/UnregisterNotificationTest.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationChangeListener; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -/** - * Pre-requisite - set -Dconfig.location=${"user.home"}/TestResources/ while running test - * Created by sheetalm on 10/19/2016. - * Scenario 24 - * Unregister notification and verify listener - */ -public class UnregisterNotificationTest { - public final static String NAMESPACE = "UnregisterNotification"; - - private String updatedValue = null; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testNotification() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - - System.out.println(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - PropertyListener propListener = new PropertyListener(); - config.addConfigurationChangeListener(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH,propListener); - - updateValue("20"); - - Thread.sleep(35000); - - System.out.println(config.getAsString(NAMESPACE,ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - //Verify listener is invoked and updated value to 20 - Assert.assertEquals("20" , updatedValue); - - config.removeConfigurationChangeListener(NAMESPACE,ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH,propListener); - - updateValue("22"); - - Thread.sleep(35000); - - //When listener is unregistered updating value does not invoke any listener and value from listener should remain unchanged - Assert.assertEquals("20" , updatedValue); - - //Verify value is updated even if listener is unregistered - Assert.assertEquals("22" , config.getAsString(NAMESPACE,ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - } - - private void updateValue(String newValue) throws IOException { - Properties props = new Properties(); - props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, newValue); - props.setProperty("_config.namespace",NAMESPACE); - props.setProperty("_config.mergeStrategy","override"); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Override Config Property at Conventional Resource"); - } - } - - private class PropertyListener implements ConfigurationChangeListener { - @Override - public void notify(String key, Object oldValue, Object newValue) { - System.out.println("received notification::oldValue=="+oldValue+" newValue=="+newValue); - updatedValue = newValue.toString(); - } - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - if(f.exists()) { - f.delete(); - } - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateDefaultModeTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateDefaultModeTest.java deleted file mode 100644 index 7ae2e0a644..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateDefaultModeTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static org.openecomp.config.util.ConfigTestConstant.*; -import static org.openecomp.config.util.TestUtil.writeFile; - -/** - * Created by ARR on 10/17/2016. - * - * Scenario 22 - * Validate the default mode if the mode is not set - */ -public class ValidateDefaultModeTest { - - public static final String NAMESPACE = "defaultmode"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithValidateDefaultMode(){ - Configuration config = ConfigurationManager.lookup(); - - Assert.assertEquals(config.getAsString(NAMESPACE, ARTIFACT_NAME_MAXLENGTH ), "14"); - - Assert.assertEquals(config.getAsString(NAMESPACE, ARTIFACT_MAXSIZE ), "1048"); - - List expectedExtList = new ArrayList(); - expectedExtList.add("pdf"); - expectedExtList.add("tgz"); - expectedExtList.add("xls"); - List extList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_EXT); - Assert.assertEquals(expectedExtList, extList); - - Assert.assertEquals(config.getAsString(NAMESPACE, ARTIFACT_NAME_MINLENGTH ), "6"); - - } - - @After - public void tearDown() throws Exception { - String data = "{name:\"SCM\"}"; - writeFile(data); - // ConfigurationUtils.executeDDLSQL("truncate dox.configuration"); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateNodeConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateNodeConfigTest.java deleted file mode 100644 index 8f7d703468..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateNodeConfigTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.openecomp.config.util.ConfigTestConstant; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.Assert; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -/** - * Scenario 13 - * Validate node specific configuration - * Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test - * - * Created by sheetalm on 10/14/2016. - */ -public class ValidateNodeConfigTest { - - public final static String NAMESPACE = "ValidateNodeConfig"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - } - - @Test - public void testValidateNodeConfig() throws IOException, InterruptedException { - Configuration config = ConfigurationManager.lookup(); - - Properties props = new Properties(); - props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "56"); - props.setProperty("_config.namespace","ValidateNodeConfig"); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - try (OutputStream out = new FileOutputStream(f)) { - props.store(out, "Node Config Property"); - } - - System.out.println(System.getProperty("node.config.location")); - - Thread.sleep(35000); - - //Verify property from node specific configuration - Assert.assertEquals("56", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH)); - - //Verify if property is not in node specific then fetch from namespace - //Assert.assertEquals("a-zA-Z",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER)); - - //Verify if property is not in node specific and namespace then fetch from global - Assert.assertEquals("1024", config.getAsString(NAMESPACE, "maxCachedBufferSize")); - - //Deleting node configurations to test property is fetched from namespace configuration when node configuration is not present - if(f.exists()) { - boolean isDeleted = f.delete(); - System.out.println(isDeleted); - } - - Thread.sleep(35000); - - Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH), "14"); - } - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - File f = new File(TestUtil.jsonSchemaLoc+"config.properties"); - if(f.exists()) { - f.delete(); - } - } - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/XMLConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/XMLConfigTest.java deleted file mode 100644 index 8af5ebf89d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/XMLConfigTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; - -import static org.openecomp.config.util.TestUtil.validateConfiguraton; -import static org.openecomp.config.util.TestUtil.writeFile; - -/** - * Created by ARR on 10/14/2016. - * - * Scenario 2 - * Validate configuration with XML file format with mode - */ -public class XMLConfigTest { - - public static final String NAMESPACE = "XMLConfig"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithXMLFileFormat(){ - validateConfiguraton(NAMESPACE); - } - - - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/YAMLConfigTest.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/YAMLConfigTest.java deleted file mode 100644 index bc172b0eb7..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/YAMLConfigTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.openecomp.config.test; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.util.TestUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; - -import static org.openecomp.config.util.TestUtil.validateConfiguraton; -import static org.openecomp.config.util.TestUtil.writeFile; - -/** - * Created by ARR on 10/14/2016. - * - * Scenario 4 - * Validate configuration with YAML file format with mode - */ -public class YAMLConfigTest { - - public static final String NAMESPACE = "YAMLConfig"; - - @Before - public void setUp() throws IOException { - String data = "{name:\"SCM\"}"; - writeFile(data); - } - - @Test - public void testConfigurationWithYAMLFileFormat(){ - validateConfiguraton(NAMESPACE); - } - - - - @After - public void tearDown() throws Exception { - TestUtil.cleanUp(); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/ConfigTestConstant.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/ConfigTestConstant.java deleted file mode 100644 index d639ccad42..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/ConfigTestConstant.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.openecomp.config.util; - -public class ConfigTestConstant { - - public static final String ARTIFACT_NAME_MAXLENGTH = "artifact.name.maxlength"; - public static final String ARTIFACT_MAXSIZE = "artifact.maxsize"; - public static final String ARTIFACT_EXT = "artifact.extension"; - public static final String ARTIFACT_ENC = "artifact.supportedEncryption"; - public static final String ARTIFACT_NAME_UPPER = "artifact.name.allowedChar"; - public static final String ARTIFACT_NAME_LOWER = "artifact.name.allowedchar"; - public static final String ARTIFACT_STATUS = "artifact.status"; - public static final String ARTIFACT_LOC = "artifact.persistLocation"; - public static final String ARTIFACT_JSON_SCHEMA = "artifact.jsonSchema"; - public static final String ARTIFACT_XML_SCHEMA = "artifact.xmlSchema"; - public static final String ARTIFACT_CONSUMER_APPC = "artifact.consumerAPPC"; - public static final String ARTIFACT_CONSUMER = "artifact.consumer"; - public static final String ARTIFACT_MANDATORY_NAME = "artifact.mandatory.name"; - public static final String ARTIFACT_NAME_MINLENGTH = "artifact.name.minlength"; - public static final String ARTIFACT_ENCODED = "artifact.encoded"; - - public static final String ONBOARDING_NAMESPACE = "onboarding"; - -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/TestUtil.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/TestUtil.java deleted file mode 100644 index a04f14cb84..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/util/TestUtil.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.openecomp.config.util; - -import org.openecomp.config.ConfigurationUtils; -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; -import org.junit.Assert; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static org.openecomp.config.util.ConfigTestConstant.*; -import static org.openecomp.config.util.ConfigTestConstant.ARTIFACT_ENCODED; -import static org.openecomp.config.util.ConfigTestConstant.ARTIFACT_MANDATORY_NAME; - -/** - * Created by sheetalm on 10/13/2016. - */ -public class TestUtil { - - public final static String jsonSchemaLoc = System.getProperty("user.home")+"/TestResources/"; - public static FileWriter fileWriter ; - - public static void writeFile(String data) throws IOException { - File dir = new File(jsonSchemaLoc); - File file = null; - dir.mkdirs(); - file = new File(jsonSchemaLoc+"/GeneratorsList.json"); - file.createNewFile(); - fileWriter = new FileWriter(file); - fileWriter.write(data); - fileWriter.close(); - } - - public static void cleanUp() throws Exception { - String data = "{name:\"SCM\"}"; - TestUtil.writeFile(data); - //ConfigurationUtils.executeDdlSql("truncate dox.configuration"); - try{ - ConfigurationUtils.executeDdlSql("truncate dox.configuration_change"); - } - catch(Exception e){ - e.printStackTrace(); - } - - } - - public static void validateConfiguraton(String nameSpace) { - Configuration config = ConfigurationManager.lookup(); - - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_NAME_MAXLENGTH ), "14"); - - // First value from list is picked from Merge properties - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_MAXSIZE ), "1048576"); - - List expectedExtList = new ArrayList(); - expectedExtList.add("pdf"); - expectedExtList.add("zip"); - expectedExtList.add("xml"); - expectedExtList.add("pdf"); - expectedExtList.add("tgz"); - expectedExtList.add("xls"); - List extList = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_EXT); - Assert.assertEquals(expectedExtList, extList); - - List expectedEncList = new ArrayList(); - expectedEncList.add("Base64"); - expectedEncList.add("MD5"); - List encList = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_ENC); - Assert.assertEquals(expectedEncList, encList); - - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_NAME_UPPER ), "a-zA-Z_0-9"); - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_NAME_LOWER ), "a-zA-Z"); - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_STATUS ), "deleted"); - - List expectedLocList = new ArrayList(); - expectedLocList.add("/opt/spool"); - expectedLocList.add(System.getProperty("user.home")+"/asdc"); - List locList = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_LOC); - Assert.assertEquals(expectedLocList, locList); - - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_JSON_SCHEMA ), "@GeneratorList.json"); - - Assert.assertEquals("@"+System.getenv("Path")+"/myschema.json",config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_XML_SCHEMA)); - - List artifactConsumer = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_CONSUMER ); - Assert.assertEquals(config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_CONSUMER_APPC ), artifactConsumer); - - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_NAME_MINLENGTH ), "6"); - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_MANDATORY_NAME ), "true"); - Assert.assertEquals(config.getAsString(nameSpace, ARTIFACT_ENCODED ), "true"); - } -} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config-NS.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config-NS.properties deleted file mode 100644 index a50cabc151..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config-NS.properties +++ /dev/null @@ -1,12 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@${sys:user.home}/TestResources/GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=OPENECOMP:CLI \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.json deleted file mode 100644 index 5d98a327db..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "artifact": { - "name": { "minlength": "6" }, - "extension": "pdf,tgz,xls" - }, - "_config":{"namespace": "OPENECOMP:CLI", "mergeStrategy": "union"} - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.properties deleted file mode 100644 index 4daad19dcc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -maxCachedBufferSize=1024 -artifact.maxsize=1024 -artifact.name.maxlength=28 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.xml deleted file mode 100644 index 2f09871bd5..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 28 - - gz,tgz - Base64 - deleted - - true - - <_config> - OPENECOMP:CLI - merge - - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.yaml deleted file mode 100644 index 4333f3e83e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLI/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" -_config: - namespace: "OPENECOMP:CLI" - mergeStrategy: "override" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config-NS.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config-NS.properties deleted file mode 100644 index 32da54ffbc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config-NS.properties +++ /dev/null @@ -1,12 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@${sys:user.home}/TestResources/GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=OPENECOMP:CLIFallback \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.json deleted file mode 100644 index a1db251671..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "artifact": { - "name": { "minlength": "6" }, - "extension": "pdf,tgz,xls" - }, - "_config":{"namespace": "OPENECOMP:CLIFallback", "mergeStrategy": "union"} - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.properties deleted file mode 100644 index 4daad19dcc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -maxCachedBufferSize=1024 -artifact.maxsize=1024 -artifact.name.maxlength=28 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.xml deleted file mode 100644 index 4c46762cdd..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 28 - - gz,tgz - Base64 - deleted - - true - - <_config> - OPENECOMP:CLIFallback - merge - - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.yaml deleted file mode 100644 index b0b195f354..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/CLIFallback/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" -_config: - namespace: "OPENECOMP:CLIFallback" - mergeStrategy: "override" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.json deleted file mode 100644 index c909fe8466..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - - "artifact": { - "name": { "minlength": "6" }, - "extension": "pdf,tgz,xls" - }, - "_config": {"namespace": "DynamicConfiguration", "mergeStrategy": "union"} -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.properties deleted file mode 100644 index c3825487a9..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.properties +++ /dev/null @@ -1,13 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=DynamicConfiguration \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.xml deleted file mode 100644 index 3f046e232b..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 28 - - gz,tgz - Base64 - deleted - - true - - <_config> - DynamicConfiguration - merge - - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.yaml deleted file mode 100644 index 12ba1f093e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/DynamicConfiguration/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -artifact: - name: - allowedChar: "a-zA-Z_0-9" -encoded: true -consumer: "appc,catalog" -_config: - namespace: "DynamicConfiguration" - mergeStrategy: "override" diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config-NS.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config-NS.properties deleted file mode 100644 index b7e985b90a..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config-NS.properties +++ /dev/null @@ -1,13 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=FallbackToGlobalNS \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.json deleted file mode 100644 index 6f3d68ab75..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - - "artifact": { - "name": { "minlength": "6" }, - "extension": "pdf,tgz,xls" - }, - "_config":{"namespace": "FallbackToGlobalNS" , "mergeStrategy": "union"} - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.properties deleted file mode 100644 index 4daad19dcc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -maxCachedBufferSize=1024 -artifact.maxsize=1024 -artifact.name.maxlength=28 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.xml deleted file mode 100644 index 9a881ab4a7..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 28 - - gz,tgz - Base64 - deleted - - true - - - <_config> - FallbackToGlobalNS - merge - - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.yaml deleted file mode 100644 index 46f50b6087..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/FallbackToGlobalNS/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" - _config: - namespace: "FallbackToGlobalNS" - mergeStrategy: "override" diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.json deleted file mode 100644 index e59e65855c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - - "artifact": { - "name": { "minlength": "6" }, - "maxsize": "1048", - "extension": "pdf,tgz,xls" - }, - "_config": { "mergeStrategy": "union","namespace":"GlobalAndNSConfig" } - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.properties deleted file mode 100644 index 1a86f68a65..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.properties +++ /dev/null @@ -1,10 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64, MD5 -artifact.name.allowedChar=a-zA-Z -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=GlobalAndNSConfig \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.xml deleted file mode 100644 index d8292c167e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - 28 - - gz,tgz - - true - - - <_config> - GlobalAndNSConfig - merge - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.yaml deleted file mode 100644 index bbbdde22a4..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/GlobalAndNSConfig/config.yaml +++ /dev/null @@ -1,7 +0,0 @@ - artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" - _config: - mergeStrategy: "override" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-M.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-M.json deleted file mode 100644 index 9c335724bc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-M.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - - "artifact": { - "name": { "maxlength": "28" }, - "maxsize": "1048576", - "extension": "gz,tgz", - "supportedencryption": "Base64", - "status": "deleted", - "mandatory": { "name": "true" } - }, - "_config": { - "namespace": "JSONConfig", - "mergeStrategy": "merge" - } - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-O.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-O.json deleted file mode 100644 index c324fc777c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-O.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "artifact": { - "name": { "allowedChar": "a-zA-Z_0-9" }, - "encoded": "true", - "consumer": "appc,catalog" - }, - "_config": { - "namespace": "JSONConfig", - "mergeStrategy": "override" - } -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-U.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-U.json deleted file mode 100644 index 05a7e2d7ff..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config-U.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "artifact": { - "name": { "minlength": "6" }, - "maxsize": "1048", - "extension": "pdf,tgz,xls" - }, - "_config": { - "namespace": "JSONConfig", - "mergeStrategy": "union" - } -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config.json deleted file mode 100644 index 0538ba1717..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/JSONConfiguration/config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "artifact": { - "name": { - "maxlength": "14", - "allowedChar": "a-zA-Z", - "allowedchar": "a-zA-Z" - }, - "extension": [ - "pdf", - "zip,xml" - - ], - "supportedEncryption": [ - "Base64", - "MD5" - ], - "status": [ - "deleted", - "Deleted" - ], - "persistLocation": "/opt/spool,${sys:user.home}/asdc", - "jsonSchema": "@GeneratorList.json", - "xmlSchema": "@${env:path}/myschema.json", - "consumerAPPC": "${artifact.consumer}" - - }, - "_config": { - "namespace": "JSONConfig" - } -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-M.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-M.properties deleted file mode 100644 index 5082081102..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-M.properties +++ /dev/null @@ -1,9 +0,0 @@ -artifact.name.maxlength=28 -artifact.maxsize=1048576 -artifact.extension=gz, tgz -artifact.supportedencryption=Base64 -artifact.mandatory.name=true -artifact.length=2 -_config.namespace=LoadOrderConfiguration -_config.mergeStrategy=merge -_config.loadOrder=2 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-O.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-O.properties deleted file mode 100644 index 45018269dd..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-O.properties +++ /dev/null @@ -1,7 +0,0 @@ -artifact.name.allowedChar=a-zA-Z_0-9 -artifact.encoded=true -artifact.consumer=appc, catalog -artifact.size=75 -_config.namespace=LoadOrderConfiguration -_config.mergeStrategy=override -_config.loadOrder=1 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-U.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-U.properties deleted file mode 100644 index cb5d5968f5..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-U.properties +++ /dev/null @@ -1,5 +0,0 @@ -artifact.maxsize=1048 -artifact.extension=pdf,tgz, xls -artifact.name.minlength=6 -_config.namespace=LoadOrderConfiguration -_config.mergeStrategy=union \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-M.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-M.properties deleted file mode 100644 index 79d0815a39..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-M.properties +++ /dev/null @@ -1,9 +0,0 @@ -artifact.name.maxlength=28 -artifact.maxsize=1048576 -artifact.extension=gz, tgz -artifact.supportedencryption=Base64 -artifact.mandatory.name=true -artifact.length=5 -_config.namespace=LoadOrderConfiguration -_config.mergeStrategy=merge -_config.loadOrder=1 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-O.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-O.properties deleted file mode 100644 index 164706dba7..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config-loadorder-O.properties +++ /dev/null @@ -1,7 +0,0 @@ -artifact.name.allowedChar=a-zA-Z_0-9 -artifact.encoded=true -artifact.consumer=appc, catalog -artifact.size=56 -_config.namespace=LoadOrderConfiguration -_config.mergeStrategy=override -_config.loadOrder=2 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config.properties deleted file mode 100644 index ae1f445efd..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/LoadOrderConfiguration/config.properties +++ /dev/null @@ -1,14 +0,0 @@ -artifact.name.maxlength=14 -#artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=LoadOrderConfiguration diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.json deleted file mode 100644 index 7c6d552b82..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "artifact": { - "name": { "minlength": "6" }, - "maxsize": "1048", - "extension": "pdf,tgz,xls" - }, - "_config": { "mergeStrategy": "union" , "namespace":"ModeAsConfigProp" } -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.properties deleted file mode 100644 index a82e6b23fe..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.properties +++ /dev/null @@ -1,10 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf,zip,xml -artifact.supportedEncryption=Base64,MD5 -artifact.name.allowedChar=a-zA-Z -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@${sys:user.home}/TestResources/GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=ModeAsConfigProp \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.xml deleted file mode 100644 index 2d05d2724c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - 28 - - gz,tgz - - true - - - <_config> - ModeAsConfigProp - merge - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.yaml deleted file mode 100644 index ef08bba6ce..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/MergeStrategyAsConfigProp/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" -_config: - mergeStrategy: "override" - namespace: "ModeAsConfigProp" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NodeCLI/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NodeCLI/config.properties deleted file mode 100644 index 435f98ab39..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NodeCLI/config.properties +++ /dev/null @@ -1,9 +0,0 @@ -artifact.name.maxlength=30 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.name.allowedChar=a-zA-Z -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=NodeCLI \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/Notification/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/Notification/config.properties deleted file mode 100644 index 4076eefa58..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/Notification/config.properties +++ /dev/null @@ -1,15 +0,0 @@ -artifact.name.maxlength=14 -artifact.consumer=APPC -artifact.maxsize=1048 -artifact.extension=pdf,zip,xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool,${sys:user.home}/asdc -artifact.jsonSchema=@${sys:user.home}/TestResources/GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=Notification \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig.zip b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig.zip deleted file mode 100644 index 42d14a64db..0000000000 Binary files a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig.zip and /dev/null differ diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.json deleted file mode 100644 index 0d6395af4f..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - - "artifact": { - "name": { "minlength": "6" }, - "extension": "pdf,tgz,xls" - }, - "_config":{ - "namespace": "NotificationForNodeConfig", - "mergestrategy": "union" - } - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.properties deleted file mode 100644 index d2c41aa4b5..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.properties +++ /dev/null @@ -1,14 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=NotificationForNodeConfig - diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.xml deleted file mode 100644 index 20768aa949..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 28 - - gz,tgz - Base64 - deleted - - true - - - <_config> - NotificationForNodeConfig - merge - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.yaml deleted file mode 100644 index ee85a0c68d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationForNodeConfig/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" -_config: - namespace: "NotificationForNodeConfig" - mergestrategy: "override" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config-NS.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config-NS.properties deleted file mode 100644 index 279d407664..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config-NS.properties +++ /dev/null @@ -1,13 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=NotificationOnPropVal \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.json deleted file mode 100644 index fc7f2347aa..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "artifact": { - "name": { "minlength": "6" }, - "extension": "pdf,tgz,xls" - }, - - "_config": { "mergeStrategy": "union","namespace":"NotificationOnPropVal" } - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.properties deleted file mode 100644 index 4daad19dcc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -maxCachedBufferSize=1024 -artifact.maxsize=1024 -artifact.name.maxlength=28 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.xml deleted file mode 100644 index e3a24fbc32..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 28 - - gz,tgz - Base64 - deleted - - true - - - <_config> - NotificationOnPropVal - merge - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.yaml deleted file mode 100644 index 7283df4ecb..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/NotificationOnPropVal/config.yaml +++ /dev/null @@ -1,9 +0,0 @@ - - artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" - _config: - mergeStrategy: "override" - namespace: "NotificationOnPropVal" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.json deleted file mode 100644 index 42c6be91b9..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - - "artifact": { - "name": { "minlength": "6" }, - "maxsize": "1048", - "extension": "pdf,tgz,xls" - }, - "_config": { "mergeStrategy": "union","namespace":"SourceLocation" } - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.properties deleted file mode 100644 index 22c9840fad..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.properties +++ /dev/null @@ -1,14 +0,0 @@ -artifact.name.maxlength=14 -artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=SourceLocation \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.xml deleted file mode 100644 index 1162af576e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 28 - - 1048576 - gz,tgz - Base64 - deleted - - true - - - <_config> - SourceLocation - merge - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.yaml deleted file mode 100644 index 4e073ce7f9..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/SourceLocation/appjarconfig.yaml +++ /dev/null @@ -1,8 +0,0 @@ -artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" -_config: - mergeStrategy: "override" - namespace: "SourceLocation" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config-NS.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config-NS.properties deleted file mode 100644 index 40b4518945..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config-NS.properties +++ /dev/null @@ -1,13 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=UnregisterNotification \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.json deleted file mode 100644 index 3e0464016d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "artifact": { - "name": { "minlength": "6" }, - "extension": "pdf,tgz,xls" - }, - - "_config": { "mergeStrategy": "union","namespace":"UnregisterNotification" } - -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.properties deleted file mode 100644 index 4daad19dcc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -maxCachedBufferSize=1024 -artifact.maxsize=1024 -artifact.name.maxlength=28 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.xml deleted file mode 100644 index 1153658161..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 28 - - gz,tgz - Base64 - deleted - - true - - - <_config> - UnregisterNotification - merge - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.yaml deleted file mode 100644 index 1deb37ac7a..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/UnregisterNotification/config.yaml +++ /dev/null @@ -1,9 +0,0 @@ - - artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" - _config: - mergeStrategy: "override" - namespace: "UnregisterNotification" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.json deleted file mode 100644 index 72833024c4..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "artifact": { - "name": { - "minlength": "6" - }, - "extension": "pdf,tgz,xls" - } -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.properties deleted file mode 100644 index c857da38e9..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateDefaultMode/config-defaultmode.properties +++ /dev/null @@ -1,2 +0,0 @@ -artifact.name.maxlength=14 -artifact.maxsize=1048 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config-NS.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config-NS.properties deleted file mode 100644 index a782e25835..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config-NS.properties +++ /dev/null @@ -1,13 +0,0 @@ -artifact.name.maxlength=14 -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorsList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=ValidateNodeConfig \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config.properties deleted file mode 100644 index 4daad19dcc..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/ValidateNodeConfig/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -maxCachedBufferSize=1024 -artifact.maxsize=1024 -artifact.name.maxlength=28 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-M.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-M.xml deleted file mode 100644 index 320e53348d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-M.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 28 - - 1048576 - gz,tgz - Base64 - deleted - - true - - - <_config> - XMLConfig - merge - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-O.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-O.xml deleted file mode 100644 index 508c920b83..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-O.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - a-zA-Z_0-9 - - true - appc,catalog - - <_config> - XMLConfig - override - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-U.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-U.xml deleted file mode 100644 index 962bd342f3..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config-U.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 6 - - 1048 - pdf,tgz,xls - - <_config> - XMLConfig - union - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config.xml deleted file mode 100644 index 2fff65b2e0..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/XMLConfiguration/config.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - 14 - a-zA-Z - a-zA-Z - - - pdf - zip,xml - - Base64 - MD5 - deleted - Deleted - /opt/spool,${sys:user.home}/asdc - @GeneratorList.json - @${env:path}/myschema.json - ${artifact.consumer} - - <_config> - XMLConfig - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-M.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-M.yaml deleted file mode 100644 index 8ff08cdc43..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-M.yaml +++ /dev/null @@ -1,12 +0,0 @@ - artifact: - name: - maxlength: 28 - maxsize: 1048576 - extension: "gz,tgz" - supportedencryption: Base64 - status: deleted - mandatory: - name: true - _config: - namespace: YAMLConfig - mergeStrategy: merge \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-O.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-O.yaml deleted file mode 100644 index 051d41d76b..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-O.yaml +++ /dev/null @@ -1,8 +0,0 @@ - artifact: - name: - allowedChar: "a-zA-Z_0-9" - encoded: true - consumer: "appc,catalog" - _config: - namespace: YAMLConfig - mergeStrategy: override \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-U.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-U.yaml deleted file mode 100644 index 8a9ab0e13e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config-U.yaml +++ /dev/null @@ -1,8 +0,0 @@ - artifact: - name: - minlength: 6 - maxsize: 1048 - extension: "pdf,tgz,xls" - _config: - namespace: YAMLConfig - mergeStrategy: union \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config.yaml deleted file mode 100644 index 706b22db5e..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/YAMLConfiguration/config.yaml +++ /dev/null @@ -1,27 +0,0 @@ -artifact: - name: - maxlength: 14 - allowedChar: "a-zA-Z" - allowedchar: "a-zA-Z" - #maxsize: "" - extension: - - - pdf - - - zip,xml - supportedEncryption: - - - Base64 - - - MD5 - status: - - - deleted - - - Deleted - persistLocation: "/opt/spool,${sys:user.home}/asdc" - jsonSchema: "@GeneratorList.json" - xmlSchema: "@${env:path}/myschema.json" - consumerAPPC: "${artifact.consumer}" -_config: - namespace: YAMLConfig \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties deleted file mode 100644 index cfe91e6c7d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties +++ /dev/null @@ -1,22 +0,0 @@ -driverClassName=com.github.adejanovski.cassandra.jdbc.CassandraDriver -jdbcURL=jdbc:${dbname}://${dbhost}:${dbport}/${configdb} -dbuser= -dbpassword= -config.Table=configuration -config.monitor.Table=configuration_change -configKey=key -configValue=value -configNameColumn=name -configdb=dox -dbhost= -dbport=9042 -dbname=cassandra -createtablecql=create table if not exists ${configdb}.${config.Table} (name text\, key text\, value text\, PRIMARY KEY (name\, key)) with clustering order by (key asc) -createmonitoringtablecql=create table if not exists ${configdb}.${config.monitor.Table} (name text\, changed_when bigint\, key text\, old_value text\, new_value text\, PRIMARY KEY (name\, changed_when)) with clustering order by (changed_when desc) -insertconfigurationchangecql=insert into ${configdb}.${config.monitor.Table} (name\, changed_when\, key\, old_value\, new_value) values(?\, ?\, ?\, ?\, ?) -fetchkeysql=select ${configKey} from ${config.Table} where ${configNameColumn}=? -fetchlastchangecql=select changed_when from ${configdb}.${config.monitor.Table} where name=? limit 1 -fetchnamescql=select distinct name from ${configdb}.${config.Table} -config.size.max=100 -config.refresh.interval=30000 -event.fetch.delay=5000 \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-merge.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-merge.xml deleted file mode 100644 index 3595efd87b..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-merge.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - 28 - - 1048576 - gz,tgz - Base64 - deleted - - true - - - \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-override.json b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-override.json deleted file mode 100644 index dd6087b70c..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-override.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "artifact": { - "name": { "allowedChar": "a-zA-Z_0-9" }, - "encoded": "true", - "consumer": "appc,catalog" - } -} \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-union.yaml b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-union.yaml deleted file mode 100644 index 957b75d40a..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback-union.yaml +++ /dev/null @@ -1,5 +0,0 @@ - artifact: - name: - minlength: 6 - maxsize: 1048 - extension: "pdf,tgz,xls" \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback.properties deleted file mode 100644 index 7839839258..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/fallback/config-fallback.properties +++ /dev/null @@ -1,13 +0,0 @@ -artifact.name.maxlength=14 -#artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-M.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-M.properties deleted file mode 100644 index 8a571ebc89..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-M.properties +++ /dev/null @@ -1,7 +0,0 @@ -artifact.name.maxlength=28 -artifact.maxsize=1048576 -artifact.extension=gz, tgz -artifact.supportedencryption=Base64 -artifact.mandatory.name=true -_config.namespace=javaProperties -_config.mergeStrategy=merge \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-O.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-O.properties deleted file mode 100644 index b27c67a78d..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-O.properties +++ /dev/null @@ -1,5 +0,0 @@ -artifact.name.allowedChar=a-zA-Z_0-9 -artifact.encoded=true -artifact.consumer=appc, catalog -_config.namespace=javaProperties -_config.mergeStrategy=override \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-U.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-U.properties deleted file mode 100644 index 615f2a2093..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config-U.properties +++ /dev/null @@ -1,5 +0,0 @@ -artifact.maxsize=1048 -artifact.extension=pdf,tgz, xls -artifact.name.minlength=6 -_config.namespace=javaProperties -_config.mergeStrategy=union \ No newline at end of file diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config.properties deleted file mode 100644 index d9051f6ec4..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/java-properties/config.properties +++ /dev/null @@ -1,14 +0,0 @@ -artifact.name.maxlength=14 -#artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.supportedEncryption=MD5 -artifact.name.allowedChar=a-zA-Z -artifact.name.allowedchar=a-zA-Z -artifact.status=deleted -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=javaProperties diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-at.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-at.properties deleted file mode 100644 index 3bc773369b..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-at.properties +++ /dev/null @@ -1,11 +0,0 @@ -artifact.name.maxlength=20 -#artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.name.allowedChar=a-zA-Z -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=OPENECOMP:tenancy diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-tf.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-tf.properties deleted file mode 100644 index 196bafe4e4..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-tf.properties +++ /dev/null @@ -1,10 +0,0 @@ -artifact.name.maxlength=30 -#artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.name.allowedChar=a-zA-Z -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=Telefonica:tenancy diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-vf.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-vf.properties deleted file mode 100644 index 4c0c6ad897..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config-vf.properties +++ /dev/null @@ -1,11 +0,0 @@ -artifact.name.maxlength=24 -#artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.name.allowedChar=a-zA-Z -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=Vodafone:tenancy diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config.properties deleted file mode 100644 index 8ed2485dc2..0000000000 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/multitenancy/config.properties +++ /dev/null @@ -1,11 +0,0 @@ -artifact.name.maxlength=14 -#artifact.maxsize= -artifact.extension=pdf, zip, xml -artifact.supportedEncryption=Base64 -artifact.name.allowedChar=a-zA-Z -artifact.status=Deleted -artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc -artifact.jsonSchema=@GeneratorList.json -artifact.xmlSchema=@${env:path}/myschema.json -artifact.consumerAPPC=${artifact.consumer} -_config.namespace=tenancy diff --git a/common/openecomp-common-configuration-management/pom.xml b/common/openecomp-common-configuration-management/pom.xml deleted file mode 100644 index 24b8ded023..0000000000 --- a/common/openecomp-common-configuration-management/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - 4.0.0 - - openecomp-common-configuration-management - org.openecomp.sdc.common - openecomp-common-configuration-management - pom - - - org.openecomp.sdc.common - openecomp-common-lib - 1.2.0-SNAPSHOT - .. - - - - openecomp-configuration-management-api - openecomp-configuration-management-core - openecomp-configuration-management-test - - - - - java.net - http://repo1.maven.org/maven2 - - - - -- cgit 1.2.3-korg