Skip to content

Commit

Permalink
Merge pull request #1286 from ashitsalesforce/master
Browse files Browse the repository at this point in the history
command options based proxy username/password in tests
  • Loading branch information
ashitsalesforce authored Sep 27, 2024
2 parents 13c882e + d9ea87d commit 12fab35
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
13 changes: 11 additions & 2 deletions runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ do
debug="-Dmaven.surefire.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0.0.0.0:5005"
;;
D)
debugEncryption="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=0.0.0.0:5005,suspend=y"
debugEncryption="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=0.0.0.0:5005,suspend=y"
;;
t)
test="-Dskip-unit-tests=true -Dtest=com.salesforce.dataloader.${OPTARG}"
Expand Down Expand Up @@ -74,9 +74,18 @@ jarname="$(find ./target -name 'dataloader-[0-9][0-9].[0-9].[0-9].jar' | tail -1
#echo "password = ${4}"
encryptedPassword="$(java ${debugEncryption} -cp ${jarname} com.salesforce.dataloader.process.DataLoaderRunner run.mode=encrypt -e ${4} ${encryptionFile} | tail -1)"

additionalOptions=""
for option in $@
do
if [[ ${option} == -D* ]]; then
additionalOptions+=" "
additionalOptions+=${option}
fi
done

# uncomment the following lines to debug issues with password encryption
#echo "encryptedPassword = ${encryptedPassword}"
#decryptedPassword="$(java ${debugEncryption} -cp ${jarname} com.salesforce.dataloader.process.DataLoaderRunner run.mode=encrypt -d ${encryptedPassword} ${encryptionFile} | tail -1)"
#echo "decryptedPassword = ${decryptedPassword}"

mvn ${failfast} -Dtest.endpoint=${1} -Dtest.user.default=${2} -Dtest.user.restricted=${3} -Dtest.password=${encryptedPassword} -Dtest.encryptionFile=${encryptionFile} verify ${debug} ${test}
mvn ${failfast} -Dtest.endpoint=${1} -Dtest.user.default=${2} -Dtest.user.restricted=${3} -Dtest.password=${encryptedPassword} -Dtest.encryptionFile=${encryptionFile} verify ${debug} ${test} ${additionalOptions}
28 changes: 0 additions & 28 deletions src/openjdk.txt

This file was deleted.

6 changes: 6 additions & 0 deletions src/test/java/com/salesforce/dataloader/ConfigTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ protected Map<String, String> getTestConfig() {
prop.putConfigSetting(configBase);
}
configBase.put(AppUtil.CLI_OPTION_CONFIG_DIR_PROP, TEST_CONF_DIR);
String proxyUsername = System.getProperty(Config.PROXY_USERNAME);
String proxyPassword = System.getProperty(Config.PROXY_PASSWORD);
if (proxyUsername != null && proxyPassword != null) {
configBase.put(Config.PROXY_USERNAME, proxyUsername);
configBase.put(Config.PROXY_PASSWORD, proxyPassword);
}
return configBase;
}

Expand Down

0 comments on commit 12fab35

Please sign in to comment.