Coverage Report - org.mule.config.spring.util.SystemPropertyInitializingBean
 
Classes in this File Line Coverage Branch Coverage Complexity
SystemPropertyInitializingBean
0%
0/14
0%
0/8
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.util;
 8  
 
 9  
 import org.apache.commons.logging.Log;
 10  
 import org.apache.commons.logging.LogFactory;
 11  
 import org.springframework.beans.factory.InitializingBean;
 12  
 
 13  
 import java.util.Map;
 14  
 
 15  
 /**
 16  
  * Sets system properties from the configured list.
 17  
  */
 18  0
 public class SystemPropertyInitializingBean implements InitializingBean {
 19  
 
 20  0
     protected Log logger = LogFactory.getLog(getClass());
 21  
 
 22  
     private Map<String, String> systemProperties;
 23  
 
 24  
     /**
 25  
      * Sets the system properties
 26  
      */
 27  
     public void afterPropertiesSet() throws Exception {
 28  0
         if (systemProperties == null || systemProperties.isEmpty()) {
 29  0
             return;
 30  
         }
 31  
 
 32  0
         for (Map.Entry<String, String> entry : systemProperties.entrySet()) {
 33  0
             String key = entry.getKey();
 34  0
             String value = systemProperties.get(key);
 35  
 
 36  0
             if (logger.isInfoEnabled()) {
 37  0
                 logger.info(String.format("Setting system property: %s=%s", key, value));
 38  
             }
 39  
 
 40  0
             System.setProperty(key, value);
 41  
 
 42  0
         }
 43  0
     }
 44  
 
 45  
     public void setSystemProperties(Map<String, String> systemProperties) {
 46  0
         this.systemProperties = systemProperties;
 47  0
     }
 48  
 }