Return-Path: X-Original-To: apmail-incubator-jspwiki-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-jspwiki-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13DC1D3F0 for ; Thu, 15 Nov 2012 23:02:50 +0000 (UTC) Received: (qmail 44408 invoked by uid 500); 15 Nov 2012 23:02:50 -0000 Delivered-To: apmail-incubator-jspwiki-commits-archive@incubator.apache.org Received: (qmail 44386 invoked by uid 500); 15 Nov 2012 23:02:49 -0000 Mailing-List: contact jspwiki-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jspwiki-dev@incubator.apache.org Delivered-To: mailing list jspwiki-commits@incubator.apache.org Received: (qmail 44378 invoked by uid 99); 15 Nov 2012 23:02:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2012 23:02:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2012 23:02:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 50EC6238897F; Thu, 15 Nov 2012 23:02:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1410091 - in /incubator/jspwiki/trunk/tests/org/apache/wiki/util: MailUtilTest.java UtilJ2eeCompatTest.java Date: Thu, 15 Nov 2012 23:02:28 -0000 To: jspwiki-commits@incubator.apache.org From: juanpablo@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121115230228.50EC6238897F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: juanpablo Date: Thu Nov 15 23:02:27 2012 New Revision: 1410091 URL: http://svn.apache.org/viewvc?rev=1410091&view=rev Log: Fixed a couple of tests which could fail under certain circumstances: - UtilJ2eeCompatTest: tests were order-dependent. - MailUtilTest#testSendMail(): didn't pass if the JVM needs but doesn't have a required cert needed to connect to the mail server (added extra catch to not fail the test, as is already done when we can't connect to the mail server). with the following exception: javax.mail.MessagingException: Can't send command to SMTP host; nested exception is: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [...] This is needed in order to have a Sonar analysis at Apache infra [cfr. INFRA-5441] Modified: incubator/jspwiki/trunk/tests/org/apache/wiki/util/MailUtilTest.java incubator/jspwiki/trunk/tests/org/apache/wiki/util/UtilJ2eeCompatTest.java Modified: incubator/jspwiki/trunk/tests/org/apache/wiki/util/MailUtilTest.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/org/apache/wiki/util/MailUtilTest.java?rev=1410091&r1=1410090&r2=1410091&view=diff ============================================================================== --- incubator/jspwiki/trunk/tests/org/apache/wiki/util/MailUtilTest.java (original) +++ incubator/jspwiki/trunk/tests/org/apache/wiki/util/MailUtilTest.java Thu Nov 15 23:02:27 2012 @@ -23,6 +23,7 @@ import java.net.ConnectException; import java.util.Properties; import javax.mail.MessagingException; +import javax.net.ssl.SSLHandshakeException; import junit.framework.Test; import junit.framework.TestCase; @@ -125,6 +126,14 @@ public class MailUtilTest extends TestCa System.out.println("Reason: "+e.getMessage()); return; } + if( e.getCause() instanceof SSLHandshakeException ) + { + // This can occur if you do not have the required cert in the JVM's keystore. We just log this + // and don't fail. + System.out.println("I could not test whether mail sending works, since I don't have the required cert in my keystore."); + System.out.println("Reason: "+e.getMessage()); + return; + } e.printStackTrace(); fail( "Unknown problem (check the console for error report)" ); } Modified: incubator/jspwiki/trunk/tests/org/apache/wiki/util/UtilJ2eeCompatTest.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/org/apache/wiki/util/UtilJ2eeCompatTest.java?rev=1410091&r1=1410090&r2=1410091&view=diff ============================================================================== --- incubator/jspwiki/trunk/tests/org/apache/wiki/util/UtilJ2eeCompatTest.java (original) +++ incubator/jspwiki/trunk/tests/org/apache/wiki/util/UtilJ2eeCompatTest.java Thu Nov 15 23:02:27 2012 @@ -26,20 +26,30 @@ import org.apache.wiki.util.UtilJ2eeComp public class UtilJ2eeCompatTest extends TestCase { + public void setUp() + { + UtilJ2eeCompat.useOutputStreamValue = null; + } + public void testOracle() { assertTrue( UtilJ2eeCompat.useOutputStream( "Oracle Containers for J2EE 10g(10.1.3.1.0 )", true ) ); // Do not reinitialize assertTrue( UtilJ2eeCompat.useOutputStream( "Apache Tomcat/5.5.20" ) ); + // Do not reinitialize + assertTrue( UtilJ2eeCompat.useOutputStream( "Sun Java System Application Server 9.1_02" ) ); } public void testGlassfish() { - assertTrue( UtilJ2eeCompat.useOutputStream( "Sun Java System Application Server 9.1_02" ) ); + assertFalse( UtilJ2eeCompat.useOutputStream( "Sun Java System Application Server 9.1_02", true ) ); + // Do not reinitialize + assertFalse( UtilJ2eeCompat.useOutputStream( "Sun Java System Application Server 9.1_02" ) ); } public void testTomcat() { + assertFalse( UtilJ2eeCompat.useOutputStream( "Apache Tomcat/5.5.20", true ) ); // Reinitialize assertFalse( UtilJ2eeCompat.useOutputStream( "Apache Tomcat/5.5.20", true ) ); }