Coverage Report - org.mule.example.loanbroker.bank.Bank
 
Classes in this File Line Coverage Branch Coverage Complexity
Bank
0%
0/19
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.bank;
 8  
 
 9  
 import org.mule.api.construct.FlowConstruct;
 10  
 import org.mule.api.construct.FlowConstructAware;
 11  
 import org.mule.api.service.Service;
 12  
 import org.mule.api.service.ServiceAware;
 13  
 import org.mule.example.loanbroker.LocaleMessage;
 14  
 import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest;
 15  
 import org.mule.example.loanbroker.messages.LoanQuote;
 16  
 
 17  
 import java.io.Serializable;
 18  
 
 19  
 import org.apache.commons.logging.Log;
 20  
 import org.apache.commons.logging.LogFactory;
 21  
 
 22  
 /**
 23  
  * <code>Bank</code> is a representation of a bank from which to obtain loan
 24  
  * quotes.
 25  
  */
 26  
 
 27  
 public class Bank implements ServiceAware, FlowConstructAware, Serializable, BankService
 28  
 {
 29  
     /**
 30  
      * Serial version
 31  
      */
 32  
     private static final long serialVersionUID = 4108271137166107769L;
 33  
 
 34  
     /**
 35  
      * logger used by this class
 36  
      */
 37  0
     protected static final Log logger = LogFactory.getLog(Bank.class);
 38  
 
 39  
     private String bankName;
 40  
     private double primeRate;
 41  
     
 42  
     public Bank()
 43  0
     {
 44  0
         this.primeRate = Math.random() * 10;
 45  0
     }
 46  
 
 47  
     public void setFlowConstruct(FlowConstruct flowConstruct)
 48  
     {
 49  0
         this.bankName = flowConstruct.getName(); 
 50  0
     }
 51  
 
 52  
     public void setService(Service service)
 53  
     {
 54  0
         this.bankName = service.getName(); 
 55  0
     }
 56  
 
 57  
     public LoanQuote getLoanQuote(LoanBrokerQuoteRequest request)
 58  
     {
 59  0
         LoanQuote quote = new LoanQuote();
 60  0
         quote.setBankName(getBankName());
 61  0
         quote.setInterestRate(primeRate);
 62  0
         logger.info(LocaleMessage.receivedRate(quote));
 63  
 
 64  0
         return quote;
 65  
     }
 66  
 
 67  
     public String getBankName()
 68  
     {
 69  0
         return bankName;
 70  
     }
 71  
 
 72  
     public void setBankName(String bankName)
 73  
     {
 74  0
         this.bankName = bankName;
 75  0
     }
 76  
 
 77  
     public double getPrimeRate()
 78  
     {
 79  0
         return primeRate;
 80  
     }
 81  
 
 82  
     public void setPrimeRate(double primeRate)
 83  
     {
 84  0
         this.primeRate = primeRate;
 85  0
     }
 86  
 }