Skip to content

Commit

Permalink
[JENKINS-9904] Fixed so matrix jobs can use the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
redsolo committed Oct 12, 2011
1 parent 74384be commit abcde75
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Expand Up @@ -76,7 +76,7 @@ private boolean checkForFileUsage(AbstractBuild<?, ?> build, BuildListener liste

try {
listener.getLogger().println("Searching for locked files in workspace.");
FilePath workspace = build.getBuiltOn().getWorkspaceFor((TopLevelItem) build.getProject());
FilePath workspace = build.getWorkspace();
List<FileUsageDetails> list = workspace.act(new GetUsedFiles(command, new StreamBuildListener(listener.getLogger())));
if (list.size() > 0) {
build.getActions().add(new LockedFilesReportAction(build, list));
Expand Down
@@ -0,0 +1,27 @@
package hudson.plugins.lockedfilesreport;

import hudson.matrix.Axis;
import hudson.matrix.AxisList;
import hudson.matrix.MatrixProject;
import hudson.model.FreeStyleProject;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase;

public class LockedFilesReporterIntegrationTest extends HudsonTestCase {
@Bug(9904)
public void testThatMatrixProjectCanUsePlugin() throws Exception {
MatrixProject project = createMatrixProject();
AxisList axes = new AxisList();
axes.add(new Axis("direction","north","south"));
project.setAxes(axes);
LockedFilesReporter reporter = new LockedFilesReporter();
project.getPublishersList().add(reporter);
assertBuildStatusSuccess(project.scheduleBuild2(0).get());
}

public void testThatFreeStyleProjectCanUsePlugin() throws Exception {
FreeStyleProject project = createFreeStyleProject();
project.getPublishersList().add(new LockedFilesReporter());
assertBuildStatusSuccess(project.scheduleBuild2(0).get());
}
}

0 comments on commit abcde75

Please sign in to comment.