Skip to content

Commit

Permalink
Merge pull request #214 from slide/JENKINS-63367
Browse files Browse the repository at this point in the history
Fix JENKINS-63367
  • Loading branch information
slide authored Aug 12, 2020
2 parents 239b56b + d6e6e31 commit 4602a80
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/emailext/MailAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public MailAccount(JSONObject jo){
}

@DataBoundConstructor
public MailAccount(){
public MailAccount() {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ f.entry(field: "smtpHost", title: _("SMTP Server")) {
f.textbox()
}
f.entry(field: "smtpPort", title: _("SMTP Port")) {
f.number(value: 25)
f.number(default: "25")
}

f.advanced {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void testGlobalConfigDefaultState() throws Exception {
assertEquals("SMTP Server should be blank by default", "", smtpHost.getText());

HtmlNumberInput smtpPort = page.getElementByName("_.smtpPort");
assertNotNull("SMTP Server should be present", smtpPort);
assertEquals("SMTP Server should be blank by default", "25", smtpPort.getText());
assertNotNull("SMTP Port should be present", smtpPort);
assertEquals("SMTP Port should be 25 by default", "25", smtpPort.getText());

HtmlTextInput defaultSuffix = page.getElementByName("_.defaultSuffix");
assertNotNull("Default suffix should be present", defaultSuffix);
Expand Down Expand Up @@ -151,6 +151,23 @@ public void testGlobalConfigSimpleRoundTrip() throws Exception {
assertEquals("mickey@disney.com", descriptor.getDefaultRecipients());
}

@Test
@Issue("JENKINS-63367")
public void testSmtpPortRetainsSetValue() throws Exception {
ExtendedEmailPublisherDescriptor descriptor = j.jenkins.getDescriptorByType(ExtendedEmailPublisherDescriptor.class);
JenkinsRule.WebClient client = j.createWebClient();
HtmlPage page = client.goTo("configure");
HtmlNumberInput smtpPort = page.getElementByName("_.smtpPort");
smtpPort.setValueAttribute("587");
j.submit(page.getFormByName("config"));

assertEquals("587", descriptor.getMailAccount().getSmtpPort());

page = client.goTo("configure");
smtpPort = page.getElementByName("_.smtpPort");
assertEquals("587", smtpPort.getValueAttribute());
}

@Test
@Issue("JENKINS-20133")
public void testPrecedenceBulkSettingRoundTrip() throws Exception {
Expand Down

0 comments on commit 4602a80

Please sign in to comment.