Skip to content

Commit

Permalink
Merge pull request #48 from oleg-nenashev/facelift
Browse files Browse the repository at this point in the history
Facelift: Localization and Plugin POM
  • Loading branch information
alecharp committed Dec 21, 2018
2 parents 26967de + 7ecac47 commit 2457f6c
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 37 deletions.
22 changes: 6 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.19</version>
<version>3.32</version>
<relativePath />
</parent>

Expand All @@ -13,7 +13,7 @@
<name>Jenkins Mailer Plugin</name>
<description>This plugin allows you to configure email notifications for build results</description>

<url>https://wiki.jenkins-ci.org/display/JENKINS/Mailer</url>
<url>https://wiki.jenkins.io/display/JENKINS/Mailer</url>
<licenses>
<license>
<name>The MIT license</name>
Expand All @@ -22,7 +22,6 @@
</license>
</licenses>
<properties>
<powermock.version>1.6.6</powermock.version>
<java.level>7</java.level>
<jenkins.version>1.625.3</jenkins.version>
</properties>
Expand All @@ -41,7 +40,7 @@
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<version>1.4.4</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -65,7 +64,6 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -77,7 +75,6 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -88,15 +85,8 @@
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
<artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<scm>
Expand All @@ -107,13 +97,13 @@
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
13 changes: 4 additions & 9 deletions src/main/java/hudson/cli/MailCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc.
* Copyright (c) 2004-2018, Sun Microsystems, Inc., CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,13 +26,12 @@
import hudson.tasks.Mailer;
import hudson.Extension;
import jenkins.model.Jenkins;
import hudson.model.Item;

import javax.mail.internet.MimeMessage;
import javax.mail.Transport;

