You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Andreas Veithen <an...@skynet.be> on 2008/09/13 00:28:59 UTC

Re: svn commit: r694732 - in /synapse/trunk/java/modules: core/src/main/java/org/apache/synapse/util/ transports/src/main/java/org/apache/synapse/transport/mail/

Asankha,

I have some comments/questions related to these modifications:

1) The change to MessageHelper seems to be related SYNAPSE-309. This  
should have been fixed in AXIOM. In which case is there an exception?

2) Why do we need an action "LEAVE" for a polling transport?

3) We already had support for multipart/mixed. It had some serious  
problems, but now all the unit tests for multipart/mixed that worked  
before no longer work. This is a big regression. Worse, this  
regression breaks the interoperability between MailTransportSender and  
MailTransportListener when transport.mail.Format is set to Multipart  
(I will commit unit tests for this). This needs to be corrected or  
reverted ASAP since now the build fails because of test failures.

Andreas

On 12 sept. 08, at 18:22, asankha@apache.org wrote:

> Author: asankha
> Date: Fri Sep 12 09:22:45 2008
> New Revision: 694732
>
> URL: http://svn.apache.org/viewvc?rev=694732&view=rev
> Log:
> support multipart/mixed and multipart/alternative mail messages
>
> Modified:
>    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> util/MessageHelper.java
>    synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/MailTransportListener.java
>    synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/MailUtils.java
>    synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/PollTableEntry.java
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/ 
> synapse/util/MessageHelper.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java?rev=694732&r1=694731&r2=694732&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> util/MessageHelper.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> util/MessageHelper.java Fri Sep 12 09:22:45 2008
> @@ -174,7 +174,10 @@
>         Attachments attachments = ori.getAttachmentMap();
>         if (attachments != null &&  
> attachments.getAllContentIDs().length > 0) {
>             String[] cIDs = attachments.getAllContentIDs();
> -            String soapPart = attachments.getSOAPPartContentID();
> +            String soapPart = null;
> +            try {
> +                soapPart = attachments.getSOAPPartContentID();
> +            } catch (Exception ignore) {}
>             for (String cID : cIDs) {
>                 if (!cID.equals(soapPart)) {
>                     newMC.addAttachment(cID,  
> attachments.getDataHandler(cID));
>
> Modified: synapse/trunk/java/modules/transports/src/main/java/org/ 
> apache/synapse/transport/mail/MailTransportListener.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/mail/MailTransportListener.java?rev=694732&r1=694731&r2=694732&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/MailTransportListener.java (original)
> +++ synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/MailTransportListener.java Fri Sep 12  
> 09:22:45 2008
> @@ -57,6 +57,7 @@
>
>     public static final String DELETE = "DELETE";
>     public static final String MOVE = "MOVE";
> +    public static final String LEAVE = "LEAVE";
>
>     /**
>      * Initializes the Mail transport
> @@ -394,12 +395,16 @@
>                 case PollTableEntry.SUCCSESSFUL:
>                     if (entry.getActionAfterProcess() ==  
> PollTableEntry.MOVE) {
>                         moveToFolder = entry.getMoveAfterProcess();
> +                    } else if (entry.getActionAfterProcess() ==  
> PollTableEntry.LEAVE) {
> +                        return;
>                     }
>                     break;
>
>                 case PollTableEntry.FAILED:
>                     if (entry.getActionAfterFailure() ==  
> PollTableEntry.MOVE) {
>                         moveToFolder = entry.getMoveAfterFailure();
> +                    } else if (entry.getActionAfterFailure() ==  
> PollTableEntry.LEAVE) {
> +                        return;
>                     }
>                     break;
>                 case PollTableEntry.NONE:
> @@ -469,11 +474,13 @@
>             String option = ParamUtils.getOptionalParam(
>                 service,  
> MailConstants.TRANSPORT_MAIL_ACTION_AFTER_PROCESS);
>             entry.setActionAfterProcess(
> -                MOVE.equals(option) ? PollTableEntry.MOVE :  
> PollTableEntry.DELETE);
> +                MOVE.equals(option) ? PollTableEntry.MOVE :
> +                LEAVE.equals(option) ? PollTableEntry.LEAVE :  
> PollTableEntry.DELETE);
>             option = ParamUtils.getOptionalParam(
>                 service,  
> MailConstants.TRANSPORT_MAIL_ACTION_AFTER_FAILURE);
>             entry.setActionAfterFailure(
> -                MOVE.equals(option) ? PollTableEntry.MOVE :  
> PollTableEntry.DELETE);
> +                MOVE.equals(option) ? PollTableEntry.MOVE :
> +                LEAVE.equals(option) ? PollTableEntry.LEAVE :  
> PollTableEntry.DELETE);
>
>             String moveFolderAfterProcess =  
> ParamUtils.getOptionalParam(
>                 service,  
> MailConstants.TRANSPORT_MAIL_MOVE_AFTER_PROCESS);
>
> Modified: synapse/trunk/java/modules/transports/src/main/java/org/ 
> apache/synapse/transport/mail/MailUtils.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/mail/MailUtils.java?rev=694732&r1=694731&r2=694732&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/MailUtils.java (original)
> +++ synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/MailUtils.java Fri Sep 12 09:22:45 2008
> @@ -20,20 +20,39 @@
> package org.apache.synapse.transport.mail;
>
> import org.apache.synapse.transport.base.BaseUtils;
> +import org.apache.synapse.transport.base.BaseConstants;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> +import org.apache.commons.lang.StringUtils;
> import org.apache.axiom.soap.SOAP12Constants;
> import org.apache.axiom.soap.SOAP11Constants;
> +import org.apache.axiom.soap.SOAPFactory;
> +import org.apache.axiom.soap.SOAPEnvelope;
> +import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
> +import org.apache.axiom.om.impl.builder.StAXBuilder;
> +import org.apache.axiom.om.impl.llom.OMTextImpl;
> +import org.apache.axiom.om.OMElement;
> +import org.apache.axis2.context.MessageContext;
> +import org.apache.axis2.AxisFault;
> +import org.apache.axis2.Constants;
> +import org.apache.axis2.description.Parameter;
> +import org.apache.axis2.builder.BuilderUtil;
>
> import javax.mail.Message;
> import javax.mail.MessagingException;
> import javax.mail.Multipart;
> +import javax.mail.Part;
> import javax.mail.internet.MimeMessage;
> import javax.mail.internet.MimeBodyPart;
> -
> -import java.io.ByteArrayOutputStream;
> -import java.io.InputStream;
> -import java.io.IOException;
> +import javax.mail.internet.ContentType;
> +import javax.mail.internet.ParseException;
> +import javax.xml.namespace.QName;
> +import javax.xml.stream.XMLStreamException;
> +import javax.activation.DataHandler;
> +
> +import java.io.*;
> +import java.util.List;
> +import java.util.ArrayList;
>
> public class MailUtils extends BaseUtils {
>
> @@ -145,4 +164,161 @@
>         }
>     }
>
> +    @Override
> +    public void setSOAPEnvelope(Object message, MessageContext  
> msgContext, String contentType) throws AxisFault {
> +
> +        if (message instanceof MimeMessage &&
> +            (contentType.toLowerCase().contains("multipart/ 
> alternative") ||
> +             contentType.toLowerCase().contains("multipart/ 
> mixed"))) {
> +
> +            MultipartParser mp = new MultipartParser((MimeMessage)  
> message);
> +            try {
> +                mp.parse();
> +            } catch (Exception e) {
> +                throw new AxisFault("Error parsing multipart  
> message", e);
> +            }
> +
> +            SOAPFactory soapFactory = new SOAP11Factory();
> +            SOAPEnvelope envelope = null;
> +            StAXBuilder builder = null;
> +            String charSetEnc = null;
> +
> +            try {
> +                if (mp.getMainTextContentType() != null) {
> +                    charSetEnc = new  
> ContentType(mp.getMainTextContentType()).getParameter("charset");
> +                }
> +            } catch (ParseException ignore) {
> +                charSetEnc =  
> MessageContext.DEFAULT_CHAR_SET_ENCODING;
> +            }
> +
> +            try {
> +                // select primary message - in the following order  
> of priority
> +                // SOAP 1.2, SOAP 1.1 / POX, text/plain, text/html
> +                if  
> (mp 
> .getMainTextContentType 
> ().contains(SOAP12Constants.SOAP_12_CONTENT_TYPE) ||
> +                     
> mp 
> .getMainTextContentType 
> ().contains((SOAP11Constants.SOAP_11_CONTENT_TYPE))) {
> +                    builder = BuilderUtil.getSOAPBuilder(
> +                        new  
> ByteArrayInputStream(mp.getMainText().getBytes(charSetEnc)),  
> charSetEnc);
> +                    envelope = (SOAPEnvelope)  
> builder.getDocumentElement();
> +
> +                } else if  
> (mp.getMainTextContentType().toLowerCase().contains(("text/plain"))) {
> +
> +                    // pick the name of the element that will act  
> as the wrapper element for the
> +                    // non-xml payload. If service doesn't define  
> one, default
> +                    Parameter wrapperParam =  
> msgContext.getAxisService().
> +                        getParameter(BaseConstants.WRAPPER_PARAM);
> +
> +                    QName wrapperQName = null;
> +                    OMElement wrapper = null;
> +                    if (wrapperParam != null) {
> +                        wrapperQName =  
> BaseUtils.getQNameFromString(wrapperParam.getValue());
> +                    }
> +
> +                    OMTextImpl textData = (OMTextImpl)  
> soapFactory.createOMText(mp.getMainText());
> +
> +                    if (wrapperQName == null) {
> +                        wrapperQName =  
> BaseConstants.DEFAULT_TEXT_WRAPPER;
> +                    }
> +                    wrapper =  
> soapFactory.createOMElement(wrapperQName, null);
> +                    wrapper.addChild(textData);
> +
> +                    envelope = soapFactory.getDefaultEnvelope();
> +                    envelope.getBody().addChild(wrapper);
> +                }
> +            } catch (XMLStreamException e) {
> +                handleException("Error building SOAP or POX  
> payload", e);
> +            } catch (UnsupportedEncodingException e) {
> +                handleException("Encoding error building SOAP or  
> POX payload", e);
> +            }
> +
> +            // Set the encoding scheme in the message context
> +             
> msgContext 
> .setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,  
> charSetEnc);
> +
> +            String charEncOfMessage =
> +                builder == null ? null :
> +                    builder.getDocument() == null ? null :  
> builder.getDocument().getCharsetEncoding();
> +
> +            if (StringUtils.isNotBlank(charEncOfMessage) &&
> +                StringUtils.isNotBlank(charSetEnc) &&
> +                !charSetEnc.equalsIgnoreCase(charEncOfMessage)) {
> +                handleException("Charset encodings differs from  
> whats used in the payload");
> +            }
> +
> +            msgContext.setEnvelope(envelope);
> +
> +            int cid = 1;
> +            for (DataHandler dh : mp.getAttachments()) {
> +                msgContext.addAttachment(Integer.toString(cid++),  
> dh);
> +            }
> +
> +        } else {
> +            super.setSOAPEnvelope(message, msgContext, contentType);
> +        }
> +    }
> +
> +    private class MultipartParser {
> +
> +        final MimeMessage msg;
> +        private String mainText = null;
> +        private String mainTextContentType = null;
> +        private List<DataHandler> attachments = new  
> ArrayList<DataHandler>();
> +
> +        MultipartParser(MimeMessage msg) {
> +            this.msg = msg;
> +        }
> +
> +        public void parse() throws MessagingException, IOException {
> +            Multipart mp = (Multipart) msg.getContent();
> +            for (int i=0; i<mp.getCount(); i++) {
> +                buildContentMap(mp.getBodyPart(i));
> +            }
> +        }
> +
> +        private void buildContentMap(Part p) throws  
> MessagingException, IOException {
> +
> +            if (p.isMimeType("multipart/alternative")) {
> +
> +                Multipart mp = (Multipart) p.getContent();
> +                for (int i = 0; i < mp.getCount(); i++) {
> +
> +                    Part bp = mp.getBodyPart(i);
> +                    processBodyPart(bp);
> +                }
> +
> +            } else if (p.isMimeType("multipart/*")) {
> +                Multipart mp = (Multipart) p.getContent();
> +                for (int i = 0; i < mp.getCount(); i++) {
> +                    buildContentMap(mp.getBodyPart(i));
> +                }
> +
> +            } else {
> +                processBodyPart(p);
> +            }
> +        }
> +
> +        private void processBodyPart(Part bp) throws  
> MessagingException, IOException {
> +            if (bp.isMimeType(SOAP12Constants.SOAP_12_CONTENT_TYPE)  
> ||
> +                bp.isMimeType(SOAP11Constants.SOAP_11_CONTENT_TYPE)  
> ||
> +                bp.isMimeType("text/plain")) {
> +
> +                if (mainText == null) {
> +                    mainText = (String) bp.getContent();
> +                    mainTextContentType = bp.getContentType();
> +                }
> +            } else {
> +                attachments.add(bp.getDataHandler());
> +            }
> +        }
> +
> +        public String getMainText() {
> +            return mainText;
> +        }
> +
> +        public String getMainTextContentType() {
> +            return mainTextContentType;
> +        }
> +
> +        public List<DataHandler> getAttachments() {
> +            return attachments;
> +        }
> +    }
> }
>
> Modified: synapse/trunk/java/modules/transports/src/main/java/org/ 
> apache/synapse/transport/mail/PollTableEntry.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/mail/PollTableEntry.java?rev=694732&r1=694731&r2=694732&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/PollTableEntry.java (original)
> +++ synapse/trunk/java/modules/transports/src/main/java/org/apache/ 
> synapse/transport/mail/PollTableEntry.java Fri Sep 12 09:22:45 2008
> @@ -40,6 +40,7 @@
>     // operation after mail check
>     public static final int DELETE = 0;
>     public static final int MOVE   = 1;
> +    public static final int LEAVE  = 2;
>
>     /** The email address mapped to the service */
>     private InternetAddress emailAddress = null;
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: svn commit: r694732 - in /synapse/trunk/java/modules: core/src/main/java/org/apache/synapse/util/ transports/src/main/java/org/apache/synapse/transport/mail/

Posted by Andreas Veithen <an...@skynet.be>.
Asankha,


For the test failures you are seeing, probably adding a Thread.sleep  
at the end of GreenMailTestEnvironment#setUp will do the trick.

Andreas

On 13 sept. 08, at 08:39, Asankha C. Perera wrote:

> Andreas
>> 1) The change to MessageHelper seems to be related SYNAPSE-309.  
>> This should have been fixed in AXIOM. In which case is there an  
>> exception?
> Sorry I did this off the 1.2 codebase, and thus missed the change in  
> the latest Axiom snapshot
>> 2) Why do we need an action "LEAVE" for a polling transport?
> To not delete or move after processing or failure. For example, if  
> something goes wrong during processing one may want to leave that  
> mail intact on the inbox
>> 3) We already had support for multipart/mixed. It had some serious  
>> problems, but now all the unit tests for multipart/mixed that  
>> worked before no longer work. This is a big regression. Worse, this  
>> regression breaks the interoperability between MailTransportSender  
>> and MailTransportListener when transport.mail.Format is set to  
>> Multipart (I will commit unit tests for this). This needs to be  
>> corrected or reverted ASAP since now the build fails because of  
>> test failures.
> I reverted my last commit locally, and reran with the latest tests,  
> but they still fail..
>
> Tests in error:
>    
> 0025 
> :test 
> = 
> AsyncXML 
> ,data 
> = 
> UTF8 
> ,messageType 
> = 
> SOAP12 
> ,server 
> = 
> greenmail 
> ,client 
> = 
> javamail 
> ,layout 
> = 
> multipart 
> ,endpoint 
> = 
> axis 
> (org 
> .apache.synapse.transport.testkit.tests.async.XMLAsyncMessageTestCase)
>    
> 0032 
> :test 
> = 
> EchoXML 
> ,data 
> = 
> UTF8 
> ,messageType 
> = 
> POX 
> ,server 
> = 
> greenmail 
> ,client 
> = 
> javamail 
> ,layout 
> = 
> flat 
> ,endpoint 
> = 
> axis 
> (org 
> .apache 
> .synapse 
> .transport.testkit.tests.echo.XMLRequestResponseMessageTestCase)
>    
> 0034 
> :test 
> = 
> AsyncTextPlain 
> ,data 
> = 
> ASCII 
> ,client 
> = 
> java 
> .net 
> ,endpoint 
> = 
> axis 
> (org.apache.synapse.transport.testkit.tests.async.TextPlainTestCase)
>    
> 0035 
> :test 
> = 
> AsyncTextPlain 
> ,data 
> = 
> UTF8 
> ,client 
> = 
> java 
> .net 
> ,endpoint 
> = 
> axis 
> (org.apache.synapse.transport.testkit.tests.async.TextPlainTestCase)
>    
> 0036 
> :test 
> = 
> AsyncTextPlain 
> ,data 
> = 
> Latin1 
> ,client 
> = 
> java 
> .net 
> ,endpoint 
> = 
> axis 
> (org.apache.synapse.transport.testkit.tests.async.TextPlainTestCase)
>    
> 0043 
> :test 
> = 
> AsyncBinary 
> ,client 
> = 
> java 
> .net 
> ,endpoint 
> =axis(org.apache.synapse.transport.testkit.tests.async.BinaryTestCase)
>    
> 0046 
> :test 
> = 
> REST 
> ,client 
> = 
> java 
> .net 
> ,endpoint 
> =axis(org.apache.synapse.transport.testkit.tests.async.RESTTestCase)
>
> I need to look a bit into the email tests to figure out what went  
> wrong.. Have you seen this (log attached)? Anyway, I will update the  
> code to be better compliant with the latest trunk changes next week.
>
> asankha
>
> -- 
> Asankha C. Perera
>
> WSO2 - http://wso2.org
> http://esbmagic.blogspot.com
>
> -------------------------------------------------------------------------------
> Test set: org.apache.synapse.transport.mail.MailTransportListenerTest
> -------------------------------------------------------------------------------
> Tests run: 32, Failures: 0, Errors: 2, Skipped: 0, Time elapsed:  
> 11.475 sec <<< FAILURE!
> 0025 
> :test 
> = 
> AsyncXML 
> ,data 
> = 
> UTF8 
> ,messageType 
> = 
> SOAP12 
> ,server 
> = 
> greenmail 
> ,client 
> = 
> javamail 
> ,layout 
> = 
> multipart 
> ,endpoint 
> = 
> axis 
> (org 
> .apache 
> .synapse.transport.testkit.tests.async.XMLAsyncMessageTestCase)   
> Time elapsed: 0.154 sec  <<< ERROR!
> javax.mail.MessagingException: Could not connect to SMTP host:  
> localhost, port: 7025;
>  nested exception is:
> 	java.net.ConnectException: Connection refused
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java: 
> 1282)
> 	at  
> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java: 
> 370)
> 	at javax.mail.Service.connect(Service.java:275)
> 	at javax.mail.Service.connect(Service.java:156)
> 	at javax.mail.Service.connect(Service.java:105)
> 	at javax.mail.Transport.send0(Transport.java:168)
> 	at javax.mail.Transport.send(Transport.java:98)
> 	at  
> org 
> .apache 
> .synapse.transport.mail.MailClient.sendMessage(MailClient.java:83)
> 	at  
> org 
> .apache 
> .synapse 
> .transport.mail.MailAsyncClient.sendMessage(MailAsyncClient.java:33)
> 	at  
> org 
> .apache 
> .synapse 
> .transport.mail.MailAsyncClient.sendMessage(MailAsyncClient.java:27)
> 	at  
> org 
> .apache 
> .synapse 
> .transport 
> .testkit 
> .client 
> .AsyncTestClientAdapter.sendMessage(AsyncTestClientAdapter.java:45)
> 	at  
> org 
> .apache 
> .synapse 
> .transport 
> .testkit 
> .tests.async.AsyncMessageTestCase.runTest(AsyncMessageTestCase.java: 
> 49)
> 	at junit.framework.TestCase.runBare(TestCase.java:130)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:120)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:230)
> 	at junit.framework.TestSuite.run(TestSuite.java:225)
> 	at  
> org 
> .apache 
> .synapse 
> .transport.testkit.TransportTestSuite.run(TransportTestSuite.java:192)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at  
> org 
> .apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java: 
> 213)
> 	at  
> org 
> .apache 
> .maven 
> .surefire 
> .suite 
> .AbstractDirectoryTestSuite 
> .executeTestSet(AbstractDirectoryTestSuite.java:138)
> 	at  
> org 
> .apache 
> .maven 
> .surefire 
> .suite 
> .AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java: 
> 125)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at  
> org 
> .apache 
> .maven 
> .surefire 
> .booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
> 	at  
> org 
> .apache 
> .maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
> Caused by: java.net.ConnectException: Connection refused
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> 	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java: 
> 195)
> 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> 	at java.net.Socket.connect(Socket.java:520)
> 	at java.net.Socket.connect(Socket.java:470)
> 	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java: 
> 232)
> 	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java: 
> 1250)
> 	... 33 more
> 	... 33 more
>
> 0032 
> :test 
> = 
> EchoXML 
> ,data 
> = 
> UTF8 
> ,messageType 
> = 
> POX 
> ,server 
> = 
> greenmail 
> ,client 
> = 
> javamail 
> ,layout 
> = 
> flat 
> ,endpoint 
> = 
> axis 
> (org 
> .apache 
> .synapse 
> .transport.testkit.tests.echo.XMLRequestResponseMessageTestCase)   
> Time elapsed: 0.03 sec  <<< ERROR!
> java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.apache.synapse.transport.testkit.tests.TestResource 
> $Initializer.execute(TestResource.java:48)
> 	at  
> org 
> .apache 
> .synapse 
> .transport.testkit.tests.TestResource.setUp(TestResource.java:154)
> 	at  
> org 
> .apache 
> .synapse 
> .transport.testkit.tests.TestResourceSet.setUp(TestResourceSet.java: 
> 152)
> 	at  
> org 
> .apache 
> .synapse 
> .transport.testkit.tests.TestResourceSet.setUp(TestResourceSet.java: 
> 133)
> 	at  
> org 
> .apache 
> .synapse 
> .transport 
> .testkit.tests.TransportTestCase.setUp(TransportTestCase.java:107)
> 	at junit.framework.TestCase.runBare(TestCase.java:128)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:120)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:230)
> 	at junit.framework.TestSuite.run(TestSuite.java:225)
> 	at  
> org 
> .apache 
> .synapse 
> .transport.testkit.TransportTestSuite.run(TransportTestSuite.java:192)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at  
> org 
> .apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java: 
> 213)
> 	at  
> org 
> .apache 
> .maven 
> .surefire 
> .suite 
> .AbstractDirectoryTestSuite 
> .executeTestSet(AbstractDirectoryTestSuite.java:138)
> 	at  
> org 
> .apache 
> .maven 
> .surefire 
> .suite 
> .AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java: 
> 125)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at  
> org 
> .apache 
> .maven 
> .surefire 
> .booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
> 	at  
> org 
> .apache 
> .maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
> Caused by: javax.mail.MessagingException: Connect failed;
>  nested exception is:
> 	java.net.ConnectException: Connection refused
> 	at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:148)
> 	at javax.mail.Service.connect(Service.java:275)
> 	at javax.mail.Service.connect(Service.java:156)
> 	at javax.mail.Service.connect(Service.java:176)
> 	at  
> org 
> .apache 
> .synapse 
> .transport 
> .mail.MailRequestResponseClient.setUp(MailRequestResponseClient.java: 
> 54)
> 	... 31 more
> Caused by: java.net.ConnectException: Connection refused
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> 	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java: 
> 195)
> 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> 	at java.net.Socket.connect(Socket.java:520)
> 	at java.net.Socket.connect(Socket.java:470)
> 	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java: 
> 232)
> 	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
> 	at com.sun.mail.pop3.Protocol.<init>(Protocol.java:81)
> 	at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:201)
> 	at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:144)
> 	... 35 more
> 	... 35 more
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: svn commit: r694732 - in /synapse/trunk/java/modules: core/src/main/java/org/apache/synapse/util/ transports/src/main/java/org/apache/synapse/transport/mail/

