[FIXED JENKINS-10903] Canceling a parent multi-configuration build produce a

build.xml that can't be deserialized

Handle resolves-to="com.google.common.collect.ImmutableList$SerializedForm"
manually and construct a suitable list. Any subsequent serialization of the
class will use the direct form of serialization.
This commit is contained in:
Richard Mortimer authored and Kohsuke Kawaguchi committed 2011-09-23 22:54:55 -07:00
1 parent ebee47bb75
commit f356b78ea0
4 files changed
+95 -2

No files matched your search

@@ -26,6 +26,7 @@ package hudson.util;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import junit.framework.TestCase;
import hudson.matrix.MatrixRun;
import hudson.model.Result;
import hudson.model.Run;
@@ -35,9 +36,12 @@ import java.io.InputStream;
import java.util.List;
import java.util.Map;
import jenkins.model.CauseOfInterruption;
import jenkins.model.InterruptedBuildAction;
/**
* Tests for XML serialization of java objects.
* @author Kohsuke Kawaguchi, Mike Dillon, Alan Harder
* @author Kohsuke Kawaguchi, Mike Dillon, Alan Harder, Richard Mortimer
*/
public class XStream2Test extends TestCase {
@@ -238,4 +242,22 @@ public class XStream2Test extends TestCase {
public static class Point {
public int x,y;
}
/**
* Unmarshall a matrix build.xml result.
* (JENKINS-10903)
*/
public void testUnMarshalRunMatrix() {
InputStream is = XStream2Test.class.getResourceAsStream("runMatrix.xml");
MatrixRun result = (MatrixRun) Run.XSTREAM.fromXML(is);
assertNotNull(result);
assertNotNull(result.getActions());
assertEquals(2, result.getActions().size());
InterruptedBuildAction action = (InterruptedBuildAction) result.getActions().get(1);
assertNotNull(action.getCauses());
assertEquals(1, action.getCauses().size());
CauseOfInterruption.UserInterruption cause =
(CauseOfInterruption.UserInterruption) action.getCauses().get(0);
assertNotNull(cause);
}
}