/**
* Sends e-mail through Hudson.
* Sends e-mail through Jenkins.
*
* <p>
* Various platforms have different commands to do this, so on heterogenous platform, doing this via Hudson is easier.
Expand All @@ -42,15 +41,11 @@
@Extension
public class MailCommand extends CLICommand {
public String getShortDescription() {
return Messages.MailCommand_ShortDescription();
return jenkins.plugins.mailer.tasks.i18n.Messages.MailCommand_ShortDescription();
}

protected int run() throws Exception {
// TODO 1.590+ Jenkins.getActiveInstance
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
throw new IllegalStateException("Jenkins is not active.");
}
Jenkins jenkins = Jenkins.getActiveInstance();
jenkins.checkPermission(Jenkins.ADMINISTER);
Transport.send(new MimeMessage(Mailer.descriptor().createSession(),stdin));
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ Mailer.EmailSentSuccessfully=Email was successfully sent
Mailer.FailedToSendEmail=Failed to send out e-mail
Mailer.TestMail.Subject=Test email #{0}
Mailer.TestMail.Content=This is test email #{0} sent from {1}

MailCommand.ShortDescription=\
Reads stdin and sends that out as an e-mail.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MailCommand.ShortDescription=\
\u0418\u0437\u0447\u0438\u0442\u0430\u043d\u0435 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0438\u044f \u0432\u0445\u043e\u0434 \u0438 \u0438\u0437\u043f\u0440\u0430\u0449\u0430\u043d\u0435 \u043f\u043e \u0435-\u043f\u043e\u0449\u0430.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

MailSender.ListEmpty=Der Versuch wurde ignoriert, eine E-Mail an eine leere Liste von Empfängern zu verschicken.
MailSender.NoAddress=Es konnte keine E-Mail an {0} geschickt werden, weil die E-Mail-Adresse unbekannt ist und kein Standardwert für die E-Mail-Domain eingestellt ist.
MailSender.ListEmpty=Der Versuch wurde ignoriert, eine E-Mail an eine leere Liste von Empfängern zu verschicken.
MailSender.NoAddress=Es konnte keine E-Mail an {0} geschickt werden, weil die E-Mail-Adresse unbekannt ist und kein Standardwert für die E-Mail-Domain eingestellt ist.
MailSender.BackToNormal.Normal=normal
MailSender.BackToNormal.Stable=stabil
MailSender.BackToNormalMail.Subject=Jenkins-Build ist wieder {0}:
MailSender.UnstableMail.Subject=Jenkins-Build ist instabil:
MailSender.UnstableMail.ToUnStable.Subject=Jenkins-Build ist instabil geworden:
MailSender.UnstableMail.StillUnstable.Subject=Jenkins-Build ist immer noch instabil:
MailSender.FailureMail.Subject=Jenkins-Build fehlgeschlagen:
MailSender.FailureMail.Changes=Änderungen:
MailSender.FailureMail.Changes=Änderungen:
MailSender.FailureMail.FailedToAccessBuildLog=Zugriff auf Build-Protokoll fehlgeschlagen
MailSender.Link=Siehe <{0}>

Expand All @@ -39,3 +39,5 @@ Mailer.Unknown.Host.Name=Unbekannter Host:
Mailer.Suffix.Error=Der Inhalt dieses Feldes sollte ''@'', gefolgt von einem Domain-Namen, sein.
Mailer.EmailSentSuccessfully=Das Versenden der E-Mail war erfolgreich
Mailer.FailedToSendEmail=Das Versenden der E-Mail ist fehlgeschlagen

MailCommand.ShortDescription=Liest eine Nachricht von der Standardeingabe (stdin) und versendet sie als E-Mail
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

MailSender.ListEmpty=Ignorado un intento de envio de correos a una lista de destinatarios vacía.
MailSender.NoAddress=Falló el envio de correo a {0} porque ninguna dirección de correo es conocida, y no se ha configurado ningún dominio por defecto.
MailSender.ListEmpty=Ignorado un intento de envio de correos a una lista de destinatarios vacía.
MailSender.NoAddress=Falló el envio de correo a {0} porque ninguna dirección de correo es conocida, y no se ha configurado ningún dominio por defecto.
MailSender.BackToNormal.Normal=Normal
MailSender.BackToNormal.Stable=Estable
MailSender.BackToNormalMail.Subject=El estado de Jenkins ha vuelto a {0} :
MailSender.UnstableMail.Subject=El resultado de la ejecución es inestable:
MailSender.UnstableMail.Subject=El resultado de la ejecución es inestable:
MailSender.UnstableMail.ToUnStable.Subject=El estado de Jenkins es inestable:
MailSender.UnstableMail.StillUnstable.Subject=El estado de Jenkins continúa siendo inestable:
MailSender.FailureMail.Subject=La ejecución en Jenkins ha fallado:
MailSender.UnstableMail.StillUnstable.Subject=El estado de Jenkins continúa siendo inestable:
MailSender.FailureMail.Subject=La ejecución en Jenkins ha fallado:
MailSender.FailureMail.Changes=Cambios:
MailSender.FailureMail.FailedToAccessBuildLog=Error al acceder al "log" de ejecución
MailSender.FailureMail.FailedToAccessBuildLog=Error al acceder al "log" de ejecución
MailSender.Link=Echa un vistazo a <{0}{1}>

Mailer.DisplayName=Notificación por correo
Mailer.DisplayName=Notificación por correo
Mailer.UserProperty.DisplayName=E-mail
Mailer.Unknown.Host.Name=Nombre de Host desconocido:
Mailer.Suffix.Error=Este campo deberia ser el símbolo "@" seguido de un nombre de dominio.
Mailer.Suffix.Error=Este campo deberia ser el símbolo "@" seguido de un nombre de dominio.

MailCommand.ShortDescription=Lee de la entrada estándard, y lo envía por email.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MailCommand.ShortDescription=Legge lo standard input e lo invia come messaggio di posta elettronica.
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ Mailer.EmailSentSuccessfully=\u30e1\u30fc\u30eb\u3092\u6b63\u5e38\u306b\u9001\u4
Mailer.FailedToSendEmail=\u30e1\u30fc\u30eb\u306e\u9001\u4fe1\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
Mailer.TestMail.Subject=\u30c6\u30b9\u30c8\u30e1\u30fc\u30eb #{0}
Mailer.TestMail.Content=\u3053\u306e\u30e1\u30fc\u30eb\u306f\u3001{1}\u304b\u3089\u306e\u30c6\u30b9\u30c8\u30e1\u30fc\u30eb #{0}\u3067\u3059\u3002

MailCommand.ShortDescription=\
\u6a19\u6e96\u5165\u529b\u306e\u5185\u5bb9\u3092\u30e1\u30fc\u30eb\u3068\u3057\u3066\u9001\u4fe1\u3057\u307e\u3059\u3002
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MailCommand.ShortDescription=\
Skaito stdin ir i\u0161siun\u010dia kaip e-pa\u0161t\u0105.
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ MailSender.FailureMail.Subject=Constru\u00e7\u00e3o falhou.
Mailer.Unknown.Host.Name=Nome de host n\u00e3o localizado:
# Jenkins build is unstable:
MailSender.UnstableMail.Subject=Constru\u00e7\u00e3o est\u00e1 inst\u00e1vel

# Reads stdin and sends that out as an e-mail.
MailCommand.ShortDescription=L\u00ea a stdin e envia como um e-mail.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MailCommand.ShortDescription=\u0418\u0437\u0447\u0438\u0442\u0430 stdin \u0438 \u043F\u043E\u0448\u0430\u0459\u0435 \u0441\u0430\u0434\u0440\u0436\u0430\u0458 \u043F\u0440\u0435\u043A\u043E \u0435-\u043F\u043E\u0448\u0442\u0435.
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ Mailer.EmailSentSuccessfully=\u96fb\u5b50\u90f5\u4ef6\u6210\u529f\u5bc4\u51fa
Mailer.FailedToSendEmail=\u96fb\u5b50\u90f5\u4ef6\u50b3\u9001\u5931\u6557
Mailer.TestMail.Subject=\u6e2c\u8a66\u4fe1 #{0}
Mailer.TestMail.Content=\u9019\u662f\u4e2d {0} \u5bc4\u51fa\u7684\u6e2c\u8a66\u4fe1 #{0}

MailCommand.ShortDescription=\
\u8b80\u53d6 stdin \u4e26\u5c07\u7d50\u679c\u4ee5 e-mail \u65b9\u5f0f\u50b3\u9001\u3002
2 changes: 1 addition & 1 deletion src/test/java/hudson/tasks/MailSenderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest(Jenkins.class)
@PowerMockIgnore("javax.security.auth.Subject") // otherwise as in https://groups.google.com/d/msg/jenkinsci-dev/n5sdCxrccSk/7K4yTTc7XG4J mock(ACL.class) in Java 8 fails with: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.acegisecurity.Authentication$$EnhancerByMockitoWithCGLIB$$31bf4863.implies(Ljavax/security/auth/Subject;)Z" the class loader (instance of org/powermock/core/classloader/MockClassLoader) of the current class, org/acegisecurity/Authentication$$EnhancerByMockitoWithCGLIB$$31bf4863, and the class loader (instance of <bootloader>) for interface java/security/Principal have different Class objects for the type javax/security/auth/Subject used in the signature
@PowerMockIgnore({"javax.security.auth.Subject", "javax.security.*", "javax.xml.*"}) // otherwise as in https://groups.google.com/d/msg/jenkinsci-dev/n5sdCxrccSk/7K4yTTc7XG4J mock(ACL.class) in Java 8 fails with: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.acegisecurity.Authentication$$EnhancerByMockitoWithCGLIB$$31bf4863.implies(Ljavax/security/auth/Subject;)Z" the class loader (instance of org/powermock/core/classloader/MockClassLoader) of the current class, org/acegisecurity/Authentication$$EnhancerByMockitoWithCGLIB$$31bf4863, and the class loader (instance of <bootloader>) for interface java/security/Principal have different Class objects for the type javax/security/auth/Subject used in the signature
@SuppressWarnings("rawtypes")
public class MailSenderTest {

Expand Down

0 comments on commit 2457f6c

Please sign in to comment.