allow subtypes to override the update center behavior.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@26208 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2010-01-21 22:00:01 +00:00
1 parent b0df11332a
commit e07b0c7d1e
1 file changed
+17 -10
@@ -250,16 +250,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
// set a default JDK to be the one that the harness is using.
hudson.getJDKs().add(new JDK("default",System.getProperty("java.home")));
// load updates from local proxy to avoid network traffic.
final String updateCenterUrl = "http://localhost:"+JavaNetReverseProxy.getInstance().localPort+"/update-center.json";
// don't waste bandwidth talking to the update center
DownloadService.neverUpdate = true;
UpdateSite.neverUpdate = true;
PersistedList<UpdateSite> sites = hudson.getUpdateCenter().getSites();
sites.clear();
sites.add(new UpdateSite("default", updateCenterUrl));
configureUpdateCenter();
// expose the test instance as a part of URL tree.
// this allows tests to use a part of the URL space for itself.
@@ -272,6 +263,22 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
d.load();
}
/**
* Configures the update center setting for the test.
* By default, we load updates from local proxy to avoid network traffic as much as possible.
*/
protected void configureUpdateCenter() throws Exception {
final String updateCenterUrl = "http://localhost:"+ JavaNetReverseProxy.getInstance().localPort+"/update-center.json";
// don't waste bandwidth talking to the update center
DownloadService.neverUpdate = true;
UpdateSite.neverUpdate = true;
PersistedList<UpdateSite> sites = hudson.getUpdateCenter().getSites();
sites.clear();
sites.add(new UpdateSite("default", updateCenterUrl));
}
@Override
protected void tearDown() throws Exception {
try {