Skip to content
Permalink
Browse files

Fix JENKINS-33690

Removed explicit look for an ExtendedEmailPublisher instance to get the Jenkins url.
  • Loading branch information
Alex Earl
Alex Earl committed Mar 25, 2016
1 parent 4edc42b commit 6a17566feeab23d8a831bfbc30990ce54eae6c81
@@ -8,6 +8,7 @@
import hudson.plugins.emailext.plugins.EmailTrigger;
import hudson.plugins.emailext.plugins.RecipientProvider;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.codehaus.groovy.control.CompilerConfiguration;
@@ -72,12 +73,10 @@ private GroovyShell createEngine(AbstractBuild<?, ?> build, TaskListener listene
"hudson",
"hudson.model"));

ExtendedEmailPublisher publisher = build.getProject().getPublishersList().get(ExtendedEmailPublisher.class);

Binding binding = new Binding();
binding.setVariable("build", build);
binding.setVariable("project", build.getParent());
binding.setVariable("rooturl", publisher.getDescriptor().getHudsonUrl());
binding.setVariable("rooturl", JenkinsLocationConfiguration.get().getUrl());
binding.setVariable("out", listener.getLogger());

GroovyShell shell = new GroovyShell(cl, binding, cc);
@@ -43,12 +43,13 @@
public class AttachmentUtilsTest {

@Rule
public final JenkinsRule j = new JenkinsRule();

@Before
public void setUp() {
Mailbox.clearAll();
}
public final JenkinsRule j = new JenkinsRule() {
@Override
public void before() throws Throwable {
Mailbox.clearAll();
super.before();
}
};

@Test
public void testAttachmentFromWorkspace() throws Exception {
@@ -197,7 +198,7 @@ public void testNonEnglishCharacter() throws Exception {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.getWorkspace().child("已使用红包.txt").write("test.property=success","UTF-8");
return true;
return build.getWorkspace().child("已使用红包.txt").exists();
}
});

0 comments on commit 6a17566

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