From e07b0c7d1e5b12929ee710a99061bff6d2ca0850 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 21 Jan 2010 22:00:01 +0000 Subject: [PATCH] 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 --- .../org/jvnet/hudson/test/HudsonTestCase.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index e1cc947a4e..2413a5d2d3 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -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 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 sites = hudson.getUpdateCenter().getSites(); + sites.clear(); + sites.add(new UpdateSite("default", updateCenterUrl)); + } + @Override protected void tearDown() throws Exception { try {