Coverage Report - org.mule.samples.voipservice.service.SyncVoipBroker
 
Classes in this File Line Coverage Branch Coverage Complexity
SyncVoipBroker
0%
0/18
0%
0/2
2
 
 1  
 /*
 2  
  * $Id: SyncVoipBroker.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 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.samples.voipservice.service;
 12  
 
 13  
 import org.mule.impl.MuleMessage;
 14  
 import org.mule.impl.RequestContext;
 15  
 import org.mule.samples.voipservice.interfaces.AddressValidation;
 16  
 import org.mule.samples.voipservice.to.CreditProfileTO;
 17  
 import org.mule.samples.voipservice.to.ServiceParamTO;
 18  
 import org.mule.umo.UMOEventContext;
 19  
 import org.mule.umo.UMOMessage;
 20  
 
 21  
 import java.util.HashMap;
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 import org.apache.commons.logging.Log;
 26  
 import org.apache.commons.logging.LogFactory;
 27  
 
 28  0
 public class SyncVoipBroker
 29  
 {
 30  
 
 31  0
     protected static transient Log logger = LogFactory.getLog(SyncVoipBroker.class);
 32  
 
 33  
     public UMOMessage validate(ServiceParamTO serviceParamTO) throws Exception
 34  
     {
 35  
 
 36  0
         logger.info("Inside Method : " + serviceParamTO);
 37  
 
 38  0
         UMOMessage msg = null;
 39  0
         List endPoints = null;
 40  0
         UMOEventContext umoEventContext = RequestContext.getEventContext();
 41  0
         UMOMessage umoMessage = umoEventContext.sendEvent(serviceParamTO.getCustomer().getAddress());
 42  0
         Integer isValidAddress = (Integer)umoMessage.getPayload();
 43  0
         if (isValidAddress.intValue() == AddressValidation.SUCCESS)
 44  
         {
 45  0
             umoMessage = umoEventContext.sendEvent(serviceParamTO.getCreditCard().getCardType());
 46  0
             endPoints = (List)umoMessage.getPayload();
 47  0
             logger.info("Inside Method : isValidAddress = " + isValidAddress + "; endPoints = " + endPoints);
 48  0
             Map props = new HashMap();
 49  0
             props.put("recipients", endPoints);
 50  0
             msg = new MuleMessage(new CreditProfileTO(serviceParamTO.getCustomer()), props);
 51  0
             umoEventContext.dispatchEvent(msg);
 52  0
             umoEventContext.setStopFurtherProcessing(true);
 53  
         }
 54  0
         return msg;
 55  
     }
 56  
 }