Coverage Report - org.mule.transport.soap.axis.extras.AxisCleanAndAddProperties
 
Classes in this File Line Coverage Branch Coverage Complexity
AxisCleanAndAddProperties
89%
8/9
81%
13/16
3
 
 1  
 /*
 2  
  * $Id: AxisCleanAndAddProperties.java 10489 2008-01-23 17:53:38Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.transport.soap.axis.extras;
 12  
 
 13  
 import org.mule.api.MuleEventContext;
 14  
 import org.mule.api.MuleMessage;
 15  
 import org.mule.api.config.MuleProperties;
 16  
 import org.mule.transport.http.HttpConnector;
 17  
 import org.mule.transport.http.HttpConstants;
 18  
 import org.mule.transport.soap.SoapConstants;
 19  
 import org.mule.transport.soap.axis.AxisConnector;
 20  
 import org.mule.util.StringUtils;
 21  
 
 22  
 import java.util.HashMap;
 23  
 import java.util.Iterator;
 24  
 import java.util.Map;
 25  
 
 26  0
 public class AxisCleanAndAddProperties
 27  
 {
 28  
     
 29  
     // add all custom headers, filter out all mule headers (such as
 30  
     // MULE_SESSION) except
 31  
     // for MULE_USER header. Filter out other headers like "soapMethods" and
 32  
     // MuleProperties.MULE_METHOD_PROPERTY and "soapAction"
 33  
     // and also filter out any http related header
 34  
     
 35  
     public static Map cleanAndAdd(MuleEventContext muleEventContext){
 36  
         
 37  304
         Map props = new HashMap();
 38  304
         MuleMessage currentMessage = muleEventContext.getMessage();
 39  
 
 40  304
         for (Iterator iterator = currentMessage.getPropertyNames().iterator(); iterator.hasNext();)
 41  
         {
 42  2470
             String name = (String)iterator.next();
 43  2470
             if (!StringUtils.equals(name, AxisConnector.SOAP_METHODS)
 44  
                 && !StringUtils.equals(name, SoapConstants.SOAP_ACTION_PROPERTY)
 45  
                 && !StringUtils.equals(name, MuleProperties.MULE_METHOD_PROPERTY)
 46  
                 && (!name.startsWith(MuleProperties.PROPERTY_PREFIX) || StringUtils.equals(name,
 47  
                     MuleProperties.MULE_USER_PROPERTY))
 48  
                 && !HttpConstants.ALL_HEADER_NAMES.containsValue(name)
 49  
                 && !StringUtils.equals(name, HttpConnector.HTTP_STATUS_PROPERTY))
 50  
             {
 51  970
                 props.put(name, currentMessage.getProperty(name));
 52  
             }
 53  2470
         }
 54  304
         return props;
 55  
     }
 56  
 }