Coverage Report - org.mule.context.notification.TransactionNotification
 
Classes in this File Line Coverage Branch Coverage Complexity
TransactionNotification
0%
0/9
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.context.notification.BlockingServerEvent;
 10  
 import org.mule.api.context.notification.ServerNotification;
 11  
 import org.mule.api.transaction.Transaction;
 12  
 
 13  
 public class TransactionNotification extends ServerNotification implements BlockingServerEvent
 14  
 {
 15  
     /**
 16  
      * Serial version
 17  
      */
 18  
     private static final long serialVersionUID = -3245036187011582121L;
 19  
     public static final int TRANSACTION_BEGAN = TRANSACTION_EVENT_ACTION_START_RANGE + 1;
 20  
     public static final int TRANSACTION_COMMITTED = TRANSACTION_EVENT_ACTION_START_RANGE + 2;
 21  
     public static final int TRANSACTION_ROLLEDBACK = TRANSACTION_EVENT_ACTION_START_RANGE + 3;
 22  
 
 23  
     static
 24  
     {
 25  0
         registerAction("begin", TRANSACTION_BEGAN);
 26  0
         registerAction("commit", TRANSACTION_COMMITTED);
 27  0
         registerAction("rollback", TRANSACTION_ROLLEDBACK);
 28  0
     }
 29  
 
 30  
     /**
 31  
      * Ideally, that should've been a transaction's XID, but we'd need to resort to all kinds of reflection tricks to
 32  
      * get it. Still, toString() typically outputs a class name followed by the XID, so that's good enough.
 33  
      */
 34  
     private String transactionStringId;
 35  
 
 36  
     public TransactionNotification(Transaction transaction, int action)
 37  
     {
 38  0
         super(transaction.getId(), action, transaction.getId());
 39  0
         this.transactionStringId = transaction.getId();
 40  0
     }
 41  
 
 42  
     public String getTransactionStringId()
 43  
     {
 44  0
         return this.transactionStringId;
 45  
     }
 46  
 
 47  
     @Override
 48  
     public String toString()
 49  
     {
 50  0
         return EVENT_NAME + "{" + "action=" + getActionName(action) + ", transactionStringId=" + transactionStringId
 51  
                + ", timestamp=" + timestamp + "}";
 52  
     }
 53  
 
 54  
 }