Coverage Report - org.mule.transport.bpm.jbpm.actions.ValidateMessageSource
 
Classes in this File Line Coverage Branch Coverage Complexity
ValidateMessageSource
0%
0/7
0%
0/2
3
 
 1  
 /*
 2  
  * $Id: ValidateMessageSource.java 10489 2008-01-23 17:53:38Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.transport.bpm.jbpm.actions;
 12  
 
 13  
 import org.mule.transport.bpm.ProcessConnector;
 14  
 
 15  
 import org.jbpm.JbpmException;
 16  
 import org.jbpm.graph.exe.ExecutionContext;
 17  
 
 18  
 /**
 19  
  * Throws an exception if the message's source is not as expected.
 20  
  * 
 21  
  *  <action class="org.mule.transport.bpm.jbpm.actions.ValidateSource">
 22  
  *     <expectedSource>ERPGateway</expectedSource> 
 23  
  *  </action> 
 24  
  *  <action class="org.mule.transport.bpm.jbpm.actions.ValidateSource">
 25  
  *     <expectedSource>http://localhost:8080/incoming</expectedSource>
 26  
  *  </action>
 27  
  *             
 28  
  * @param expectedSource can be the expected endpoint's "name" or "address"
 29  
  * @throws JbpmException 
 30  
  */
 31  0
 public class ValidateMessageSource extends LoggingActionHandler
 32  
 {
 33  
 
 34  
     private static final long serialVersionUID = 1L;
 35  
 
 36  
     protected String expectedSource;
 37  
 
 38  
     public void execute(ExecutionContext executionContext) throws Exception
 39  
     {
 40  0
         super.execute(executionContext);
 41  0
         String messageSource = (String)executionContext
 42  
             .getVariable(ProcessConnector.PROCESS_VARIABLE_INCOMING_SOURCE);
 43  0
         logger.debug("Validating message source = " + messageSource + ", expected = " + expectedSource);
 44  0
         if (!expectedSource.equalsIgnoreCase(messageSource))
 45  
         {
 46  0
             throw new JbpmException("Incoming message source is " + messageSource + ", expected source is "
 47  
                             + expectedSource);
 48  
         }
 49  0
     }
 50  
 
 51  
 }