Lines 7-12
Link Here
|
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* Markus Knittig - initial API and implementation |
9 |
* Markus Knittig - initial API and implementation |
|
|
10 |
* Benjamin Muskalla - 324039: [build] tests fail with NPE |
10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
11 |
|
12 |
|
12 |
package org.eclipse.mylyn.hudson.tests.support; |
13 |
package org.eclipse.mylyn.hudson.tests.support; |
Lines 31-41
Link Here
|
31 |
*/ |
32 |
*/ |
32 |
public class HudsonFixture extends TestFixture { |
33 |
public class HudsonFixture extends TestFixture { |
33 |
|
34 |
|
34 |
public final static String HUDSON_TEST_URL = "http://mylyn.eclipse.org/hudson"; |
35 |
public final static String HUDSON_TEST_URL = "http://localhost:8080/"; |
35 |
|
36 |
|
36 |
private static HudsonFixture current; |
37 |
private static HudsonFixture current; |
37 |
|
38 |
|
38 |
private static final HudsonFixture DEFAULT = new HudsonFixture(HUDSON_TEST_URL, "1.339", "REST"); |
39 |
private static final HudsonFixture DEFAULT = new HudsonFixture(HUDSON_TEST_URL, "1.374", "REST"); |
39 |
|
40 |
|
40 |
/** |
41 |
/** |
41 |
* Standard configurations for running all test against. |
42 |
* Standard configurations for running all test against. |
Lines 69-75
Link Here
|
69 |
return this; |
70 |
return this; |
70 |
} |
71 |
} |
71 |
|
72 |
|
72 |
public RestfulHudsonClient connect() { |
73 |
public RestfulHudsonClient connect() throws Exception { |
73 |
return connect(getRepositoryUrl()); |
74 |
return connect(getRepositoryUrl()); |
74 |
} |
75 |
} |
75 |
|
76 |
|
Lines 77-96
Link Here
|
77 |
return connect(repositoryUrl, Proxy.NO_PROXY, level); |
78 |
return connect(repositoryUrl, Proxy.NO_PROXY, level); |
78 |
} |
79 |
} |
79 |
|
80 |
|
80 |
public RestfulHudsonClient connect(String url) { |
81 |
public RestfulHudsonClient connect(String url) throws Exception { |
81 |
return connect(url, Proxy.NO_PROXY, PrivilegeLevel.USER); |
82 |
return connect(url, Proxy.NO_PROXY, PrivilegeLevel.USER); |
82 |
} |
83 |
} |
83 |
|
84 |
|
84 |
public RestfulHudsonClient connect(String url, Proxy proxy, PrivilegeLevel level) { |
85 |
public RestfulHudsonClient connect(String url, Proxy proxy, PrivilegeLevel level) throws Exception { |
85 |
Credentials credentials = TestUtil.readCredentials(level); |
86 |
Credentials credentials = TestUtil.readCredentials(level); |
86 |
return connect(url, credentials.username, credentials.password, proxy); |
87 |
return connect(url, credentials.username, credentials.password, proxy); |
87 |
} |
88 |
} |
88 |
|
89 |
|
89 |
public RestfulHudsonClient connect(String url, String username, String password) { |
90 |
public RestfulHudsonClient connect(String url, String username, String password) throws Exception { |
90 |
return connect(url, username, password, Proxy.NO_PROXY); |
91 |
return connect(url, username, password, Proxy.NO_PROXY); |
91 |
} |
92 |
} |
92 |
|
93 |
|
93 |
public RestfulHudsonClient connect(String url, String username, String password, final Proxy proxy) { |
94 |
public RestfulHudsonClient connect(String url, String username, String password, final Proxy proxy) |
|
|
95 |
throws Exception { |
94 |
WebLocation location = new WebLocation(url, username, password, new IProxyProvider() { |
96 |
WebLocation location = new WebLocation(url, username, password, new IProxyProvider() { |
95 |
public Proxy getProxyForHost(String host, String proxyType) { |
97 |
public Proxy getProxyForHost(String host, String proxyType) { |
96 |
return proxy; |
98 |
return proxy; |
Lines 99-105
Link Here
|
99 |
if (username != null && password != null) { |
101 |
if (username != null && password != null) { |
100 |
location.setCredentials(AuthenticationType.HTTP, username, password); |
102 |
location.setCredentials(AuthenticationType.HTTP, username, password); |
101 |
} |
103 |
} |
102 |
return new RestfulHudsonClient(location); |
104 |
RestfulHudsonClient hudsonClient = new RestfulHudsonClient(location); |
|
|
105 |
hudsonClient.setCache(new MockHudsonConfigurationCache()); |
106 |
return hudsonClient; |
103 |
} |
107 |
} |
104 |
|
108 |
|
105 |
@Override |
109 |
@Override |