Coverage Report - org.mule.context.notification.ComponentMessageNotification
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentMessageNotification
0%
0/12
N/A
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.context.notification;
 8  
 
 9  
 import org.mule.api.MuleMessage;
 10  
 import org.mule.api.component.Component;
 11  
 import org.mule.api.construct.FlowConstruct;
 12  
 import org.mule.api.context.notification.ServerNotification;
 13  
 
 14  
 /**
 15  
  * These notifications are fired when before and after a service component is
 16  
  * invoked.
 17  
  */
 18  0
 public class ComponentMessageNotification extends ServerNotification
 19  
 {
 20  
 
 21  
     private static final long serialVersionUID = -6369685122731797646L;
 22  
 
 23  
     public static final int COMPONENT_PRE_INVOKE = COMPONENT_EVENT_ACTION_START_RANGE + 1;
 24  
     public static final int COMPONENT_POST_INVOKE = COMPONENT_EVENT_ACTION_START_RANGE + 2;
 25  
 
 26  
     static
 27  
     {
 28  0
         registerAction("component pre invoke", COMPONENT_PRE_INVOKE);
 29  0
         registerAction("component post invoke", COMPONENT_POST_INVOKE);
 30  0
     }
 31  
 
 32  
     /**
 33  
      * @param message
 34  
      * @param action
 35  
      */
 36  
     public ComponentMessageNotification(MuleMessage message, Component component, FlowConstruct flowConstruct, int action)
 37  
     {
 38  0
         super(cloneMessage(message), action);
 39  0
         resourceIdentifier = flowConstruct.getName();
 40  
 
 41  0
     }
 42  
 
 43  
     @Override
 44  
     protected String getPayloadToString()
 45  
     {
 46  0
        return ((MuleMessage) source).getPayloadForLogging();
 47  
     }
 48  
 
 49  
     /**
 50  
      * @return the message
 51  
      */
 52  
     public String getServiceName()
 53  
     {
 54  0
         return resourceIdentifier;
 55  
     }
 56  
 
 57  
     @Override
 58  
     public String toString()
 59  
     {
 60  0
         return EVENT_NAME + "{action=" + getActionName(action) + ", message: " + source + ", resourceId="
 61  
                + resourceIdentifier + ", timestamp=" + timestamp + ", serverId=" + serverId + ", component: "
 62  
                + "}";
 63  
     }
 64  
 
 65  
     @Override
 66  
     public String getType()
 67  
     {
 68  0
         return "trace"; 
 69  
     }
 70  
 
 71  
     @Override
 72  
     public MuleMessage getSource()
 73  
     {
 74  0
         return (MuleMessage) super.getSource();
 75  
     }
 76  
 }