Coverage Report - org.mule.module.launcher.StartupSummaryDeploymentListener
 
Classes in this File Line Coverage Branch Coverage Complexity
StartupSummaryDeploymentListener
0%
0/19
0%
0/6
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.module.launcher;
 8  
 
 9  
 import java.util.Map;
 10  
 
 11  
 import org.apache.commons.logging.Log;
 12  
 import org.apache.commons.logging.LogFactory;
 13  
 
 14  
 /**
 15  
  * Prints application status summary table on Mule startup.
 16  
  */
 17  
 public class StartupSummaryDeploymentListener implements DeploymentService.StartupListener
 18  
 {
 19  0
     protected transient final Log logger = LogFactory.getLog(getClass());
 20  
 
 21  
     protected DeploymentStatusTracker tracker;
 22  
 
 23  
     public StartupSummaryDeploymentListener(DeploymentStatusTracker tracker)
 24  0
     {
 25  0
         this.tracker = tracker;
 26  0
     }
 27  
 
 28  
     public void onAfterStartup()
 29  
     {
 30  0
         if (!logger.isInfoEnabled())
 31  
         {
 32  0
             return;
 33  
         }
 34  
 
 35  0
         Map<String, DeploymentStatusTracker.DeploymentState> applicationStates = tracker.getDeploymentStates();
 36  
 
 37  0
         if (applicationStates.isEmpty())
 38  
         {
 39  0
             return;
 40  
         }
 41  
 
 42  0
         SimpleLoggingTable applicationTable = new SimpleLoggingTable();
 43  0
         applicationTable.addColumn("APPLICATION", 45);
 44  0
         applicationTable.addColumn("STATUS", 18);
 45  
 
 46  0
         for (String app : applicationStates.keySet())
 47  
         {
 48  0
             String[] data = new String[] {app, applicationStates.get(app).toString()};
 49  0
             applicationTable.addDataRow(data);
 50  0
         }
 51  
 
 52  0
         String message = String.format("%n%n%s", applicationTable);
 53  
 
 54  0
         logger.info(message);
 55  0
     }
 56  
 }