jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1854619 - in /jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol: mail/sampler/MailReaderSampler.java smtp/sampler/protocol/SendMailCommand.java
Date Fri, 01 Mar 2019 21:36:20 GMT
Author: pmouawad
Date: Fri Mar  1 21:36:20 2019
New Revision: 1854619

URL: http://svn.apache.org/viewvc?rev=1854619&view=rev
Log:
Cleanup code
Reuse TrustAllSSLSocketFactory

Modified:
    jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/mail/sampler/MailReaderSampler.java
    jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/mail/sampler/MailReaderSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/mail/sampler/MailReaderSampler.java?rev=1854619&r1=1854618&r2=1854619&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/mail/sampler/MailReaderSampler.java
(original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/mail/sampler/MailReaderSampler.java
Fri Mar  1 21:36:20 2019
@@ -44,7 +44,6 @@ import org.apache.commons.io.IOUtils;
 import org.apache.jmeter.config.ConfigTestElement;
 import org.apache.jmeter.protocol.smtp.sampler.gui.SecuritySettingsPanel;
 import org.apache.jmeter.protocol.smtp.sampler.protocol.LocalTrustStoreSSLSocketFactory;
-import org.apache.jmeter.protocol.smtp.sampler.protocol.TrustAllSSLSocketFactory;
 import org.apache.jmeter.samplers.AbstractSampler;
 import org.apache.jmeter.samplers.Entry;
 import org.apache.jmeter.samplers.Interruptible;
@@ -55,6 +54,7 @@ import org.apache.jmeter.testelement.pro
 import org.apache.jmeter.testelement.property.IntegerProperty;
 import org.apache.jmeter.testelement.property.StringProperty;
 import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jmeter.util.TrustAllSSLSocketFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -167,10 +167,7 @@ public class MailReaderSampler extends A
             }
 
             if (isTrustAllCerts()) {
-                if (isUseSSL()) {
-                    props.setProperty(mailProp(serverProtocol, "ssl.socketFactory.class"),
TRUST_ALL_SOCKET_FACTORY);  // $NON-NLS-1$
-                    props.setProperty(mailProp(serverProtocol, "ssl.socketFactory.fallback"),
FALSE);  // $NON-NLS-1$
-                } else if (isUseStartTLS()) {
+                if (isUseSSL() || isUseStartTLS()) {
                     props.setProperty(mailProp(serverProtocol, "ssl.socketFactory.class"),
TRUST_ALL_SOCKET_FACTORY);  // $NON-NLS-1$
                     props.setProperty(mailProp(serverProtocol, "ssl.socketFactory.fallback"),
FALSE);  // $NON-NLS-1$
                 }
@@ -191,16 +188,11 @@ public class MailReaderSampler extends A
                                         + truststore.getAbsolutePath());
                     }
                 }
-                if (isUseSSL()) {
+                if (isUseSSL() || isUseStartTLS()) {
                     // Requires JavaMail 1.4.2+
                     props.put(mailProp(serverProtocol, "ssl.socketFactory"),   // $NON-NLS-1$

                             new LocalTrustStoreSSLSocketFactory(truststore));
                     props.put(mailProp(serverProtocol, "ssl.socketFactory.fallback"), FALSE);
 // $NON-NLS-1$
-                } else if (isUseStartTLS()) {
-                    // Requires JavaMail 1.4.2+
-                    props.put(mailProp(serverProtocol, "ssl.socketFactory"),  // $NON-NLS-1$
-                            new LocalTrustStoreSSLSocketFactory(truststore));
-                    props.put(mailProp(serverProtocol, "ssl.socketFactory.fallback"), FALSE);
 // $NON-NLS-1$
                 }
             }
             addCustomProperties(props);

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java?rev=1854619&r1=1854618&r2=1854619&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
(original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
Fri Mar  1 21:36:20 2019
@@ -49,6 +49,7 @@ import org.apache.commons.lang3.StringUt
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.services.FileServer;
 import org.apache.jmeter.testelement.property.CollectionProperty;
+import org.apache.jmeter.util.TrustAllSSLSocketFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 



Mime
View raw message