aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-23 06:54:58 (EST)
committerWinston Prakash2011-12-01 20:47:08 (EST)
commit6582308f9011f319b144fa5fade2c76cbebfdff2 (patch)
tree677ccd47005146d3d14fb89171ae33d6bd6ffdd8
parent56dc5e7480b17e097daa97ad91094991fbf9e34b (diff)
downloadorg.eclipse.hudson.core-6582308f9011f319b144fa5fade2c76cbebfdff2.zip
org.eclipse.hudson.core-6582308f9011f319b144fa5fade2c76cbebfdff2.tar.gz
org.eclipse.hudson.core-6582308f9011f319b144fa5fade2c76cbebfdff2.tar.bz2
Improved test.
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/matrix/MatrixProject.java3
-rw-r--r--hudson-core/src/main/java/hudson/model/AbstractItem.java3
-rw-r--r--hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java3
3 files changed, 5 insertions, 4 deletions
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
index 95b00ec..4a7f508 100644
--- a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
+++ b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
@@ -554,8 +554,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
}
private File getConfigurationsDir() {
- return (getRootDir() != null ? new File(getRootDir(), AXIS_CONFIGURATIONS_DIR)
- : new File(new File("target"), AXIS_CONFIGURATIONS_DIR)); //For the tests
+ return new File(getRootDir(), AXIS_CONFIGURATIONS_DIR);
}
/**
diff --git a/hudson-core/src/main/java/hudson/model/AbstractItem.java b/hudson-core/src/main/java/hudson/model/AbstractItem.java
index c998c31..1875d53 100644
--- a/hudson-core/src/main/java/hudson/model/AbstractItem.java
+++ b/hudson-core/src/main/java/hudson/model/AbstractItem.java
@@ -105,8 +105,9 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
}
public File getRootDir() {
- return (parent != null ? parent.getRootDirFor(this) : null);
+ return (parent != null ? parent.getRootDirFor(this) : Hudson.getInstance().getRootDir());
}
+
/**
* This bridge method is to maintain binary compatibility with {@link TopLevelItem#getParent()}.
*/
diff --git a/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java b/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java
index ff81d9b..1b7fbab 100644
--- a/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java
+++ b/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java
@@ -66,13 +66,14 @@ public class LegacyMatrixConfigurationTest {
Hudson hudson = createMock(Hudson.class);
expect(hudson.getNodes()).andReturn(Lists.<Node>newArrayList()).anyTimes();
expect(hudson.getInitLevel()).andReturn(InitMilestone.STARTED).anyTimes();
+ expect(hudson.getRootDir()).andReturn(new File("./target/matrix")).anyTimes();
ExtensionList<TransientProjectActionFactory> actionList = ExtensionList.create(hudson,
TransientProjectActionFactory.class);
expect(hudson.getExtensionList(TransientProjectActionFactory.class)).andReturn(actionList).anyTimes();
ExtensionList<SaveableListener> saveableListenerList = ExtensionList.create(hudson, SaveableListener.class);
expect(hudson.getExtensionList(SaveableListener.class)).andReturn(saveableListenerList).anyTimes();
expect(hudson.getAllItems(MatrixConfiguration.class)).andReturn(Lists.<MatrixConfiguration>newArrayList())
- .times(3);
+ .anyTimes();
mockStatic(Hudson.class);
expect(Hudson.getInstance()).andReturn(hudson).anyTimes();
replayAll();