Coverage Report - org.apache.camel.component.mail.MailExchange
 
Classes in this File Line Coverage Branch Coverage Complexity
MailExchange
87% 
N/A 
0
 
 1  
 /**
 2  
  *
 3  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 4  
  * contributor license agreements.  See the NOTICE file distributed with
 5  
  * this work for additional information regarding copyright ownership.
 6  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 7  
  * (the "License"); you may not use this file except in compliance with
 8  
  * the License.  You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.camel.component.mail;
 19  
 
 20  
 import org.apache.camel.CamelContext;
 21  
 import org.apache.camel.Exchange;
 22  
 import org.apache.camel.impl.DefaultExchange;
 23  
 
 24  
 import javax.mail.Message;
 25  
 
 26  
 /**
 27  
  * Represents an {@ilnk Exchange} for working with Mail
 28  
  *
 29  
  * @version $Revision:520964 $
 30  
  */
 31  22
 public class MailExchange extends DefaultExchange {
 32  
     private MailBinding binding;
 33  
 
 34  
     public MailExchange(CamelContext context, MailBinding binding) {
 35  7
         super(context);
 36  7
         this.binding = binding;
 37  7
     }
 38  
 
 39  
     public MailExchange(CamelContext context, MailBinding binding, Message message) {
 40  6
         this(context, binding);
 41  6
         setIn(new MailMessage(message));
 42  6
     }
 43  
 
 44  
     @Override
 45  
     public MailMessage getIn() {
 46  21
         return (MailMessage) super.getIn();
 47  
     }
 48  
 
 49  
     @Override
 50  
     public MailMessage getOut() {
 51  1
         return (MailMessage) super.getOut();
 52  
     }
 53  
 
 54  
     @Override
 55  
     public MailMessage getOut(boolean lazyCreate) {
 56  1
         return (MailMessage) super.getOut(lazyCreate);
 57  
     }
 58  
 
 59  
     @Override
 60  
     public MailMessage getFault() {
 61  0
         return (MailMessage) super.getFault();
 62  
     }
 63  
 
 64  
     public MailBinding getBinding() {
 65  6
         return binding;
 66  
     }
 67  
 
 68  
     @Override
 69  
     public Exchange newInstance() {
 70  0
         return new MailExchange(getContext(), binding);
 71  
     }
 72  
 
 73  
     // Expose Email APIs
 74  
     //-------------------------------------------------------------------------
 75  
 
 76  
     // Implementation methods
 77  
     //-------------------------------------------------------------------------
 78  
 
 79  
     @Override
 80  
     protected MailMessage createInMessage() {
 81  1
         return new MailMessage();
 82  
     }
 83  
 
 84  
     @Override
 85  
     protected MailMessage createOutMessage() {
 86  1
         return new MailMessage();
 87  
     }
 88  
 }