Skip to content

Commit

Permalink
Fix JENKINS-15442
Browse files Browse the repository at this point in the history
Removed check for triggers to determine configured state.
  • Loading branch information
slide committed Oct 10, 2013
1 parent ca20d1a commit 7ba282f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
14 changes: 0 additions & 14 deletions src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
Expand Up @@ -191,20 +191,6 @@ public List<EmailTrigger> getConfiguredTriggers() {
return configuredTriggers;
}

/**
* Return true if the project has been configured, otherwise returns false
*/
public boolean isConfigured() {
return !getConfiguredTriggers().isEmpty();
}

/**
* Return true if the project has been configured, otherwise returns false
*/
public boolean getConfigured() {
return isConfigured();
}

public MatrixTriggerMode getMatrixTriggerMode() {
if (matrixTriggerMode ==null) return MatrixTriggerMode.BOTH;
return matrixTriggerMode;
Expand Down
Expand Up @@ -10,7 +10,7 @@ d = namespace("jelly:define")


def triggers = hudson.plugins.emailext.plugins.EmailTrigger.all()
def configured = instance != null ? instance.configured : false
def configured = instance != null

f.entry(title: _("Project Recipient List"), help: "/plugin/email-ext/help/projectConfig/globalRecipientList.html", description: _("Comma-separated list of email address that should receive notifications for this project.")) {
f.textbox(name: "project_recipient_list", value: configured ? instance.recipientList : "\$DEFAULT_RECIPIENTS", checkUrl: "'${rootURL}/publisher/ExtendedEmailPublisher/recipientListRecipientsCheck?value='+encodeURIComponent(this.value)")
Expand Down
@@ -1,5 +1,7 @@
package hudson.plugins.emailext;

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.containsString;
Expand Down Expand Up @@ -42,6 +44,8 @@
import org.jvnet.mock_javamail.Mailbox;
import org.kohsuke.stapler.Stapler;
import static org.junit.Assert.*;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.JenkinsRule.WebClient;

public class ExtendedEmailPublisherTest {

Expand Down Expand Up @@ -763,6 +767,22 @@ public Void call() throws Exception {
}
});
}

@Test
@Bug(15442)
public void testConfiguredStateNoTriggers()
throws Exception {
FreeStyleProject prj = j.createFreeStyleProject("JENKINS-15442");
prj.getPublishersList().add(publisher);

publisher.recipientList = "mickey@disney.com";
publisher.configuredTriggers.clear();

WebClient client = j.createWebClient();
HtmlPage page = client.goTo("job/JENKINS-15442/configure");
HtmlTextInput recipientList = page.getElementByName("project_recipient_list");
assertEquals(recipientList.getText(), "mickey@disney.com");
}

private void addEmailType(EmailTrigger trigger) {
trigger.setEmail(new EmailType() {
Expand Down

0 comments on commit 7ba282f

Please sign in to comment.