Skip to content
Permalink
Browse files

[JENKINS-17125] Establishing baseline FingerprintAction behavior that…

… should not be regressed.
  • Loading branch information...
jglick committed Jun 5, 2013
1 parent 291c39a commit bd709b0631329f1abaf05de4a3499562a1606691
@@ -24,6 +24,7 @@

package hudson.tasks;

import hudson.XmlFile;
import hudson.matrix.Axis;
import hudson.matrix.AxisList;
import hudson.matrix.MatrixProject;
@@ -34,6 +35,7 @@
import hudson.model.Hudson;
import hudson.model.Result;
import hudson.util.RunList;
import java.io.File;

import java.io.IOException;
import java.util.Collection;
@@ -44,6 +46,7 @@
import org.junit.Test;

import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.recipes.LocalData;

/**
*
@@ -249,6 +252,27 @@ public static void setUp() throws Exception {
assertFalse(jobs.contains(oldDownstreamName));
}
}

@LocalData
@Test public void actionSerialization() throws Exception {
FreeStyleProject job = j.jenkins.getItemByFullName("j", FreeStyleProject.class);
assertNotNull(job);
FreeStyleBuild build = job.getBuildByNumber(2);
assertNotNull(build);
Fingerprinter.FingerprintAction action = build.getAction(Fingerprinter.FingerprintAction.class);
assertNotNull(action);
assertEquals(build, action.getBuild());
assertEquals("{a=2d5fac981a2e865baf0e15db655c7d63}", action.getRecords().toString());
j.assertBuildStatusSuccess(job.scheduleBuild2(0));
job._getRuns().purgeCache(); // force build records to be reloaded
build = job.getBuildByNumber(3);
assertNotNull(build);
System.out.println(new XmlFile(new File(build.getRootDir(), "build.xml")).asString());
action = build.getAction(Fingerprinter.FingerprintAction.class);
assertNotNull(action);
assertEquals(build, action.getBuild());
assertEquals("{a=f31efcf9afe30617d6c46b919e702822}", action.getRecords().toString());
}

private FreeStyleProject createFreeStyleProjectWithFingerprints(String[] contents, String[] files) throws IOException, Exception {
FreeStyleProject project = j.createFreeStyleProject();
Binary file not shown.

0 comments on commit bd709b0

Please sign in to comment.
You can’t perform that action at this time.