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  
  * $Id: CreditAgencyBean.java 10789 2008-02-12 20:04:43Z 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.example.loanbroker.credit;
 12  
 
 13  
 import java.text.MessageFormat;
 14  
 
 15  
 import javax.ejb.EJBException;
 16  
 import javax.ejb.SessionBean;
 17  
 import javax.ejb.SessionContext;
 18  
 
 19  
 /**
 20  
  * <code>CreditAgencyBean</code> obtains a credit historey record for a customer.
 21  
  */
 22  0
 public class CreditAgencyBean implements SessionBean
 23  
 {
 24  
     private static final long serialVersionUID = 1546168214387311746L;
 25  
 
 26  
     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>";
 27  
 
 28  
     public void ejbActivate() throws EJBException
 29  
     {
 30  
         // nothing to do
 31  0
     }
 32  
 
 33  
     public void ejbPassivate() throws EJBException
 34  
     {
 35  
         // nothing to do
 36  0
     }
 37  
 
 38  
     public void ejbRemove() throws EJBException
 39  
     {
 40  
         // nothing to do
 41  0
     }
 42  
 
 43  
     public void ejbCreate() throws EJBException
 44  
     {
 45  
         // nothing to do
 46  0
     }
 47  
 
 48  
     public void setSessionContext(SessionContext sessionContext) throws EJBException
 49  
     {
 50  
         // SessionContext can be ignored
 51  0
     }
 52  
 
 53  
     protected int getCreditScore(int ssn)
 54  
     {
 55  
         int credit_score;
 56  
 
 57  0
         credit_score = (int)(Math.random() * 600 + 300);
 58  
 
 59  0
         return credit_score;
 60  
     }
 61  
 
 62  
     protected int getCreditHistoryLength(int ssn)
 63  
     {
 64  
         int credit_history_length;
 65  
 
 66  0
         credit_history_length = (int)(Math.random() * 19 + 1);
 67  
 
 68  0
         return credit_history_length;
 69  
     }
 70  
 
 71  
     /**
 72  
      * Used by Ejb Call
 73  
      * 
 74  
      * @param name
 75  
      * @param ssn
 76  
      * @return
 77  
      */
 78  
     public String getCreditProfile(String name, Integer ssn)
 79  
     {
 80  0
         String msg = MessageFormat.format(MSG, new Object[]{name, ssn,
 81  
             new Integer(getCreditScore(ssn.intValue())), new Integer(getCreditHistoryLength(ssn.intValue()))});
 82  0
         return msg;
 83  
     }
 84  
 
 85  
 }