[rest-gradle-plugin] 27/83: Merge branch 'supportProxy' of github.com:SirBif/rest-gradle-plugin
Alastair McKinstry
mckinstry at moszumanska.debian.org
Wed Oct 25 15:59:04 UTC 2017
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository rest-gradle-plugin.
commit 4138c05032920bffc54b5cdd36d62cd7d80d183a
Author: noamt <noam at 10ne.org>
Date: Sun Aug 10 10:36:42 2014 +0300
Merge branch 'supportProxy' of github.com:SirBif/rest-gradle-plugin
---
src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy | 8 ++++----
src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy | 11 ++++++++---
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
index adb98bd..c519ef8 100644
--- a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
+++ b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
@@ -56,10 +56,10 @@ class RestTask extends DefaultTask {
}
void configureProxy(String protocol) {
- String proxyHost = System.getProperty(protocol.toLowerCase() + ".proxyHost", "")
- int proxyPort = System.getProperty(protocol.toLowerCase() + ".proxyPort", "0") as int
- if (proxyHost.length() > 0 && proxyPort > 0) {
- println "Using " + protocol.toUpperCase() + " proxy: " + proxyHost + ":" + proxyPort
+ String proxyHost = System.getProperty("${protocol}.proxyHost", '')
+ int proxyPort = System.getProperty("${protocol}.proxyPort", '0') as int
+ if (StringUtils.isNotBlank(proxyHost) && proxyPort > 0) {
+ println "Using ${protocol.toUpperCase()} proxy: $proxyHost:$proxyPort"
client.setProxy(proxyHost, proxyPort, protocol)
}
}
diff --git a/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy b/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
index 9f750eb..3f9cce0 100644
--- a/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
+++ b/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
@@ -145,8 +145,8 @@ class RestTaskSpec extends Specification {
def 'Configure and execute a request using a proxy'() {
setup:
- System.setProperty('http.proxyHost', "www.abc.com")
- System.setProperty('http.proxyPort', "8080")
+ System.setProperty("${protocol}.proxyHost", 'www.abc.com')
+ System.setProperty("${protocol}.proxyPort", port.toString())
Task task = project.tasks.create(name: 'request', type: RestTask) {
httpMethod = 'post'
uri = 'bob.com'
@@ -164,9 +164,14 @@ class RestTaskSpec extends Specification {
then:
1 * mockClient.setUri('bob.com')
- 1 * mockClient.setProxy("www.abc.com", 8080, "http")
+ 1 * mockClient.setProxy('www.abc.com', port, protocol)
1 * mockClient.post(_ as Map) >> { Map params ->
mockResponse
}
+
+ where:
+ protocol | port
+ 'http' | 8080
+ 'https' | 8443
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/rest-gradle-plugin.git
More information about the pkg-java-commits
mailing list