Coverage Report - org.mule.config.spring.parsers.assembly.AbstractMapBeanAssembler
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractMapBeanAssembler
0%
0/15
0%
0/2
1.5
 
 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.assembly;
 8  
 
 9  
 import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration;
 10  
 import org.mule.util.MapCombiner;
 11  
 
 12  
 import java.util.Iterator;
 13  
 import java.util.List;
 14  
 import java.util.Map;
 15  
 
 16  
 import org.springframework.beans.PropertyValue;
 17  
 import org.springframework.beans.factory.config.BeanDefinition;
 18  
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 19  
 import org.springframework.beans.factory.support.ManagedList;
 20  
 import org.springframework.beans.factory.support.ManagedMap;
 21  
 
 22  
 public abstract class AbstractMapBeanAssembler extends DefaultBeanAssembler
 23  
 {
 24  
 
 25  
     public AbstractMapBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean,
 26  
                                     PropertyConfiguration targetConfig, BeanDefinition target)
 27  
     {
 28  0
         super(beanConfig, bean, targetConfig, target);
 29  0
     }
 30  
 
 31  
     protected void insertDefinitionAsMap(String oldName)
 32  
     {
 33  0
         BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(MapCombiner.class);
 34  0
         Map map = new ManagedMap();
 35  0
         for (Iterator pvs = getBean().getBeanDefinition().getPropertyValues().getPropertyValueList().iterator();
 36  0
              pvs.hasNext();)
 37  
         {
 38  0
             PropertyValue pv = (PropertyValue) pvs.next();
 39  0
             map.put(pv.getName(), pv.getValue());
 40  0
         }
 41  0
         List list = new ManagedList();
 42  0
         list.add(map);
 43  0
         builder.addPropertyValue(MapCombiner.LIST, list);
 44  0
         setBean(builder);
 45  0
         super.insertBeanInTarget(oldName);
 46  0
     }
 47  
 
 48  
 }