Skip to content

Commit

Permalink
[JENKINS-17125] Establishing baseline FingerprintAction behavior that…
Browse files Browse the repository at this point in the history
… should not be regressed.
  • Loading branch information
jglick committed Jun 5, 2013
1 parent 291c39a commit bd709b0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/src/test/java/hudson/tasks/FingerprinterTest.java
Expand Up @@ -24,6 +24,7 @@

package hudson.tasks;

import hudson.XmlFile;
import hudson.matrix.Axis;
import hudson.matrix.AxisList;
import hudson.matrix.MatrixProject;
Expand All @@ -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;
Expand All @@ -44,6 +46,7 @@
import org.junit.Test;

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

/**
*
Expand Down Expand Up @@ -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();
Expand Down
Binary file not shown.

0 comments on commit bd709b0

Please sign in to comment.