Coverage Report - org.mule.example.loanbroker.credit.CreditAgencyBean
 
Classes in this File Line Coverage Branch Coverage Complexity
CreditAgencyBean
0%
0/12
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.credit;
 8  
 
 9  
 import java.text.MessageFormat;
 10  
 
 11  
 import javax.ejb.EJBException;
 12  
 import javax.ejb.SessionBean;
 13  
 import javax.ejb.SessionContext;
 14  
 
 15  
 /**
 16  
  * <code>CreditAgencyBean</code> obtains a credit historey record for a customer.
 17  
  */
 18  0
 public class CreditAgencyBean implements SessionBean
 19  
 {
 20  
     private static final long serialVersionUID = 1546168214387311746L;
 21  
 
 22  
     private static final String MSG = "<credit-profile><customer-name>{0}</customer-name><customer-ssn>{1}</customer-ssn><credit-score>{2}</credit-score><customer-history>{3}</customer-history></credit-profile>";
 23  
 
 24  
     public void ejbActivate() throws EJBException
 25  
     {
 26  
         // nothing to do
 27  0
     }
 28  
 
 29  
     public void ejbPassivate() throws EJBException
 30  
     {
 31  
         // nothing to do
 32  0
     }
 33  
 
 34  
     public void ejbRemove() throws EJBException
 35  
     {
 36  
         // nothing to do
 37  0
     }
 38  
 
 39  
     public void ejbCreate() throws EJBException
 40  
     {
 41  
         // nothing to do
 42  0
     }
 43  
 
 44  
     public void setSessionContext(SessionContext sessionContext) throws EJBException
 45  
     {
 46  
         // SessionContext can be ignored
 47  0
     }
 48  
 
 49  
     protected int getCreditScore(int ssn)
 50  
     {
 51  
         int credit_score;
 52  
 
 53  0
         credit_score = (int)(Math.random() * 600 + 300);
 54  
 
 55  0
         return credit_score;
 56  
     }
 57  
 
 58  
     protected int getCreditHistoryLength(int ssn)
 59  
     {
 60  
         int credit_history_length;
 61  
 
 62  0
         credit_history_length = (int)(Math.random() * 19 + 1);
 63  
 
 64  0
         return credit_history_length;
 65  
     }
 66  
 
 67  
     /**
 68  
      * Used by Ejb Call
 69  
      */
 70  
     public String getCreditProfile(String name, Integer ssn)
 71  
     {
 72  0
         String msg = MessageFormat.format(MSG, name, ssn,
 73  
                                           getCreditScore(ssn), getCreditHistoryLength(ssn));
 74  0
         return msg;
 75  
     }
 76  
 
 77  
 }