| author | akozak | 2011-11-23 06:46:51 (EST) |
|---|---|---|
| committer | Winston Prakash | 2011-12-01 20:47:08 (EST) |
| commit | 56dc5e7480b17e097daa97ad91094991fbf9e34b (patch) (side-by-side diff) | |
| tree | 12214c4960273ddf451a8d60840b8a0b57d500be | |
| parent | fba1dfddaaac5750376211172d97eb3f97c6659a (diff) | |
| download | org.eclipse.hudson.core-56dc5e7480b17e097daa97ad91094991fbf9e34b.zip org.eclipse.hudson.core-56dc5e7480b17e097daa97ad91094991fbf9e34b.tar.gz org.eclipse.hudson.core-56dc5e7480b17e097daa97ad91094991fbf9e34b.tar.bz2 | |
Fixed test which verifies loading of the legacy project matrix configuration
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
| -rw-r--r-- | hudson-core/src/main/java/hudson/matrix/MatrixProject.java | 32 | ||||
| -rw-r--r-- | hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java | 4 |
2 files changed, 20 insertions, 16 deletions
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java index fa25099..95b00ec 100644 --- a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java +++ b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java @@ -207,8 +207,8 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i */ public void setAxes(AxisList axes) throws IOException { getAxesListProjectProperty(AXES_PROPERTY_NAME).setValue(axes); - rebuildConfigurations(); - save(); +// rebuildConfigurations(); +// save(); } /** @@ -223,7 +223,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i */ public void setRunSequentially(boolean runSequentially) throws IOException { getBooleanProperty(RUN_SEQUENTIALLY_PROPERTY_NAME).setValue(runSequentially); - save(); +// save(); } /** @@ -238,8 +238,8 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i */ public void setCombinationFilter(String combinationFilter) throws IOException { getStringProperty(COMBINATION_FILTER_PROPERTY_NAME).setValue(combinationFilter); - rebuildConfigurations(); - save(); +// rebuildConfigurations(); +// save(); } /** @@ -345,17 +345,15 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i super.buildProjectProperties(); //Convert legacy properties to IProjectProperty logic if (null != axes && null == getProperty(AXES_PROPERTY_NAME)) { - //we shouldn't rebuild the axis configuration - getAxesListProjectProperty(AXES_PROPERTY_NAME).setValue(axes); + setAxes(axes); axes = null;//Reset to null. No longer needed. } if (null != combinationFilter && null == getProperty(COMBINATION_FILTER_PROPERTY_NAME)) { - //we shouldn't rebuild the axis configuration - getStringProperty(COMBINATION_FILTER_PROPERTY_NAME).setValue(combinationFilter); + setCombinationFilter(combinationFilter); combinationFilter = null;//Reset to null. No longer needed. } if ( null == getProperty(RUN_SEQUENTIALLY_PROPERTY_NAME)) { - getBooleanProperty(RUN_SEQUENTIALLY_PROPERTY_NAME).setValue(runSequentially); + setRunSequentially(runSequentially); runSequentially = false; } if (null != touchStoneCombinationFilter && null == getProperty(TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME)) { @@ -512,10 +510,6 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i * Rebuilds the {@link #configurations} list and {@link #activeConfigurations}. */ void rebuildConfigurations() throws IOException { - // for the tests - if(!isAllowSave()){ - return; - } // backward compatibility check to see if there's any data in the old structure // if so, bring them to the newer structure. File[] oldDirs = getConfigurationsDir().listFiles(new FileFilter() { @@ -799,5 +793,15 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i super.setAllowSave(allowSave); } + @Override + public void setCascadingProjectName(String cascadingProjectName) { + super.setCascadingProjectName(cascadingProjectName); + try { + rebuildConfigurations(); + } catch (IOException e) { + LOGGER.log(Level.WARNING, "Failed to rebuild matrix configuration", e); + } + } + private static final Logger LOGGER = Logger.getLogger(MatrixProject.class.getName()); } diff --git a/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java b/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java index 9b8125e..ff81d9b 100644 --- a/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java +++ b/hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java @@ -35,7 +35,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import static junit.framework.Assert.*; -import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; import static org.powermock.api.easymock.PowerMock.*; @@ -72,7 +71,8 @@ public class LegacyMatrixConfigurationTest { 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()).anyTimes(); + expect(hudson.getAllItems(MatrixConfiguration.class)).andReturn(Lists.<MatrixConfiguration>newArrayList()) + .times(3); mockStatic(Hudson.class); expect(Hudson.getInstance()).andReturn(hudson).anyTimes(); replayAll(); |

