mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-15 04:52:20 +00:00
fixed a test failure caused by the lack of reloading configuration at the test case boundary.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11655 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
c77ebc26a8
commit
66528e43aa
2 files changed
+10
-5
No files matched your search
@@ -279,7 +279,7 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
|
||||
* (If we do that in the base class, the derived class won't
|
||||
* get a chance to set default values.)
|
||||
*/
|
||||
protected synchronized void load() {
|
||||
public synchronized void load() {
|
||||
XmlFile file = getConfigFile();
|
||||
if(!file.exists())
|
||||
return;
|
||||
|
||||
@@ -5,10 +5,7 @@ import com.gargoylesoftware.htmlunit.Page;
|
||||
import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlForm;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlPage;
|
||||
import hudson.model.FreeStyleProject;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.Item;
|
||||
import hudson.model.UpdateCenter;
|
||||
import hudson.model.*;
|
||||
import junit.framework.TestCase;
|
||||
import org.jvnet.hudson.test.HudsonHomeLoader.CopyExisting;
|
||||
import org.jvnet.hudson.test.recipes.Recipe;
|
||||
@@ -75,6 +72,10 @@ public abstract class HudsonTestCase extends TestCase {
|
||||
hudson = newHudson();
|
||||
hudson.servletContext.setAttribute("app",hudson);
|
||||
hudson.servletContext.setAttribute("version","?");
|
||||
// cause all the descriptors to reload.
|
||||
// ideally we'd like to reset them to properly emulate the behavior, but that's not possible.
|
||||
for( Descriptor d : Descriptor.ALL )
|
||||
d.load();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@@ -85,6 +86,10 @@ public abstract class HudsonTestCase extends TestCase {
|
||||
env.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link Hudson}. If the derived class wants to create it in a different way,
|
||||
* you can override it.
|
||||
*/
|
||||
protected Hudson newHudson() throws Exception {
|
||||
return new Hudson(homeLoader.allocate(), createWebServer());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user