Posted by "Asankha C. Perera" <as...@wso2.com>.
Andreas
> 1) The change to MessageHelper seems to be related SYNAPSE-309. This 
> should have been fixed in AXIOM. In which case is there an exception?
Sorry I did this off the 1.2 codebase, and thus missed the change in the 
latest Axiom snapshot
> 2) Why do we need an action "LEAVE" for a polling transport?
To not delete or move after processing or failure. For example, if 
something goes wrong during processing one may want to leave that mail 
intact on the inbox
> 3) We already had support for multipart/mixed. It had some serious 
> problems, but now all the unit tests for multipart/mixed that worked 
> before no longer work. This is a big regression. Worse, this 
> regression breaks the interoperability between MailTransportSender and 
> MailTransportListener when transport.mail.Format is set to Multipart 
> (I will commit unit tests for this). This needs to be corrected or 
> reverted ASAP since now the build fails because of test failures.
I reverted my last commit locally, and reran with the latest tests, but 
they still fail..

Tests in error:
  
0025:test=AsyncXML,data=UTF8,messageType=SOAP12,server=greenmail,client=javamail,layout=multipart,endpoint=axis(org.apache.synapse.transport.testkit.tests.async.XMLAsyncMessageTestCase)
  
0032:test=EchoXML,data=UTF8,messageType=POX,server=greenmail,client=javamail,layout=flat,endpoint=axis(org.apache.synapse.transport.testkit.tests.echo.XMLRequestResponseMessageTestCase)
  
0034:test=AsyncTextPlain,data=ASCII,client=java.net,endpoint=axis(org.apache.synapse.transport.testkit.tests.async.TextPlainTestCase)
  
0035:test=AsyncTextPlain,data=UTF8,client=java.net,endpoint=axis(org.apache.synapse.transport.testkit.tests.async.TextPlainTestCase)
  
0036:test=AsyncTextPlain,data=Latin1,client=java.net,endpoint=axis(org.apache.synapse.transport.testkit.tests.async.TextPlainTestCase)
  
0043:test=AsyncBinary,client=java.net,endpoint=axis(org.apache.synapse.transport.testkit.tests.async.BinaryTestCase)
  
0046:test=REST,client=java.net,endpoint=axis(org.apache.synapse.transport.testkit.tests.async.RESTTestCase)

I need to look a bit into the email tests to figure out what went 
wrong.. Have you seen this (log attached)? Anyway, I will update the 
code to be better compliant with the latest trunk changes next week.

asankha

-- 
Asankha C. Perera

WSO2 - http://wso2.org
http://esbmagic.blogspot.com