Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-20884] Adjusted the test case
The situation cited in the bug report involves build action, not a
project action.
  • Loading branch information
kohsuke committed Oct 9, 2014
1 parent 4d63a43 commit 14f28ed
Showing 1 changed file with 12 additions and 22 deletions.
@@ -1,35 +1,24 @@
package hudson.maven;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;

import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.JenkinsRule;
import org.kohsuke.stapler.StaplerRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import hudson.EnvVars;
import hudson.Extension;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.BuildListener;
import hudson.model.Cause;
import hudson.model.EnvironmentContributingAction;
import hudson.model.InvisibleAction;
import hudson.model.Result;
import hudson.tasks.BuildWrapper;
import hudson.tasks.BuildWrapperDescriptor;
import hudson.tasks.Builder;
import hudson.util.ArgumentListBuilder;
import net.sf.json.JSONObject;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.JenkinsRule;

import java.io.IOException;

/**
* This test case verifies that a maven build also takes EnvironmentContributingAction into account to resolve variables on the command line
Expand Down Expand Up @@ -123,7 +112,7 @@ public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener l
}

/**
* This builder returns an action with variable replacement to build process
* Simulates envinject plugin that does stuff and add an action to the build
*/
public static class TestMvnBuilder extends Builder {

Expand All @@ -134,8 +123,9 @@ public TestMvnBuilder(String envVariableValue) {
}

@Override
public Collection<? extends Action> getProjectActions(AbstractProject<?, ?> project) {
return Collections.singletonList(new TestAction("KEY", envVariableValue));
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.addAction(new TestAction("KEY", envVariableValue));
return true;
}
}
}

0 comments on commit 14f28ed

Please sign in to comment.