Coverage Report - org.mule.config.spring.parsers.specific.MessageEnricherDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageEnricherDefinitionParser
0%
0/12
0%
0/4
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.config.spring.parsers.specific;
 8  
 
 9  
 import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
 10  
 import org.mule.enricher.MessageEnricher.EnrichExpressionPair;
 11  
 import org.mule.util.StringUtils;
 12  
 
 13  
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 14  
 import org.springframework.beans.factory.support.GenericBeanDefinition;
 15  
 import org.springframework.beans.factory.support.ManagedList;
 16  
 import org.springframework.beans.factory.xml.ParserContext;
 17  
 import org.w3c.dom.Element;
 18  
 
 19  
 public class MessageEnricherDefinitionParser extends ChildDefinitionParser
 20  
 {
 21  
 
 22  
     public MessageEnricherDefinitionParser(String setterMethod, Class clazz)
 23  
     {
 24  0
         super(setterMethod, clazz);
 25  0
     }
 26  
 
 27  
     @Override
 28  
     protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder)
 29  
     {
 30  0
         if (!StringUtils.isEmpty(element.getAttribute("source")) || !StringUtils.isEmpty(element.getAttribute("target")))
 31  
         {
 32  0
             GenericBeanDefinition objectFactoryBeanDefinition = new GenericBeanDefinition();
 33  0
             objectFactoryBeanDefinition.setBeanClass(EnrichExpressionPair.class);
 34  0
             objectFactoryBeanDefinition.getPropertyValues().addPropertyValue("source",
 35  
                 element.getAttribute("source"));
 36  0
             objectFactoryBeanDefinition.getPropertyValues().addPropertyValue("target",
 37  
                 element.getAttribute("target"));
 38  0
             ManagedList<GenericBeanDefinition> list = new ManagedList<GenericBeanDefinition>();
 39  0
             list.add(objectFactoryBeanDefinition);
 40  0
             builder.addPropertyValue("enrichExpressionPairs", list);
 41  
         }
 42  
 
 43  0
         super.parseChild(element, parserContext, builder);
 44  0
     }
 45  
 }