| author | akozak | 2011-11-23 06:54:58 (EST) |
|---|---|---|
| committer | Winston Prakash | 2011-12-01 20:47:08 (EST) |
| commit | e205412de703cfa05a61d7922087da9437bf12d6 (patch) (side-by-side diff) | |
| tree | 76256cf563a73bc1e53955faa20c06537c1aa7dc | |
| parent | da5b69dc7e29caf5948df7e5850eb4130c811a73 (diff) | |
| download | org.eclipse.hudson.core-e205412de703cfa05a61d7922087da9437bf12d6.zip org.eclipse.hudson.core-e205412de703cfa05a61d7922087da9437bf12d6.tar.gz org.eclipse.hudson.core-e205412de703cfa05a61d7922087da9437bf12d6.tar.bz2 | |
Improved test.
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
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(); |

