Skip to content

Commit

Permalink
[FIXED HUDSON-4063] disable DownloadService during tests
Browse files Browse the repository at this point in the history
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20370 71c3de6d-444a-0410-be80-ed276b4c234a
  • Loading branch information
huybrechts committed Aug 1, 2009
1 parent 380238f commit 163c080
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/src/main/java/hudson/model/DownloadService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public DownloadService() {
* Builds up an HTML fragment that starts all the download jobs.
*/
public String generateFragment() {
if (neverUpdate) return "";

StringBuilder buf = new StringBuilder();
if(Hudson.getInstance().hasPermission(Hudson.READ)) {
long now = System.currentTimeMillis();
Expand Down Expand Up @@ -196,5 +198,7 @@ public static Downloadable get(String id) {

private static final Logger LOGGER = Logger.getLogger(Downloadable.class.getName());
}

public static boolean neverUpdate = Boolean.getBoolean(DownloadService.class.getName()+".never");
}

4 changes: 3 additions & 1 deletion test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenEmbedder;
import hudson.model.Descriptor;
import hudson.model.DownloadService;
import hudson.model.FreeStyleProject;
import hudson.model.Hudson;
import hudson.model.Item;
Expand Down Expand Up @@ -214,6 +215,7 @@ public String getUpdateCenterUrl() {
return updateCenterUrl;
}
});
DownloadService.neverUpdate = true;

// cause all the descriptors to reload.
// ideally we'd like to reset them to properly emulate the behavior, but that's not possible.
Expand Down Expand Up @@ -249,7 +251,7 @@ protected void tearDown() throws Exception {
}

protected void runTest() throws Throwable {
System.out.println("=== Starting "+getName());
System.out.println("=== Starting "+ getClass().getSimpleName() + "." + getName());
new JavaScriptEngine(null); // ensure that ContextFactory is initialized
Context cx= ContextFactory.getGlobal().enterContext();
try {
Expand Down

0 comments on commit 163c080

Please sign in to comment.