Coverage Report - org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleOrphanDefinitionParser
0%
0/9
0%
0/2
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.generic;
 8  
 
 9  
 import org.mule.config.spring.util.SpringXMLUtils;
 10  
 
 11  
 import org.springframework.beans.factory.support.AbstractBeanDefinition;
 12  
 import org.springframework.beans.factory.xml.ParserContext;
 13  
 import org.w3c.dom.Element;
 14  
 
 15  
 /**
 16  
  * A parser for direct children of the <mule> element.
 17  
  */
 18  
 public class MuleOrphanDefinitionParser extends OrphanDefinitionParser
 19  
 {
 20  
     /**
 21  
      * This constructor assumes that the class name will be explicitly specified as
 22  
      * an attribute on the element.
 23  
      */
 24  
     public MuleOrphanDefinitionParser(boolean singleton)
 25  
     {
 26  0
         super(singleton);
 27  0
     }
 28  
 
 29  
     public MuleOrphanDefinitionParser(Class<?> beanClass, boolean singleton)
 30  
     {
 31  0
         super(beanClass, singleton);
 32  0
     }
 33  
 
 34  
     @Override
 35  
     protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext)
 36  
     {
 37  0
         assertMuleParent(element);
 38  0
         return super.parseInternal(element, parserContext);
 39  
     }
 40  
 
 41  
     protected void assertMuleParent(Element element)
 42  
     {
 43  0
         if (!isTopLevel(element))
 44  
         {
 45  0
             throw new IllegalStateException("This element should be embedded inside the Mule <"
 46  
                     + ROOT_ELEMENT + "> element: " + SpringXMLUtils.elementToString(element));
 47  
         }
 48  0
     }
 49  
 }