From 6b348ec08a61fcbdb3e5496ea8ef971c8f545228 Mon Sep 17 00:00:00 2001 From: Kevin McGoldrick Date: Mon, 1 Apr 2024 17:57:44 -0700 Subject: [PATCH] apache commons-configuration2 --- agent/http_client_5/settings.xml | 12 +- api/pom.xml | 10 +- .../intuit/tank/vm/settings/AgentConfig.java | 2 +- .../vm/settings/BaseCommonsXmlConfig.java | 68 +++---- .../tank/vm/settings/CloudCredentials.java | 2 +- .../intuit/tank/vm/settings/DefaultUser.java | 2 +- .../tank/vm/settings/InstanceDescription.java | 2 +- .../settings/InstanceDescriptionDefaults.java | 2 +- .../tank/vm/settings/LocationsConfig.java | 2 +- .../tank/vm/settings/LogicStepConfig.java | 2 +- .../intuit/tank/vm/settings/MailConfig.java | 2 +- .../tank/vm/settings/MailMessageConfig.java | 16 +- .../tank/vm/settings/OidcSsoConfig.java | 2 +- .../tank/vm/settings/ProductConfig.java | 2 +- .../tank/vm/settings/ReportingConfig.java | 7 +- .../tank/vm/settings/ReportingInstance.java | 2 +- .../intuit/tank/vm/settings/SearchConfig.java | 2 +- .../tank/vm/settings/SecurityConfig.java | 2 +- .../intuit/tank/vm/settings/TankConfig.java | 30 +-- .../tank/vm/settings/VmManagerConfig.java | 8 +- api/src/main/resources/insert.js | 8 +- api/src/main/resources/settings.xml | 12 +- .../tank/vm/settings/AgentConfigCpTest.java | 52 ++--- .../settings/BaseCommonsXmlConfigCpTest.java | 189 +++--------------- .../vm/settings/CloudCredentialsCpTest.java | 16 +- .../tank/vm/settings/DefaultUserCpTest.java | 36 ++-- .../settings/InstanceDescriptionCpTest.java | 16 +- .../InstanceDescriptionDefaultsCpTest.java | 50 ++--- .../vm/settings/LocationsConfigCpTest.java | 8 +- .../vm/settings/LogicStepConfigCpTest.java | 12 +- .../tank/vm/settings/MailConfigCpTest.java | 14 +- .../tank/vm/settings/OidcSsoConfigTest.java | 10 +- .../tank/vm/settings/ReportingConfigTest.java | 10 +- .../vm/settings/ReportingInstanceCpTest.java | 48 ++--- .../vm/settings/SecurityConfigCpTest.java | 46 +++-- api/src/test/resources/settings.xml | 12 +- pom.xml | 20 +- .../config/CommonsProxyConfiguration.java | 151 +++++--------- .../reporting/api/DummyResultsReader.java | 2 +- .../reporting/api/DummyResultsReporter.java | 2 +- .../tank/reporting/api/ResultsReader.java | 2 +- .../tank/reporting/api/ResultsReporter.java | 2 +- .../reporting/factory/ReportingFactory.java | 2 +- reporting/db/settings.xml | 12 +- .../databases/AmazonDynamoDatabaseDocApi.java | 2 +- .../databases/GraphiteDatasource.java | 2 +- .../persistence/databases/S3Datasource.java | 2 +- .../databases/WavefrontDatasource.java | 2 +- .../reporting/db/DatabaseResultsReader.java | 2 +- .../reporting/db/DatabaseResultsReporter.java | 2 +- .../reporting/rest/RestResultsReader.java | 2 +- .../reporting/rest/RestResultsReporter.java | 2 +- .../java/com/intuit/tank/TankSettings.java | 6 - .../intuit/tank/util/ExceptionHandler.java | 3 +- .../auth/sso/TankOidcAuthorizationTest.java | 2 +- .../tank/auth/sso/TankSsoHandlerTest.java | 2 +- .../intuit/tank/config/LoginFilterTest.java | 2 +- 57 files changed, 374 insertions(+), 566 deletions(-) diff --git a/agent/http_client_5/settings.xml b/agent/http_client_5/settings.xml index c6ff5b210..44e1f324c 100644 --- a/agent/http_client_5/settings.xml +++ b/agent/http_client_5/settings.xml @@ -34,7 +34,7 @@ - + @@ -387,7 +387,7 @@ function toJsonObj(text) { function toJsonString(jsonObj) { try { - return JSON.stringify(jsonObj\, null\, '\t'); + return JSON.stringify(jsonObj, null, '\t'); } catch(e) { error("Error converting json to string json: " + e); } @@ -458,8 +458,8 @@ function getVariable(key) { * @param value * the value to set it to */ -function setVariable(key\, value) { - ioBean.getInput("variables").addVariable(key\, value); +function setVariable(key, value) { + ioBean.getInput("variables").addVariable(key, value); } //######## Result functions ########## @@ -468,7 +468,7 @@ function setVariable(key\, value) { * jump to a group within the script with the specified name. * * @param groupName - * the name of the group to go to. if the group does not exist\, it + * the name of the group to go to. if the group does not exist, it * skips to next script. */ function gotoGroup(groupName) { @@ -517,7 +517,7 @@ function terminateUser() { * sets the action in the output. */ function setAction(action) { - ioBean.setOutput("action"\, action); + ioBean.setOutput("action", action); } ]]> diff --git a/api/pom.xml b/api/pom.xml index 5df8b604d..2c2dc29f2 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -36,13 +36,13 @@ - commons-configuration - commons-configuration + org.apache.commons + commons-configuration2 - + - commons-collections - commons-collections + commons-beanutils + commons-beanutils diff --git a/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java index dc51c4a84..742f6c3da 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java @@ -27,7 +27,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/api/src/main/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfig.java index cce237725..b3ee96f41 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfig.java @@ -13,19 +13,20 @@ * #L% */ -import java.io.File; -import java.io.Serializable; +import java.io.*; import java.net.URL; import java.util.List; import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; -import org.apache.commons.configuration.tree.ExpressionEngine; -import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder; +import org.apache.commons.configuration2.builder.fluent.Parameters; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.commons.configuration2.reloading.ReloadingController; +import org.apache.commons.configuration2.tree.ExpressionEngine; +import org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -40,20 +41,18 @@ public abstract class BaseCommonsXmlConfig implements Serializable { private static final Logger LOG = LogManager.getLogger(BaseCommonsXmlConfig.class); - protected XMLConfiguration config; + protected XMLConfiguration XMLConfig; + protected File configFile; /** * Constructor pulls file out of the jar or reads from disk and sets up refresh policy. - * - * @param expressionEngine - * the expression engine to use. Null results in default expression engine + * */ protected void readConfig() { try { ExpressionEngine expressionEngine = new XPathExpressionEngine(); String configPath = getConfigName(); - FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy(); File dataDirConfigFile = new File(configPath); // LOG.info("Reading settings from " + dataDirConfigFile.getAbsolutePath()); @@ -67,33 +66,38 @@ protected void readConfig() { throw new RuntimeException("unable to load resource: " + configPath); } - XMLConfiguration tmpConfig = new XMLConfiguration(configResourceUrl); + XMLConfiguration tmpConfig = new ReloadingFileBasedConfigurationBuilder(XMLConfiguration.class) + .configure(new Parameters().xml().setURL(configResourceUrl)) + .getConfiguration(); + // Copy over a default configuration since none exists: // Ensure data dir location exists: if (dataDirConfigFile.getParentFile() != null && !dataDirConfigFile.getParentFile().exists() && !dataDirConfigFile.getParentFile().mkdirs()) { throw new RuntimeException("could not create directories."); } - tmpConfig.save(dataDirConfigFile); + tmpConfig.write(new FileWriter(dataDirConfigFile)); LOG.info("Saving settings file to " + dataDirConfigFile.getAbsolutePath()); } if (dataDirConfigFile.exists()) { - config = new XMLConfiguration(dataDirConfigFile); + XMLConfig = new ReloadingFileBasedConfigurationBuilder(XMLConfiguration.class) + .configure(new Parameters().xml().setFile(dataDirConfigFile)) + .getConfiguration(); } else { // extract from jar and write to throw new IllegalStateException("Config file does not exist or cannot be created"); } if (expressionEngine != null) { - config.setExpressionEngine(expressionEngine); + XMLConfig.setExpressionEngine(expressionEngine); } configFile = dataDirConfigFile; - // reload at most once per thirty seconds on configuration queries. - config.setReloadingStrategy(reloadingStrategy); - initConfig(config); + initConfig(XMLConfig); } catch (ConfigurationException e) { LOG.error("Error reading settings file: " + e, e); throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); } } @@ -119,8 +123,7 @@ public static HierarchicalConfiguration getChildConfigurationAt(HierarchicalConf * @return the config */ protected XMLConfiguration getConfig() { - checkReload(); - return config; + return XMLConfig; } /** @@ -138,25 +141,4 @@ protected XMLConfiguration getConfig() { */ protected abstract void initConfig(@Nonnull XMLConfiguration configuration); - /** - * checks if the config needs to be reloaded and calls initConfig on it. should be called if parsing of the config - * is needed. - */ - protected synchronized void checkReload() { - if (config == null) { - readConfig(); - } else if (config.getReloadingStrategy().reloadingRequired()) { - config.reload(); - initConfig(config); - config.getReloadingStrategy().reloadingPerformed(); - } - } - - /** - * checks if the config needs to be reloaded. - */ - public boolean needsReload() { - return (config == null || config.getReloadingStrategy().reloadingRequired()); - } - } diff --git a/api/src/main/java/com/intuit/tank/vm/settings/CloudCredentials.java b/api/src/main/java/com/intuit/tank/vm/settings/CloudCredentials.java index 0ad3ee735..ed118a16b 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/CloudCredentials.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/CloudCredentials.java @@ -16,7 +16,7 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; import com.intuit.tank.harness.AmazonUtil; diff --git a/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java b/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java index 29a200d4e..5d08b7158 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Set; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; diff --git a/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescription.java b/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescription.java index 4e5ed76c9..9ffe52114 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescription.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescription.java @@ -16,7 +16,7 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import com.intuit.tank.vm.api.enumerated.VMImageType; diff --git a/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaults.java b/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaults.java index ce4020fd7..049ac7675 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaults.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaults.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.stream.Collectors; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; /** * InstanceDescription diff --git a/api/src/main/java/com/intuit/tank/vm/settings/LocationsConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/LocationsConfig.java index 7fd7dde40..41ff75c12 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/LocationsConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/LocationsConfig.java @@ -23,7 +23,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; /** * ProductConfig diff --git a/api/src/main/java/com/intuit/tank/vm/settings/LogicStepConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/LogicStepConfig.java index c5e5ba1a4..8e1c9d19e 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/LogicStepConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/LogicStepConfig.java @@ -20,7 +20,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; /** * diff --git a/api/src/main/java/com/intuit/tank/vm/settings/MailConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/MailConfig.java index e1ff2307f..77c5f7c52 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/MailConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/MailConfig.java @@ -20,7 +20,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; /** * MailConfig diff --git a/api/src/main/java/com/intuit/tank/vm/settings/MailMessageConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/MailMessageConfig.java index c8fc663a4..5096666de 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/MailMessageConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/MailMessageConfig.java @@ -22,8 +22,9 @@ import jakarta.enterprise.context.ApplicationScoped; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.configuration.XMLConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.tree.ImmutableNode; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -91,7 +92,6 @@ public MailMessageConfig() { } public MailMessage getMailMessage(String event) { - checkReload(); MailMessage mailMessage = messages.get(event); if (mailMessage == null) { mailMessage = messages.get(MailMessageConfig.DEFAULT); @@ -100,7 +100,6 @@ public MailMessage getMailMessage(String event) { } public Collection getAllMessages() { - checkReload(); return messages.values(); } @@ -108,14 +107,14 @@ public Collection getAllMessages() { * @return the footer */ public String getFooter() { - return config + return XMLConfig .getString( KEY_FOOTER, "

This message automatically generated by Tank ({tankBaseUrl}).

"); } public String getStyle() { - return config.getString(KEY_CSS, ""); + return XMLConfig.getString(KEY_CSS, ""); } /** @@ -132,10 +131,9 @@ protected String getConfigName() { @Override protected void initConfig(XMLConfiguration configuration) { messages.clear(); - if (config != null) { + if (XMLConfig != null) { String style = getStyle(); - @SuppressWarnings("unchecked") List msgConfigs = config - .configurationsAt(KEY_MESSAGE_NODE); + List> msgConfigs = XMLConfig.configurationsAt(KEY_MESSAGE_NODE); for (HierarchicalConfiguration msgConfig : msgConfigs) { String event = msgConfig.getString(KEY_EVENT); String subject = msgConfig.getString(KEY_SUBJECT); diff --git a/api/src/main/java/com/intuit/tank/vm/settings/OidcSsoConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/OidcSsoConfig.java index 18c5567c0..5a19115b9 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/OidcSsoConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/OidcSsoConfig.java @@ -1,6 +1,6 @@ package com.intuit.tank.vm.settings; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; /** * OidcSsoConfig diff --git a/api/src/main/java/com/intuit/tank/vm/settings/ProductConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/ProductConfig.java index 453b377bf..955701670 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/ProductConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/ProductConfig.java @@ -23,7 +23,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; /** * ProductConfig diff --git a/api/src/main/java/com/intuit/tank/vm/settings/ReportingConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/ReportingConfig.java index 3534a5382..b9cf160f3 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/ReportingConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/ReportingConfig.java @@ -19,8 +19,7 @@ import java.io.Serializable; import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.configuration.SubnodeConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -55,7 +54,7 @@ public String getReporterClass() { String ret = DEFAULT_REPORTER; if (config != null) { try { - SubnodeConfiguration configurationAt = config.configurationAt(KEY_REPORTER); + HierarchicalConfiguration configurationAt = config.configurationAt(KEY_REPORTER); String string = configurationAt.getString(""); if (StringUtils.isNotBlank(string)) { ret = string; @@ -76,7 +75,7 @@ public String getReaderClass() { String ret = DEFAULT_READER; if (config != null) { try { - SubnodeConfiguration configurationAt = config.configurationAt(KEY_READER); + HierarchicalConfiguration configurationAt = config.configurationAt(KEY_READER); String string = configurationAt.getString(""); if (StringUtils.isNotBlank(string)) { ret = string; diff --git a/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java b/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java index 5e9aca329..fa396d919 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java @@ -16,7 +16,7 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.builder.ToStringBuilder; import com.intuit.tank.vm.api.enumerated.VMRegion; diff --git a/api/src/main/java/com/intuit/tank/vm/settings/SearchConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/SearchConfig.java index ef3697d86..703d95d36 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/SearchConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/SearchConfig.java @@ -17,7 +17,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; public class SearchConfig { diff --git a/api/src/main/java/com/intuit/tank/vm/settings/SecurityConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/SecurityConfig.java index fbaddc58a..469d61c8b 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/SecurityConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/SecurityConfig.java @@ -25,7 +25,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; /** * SecurityConfig diff --git a/api/src/main/java/com/intuit/tank/vm/settings/TankConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/TankConfig.java index d6d7a0fd1..497153fdd 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/TankConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/TankConfig.java @@ -19,7 +19,7 @@ import jakarta.inject.Named; import com.google.common.collect.ImmutableMap; -import org.apache.commons.configuration.XMLConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ObjectMessage; @@ -111,77 +111,76 @@ public TankConfig() { * @return the Datafile storage root dir */ public String getDataFileStorageDir() { - return config.getString(KEY_DATA_FILE_STORAGE, "/tmp/tank/datafiles"); + return XMLConfig.getString(KEY_DATA_FILE_STORAGE, "/tmp/tank/datafiles"); } /** * @return true if rest security is enabled */ public boolean isRestSecurityEnabled() { - return config.getBoolean(KEY_REST_SECURITY_ENABLED, false); + return XMLConfig.getBoolean(KEY_REST_SECURITY_ENABLED, false); } /** * @return banner text */ public String getTextBanner() { - return config.getString(KEY_BANNER_TEXT, ""); + return XMLConfig.getString(KEY_BANNER_TEXT, ""); } /** * @return true if rest security is enabled */ public boolean isS3EncryptionEnabled() { - return config.getBoolean(KEY_ENCRYPT_S3, false); + return XMLConfig.getBoolean(KEY_ENCRYPT_S3, false); } /** * @return the Datafile storage root dir */ public boolean getStandalone() { - return config.getBoolean(KEY_STANDALONE, false); + return XMLConfig.getBoolean(KEY_STANDALONE, false); } /** * @return the Datafile storage root dir */ public String getTmpDir() { - return config.getString(KEY_TMP_FILE_STORAGE, "/tmp/tank/tmpfiles"); + return XMLConfig.getString(KEY_TMP_FILE_STORAGE, "/tmp/tank/tmpfiles"); } /** * @return the Datafile storage root dir */ public String getJarDir() { - return config.getString(KEY_JAR_FILE_STORAGE, "/tmp/tank/jars"); + return XMLConfig.getString(KEY_JAR_FILE_STORAGE, "/tmp/tank/jars"); } /** * @return the Datafile storage root dir */ public String getTimingDir() { - return config.getString(KEY_TIMING_FILE_STORAGE, "/tmp/tank/timing"); + return XMLConfig.getString(KEY_TIMING_FILE_STORAGE, "/tmp/tank/timing"); } /** * @return the controller base url */ public String getControllerBase() { - return config.getString(KEY_CONTROLLER_BASE, "http://tank.controller/"); + return XMLConfig.getString(KEY_CONTROLLER_BASE, "http://tank.controller/"); } /** * @return the controller base url */ public String getInstanceName() { - return config.getString(KEY_INSTANCE_NAME, "prod"); + return XMLConfig.getString(KEY_INSTANCE_NAME, "prod"); } /** * @return the vmManagerConfig */ public VmManagerConfig getVmManagerConfig() { - checkReload(); return vmManagerConfig; } @@ -189,7 +188,6 @@ public VmManagerConfig getVmManagerConfig() { * @return the vmManagerConfig */ public AgentConfig getAgentConfig() { - checkReload(); return agentConfig; } @@ -197,7 +195,6 @@ public AgentConfig getAgentConfig() { * @return the vmManagerConfig */ public ProductConfig getProductConfig() { - checkReload(); return productConfig; } @@ -205,7 +202,6 @@ public ProductConfig getProductConfig() { * @return the vmManagerConfig */ public LogicStepConfig getLogicStepConfig() { - checkReload(); return logicStepConfig; } @@ -213,7 +209,6 @@ public LogicStepConfig getLogicStepConfig() { * @return the vmManagerConfig */ public MailConfig getMailConfig() { - checkReload(); return mailConfig; } @@ -228,7 +223,6 @@ public LocationsConfig getLocationsConfig() { * @return the vmManagerConfig */ public SecurityConfig getSecurityConfig() { - checkReload(); return securityConfig; } @@ -236,7 +230,6 @@ public SecurityConfig getSecurityConfig() { * @return the reportingConfig */ public ReportingConfig getReportingConfig() { - checkReload(); return reportingConfig; } @@ -244,7 +237,6 @@ public ReportingConfig getReportingConfig() { * @return the oidcSsoConfig */ public OidcSsoConfig getOidcSsoConfig() { - checkReload(); return oidcSsoConfig; } diff --git a/api/src/main/java/com/intuit/tank/vm/settings/VmManagerConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/VmManagerConfig.java index aa15885ce..d4c203b5e 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/VmManagerConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/VmManagerConfig.java @@ -29,8 +29,7 @@ import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.configuration.SubnodeConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -294,8 +293,7 @@ public long getWatchdogSleepTime(long defaultMills) { } /** - * - * @param defaultResult + * * @return */ public boolean isUseElasticIps() { @@ -328,7 +326,7 @@ public CloudCredentials getCloudCredentials(@Nonnull CloudProvider provider) { * @return */ InstanceDescriptionDefaults getInstanceDefaults() { - SubnodeConfiguration c = config.configurationAt("default-instance-description"); + HierarchicalConfiguration c = config.configurationAt("default-instance-description"); return new InstanceDescriptionDefaults(c, c); } diff --git a/api/src/main/resources/insert.js b/api/src/main/resources/insert.js index 2222207f9..9e5805133 100644 --- a/api/src/main/resources/insert.js +++ b/api/src/main/resources/insert.js @@ -56,7 +56,7 @@ function toJsonObj(text) { function toJsonString(jsonObj) { try { - return JSON.stringify(jsonObj\, null\, '\t'); + return JSON.stringify(jsonObj, null, '\t'); } catch(e) { error("Error converting json to string json: " + e); } @@ -127,8 +127,8 @@ function getVariable(key) { * @param value * the value to set it to */ -function setVariable(key\, value) { - ioBean.getInput("variables").addVariable(key\, value); +function setVariable(key, value) { + ioBean.getInput("variables").addVariable(key, value); } //######## Result functions ########## @@ -186,7 +186,7 @@ function terminateUser() { * sets the action in the output. */ function setAction(action) { - ioBean.setOutput("action"\, action); + ioBean.setOutput("action", action); } diff --git a/api/src/main/resources/settings.xml b/api/src/main/resources/settings.xml index 87adc28c1..b03c508ce 100644 --- a/api/src/main/resources/settings.xml +++ b/api/src/main/resources/settings.xml @@ -47,7 +47,7 @@ - + @@ -401,7 +401,7 @@ function toJsonObj(text) { function toJsonString(jsonObj) { try { - return JSON.stringify(jsonObj\, null\, '\t'); + return JSON.stringify(jsonObj, null, '\t'); } catch(e) { error("Error converting json to string json: " + e); } @@ -472,8 +472,8 @@ function getVariable(key) { * @param value * the value to set it to */ -function setVariable(key\, value) { - ioBean.getInput("variables").addVariable(key\, value); +function setVariable(key, value) { + ioBean.getInput("variables").addVariable(key, value); } //######## Result functions ########## @@ -482,7 +482,7 @@ function setVariable(key\, value) { * jump to a group within the script with the specified name. * * @param groupName - * the name of the group to go to. if the group does not exist\, it + * the name of the group to go to. if the group does not exist, it * skips to next script. */ function gotoGroup(groupName) { @@ -531,7 +531,7 @@ function terminateUser() { * sets the action in the output. */ function setAction(action) { - ioBean.setOutput("action"\, action); + ioBean.setOutput("action", action); } ]]> diff --git a/api/src/test/java/com/intuit/tank/vm/settings/AgentConfigCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/AgentConfigCpTest.java index 36d186195..b922874b5 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/AgentConfigCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/AgentConfigCpTest.java @@ -17,7 +17,9 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; @@ -39,13 +41,13 @@ public class AgentConfigCpTest { @Test public void testAgentConfig_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); AgentConfig result = new AgentConfig(config); Map empty = new HashMap(); assertNotNull(result); - assertEquals(new Long(40000L), result.getConnectionTimeout()); + assertEquals(Long.valueOf(40000L), result.getConnectionTimeout()); assertEquals(false, result.getLogVariables()); assertEquals(false, result.getLogPostResponse()); assertEquals(8090, result.getAgentPort()); @@ -78,7 +80,7 @@ public void testAgentConfig_1() @Test public void testGetAgentDataFileStorageDir_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); String result = fixture.getAgentDataFileStorageDir(); @@ -96,7 +98,7 @@ public void testGetAgentDataFileStorageDir_1() @Test public void testGetAgentPort_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); int result = fixture.getAgentPort(); @@ -114,7 +116,7 @@ public void testGetAgentPort_1() @Test public void testGetConnectionTimeout_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); Long result = fixture.getConnectionTimeout(); @@ -139,7 +141,7 @@ public void testGetConnectionTimeout_1() @Test public void testGetDefaultResultProvider_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); String result = fixture.getDefaultResultProvider(); @@ -157,7 +159,7 @@ public void testGetDefaultResultProvider_1() @Test public void testGetLogPostRequest_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); boolean result = fixture.getLogPostRequest(); @@ -175,7 +177,7 @@ public void testGetLogPostRequest_1() @Test public void testGetLogPostRequest_2() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); boolean result = fixture.getLogPostRequest(); @@ -193,7 +195,7 @@ public void testGetLogPostRequest_2() @Test public void testGetLogPostResponse_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); boolean result = fixture.getLogPostResponse(); @@ -211,7 +213,7 @@ public void testGetLogPostResponse_1() @Test public void testGetLogPostResponse_2() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); boolean result = fixture.getLogPostResponse(); @@ -229,7 +231,7 @@ public void testGetLogPostResponse_2() @Test public void testGetLogVariables_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); boolean result = fixture.getLogVariables(); @@ -247,7 +249,7 @@ public void testGetLogVariables_1() @Test public void testGetLogVariables_2() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); boolean result = fixture.getLogVariables(); @@ -265,7 +267,7 @@ public void testGetLogVariables_2() @Test public void testGetMaxAgentResponseTime_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); long result = fixture.getMaxAgentResponseTime(); @@ -283,7 +285,7 @@ public void testGetMaxAgentResponseTime_1() @Test public void testGetMaxAgentWaitTime_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); long result = fixture.getMaxAgentWaitTime(); @@ -301,7 +303,7 @@ public void testGetMaxAgentWaitTime_1() @Test public void testGetMaxBodyReportSize_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); int result = fixture.getMaxBodyReportSize(); @@ -319,7 +321,7 @@ public void testGetMaxBodyReportSize_1() @Test public void testGetOverSimulationMaxTime_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); long result = fixture.getOverSimulationMaxTime(); @@ -337,7 +339,7 @@ public void testGetOverSimulationMaxTime_1() @Test public void testGetRange_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); String type = ""; @@ -358,7 +360,7 @@ public void testGetRange_1() @Test public void testGetResultsProviderClass_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); String providerKey = ""; @@ -377,7 +379,7 @@ public void testGetResultsProviderClass_1() @Test public void testGetResultsTypeMap_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); Map result = fixture.getResultsTypeMap(); @@ -396,7 +398,7 @@ public void testGetResultsTypeMap_1() @Test public void testGetSSLTimeout_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); long result = fixture.getSSLTimeout(); @@ -414,7 +416,7 @@ public void testGetSSLTimeout_1() @Test public void testGetStatusReportIntervalMilis_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); long pollTime = 1L; @@ -433,7 +435,7 @@ public void testGetStatusReportIntervalMilis_1() @Test public void testGetTPSPeriod_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); int result = fixture.getTPSPeriod(); @@ -451,7 +453,7 @@ public void testGetTPSPeriod_1() @Test public void testGetTextMimeTypeRegex_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); Collection result = fixture.getTextMimeTypeRegex(); @@ -470,7 +472,7 @@ public void testGetTextMimeTypeRegex_1() @Test public void testSetResultsTypeMap_1() throws Exception { - AgentConfig fixture = new AgentConfig(new HierarchicalConfiguration()); + AgentConfig fixture = new AgentConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); fixture.setResultsTypeMap(new HashMap()); Map resultsTypeMap = new HashMap(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfigCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfigCpTest.java index ddded9f15..faa8382b2 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfigCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfigCpTest.java @@ -15,13 +15,11 @@ import java.io.File; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.configuration.XMLConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; -import com.intuit.tank.vm.settings.BaseCommonsXmlConfig; -import com.intuit.tank.vm.settings.MailMessageConfig; - import static org.junit.jupiter.api.Assertions.*; /** @@ -42,40 +40,9 @@ public class BaseCommonsXmlConfigCpTest { public void testCheckReload_1() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); - - fixture.checkReload(); - - // An unexpected exception was thrown in user code while executing this test: - // java.lang.SecurityException: Cannot write to files while generating test cases - // at - // com.instantiations.assist.eclipse.junit.CodeProJUnitSecurityManager.checkWrite(CodeProJUnitSecurityManager.java:76) - // at java.io.FileOutputStream.(FileOutputStream.java:209) - // at java.io.FileOutputStream.(FileOutputStream.java:171) - // at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:490) - // at - // org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.save(AbstractHierarchicalFileConfiguration.java:204) - // at com.intuit.tank.settings.BaseCommonsXmlConfig.readConfig(BaseCommonsXmlConfig.java:63) - // at com.intuit.tank.settings.MailMessageConfig.(MailMessageConfig.java:71) - } - - /** - * Run the void checkReload() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/3/14 3:44 PM - */ - @Test - public void testCheckReload_2() - throws Exception { - MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); - fixture.configFile = new File(""); - - fixture.checkReload(); - + // An unexpected exception was thrown in user code while executing this test: // java.lang.SecurityException: Cannot write to files while generating test cases // at @@ -100,11 +67,9 @@ public void testCheckReload_2() public void testCheckReload_3() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = null; + fixture.XMLConfig = null; fixture.configFile = new File(""); - fixture.checkReload(); - // An unexpected exception was thrown in user code while executing this test: // java.lang.SecurityException: Cannot write to files while generating test cases // at @@ -146,17 +111,13 @@ public void testGetChildConfigurationAt_1() @Test public void testGetChildConfigurationAt_2() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); String key = ""; HierarchicalConfiguration result = BaseCommonsXmlConfig.getChildConfigurationAt(config, key); assertNotNull(result); assertEquals(true, result.isEmpty()); - assertEquals(false, result.isDelimiterParsingDisabled()); - assertEquals(',', result.getListDelimiter()); - assertEquals(false, result.isThrowExceptionOnMissing()); - assertEquals(false, result.isDetailEvents()); } /** @@ -169,17 +130,13 @@ public void testGetChildConfigurationAt_2() @Test public void testGetChildConfigurationAt_3() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); String key = ""; HierarchicalConfiguration result = BaseCommonsXmlConfig.getChildConfigurationAt(config, key); assertNotNull(result); assertEquals(true, result.isEmpty()); - assertEquals(false, result.isDelimiterParsingDisabled()); - assertEquals(',', result.getListDelimiter()); - assertEquals(false, result.isThrowExceptionOnMissing()); - assertEquals(false, result.isDetailEvents()); } /** @@ -192,17 +149,13 @@ public void testGetChildConfigurationAt_3() @Test public void testGetChildConfigurationAt_4() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); String key = ""; HierarchicalConfiguration result = BaseCommonsXmlConfig.getChildConfigurationAt(config, key); assertNotNull(result); - assertEquals(true, result.isEmpty()); - assertEquals(false, result.isDelimiterParsingDisabled()); - assertEquals(',', result.getListDelimiter()); - assertEquals(false, result.isThrowExceptionOnMissing()); - assertEquals(false, result.isDetailEvents()); + assertTrue(result.isEmpty()); } /** @@ -216,7 +169,7 @@ public void testGetChildConfigurationAt_4() public void testGetConfig_1() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); XMLConfiguration result = fixture.getConfig(); @@ -246,7 +199,7 @@ public void testGetConfig_1() public void testGetSourceConfigFile_1() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); File result = fixture.getSourceConfigFile(); @@ -265,96 +218,6 @@ public void testGetSourceConfigFile_1() assertNotNull(result); } - /** - * Run the boolean needsReload() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/3/14 3:44 PM - */ - @Test - public void testNeedsReload_1() - throws Exception { - MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = null; - fixture.configFile = new File(""); - - boolean result = fixture.needsReload(); - - // An unexpected exception was thrown in user code while executing this test: - // java.lang.SecurityException: Cannot write to files while generating test cases - // at - // com.instantiations.assist.eclipse.junit.CodeProJUnitSecurityManager.checkWrite(CodeProJUnitSecurityManager.java:76) - // at java.io.FileOutputStream.(FileOutputStream.java:209) - // at java.io.FileOutputStream.(FileOutputStream.java:171) - // at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:490) - // at - // org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.save(AbstractHierarchicalFileConfiguration.java:204) - // at com.intuit.tank.settings.BaseCommonsXmlConfig.readConfig(BaseCommonsXmlConfig.java:63) - // at com.intuit.tank.settings.MailMessageConfig.(MailMessageConfig.java:71) - assertTrue(result); - } - - /** - * Run the boolean needsReload() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/3/14 3:44 PM - */ - @Test - public void testNeedsReload_2() - throws Exception { - MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); - fixture.configFile = new File(""); - - boolean result = fixture.needsReload(); - - // An unexpected exception was thrown in user code while executing this test: - // java.lang.SecurityException: Cannot write to files while generating test cases - // at - // com.instantiations.assist.eclipse.junit.CodeProJUnitSecurityManager.checkWrite(CodeProJUnitSecurityManager.java:76) - // at java.io.FileOutputStream.(FileOutputStream.java:209) - // at java.io.FileOutputStream.(FileOutputStream.java:171) - // at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:490) - // at - // org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.save(AbstractHierarchicalFileConfiguration.java:204) - // at com.intuit.tank.settings.BaseCommonsXmlConfig.readConfig(BaseCommonsXmlConfig.java:63) - // at com.intuit.tank.settings.MailMessageConfig.(MailMessageConfig.java:71) - assertFalse(result); - } - - /** - * Run the boolean needsReload() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/3/14 3:44 PM - */ - @Test - public void testNeedsReload_3() - throws Exception { - MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); - fixture.configFile = new File(""); - - boolean result = fixture.needsReload(); - - // An unexpected exception was thrown in user code while executing this test: - // java.lang.SecurityException: Cannot write to files while generating test cases - // at - // com.instantiations.assist.eclipse.junit.CodeProJUnitSecurityManager.checkWrite(CodeProJUnitSecurityManager.java:76) - // at java.io.FileOutputStream.(FileOutputStream.java:209) - // at java.io.FileOutputStream.(FileOutputStream.java:171) - // at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:490) - // at - // org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.save(AbstractHierarchicalFileConfiguration.java:204) - // at com.intuit.tank.settings.BaseCommonsXmlConfig.readConfig(BaseCommonsXmlConfig.java:63) - // at com.intuit.tank.settings.MailMessageConfig.(MailMessageConfig.java:71) - assertFalse(result); - } - /** * Run the void readConfig() method test. * @@ -366,7 +229,7 @@ public void testNeedsReload_3() public void testReadConfig_1() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -395,7 +258,7 @@ public void testReadConfig_1() public void testReadConfig_2() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -424,7 +287,7 @@ public void testReadConfig_2() public void testReadConfig_3() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -453,7 +316,7 @@ public void testReadConfig_3() public void testReadConfig_4() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -482,7 +345,7 @@ public void testReadConfig_4() public void testReadConfig_5() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -511,7 +374,7 @@ public void testReadConfig_5() public void testReadConfig_6() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -540,7 +403,7 @@ public void testReadConfig_6() public void testReadConfig_7() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -569,7 +432,7 @@ public void testReadConfig_7() public void testReadConfig_8() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -598,7 +461,7 @@ public void testReadConfig_8() public void testReadConfig_9() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -627,7 +490,7 @@ public void testReadConfig_9() public void testReadConfig_10() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -656,7 +519,7 @@ public void testReadConfig_10() public void testReadConfig_11() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -685,7 +548,7 @@ public void testReadConfig_11() public void testReadConfig_12() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -714,7 +577,7 @@ public void testReadConfig_12() public void testReadConfig_13() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); @@ -743,7 +606,7 @@ public void testReadConfig_13() public void testReadConfig_14() throws Exception { MailMessageConfig fixture = new MailMessageConfig(); - fixture.config = new XMLConfiguration(); + fixture.XMLConfig = new XMLConfiguration(); fixture.configFile = new File(""); fixture.readConfig(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/CloudCredentialsCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/CloudCredentialsCpTest.java index 5e634a873..73483f504 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/CloudCredentialsCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/CloudCredentialsCpTest.java @@ -13,7 +13,9 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.*; @@ -34,7 +36,7 @@ public class CloudCredentialsCpTest { @Test public void testCloudCredentials_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); CloudCredentials result = new CloudCredentials(config); @@ -55,7 +57,7 @@ public void testCloudCredentials_1() @Test public void testGetKey_1() throws Exception { - CloudCredentials fixture = new CloudCredentials(new HierarchicalConfiguration()); + CloudCredentials fixture = new CloudCredentials(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getKey(); @@ -72,7 +74,7 @@ public void testGetKey_1() @Test public void testGetKeyId_1() throws Exception { - CloudCredentials fixture = new CloudCredentials(new HierarchicalConfiguration()); + CloudCredentials fixture = new CloudCredentials(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getKeyId(); @@ -89,7 +91,7 @@ public void testGetKeyId_1() @Test public void testGetProxyHost_1() throws Exception { - CloudCredentials fixture = new CloudCredentials(new HierarchicalConfiguration()); + CloudCredentials fixture = new CloudCredentials(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getProxyHost(); @@ -106,7 +108,7 @@ public void testGetProxyHost_1() @Test public void testGetProxyPort_1() throws Exception { - CloudCredentials fixture = new CloudCredentials(new HierarchicalConfiguration()); + CloudCredentials fixture = new CloudCredentials(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getProxyPort(); @@ -123,7 +125,7 @@ public void testGetProxyPort_1() @Test public void testGetType_1() throws Exception { - CloudCredentials fixture = new CloudCredentials(new HierarchicalConfiguration()); + CloudCredentials fixture = new CloudCredentials(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); CloudProvider result = fixture.getType(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/DefaultUserCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/DefaultUserCpTest.java index fdd519985..c8a4624b3 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/DefaultUserCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/DefaultUserCpTest.java @@ -15,11 +15,11 @@ import java.util.Set; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; -import com.intuit.tank.vm.settings.DefaultUser; - import static org.junit.jupiter.api.Assertions.*; /** @@ -38,7 +38,7 @@ public class DefaultUserCpTest { @Test public void testDefaultUser_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); DefaultUser result = new DefaultUser(config); @@ -60,7 +60,7 @@ public void testDefaultUser_1() @Test public void testDefaultUser_2() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); DefaultUser result = new DefaultUser(config); @@ -82,7 +82,7 @@ public void testDefaultUser_2() @Test public void testEquals_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); Object obj = new Object(); boolean result = fixture.equals(obj); @@ -100,8 +100,8 @@ public void testEquals_1() @Test public void testEquals_2() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); - Object obj = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); + Object obj = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.equals(obj); @@ -118,8 +118,8 @@ public void testEquals_2() @Test public void testEquals_3() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); - Object obj = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); + Object obj = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.equals(obj); @@ -136,7 +136,7 @@ public void testEquals_3() @Test public void testGetEmail_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getEmail(); @@ -153,7 +153,7 @@ public void testGetEmail_1() @Test public void testGetGroups_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); Set result = fixture.getGroups(); @@ -171,7 +171,7 @@ public void testGetGroups_1() @Test public void testGetName_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getName(); @@ -188,7 +188,7 @@ public void testGetName_1() @Test public void testGetPassword_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getPassword(); @@ -205,7 +205,7 @@ public void testGetPassword_1() @Test public void testHashCode_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); int result = fixture.hashCode(); @@ -222,7 +222,7 @@ public void testHashCode_1() @Test public void testIsAdmin_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.isAdmin(); @@ -239,7 +239,7 @@ public void testIsAdmin_1() @Test public void testIsAdmin_2() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.isAdmin(); @@ -256,7 +256,7 @@ public void testIsAdmin_2() @Test public void testToString_1() throws Exception { - DefaultUser fixture = new DefaultUser(new HierarchicalConfiguration()); + DefaultUser fixture = new DefaultUser(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.toString(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionCpTest.java index 056e48240..a9cabd0b8 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionCpTest.java @@ -13,7 +13,9 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.*; @@ -38,8 +40,8 @@ public class InstanceDescriptionCpTest { @Test public void testInstanceDescription_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); - HierarchicalConfiguration defaultInstance = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); + HierarchicalConfiguration defaultInstance = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); InstanceDescription result = new InstanceDescription(config, defaultInstance); @@ -63,8 +65,8 @@ public void testInstanceDescription_1() @Test public void testGetAmi_1() throws Exception { - InstanceDescription fixture = new InstanceDescription(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescription fixture = new InstanceDescription(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getAmi(); @@ -81,8 +83,8 @@ public void testGetAmi_1() @Test public void testGetPublicIp_1() throws Exception { - InstanceDescription fixture = new InstanceDescription(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescription fixture = new InstanceDescription(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getPublicIp(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaultsCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaultsCpTest.java index 44f90d4af..f41ed1fb8 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaultsCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/InstanceDescriptionDefaultsCpTest.java @@ -13,7 +13,9 @@ * #L% */ import java.util.*; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.*; @@ -35,8 +37,8 @@ public class InstanceDescriptionDefaultsCpTest { @Test public void testInstanceDescriptionDefaults_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); - HierarchicalConfiguration defaultInstance = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); + HierarchicalConfiguration defaultInstance = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); InstanceDescriptionDefaults result = new InstanceDescriptionDefaults(config, defaultInstance); @@ -58,7 +60,7 @@ public void testInstanceDescriptionDefaults_1() @Test public void testGet_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), (HierarchicalConfiguration) null); String key = ""; @@ -77,8 +79,8 @@ public void testGet_1() @Test public void testGet_2() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String key = ""; String result = fixture.get(key); @@ -96,8 +98,8 @@ public void testGet_2() @Test public void testGetKeypair_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getKeypair(); @@ -114,8 +116,8 @@ public void testGetKeypair_1() @Test public void testGetLocation_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getLocation(); @@ -132,8 +134,8 @@ public void testGetLocation_1() @Test public void testGetSecurityGroup_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getSecurityGroup(); @@ -151,8 +153,8 @@ public void testGetSecurityGroup_1() @Test public void testGetSubnetId_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); List result = fixture.getSubnetIds(); List expected = Arrays.asList(); @@ -163,8 +165,8 @@ public void testGetSubnetId_1() @Test public void testGetSecurityGroupIds_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); List result = fixture.getSecurityGroupIds(); List expected = Arrays.asList(); @@ -175,8 +177,8 @@ public void testGetSecurityGroupIds_1() @Test public void testGetIamRole_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getIamRole(); @@ -186,8 +188,8 @@ public void testGetIamRole_1() @Test public void testIsVPC_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); Boolean result = fixture.isVPC(); @@ -197,8 +199,8 @@ public void testIsVPC_1() @Test public void testGetTenancy_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getTenancy(); @@ -215,8 +217,8 @@ public void testGetTenancy_1() @Test public void testGetZone_1() throws Exception { - InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + InstanceDescriptionDefaults fixture = new InstanceDescriptionDefaults(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getZone(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/LocationsConfigCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/LocationsConfigCpTest.java index 0fbd4fb33..fce388beb 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/LocationsConfigCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/LocationsConfigCpTest.java @@ -15,7 +15,9 @@ import java.util.List; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; import com.intuit.tank.vm.settings.LocationsConfig; @@ -39,7 +41,7 @@ public class LocationsConfigCpTest { @Test public void testLocationsConfig_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); LocationsConfig result = new LocationsConfig(config); @@ -56,7 +58,7 @@ public void testLocationsConfig_1() @Test public void testGetLocations_1() throws Exception { - LocationsConfig fixture = new LocationsConfig(new HierarchicalConfiguration()); + LocationsConfig fixture = new LocationsConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); List result = fixture.getLocations(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/LogicStepConfigCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/LogicStepConfigCpTest.java index 9c266976f..66a295af6 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/LogicStepConfigCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/LogicStepConfigCpTest.java @@ -13,11 +13,11 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; -import com.intuit.tank.vm.settings.LogicStepConfig; - import static org.junit.jupiter.api.Assertions.*; /** @@ -36,7 +36,7 @@ public class LogicStepConfigCpTest { @Test public void testLogicStepConfig_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); LogicStepConfig result = new LogicStepConfig(config); @@ -55,7 +55,7 @@ public void testLogicStepConfig_1() @Test public void testGetAppendAfter_1() throws Exception { - LogicStepConfig fixture = new LogicStepConfig(new HierarchicalConfiguration()); + LogicStepConfig fixture = new LogicStepConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getAppendAfter(); @@ -72,7 +72,7 @@ public void testGetAppendAfter_1() @Test public void testGetInsertBefore_1() throws Exception { - LogicStepConfig fixture = new LogicStepConfig(new HierarchicalConfiguration()); + LogicStepConfig fixture = new LogicStepConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getInsertBefore(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/MailConfigCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/MailConfigCpTest.java index 49fd678d4..0966aad10 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/MailConfigCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/MailConfigCpTest.java @@ -13,11 +13,11 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; -import com.intuit.tank.vm.settings.MailConfig; - import static org.junit.jupiter.api.Assertions.*; /** @@ -36,7 +36,7 @@ public class MailConfigCpTest { @Test public void testMailConfig_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); MailConfig result = new MailConfig(config); @@ -58,7 +58,7 @@ public void testMailConfig_1() @Test public void testGetMailFrom_1() throws Exception { - MailConfig fixture = new MailConfig(new HierarchicalConfiguration()); + MailConfig fixture = new MailConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getMailFrom(); @@ -75,7 +75,7 @@ public void testGetMailFrom_1() @Test public void testGetSmtpHost_1() throws Exception { - MailConfig fixture = new MailConfig(new HierarchicalConfiguration()); + MailConfig fixture = new MailConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getSmtpHost(); @@ -92,7 +92,7 @@ public void testGetSmtpHost_1() @Test public void testGetSmtpPort_1() throws Exception { - MailConfig fixture = new MailConfig(new HierarchicalConfiguration()); + MailConfig fixture = new MailConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getSmtpPort(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/OidcSsoConfigTest.java b/api/src/test/java/com/intuit/tank/vm/settings/OidcSsoConfigTest.java index 19c0f8a31..eb4e77cb3 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/OidcSsoConfigTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/OidcSsoConfigTest.java @@ -1,6 +1,9 @@ package com.intuit.tank.vm.settings; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; +import org.apache.commons.configuration2.ex.ConfigurationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -8,9 +11,12 @@ public class OidcSsoConfigTest { - private final HierarchicalConfiguration config = new HierarchicalConfiguration(); + private final HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); private OidcSsoConfig oidc = null; + public OidcSsoConfigTest() throws ConfigurationException { + } + @BeforeEach public void init() { oidc = new OidcSsoConfig(config); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/ReportingConfigTest.java b/api/src/test/java/com/intuit/tank/vm/settings/ReportingConfigTest.java index e02af70d4..57c6d8087 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/ReportingConfigTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/ReportingConfigTest.java @@ -1,6 +1,9 @@ package com.intuit.tank.vm.settings; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; +import org.apache.commons.configuration2.ex.ConfigurationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -13,9 +16,12 @@ * @author : atayal **/ public class ReportingConfigTest { - private final HierarchicalConfiguration config = new HierarchicalConfiguration(); + private final HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); private ReportingConfig reportingConfig = null; + public ReportingConfigTest() throws ConfigurationException { + } + @BeforeEach public void init() { reportingConfig = new ReportingConfig(config); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/ReportingInstanceCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/ReportingInstanceCpTest.java index 69d16ca7a..6351cddd2 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/ReportingInstanceCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/ReportingInstanceCpTest.java @@ -13,7 +13,9 @@ * #L% */ -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.*; @@ -37,8 +39,8 @@ public class ReportingInstanceCpTest { @Test public void testReportingInstance_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); - HierarchicalConfiguration defaultInstance = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); + HierarchicalConfiguration defaultInstance = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); ReportingInstance result = new ReportingInstance(config, defaultInstance); @@ -65,8 +67,8 @@ public void testReportingInstance_1() @Test public void testGetRegion_1() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); VMRegion result = fixture.getRegion(); @@ -87,8 +89,8 @@ public void testGetRegion_1() @Test public void testGetRegion_2() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); VMRegion result = fixture.getRegion(); @@ -109,8 +111,8 @@ public void testGetRegion_2() @Test public void testGetReportingMode_1() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getReportingMode(); @@ -127,8 +129,8 @@ public void testGetReportingMode_1() @Test public void testGetReportingMode_2() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getReportingMode(); @@ -145,8 +147,8 @@ public void testGetReportingMode_2() @Test public void testGetReuseInstances_1() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.getReuseInstances(); @@ -163,8 +165,8 @@ public void testGetReuseInstances_1() @Test public void testGetReuseInstances_2() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.getReuseInstances(); @@ -181,8 +183,8 @@ public void testGetReuseInstances_2() @Test public void testGetZone_1() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.getZone(); @@ -199,8 +201,8 @@ public void testGetZone_1() @Test public void testIsRegionDependent_1() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.isRegionDependent(); @@ -217,8 +219,8 @@ public void testIsRegionDependent_1() @Test public void testIsRegionDependent_2() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); boolean result = fixture.isRegionDependent(); @@ -235,8 +237,8 @@ public void testIsRegionDependent_2() @Test public void testToString_1() throws Exception { - ReportingInstance fixture = new ReportingInstance(new HierarchicalConfiguration(), - new HierarchicalConfiguration()); + ReportingInstance fixture = new ReportingInstance(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(), + new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String result = fixture.toString(); diff --git a/api/src/test/java/com/intuit/tank/vm/settings/SecurityConfigCpTest.java b/api/src/test/java/com/intuit/tank/vm/settings/SecurityConfigCpTest.java index 5d8693c45..664078747 100644 --- a/api/src/test/java/com/intuit/tank/vm/settings/SecurityConfigCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/settings/SecurityConfigCpTest.java @@ -17,7 +17,9 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.BasicConfigurationBuilder; import org.junit.jupiter.api.*; import com.intuit.tank.vm.settings.DefaultUser; @@ -41,7 +43,7 @@ public class SecurityConfigCpTest { @Test public void testSecurityConfig_1() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -58,7 +60,7 @@ public void testSecurityConfig_1() @Test public void testSecurityConfig_2() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -75,7 +77,7 @@ public void testSecurityConfig_2() @Test public void testSecurityConfig_3() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -92,7 +94,7 @@ public void testSecurityConfig_3() @Test public void testSecurityConfig_4() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -109,7 +111,7 @@ public void testSecurityConfig_4() @Test public void testSecurityConfig_5() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -126,7 +128,7 @@ public void testSecurityConfig_5() @Test public void testSecurityConfig_6() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -143,7 +145,7 @@ public void testSecurityConfig_6() @Test public void testSecurityConfig_7() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -160,7 +162,7 @@ public void testSecurityConfig_7() @Test public void testSecurityConfig_8() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -177,7 +179,7 @@ public void testSecurityConfig_8() @Test public void testSecurityConfig_9() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -194,7 +196,7 @@ public void testSecurityConfig_9() @Test public void testSecurityConfig_10() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -211,7 +213,7 @@ public void testSecurityConfig_10() @Test public void testSecurityConfig_11() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -228,7 +230,7 @@ public void testSecurityConfig_11() @Test public void testSecurityConfig_12() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -245,7 +247,7 @@ public void testSecurityConfig_12() @Test public void testSecurityConfig_13() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -262,7 +264,7 @@ public void testSecurityConfig_13() @Test public void testSecurityConfig_14() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -279,7 +281,7 @@ public void testSecurityConfig_14() @Test public void testSecurityConfig_15() throws Exception { - HierarchicalConfiguration config = new HierarchicalConfiguration(); + HierarchicalConfiguration config = new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration(); SecurityConfig result = new SecurityConfig(config); @@ -313,7 +315,7 @@ public void testSecurityConfig_16() @Test public void testGetDefaultGroups_1() throws Exception { - SecurityConfig fixture = new SecurityConfig(new HierarchicalConfiguration()); + SecurityConfig fixture = new SecurityConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); Set result = fixture.getDefaultGroups(); @@ -331,7 +333,7 @@ public void testGetDefaultGroups_1() @Test public void testGetDefaultUsers_1() throws Exception { - SecurityConfig fixture = new SecurityConfig(new HierarchicalConfiguration()); + SecurityConfig fixture = new SecurityConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); Set result = fixture.getDefaultUsers(); @@ -349,7 +351,7 @@ public void testGetDefaultUsers_1() @Test public void testGetGroups_1() throws Exception { - SecurityConfig fixture = new SecurityConfig(new HierarchicalConfiguration()); + SecurityConfig fixture = new SecurityConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); Set result = fixture.getGroups(); @@ -367,7 +369,7 @@ public void testGetGroups_1() @Test public void testGetRestrictionMap_1() throws Exception { - SecurityConfig fixture = new SecurityConfig(new HierarchicalConfiguration()); + SecurityConfig fixture = new SecurityConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); Map> result = fixture.getRestrictionMap(); @@ -385,7 +387,7 @@ public void testGetRestrictionMap_1() @Test public void testIsDefaultGroup_1() throws Exception { - SecurityConfig fixture = new SecurityConfig(new HierarchicalConfiguration()); + SecurityConfig fixture = new SecurityConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String groupName = ""; boolean result = fixture.isDefaultGroup(groupName); @@ -403,7 +405,7 @@ public void testIsDefaultGroup_1() @Test public void testIsDefaultGroup_2() throws Exception { - SecurityConfig fixture = new SecurityConfig(new HierarchicalConfiguration()); + SecurityConfig fixture = new SecurityConfig(new BasicConfigurationBuilder<>(XMLConfiguration.class).getConfiguration()); String groupName = ""; boolean result = fixture.isDefaultGroup(groupName); diff --git a/api/src/test/resources/settings.xml b/api/src/test/resources/settings.xml index fdcba513c..3be8cb4ac 100644 --- a/api/src/test/resources/settings.xml +++ b/api/src/test/resources/settings.xml @@ -47,7 +47,7 @@ - + @@ -401,7 +401,7 @@ function toJsonObj(text) { function toJsonString(jsonObj) { try { - return JSON.stringify(jsonObj\, null\, '\t'); + return JSON.stringify(jsonObj, null, '\t'); } catch(e) { error("Error converting json to string json: " + e); } @@ -472,8 +472,8 @@ function getVariable(key) { * @param value * the value to set it to */ -function setVariable(key\, value) { - ioBean.getInput("variables").addVariable(key\, value); +function setVariable(key, value) { + ioBean.getInput("variables").addVariable(key, value); } //######## Result functions ########## @@ -482,7 +482,7 @@ function setVariable(key\, value) { * jump to a group within the script with the specified name. * * @param groupName - * the name of the group to go to. if the group does not exist\, it + * the name of the group to go to. if the group does not exist, it * skips to next script. */ function gotoGroup(groupName) { @@ -531,7 +531,7 @@ function terminateUser() { * sets the action in the output. */ function setAction(action) { - ioBean.setOutput("action"\, action); + ioBean.setOutput("action", action); } ]]> diff --git a/pom.xml b/pom.xml index 79e561320..001468618 100644 --- a/pom.xml +++ b/pom.xml @@ -481,10 +481,16 @@
- commons-configuration - commons-configuration - 1.10 - + org.apache.commons + commons-configuration2 + 2.10.1 + + + + commons-beanutils + commons-beanutils + 1.9.4 + org.apache.commons @@ -498,12 +504,6 @@ 1.5.0 - - commons-collections - commons-collections - 3.2.2 - - commons-httpclient commons-httpclient diff --git a/proxy-parent/proxy-extension/src/main/java/com/intuit/tank/proxy/config/CommonsProxyConfiguration.java b/proxy-parent/proxy-extension/src/main/java/com/intuit/tank/proxy/config/CommonsProxyConfiguration.java index b848955ae..3bfddec35 100644 --- a/proxy-parent/proxy-extension/src/main/java/com/intuit/tank/proxy/config/CommonsProxyConfiguration.java +++ b/proxy-parent/proxy-extension/src/main/java/com/intuit/tank/proxy/config/CommonsProxyConfiguration.java @@ -17,19 +17,19 @@ */ import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.net.URL; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.configuration.SubnodeConfiguration; -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; -import org.apache.commons.configuration.tree.ConfigurationNode; -import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; +import org.apache.commons.configuration2.HierarchicalConfiguration; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder; +import org.apache.commons.configuration2.builder.fluent.Parameters; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.commons.configuration2.tree.ImmutableNode; +import org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -47,8 +47,7 @@ public class CommonsProxyConfiguration implements ProxyConfiguration { public static final String SUGGESTED_CONFIG_NAME = "recording-proxy-config.xml"; private String configPath = "recording-proxy-config.xml"; - private XMLConfiguration config; - private FileChangedReloadingStrategy reloadingStrategy; + private XMLConfiguration XMLConfig; private Set exclusions = new HashSet(); private Set inclusions = new HashSet(); @@ -76,7 +75,7 @@ public CommonsProxyConfiguration() { * {@inheritDoc} */ public int getPort() { - return config.getInt("proxy-port", 8888); + return XMLConfig.getInt("proxy-port", 8888); } /** @@ -84,14 +83,14 @@ public int getPort() { */ @Override public boolean isFollowRedirects() { - return config.getBoolean("follow-redirects", true); + return XMLConfig.getBoolean("follow-redirects", true); } /** * {@inheritDoc} */ public String getOutputFile() { - return config.getString("output-file", new File("recordedOutput.xml").getAbsolutePath()); + return XMLConfig.getString("output-file", new File("recordedOutput.xml").getAbsolutePath()); } /** @@ -99,16 +98,13 @@ public String getOutputFile() { */ @Override public String getCertificateAuthorityPath() { - return config.getString("certificate-authority-path", new File("auto_generated_ca.p12").getAbsolutePath()); + return XMLConfig.getString("certificate-authority-path", new File("auto_generated_ca.p12").getAbsolutePath()); } /** * {@inheritDoc} */ public Set getExclusions() { - if (needsReload()) { - readConfig(); - } return exclusions; } @@ -116,9 +112,6 @@ public Set getExclusions() { * {@inheritDoc} */ public Set getInclusions() { - if (needsReload()) { - readConfig(); - } return inclusions; } @@ -126,9 +119,6 @@ public Set getInclusions() { * {@inheritDoc} */ public Set getBodyInclusions() { - if (needsReload()) { - readConfig(); - } return bodyInclusions; } @@ -136,36 +126,29 @@ public Set getBodyInclusions() { * {@inheritDoc} */ public Set getBodyExclusions() { - if (needsReload()) { - readConfig(); - } return bodyExclusions; } /** * Constructor pulls file out of the jar or reads from disk and sets up refresh policy. - * - * @param expressionEngine - * the expression engine to use. Null results in default expression engine + * */ private void readConfig() { try { XPathExpressionEngine expressionEngine = new XPathExpressionEngine(); - if (reloadingStrategy == null) { - reloadingStrategy = new FileChangedReloadingStrategy(); - reloadingStrategy.setRefreshDelay(0); - } File configFile = new File(configPath); System.out.println(configFile.getAbsolutePath()); if (configFile.exists() && configFile.isFile()) { try { - config = new XMLConfiguration(configFile); + XMLConfig = new ReloadingFileBasedConfigurationBuilder<>(XMLConfiguration.class) + .configure(new Parameters().xml().setFile(configFile).setExpressionEngine(expressionEngine)) + .getConfiguration(); } catch (Exception e) { LOG.error("Error parsing configFile " + configFile.getAbsolutePath() + ": " + e, e); } } - if (config == null) { + if (XMLConfig == null) { // Load a default from the classpath: LOG.info("Reading default configuration " + DEFAULT_CONFIG + " from classpath..."); // Note: we don't let new XMLConfiguration() lookup the resource @@ -175,32 +158,18 @@ private void readConfig() { if (configResourceUrl == null) { throw new RuntimeException("unable to load resource: " + configPath); } - - config = new XMLConfiguration(configResourceUrl); - // // Copy over a default configuration since none exists: - // // Ensure data dir location exists: - // configFile = new File(DEFAULT_CONFIG); - // // if (!configFile.getParentFile().exists() && !configFile.getParentFile().mkdirs()) { - // // throw new RuntimeException("could not create directories."); - // // } - // LOG.info("Saving default configuration to file " + configFile.getAbsolutePath()); - // config.save(configFile); - } - - if (expressionEngine != null) { - config.setExpressionEngine(expressionEngine); + XMLConfig = new ReloadingFileBasedConfigurationBuilder<>(XMLConfiguration.class) + .configure(new Parameters().xml().setURL(configResourceUrl).setExpressionEngine(expressionEngine)) + .getConfiguration(); } - - // reload at most once per thirty seconds on configuration queries. - config.setReloadingStrategy(reloadingStrategy); initConfig(); } catch (ConfigurationException e) { throw new RuntimeException(e); } } - public void saveConfig(File configFile) throws ConfigurationException { - config.save(configFile); + public void saveConfig(File configFile) throws ConfigurationException, IOException { + XMLConfig.write(new FileWriter(configFile)); } /** @@ -214,18 +183,18 @@ private void initConfig() { } /** - * @param string + * @param key * @return */ private Set parseInclusionExclusions(String key) { - Set ret = new HashSet(); - SubnodeConfiguration groupConfig = config.configurationAt(key); + HierarchicalConfiguration groupConfig = XMLConfig.configurationAt(key); if (groupConfig != null) { - @SuppressWarnings("unchecked") List list = groupConfig.configurationsAt("rule"); - ret = list.stream().map(c -> new ConfigInclusionExclusionRule(getTransactionPart(c), c.getString("@header", "all"), - getMatchType(c), c.getString(""))).collect(Collectors.toSet()); + List> list = groupConfig.configurationsAt("rule"); + return list.stream() + .map(c -> new ConfigInclusionExclusionRule(getTransactionPart(c), c.getString("@header", "all"), + getMatchType(c), c.getString(""))).collect(Collectors.toSet()); } - return ret; + return Set.of(); } /** @@ -262,13 +231,6 @@ private TransactionPart getTransactionPart(HierarchicalConfiguration c) { return ret; } - /** - * checks if the config needs to be reloaded. - */ - public boolean needsReload() { - return (config == null || config.getReloadingStrategy().reloadingRequired()); - } - public static boolean save(int port, boolean followRedirect, String outputFile, Set inclusions, Set exclusions, @@ -276,14 +238,14 @@ public static boolean save(int port, boolean followRedirect, String outputFile, Set bodyExclusions, String fileName) { - ConfigurationNode node = getConfNode("recording-proxy-config", "", false); - ConfigurationNode portNode = getConfNode("proxy-port", String.valueOf(port), false); - ConfigurationNode followRedirectNode = getConfNode("follow-redirects", Boolean.toString(followRedirect), false); - ConfigurationNode outputFileNode = getConfNode("output-file", outputFile, false); - ConfigurationNode inclusionsNode = getConfNode("inclusions", "", false); - ConfigurationNode exclusionsNode = getConfNode("exclusions", "", false); - ConfigurationNode bodyInclusionsNode = getConfNode("body-inclusions", "", false); - ConfigurationNode bodyExclusionsNode = getConfNode("body-exclusions", "", false); + ImmutableNode node = getConfNode("recording-proxy-config", "", false); + ImmutableNode portNode = getConfNode("proxy-port", String.valueOf(port), false); + ImmutableNode followRedirectNode = getConfNode("follow-redirects", Boolean.toString(followRedirect), false); + ImmutableNode outputFileNode = getConfNode("output-file", outputFile, false); + ImmutableNode inclusionsNode = getConfNode("inclusions", "", false); + ImmutableNode exclusionsNode = getConfNode("exclusions", "", false); + ImmutableNode bodyInclusionsNode = getConfNode("body-inclusions", "", false); + ImmutableNode bodyExclusionsNode = getConfNode("body-exclusions", "", false); updateRuleParentNode(inclusions, inclusionsNode); updateRuleParentNode(exclusions, exclusionsNode); @@ -298,41 +260,36 @@ public static boolean save(int port, boolean followRedirect, String outputFile, node.addChild(bodyInclusionsNode); node.addChild(bodyExclusionsNode); - HierarchicalConfiguration hc = new HierarchicalConfiguration(); - hc.setRootNode(node); - XMLConfiguration xmlConfiguration = new XMLConfiguration(hc); - xmlConfiguration.setRootNode(node); + XMLConfiguration xmlConfiguration = new XMLConfiguration(); + xmlConfiguration.addNodes("root", Collections.singleton(node)); try { - xmlConfiguration.save(new File(fileName)); - } catch (ConfigurationException e) { + xmlConfiguration.write(new FileWriter(fileName)); + } catch (ConfigurationException | IOException e) { e.printStackTrace(); } return true; } - public static void updateRuleParentNode(Set rule, ConfigurationNode parentNode) { + public static void updateRuleParentNode(Set rule, ImmutableNode parentNode) { for (ConfigInclusionExclusionRule configInclusionExclusionRule : rule) { - ConfigurationNode ruleNode = getConfNode("rule", configInclusionExclusionRule.getValue(), false); - ConfigurationNode checkNode = getConfNode("check", configInclusionExclusionRule.getTransactionPart() - .toString(), true); - ConfigurationNode matchNode = getConfNode("match", configInclusionExclusionRule.getMatch().toString(), true); - ConfigurationNode headerNode = getConfNode("header", configInclusionExclusionRule.getHeader(), true); + ImmutableNode ruleNode = getConfNode("rule", configInclusionExclusionRule.getValue(), false); + ImmutableNode checkNode = getConfNode("check", configInclusionExclusionRule.getTransactionPart().toString(), true); + ImmutableNode matchNode = getConfNode("match", configInclusionExclusionRule.getMatch().toString(), true); + ImmutableNode headerNode = getConfNode("header", configInclusionExclusionRule.getHeader(), true); - ruleNode.addAttribute(checkNode); - ruleNode.addAttribute(matchNode); - ruleNode.addAttribute(headerNode); + ruleNode.addChild(checkNode); + ruleNode.addChild(matchNode); + ruleNode.addChild(headerNode); parentNode.addChild(ruleNode); } } - public static ConfigurationNode getConfNode(String name, String value, boolean attributeFlag) { - ConfigurationNode confNode = new HierarchicalConfiguration.Node(name, value); - confNode.setAttribute(attributeFlag); - return confNode; + private static ImmutableNode getConfNode(String name, String value, boolean attributeFlag) { + return new ImmutableNode.Builder().addAttribute(name, value).create(); } } diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReader.java b/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReader.java index 9390aaec1..4d15005cd 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReader.java +++ b/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReader.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Map; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import com.intuit.tank.results.TankResult; diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReporter.java b/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReporter.java index 66fb13361..8da41e285 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReporter.java +++ b/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReporter.java @@ -5,7 +5,7 @@ import java.util.List; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import com.intuit.tank.results.TankResult; diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReader.java b/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReader.java index f1c26b866..39dda79e5 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReader.java +++ b/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReader.java @@ -6,7 +6,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import com.intuit.tank.results.TankResult; diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReporter.java b/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReporter.java index aa8465a96..9aad5c4cc 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReporter.java +++ b/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReporter.java @@ -2,7 +2,7 @@ import java.util.List; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import com.intuit.tank.results.TankResult; diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/factory/ReportingFactory.java b/reporting/api/src/main/java/com/intuit/tank/reporting/factory/ReportingFactory.java index 00e764962..6bc225291 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/factory/ReportingFactory.java +++ b/reporting/api/src/main/java/com/intuit/tank/reporting/factory/ReportingFactory.java @@ -1,6 +1,6 @@ package com.intuit.tank.reporting.factory; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/reporting/db/settings.xml b/reporting/db/settings.xml index 6faae5a66..4175dd51f 100644 --- a/reporting/db/settings.xml +++ b/reporting/db/settings.xml @@ -29,7 +29,7 @@ - + @@ -334,7 +334,7 @@ function toJsonObj(text) { function toJsonString(jsonObj) { try { - return JSON.stringify(jsonObj\, null\, '\t'); + return JSON.stringify(jsonObj, null, '\t'); } catch(e) { error("Error converting json to string json: " + e); } @@ -405,8 +405,8 @@ function getVariable(key) { * @param value * the value to set it to */ -function setVariable(key\, value) { - ioBean.getInput("variables").addVariable(key\, value); +function setVariable(key, value) { + ioBean.getInput("variables").addVariable(key, value); } //######## Result functions ########## @@ -415,7 +415,7 @@ function setVariable(key\, value) { * jump to a group within the script with the specified name. * * @param groupName - * the name of the group to go to. if the group does not exist\, it + * the name of the group to go to. if the group does not exist, it * skips to next script. */ function gotoGroup(groupName) { @@ -464,7 +464,7 @@ function terminateUser() { * sets the action in the output. */ function setAction(action) { - ioBean.setOutput("action"\, action); + ioBean.setOutput("action", action); } ]]> diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java index 98473dbd0..207f7b955 100644 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java +++ b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java @@ -29,7 +29,7 @@ import jakarta.annotation.Nonnull; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.http.HttpStatus; diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java index 676edd003..f25072933 100644 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java +++ b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Set; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.logging.log4j.LogManager; diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java index f05bf05fa..2d7c23361 100644 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java +++ b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java @@ -12,7 +12,7 @@ import com.intuit.tank.vm.settings.CloudCredentials; import com.intuit.tank.vm.settings.CloudProvider; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java index 8ae6d7cc0..fcd68093e 100644 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java +++ b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Set; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.logging.log4j.LogManager; diff --git a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java b/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java index 40613c660..a8cd91225 100644 --- a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java +++ b/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java @@ -11,7 +11,7 @@ import java.util.Map; import java.util.stream.Collectors; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java b/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java index ccdfc90f8..a8fcd1941 100644 --- a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java +++ b/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java @@ -12,7 +12,7 @@ import java.util.stream.Collectors; import com.google.common.collect.ImmutableMap; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java b/reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java index 2e28c938a..9e479bd0e 100644 --- a/reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java +++ b/reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Map; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import com.intuit.tank.reporting.api.PagedTimingResults; import com.intuit.tank.reporting.api.ResultsReader; diff --git a/reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java b/reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java index 9862c7374..aba11b986 100644 --- a/reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java +++ b/reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java @@ -10,7 +10,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/web/web_support/src/main/java/com/intuit/tank/TankSettings.java b/web/web_support/src/main/java/com/intuit/tank/TankSettings.java index 12b77bcdc..c51752590 100644 --- a/web/web_support/src/main/java/com/intuit/tank/TankSettings.java +++ b/web/web_support/src/main/java/com/intuit/tank/TankSettings.java @@ -63,9 +63,6 @@ public boolean isStandalone() { */ public boolean hasRegionConfigured(String region) { boolean ret = false; - if (config.needsReload()) { - init(); - } try { ret = regions.stream().anyMatch(r -> r.name().equalsIgnoreCase(region)); } catch (Exception e) { @@ -79,9 +76,6 @@ public boolean hasRegionConfigured(String region) { * @return */ public List getVmRegions() { - if (config.needsReload()) { - init(); - } return regions; } diff --git a/web/web_support/src/main/java/com/intuit/tank/util/ExceptionHandler.java b/web/web_support/src/main/java/com/intuit/tank/util/ExceptionHandler.java index a4db4e7bc..e674c0360 100644 --- a/web/web_support/src/main/java/com/intuit/tank/util/ExceptionHandler.java +++ b/web/web_support/src/main/java/com/intuit/tank/util/ExceptionHandler.java @@ -25,8 +25,7 @@ import jakarta.validation.ConstraintViolationException; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang.WordUtils; -import com.intuit.tank.util.Messages; +import org.apache.commons.text.WordUtils; /** * RestExceptionHandler diff --git a/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankOidcAuthorizationTest.java b/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankOidcAuthorizationTest.java index 08573da31..ab65e8b7c 100644 --- a/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankOidcAuthorizationTest.java +++ b/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankOidcAuthorizationTest.java @@ -5,7 +5,7 @@ import com.intuit.tank.http.WebHttpClient; import com.intuit.tank.vm.settings.OidcSsoConfig; import com.intuit.tank.vm.settings.TankConfig; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankSsoHandlerTest.java b/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankSsoHandlerTest.java index cbf2259b5..8b2d32487 100644 --- a/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankSsoHandlerTest.java +++ b/web/web_support/src/test/java/com/intuit/tank/auth/sso/TankSsoHandlerTest.java @@ -8,7 +8,7 @@ import com.intuit.tank.project.User; import com.intuit.tank.vm.settings.OidcSsoConfig; import com.intuit.tank.vm.settings.TankConfig; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/web/web_support/src/test/java/com/intuit/tank/config/LoginFilterTest.java b/web/web_support/src/test/java/com/intuit/tank/config/LoginFilterTest.java index 5d9fecbfe..7b2ddc6cf 100644 --- a/web/web_support/src/test/java/com/intuit/tank/config/LoginFilterTest.java +++ b/web/web_support/src/test/java/com/intuit/tank/config/LoginFilterTest.java @@ -4,7 +4,7 @@ import com.intuit.tank.auth.sso.TankSsoHandler; import com.intuit.tank.vm.settings.OidcSsoConfig; import com.intuit.tank.vm.settings.TankConfig; -import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration2.HierarchicalConfiguration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test;