Coverage Report - org.mule.example.loanbroker.esb.CreditAgencyGateway
 
Classes in this File Line Coverage Branch Coverage Complexity
CreditAgencyGateway
0%
0/7
N/A
1
 
 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.example.loanbroker.esb;
 8  
 
 9  
 import org.mule.example.loanbroker.credit.CreditAgencyService;
 10  
 import org.mule.example.loanbroker.messages.CreditProfile;
 11  
 import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest;
 12  
 
 13  
 /**
 14  
  * This service is the gateway used to pass requests to the credit agency service.  For the sake of the example we've added
 15  
  * some complexity here.
 16  
  * 1) We use a _component binding_ to bind the {@link org.mule.example.loanbroker.credit.CreditAgencyService} to the remote
 17  
  * CreditAgencyService EJB instance.
 18  
  * 2) The argument passed into this interface binding is {@link org.mule.example.loanbroker.messages.Customer} but the EJB instance
 19  
  * needs only a String (name) and Integer (ssn). Also the EJB service returns an XML message, but we convert it to a {@link org.mule.example.loanbroker.messages.CreditProfile}
 20  
  * object. We demonstrate how to perform argument transalations by configuring transformers and response-transformers on an endpoint.
 21  
  */
 22  0
 public class CreditAgencyGateway
 23  
 {
 24  
     //This interface is bound to an endpoint (known as an interface binding).  When the getCreditProfile() method is invoked, the call
 25  
     //will be made to a remote service.
 26  
     private CreditAgencyService creditAgencyService;
 27  
 
 28  
     public LoanBrokerQuoteRequest process(LoanBrokerQuoteRequest request)
 29  
     {
 30  0
         CreditProfile cp = creditAgencyService.getCreditProfile(request.getCustomerRequest().getCustomer());
 31  0
         request.setCreditProfile(cp);
 32  0
         return request;
 33  
     }
 34  
 
 35  
     public CreditAgencyService getCreditAgencyService()
 36  
     {
 37  0
         return creditAgencyService;
 38  
     }
 39  
 
 40  
     public void setCreditAgencyService(CreditAgencyService creditAgencyService)
 41  
     {
 42  0
         this.creditAgencyService = creditAgencyService;
 43  0
     }
 44  
 }