@@ -54,18 +54,20 @@ class BintrayClientSpec extends Specification {
5454 def encodedPath6 = ((BintrayImpl ) bintray). createUrl(path6)
5555
5656 then :
57- encodedPath1 . toString() . equals( " https://api.bintray.com/content/user/generic/bla/1.0/com/jfrog/bintray/bintray-test/1.0/bintray-test-1.0.pom;publish=1 " )
58- encodedPath2 . toString(). equals(" https://api.bintray.com/docker /bla/dockertest/v1/repositories/library/ubuntu " )
59- encodedPath3 . toString(). equals(" https://api.bintray.com/ docker/bla/dockertest/v1/images/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/json%20with%20space.ext " )
60- encodedPath4 . toString(). equals(" https://api.bintray.com/ bla/someUser/test?a=b&c=d " )
61- encodedPath5 . toString(). equals(" https://api.bintray.com/ bla/someUser/testMatrix;a+=b " )
62- encodedPath6 . toString(). equals(" https://api.bintray.com/t%25st/spe%5Eal/ch&ar \$ /*()!%23/ok? " )
63-
57+ String url = getApiUrl( )
58+ encodedPath1 . toString(). equals(url + " /content/user/generic /bla/1.0/com/jfrog/bintray/bintray-test/1.0/bintray-test-1.0.pom;publish=1 " )
59+ encodedPath2 . toString(). equals(url + " / docker/bla/dockertest/v1/repositories/library/ubuntu " )
60+ encodedPath3 . toString(). equals(url + " /docker/ bla/dockertest/v1/images/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/json%20with%20space.ext " )
61+ encodedPath4 . toString(). equals(url + " / bla/someUser/test?a=b&c=d " )
62+ encodedPath5 . toString(). equals(url + " /bla/someUser/testMatrix;a+=b " )
63+ encodedPath6 . toString() . equals(url + " /t%25st/spe%5Eal/ch&ar \$ /*()!%23/ok? " )
6464 }
6565
6666 def ' on error response is returned without parsing' () {
6767 setup :
68- Bintray wrongBintray = BintrayClient . create(connectionProperties. username as String , connectionProperties. apiKey as String )
68+ Bintray wrongBintray = BintrayClient . create(getApiUrl(),
69+ connectionProperties. username as String ,
70+ connectionProperties. apiKey as String )
6971 when :
7072 wrongBintray. subject(' bla' ). get()
7173 then :
@@ -85,7 +87,8 @@ class BintrayClientSpec extends Specification {
8587 def ' files uploaded and can be accessed by the author' () {
8688 setup :
8789 def ver = bintray. subject(connectionProperties. username). repository(REPO_NAME ). createPkg(pkgBuilder). createVersion(versionBuilder)
88- def downloadServerClient = createClient(" https://dl.bintray.com" )
90+ String url = getDownloadUrl()
91+ def downloadServerClient = createClient(url)
8992 files = [' com/bla/bintray-client-java-api.jar' : getClass(). getResourceAsStream(' /testJar1.jar' ),
9093 ' org/foo/bar/bintray-client-java-service.jar' : getClass(). getResourceAsStream(' /testJar2.jar' )]
9194
@@ -106,7 +109,8 @@ class BintrayClientSpec extends Specification {
106109 sleep(15000 ) // wait for previous deletions to propagate
107110 def ver = bintray. subject(connectionProperties. username). repository(REPO_NAME ). createPkg(pkgBuilder). createVersion(versionBuilder)
108111 HttpClientConfigurator conf = new HttpClientConfigurator ();
109- def anonymousDownloadServerClient = new BintrayImpl (conf. hostFromUrl(" https://dl.bintray.com" ). noRetry(). noCookies(). getClient(), " https://dl.bintray.com" , 5 , 90000 )
112+ String url = getDownloadUrl()
113+ def anonymousDownloadServerClient = new BintrayImpl (conf. hostFromUrl(url). noRetry(). noCookies(). getClient(), url, 5 , 90000 )
110114 files = [' com/bla/bintray-client-java-api.jar' : getClass(). getResourceAsStream(' /testJar1.jar' ),
111115 ' org/foo/bar/bintray-client-java-service.jar' : getClass(). getResourceAsStream(' /testJar2.jar' )]
112116
@@ -127,7 +131,9 @@ class BintrayClientSpec extends Specification {
127131 ' org/foo/bar/bintray-client-java-service.jar' : getClass(). getResourceAsStream(' /testJar2.jar' )]
128132 VersionHandle ver = bintray. subject(connectionProperties. username). repository(REPO_NAME ). createPkg(pkgBuilder). createVersion(versionBuilder). upload(files)
129133 HttpClientConfigurator conf = new HttpClientConfigurator ();
130- def anonymousDownloadServerClient = new BintrayImpl (conf. hostFromUrl(" https://dl.bintray.com" ). noRetry(). getClient(), " https://dl.bintray.com" , 5 , 90000 )
134+
135+ String url = getDownloadUrl()
136+ def anonymousDownloadServerClient = new BintrayImpl (conf. hostFromUrl(url). noRetry(). getClient(), url, 5 , 90000 )
131137
132138 when :
133139 sleep(5000 )
@@ -149,7 +155,9 @@ class BintrayClientSpec extends Specification {
149155 sleep(4000 )
150156 ver. discard()
151157 sleep(4000 ) // wait for propagation to dl and stuff
152- " https://dl.bintray.com/$connectionProperties . username /$REPO_NAME /${ files.keySet().asList().get(0)} " . toURL(). content
158+
159+ String url = getDownloadUrl()
160+ " $url /$connectionProperties . username /$REPO_NAME /${ files.keySet().asList().get(0)} " . toURL(). content
153161
154162 then :
155163 IOException ioe = thrown()
0 commit comments