aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-23 06:46:51 (EST)
committerWinston Prakash2011-12-01 20:47:08 (EST)
commitda5b69dc7e29caf5948df7e5850eb4130c811a73 (patch)
treeb2ae5e8182adae7d463caa0b19abfa0d5d1b4fe1
parent8985173d5fdda164f1e2ff9840c8d560553604ea (diff)
downloadorg.eclipse.hudson.core-da5b69dc7e29caf5948df7e5850eb4130c811a73.zip
org.eclipse.hudson.core-da5b69dc7e29caf5948df7e5850eb4130c811a73.tar.gz
org.eclipse.hudson.core-da5b69dc7e29caf5948df7e5850eb4130c811a73.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.java32
-rw-r--r--hudson-core/src/test/java/hudson/matrix/LegacyMatrixConfigurationTest.java4
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();