camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [2/2] camel git commit: Fixed CS
Date Sun, 12 Jul 2015 10:40:15 GMT
Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/88fca852
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/88fca852
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/88fca852

Branch: refs/heads/master
Commit: 88fca852fcb327c0756aa805d16f1d899e0fb34e
Parents: 52495d3
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Sun Jul 12 12:36:15 2015 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Sun Jul 12 12:38:51 2015 +0200

----------------------------------------------------------------------
 .../camel/component/aws/ses/SesProducer.java    |  26 +-
 .../camel/component/aws/ses/MockMessage.java    | 392 +++++++++----------
 .../aws/ses/SesComponentSpringTest.java         |   3 +-
 3 files changed, 205 insertions(+), 216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/88fca852/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
index f5ecaf2..7944ddb 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
@@ -53,21 +53,21 @@ public class SesProducer extends DefaultProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-    	if (!(exchange.getIn().getBody() instanceof javax.mail.Message)) {
-    		SendEmailRequest request = createMailRequest(exchange);
+        if (!(exchange.getIn().getBody() instanceof javax.mail.Message)) {
+            SendEmailRequest request = createMailRequest(exchange);
             log.trace("Sending request [{}] from exchange [{}]...", request, exchange); 
          
             SendEmailResult result = getEndpoint().getSESClient().sendEmail(request);
             log.trace("Received result [{}]", result);
             Message message = getMessageForResponse(exchange);
             message.setHeader(SesConstants.MESSAGE_ID, result.getMessageId());
-    	} else {
-    		SendRawEmailRequest request = createRawMailRequest(exchange);
+        } else {
+            SendRawEmailRequest request = createRawMailRequest(exchange);
             log.trace("Sending request [{}] from exchange [{}]...", request, exchange); 
          
             SendRawEmailResult result = getEndpoint().getSESClient().sendRawEmail(request);
             log.trace("Received result [{}]", result);
             Message message = getMessageForResponse(exchange);
             message.setHeader(SesConstants.MESSAGE_ID, result.getMessageId());
-    	}
+        }
     }
 
     private SendEmailRequest createMailRequest(Exchange exchange) {
@@ -82,7 +82,7 @@ public class SesProducer extends DefaultProducer {
     }
     
     private SendRawEmailRequest createRawMailRequest(Exchange exchange) {
-    	SendRawEmailRequest request = new SendRawEmailRequest();
+        SendRawEmailRequest request = new SendRawEmailRequest();
         request.setSource(determineFrom(exchange));
         request.setDestinations(determineRawTo(exchange));
         request.setRawMessage(createRawMessage(exchange));
@@ -105,14 +105,14 @@ public class SesProducer extends DefaultProducer {
     private com.amazonaws.services.simpleemail.model.RawMessage createRawMessage(Exchange
exchange) {
         com.amazonaws.services.simpleemail.model.RawMessage message = new com.amazonaws.services.simpleemail.model.RawMessage();
         javax.mail.Message content = exchange.getIn().getBody(javax.mail.Message.class);
-        OutputStream byteOutput=new ByteArrayOutputStream();
+        OutputStream byteOutput = new ByteArrayOutputStream();
         try {
-			content.writeTo(byteOutput);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-        byte[] messageByteArray=((ByteArrayOutputStream)byteOutput).toByteArray();
+            content.writeTo(byteOutput);
+        } catch (Exception e) {
+            log.error("Cannot write to byte Array");
+            e.printStackTrace();
+        }
+        byte[] messageByteArray = ((ByteArrayOutputStream)byteOutput).toByteArray();
         message.setData(ByteBuffer.wrap(messageByteArray));
         return message;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/88fca852/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
index 5e4e0db..0d9cdef 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
@@ -31,205 +31,195 @@ import javax.mail.Multipart;
 
 public class MockMessage extends Message {
 
-	@Override
-	public int getSize() throws MessagingException {
-		return 0;
-	}
-
-	@Override
-	public int getLineCount() throws MessagingException {
-		return 0;
-	}
-
-	@Override
-	public String getContentType() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public boolean isMimeType(String mimeType) throws MessagingException {
-		return false;
-	}
-
-	@Override
-	public String getDisposition() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setDisposition(String disposition) throws MessagingException {		
-	}
-
-	@Override
-	public String getDescription() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setDescription(String description) throws MessagingException {
-	}
-
-	@Override
-	public String getFileName() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setFileName(String filename) throws MessagingException {
-	}
-
-	@Override
-	public InputStream getInputStream() throws IOException, MessagingException {
-		return null;
-	}
-
-	@Override
-	public DataHandler getDataHandler() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public Object getContent() throws IOException, MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setDataHandler(DataHandler dh) throws MessagingException {
-	}
-
-	@Override
-	public void setContent(Object obj, String type) throws MessagingException {
-	}
-
-	@Override
-	public void setText(String text) throws MessagingException {
-	}
-
-	@Override
-	public void setContent(Multipart mp) throws MessagingException {	
-	}
-
-	@Override
-	public void writeTo(OutputStream os) throws IOException, MessagingException {		
-	}
-
-	@Override
-	public String[] getHeader(String header_name) throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setHeader(String header_name, String header_value)
-			throws MessagingException {
-	}
-
-	@Override
-	public void addHeader(String header_name, String header_value)
-			throws MessagingException {
-		// TODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public void removeHeader(String header_name) throws MessagingException {
-	}
-
-	@Override
-	public Enumeration getAllHeaders() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public Enumeration getMatchingHeaders(String[] header_names)
-			throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public Enumeration getNonMatchingHeaders(String[] header_names)
-			throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public Address[] getFrom() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setFrom() throws MessagingException {
-		// TODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public void setFrom(Address address) throws MessagingException {	
-	}
-
-	@Override
-	public void addFrom(Address[] addresses) throws MessagingException {		
-	}
-
-	@Override
-	public Address[] getRecipients(RecipientType type)
-			throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setRecipients(RecipientType type, Address[] addresses)
-			throws MessagingException {
-	}
-
-	@Override
-	public void addRecipients(RecipientType type, Address[] addresses)
-			throws MessagingException {
-		// TODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public String getSubject() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setSubject(String subject) throws MessagingException {
-		// TODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public Date getSentDate() throws MessagingException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void setSentDate(Date date) throws MessagingException {		
-	}
-
-	@Override
-	public Date getReceivedDate() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public Flags getFlags() throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void setFlags(Flags flag, boolean set) throws MessagingException {		
-	}
-
-	@Override
-	public Message reply(boolean replyToAll) throws MessagingException {
-		return null;
-	}
-
-	@Override
-	public void saveChanges() throws MessagingException {		
-	}
-
+    @Override
+    public int getSize() throws MessagingException {
+        return 0;
+    }
+
+    @Override
+    public int getLineCount() throws MessagingException {
+        return 0;
+    }
+
+    @Override
+    public String getContentType() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public boolean isMimeType(String mimeType) throws MessagingException {
+        return false;
+    }
+
+    @Override
+    public String getDisposition() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setDisposition(String disposition) throws MessagingException {
+    }
+
+    @Override
+    public String getDescription() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setDescription(String description) throws MessagingException {
+    }
+
+    @Override
+    public String getFileName() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setFileName(String filename) throws MessagingException {
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException, MessagingException {
+        return null;
+    }
+
+    @Override
+    public DataHandler getDataHandler() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public Object getContent() throws IOException, MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setDataHandler(DataHandler dh) throws MessagingException {
+    }
+
+    @Override
+    public void setContent(Object obj, String type) throws MessagingException {
+    }
+
+    @Override
+    public void setText(String text) throws MessagingException {
+    }
+    
+    @Override
+    public void setContent(Multipart mp) throws MessagingException {
+    }
+
+    @Override
+    public void writeTo(OutputStream os) throws IOException, MessagingException {
+    }
+
+    @Override
+    public String[] getHeader(String headername) throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setHeader(String headername, String headervalue)
+        throws MessagingException {
+    }
+
+    @Override
+    public void addHeader(String headername, String headervalue)
+        throws MessagingException {
+    }
+
+    @Override
+    public void removeHeader(String headername) throws MessagingException {
+    }
+
+    @Override
+    public Enumeration getAllHeaders() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public Enumeration getMatchingHeaders(String[] headernames)
+        throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public Enumeration getNonMatchingHeaders(String[] headernames)
+        throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public Address[] getFrom() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setFrom() throws MessagingException {
+    }
+
+    @Override
+    public void setFrom(Address address) throws MessagingException {
+    }
+
+    @Override
+    public void addFrom(Address[] addresses) throws MessagingException {
+    }
+
+    @Override
+    public Address[] getRecipients(RecipientType type)
+        throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setRecipients(RecipientType type, Address[] addresses)
+        throws MessagingException {
+    }
+
+    @Override
+    public void addRecipients(RecipientType type, Address[] addresses)
+        throws MessagingException {
+    }
+
+    @Override
+    public String getSubject() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setSubject(String subject) throws MessagingException {
+    }
+
+    @Override
+    public Date getSentDate() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setSentDate(Date date) throws MessagingException {
+    }
+
+    @Override
+    public Date getReceivedDate() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public Flags getFlags() throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void setFlags(Flags flag, boolean set) throws MessagingException {
+    }
+
+    @Override
+    public Message reply(boolean replyToAll) throws MessagingException {
+        return null;
+    }
+
+    @Override
+    public void saveChanges() throws MessagingException {
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/88fca852/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentSpringTest.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentSpringTest.java
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentSpringTest.java
index 4b736c6..d087d24 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentSpringTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentSpringTest.java
@@ -83,8 +83,7 @@ public class SesComponentSpringTest extends CamelSpringTestSupport {
     
     @Test
     public void sendRawMessage() throws Exception {
-        final MockMessage mess = new MockMessage();
-    	  
+        final MockMessage mess = new MockMessage();  
         Exchange exchange = template.request("direct:start", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {


Mime
View raw message