Examples of BankSession


Examples of org.jboss.test.banknew.interfaces.BankSession

      CustomerSessionHome lCustomerHome = (CustomerSessionHome) mContext.lookup( CustomerSessionHome.JNDI_NAME );
      AccountSessionHome lAccountHome = (AccountSessionHome) mContext.lookup( AccountSessionHome.JNDI_NAME );
      TellerSessionHome lTellerHome = (TellerSessionHome) mContext.lookup( TellerSessionHome.JNDI_NAME );
     
      // Create a session bean by default
      BankSession lBank = lBankHome.create();
      CustomerSession lCustomer = lCustomerHome.create();
      AccountSession lAccount = lAccountHome.create();
      TellerSession lTeller = lTellerHome.create();
     
      // Create a bank the root of everything
      BankData lBankData = lBank.createBank( "Andy's TestBank", "12345 XMass Avenue, New JBoss, GA" );
     
      // Check all the methods on teller inteface because that
      // is what we are here working with primarly
      CustomerData lCustomerData = lTeller.createCustomer( lBankData.getId(), "One", 100 );
      CustomerData lCustomerData2 = lTeller.getCustomer( lCustomerData.getId() );
      Collection lCustomers = lTeller.getCustomers( lBankData.getId() );
     
      AccountData lAccountData = lTeller.createAccount( lCustomerData.getId(), Constants.SAVING, 150 );
      AccountData lAccountData2 = lTeller.getAccount( lCustomerData.getId(), Constants.SAVING );
      AccountData lAccountData3 = lTeller.getAccount( lAccountData.getId() );
      AccountData lAccountData4 = lTeller.getAccount( lCustomerData.getId(), Constants.CHECKING );
      Collection lAccounts = lTeller.getAccounts( lCustomerData.getId() );
     
      lTeller.deposit( lAccountData4.getId(), 75 );
      lTeller.withdraw( lAccountData3.getId(), 63 );
      lTeller.transfer( lAccountData4.getId(), lAccountData3.getId(), 52 );
     
      lTeller.removeAccount( lAccountData4.getId() );
      lTeller.removeAccount( lAccountData.getId() );
      lTeller.removeCustomer( lCustomerData.getId() );
     
      lBank.removeBank( lBankData.getId() );
      log.debug( "testEnvironment() ends" );
   }
View Full Code Here

Examples of org.jboss.test.banknew.interfaces.BankSession

     
      log.info("Remove accounts and customers");
      BankSessionHome lBankHome = (BankSessionHome) mContext.lookup( BankSessionHome.JNDI_NAME );
      CustomerSessionHome lCustomerHome = (CustomerSessionHome) mContext.lookup( CustomerSessionHome.JNDI_NAME );
      AccountSessionHome lAccountHome = (AccountSessionHome) mContext.lookup( AccountSessionHome.JNDI_NAME );
      BankSession lBankSession = lBankHome.create();
      Collection lBanks = lBankSession.getBanks();
      Iterator i = lBanks.iterator();
      while( i.hasNext() ) {
         BankData lBank = (BankData) i.next();
         // Get all customers
         CustomerSession lCustomerSession = lCustomerHome.create();
         Collection lCustomers = lCustomerSession.getCustomers( lBank.getId() );
         Iterator j = lCustomers.iterator();
         while( j.hasNext() ) {
            CustomerData lCustomer = (CustomerData) j.next();
            // Get all accounts
            AccountSession lAccountSession = lAccountHome.create();
            Collection lAccounts = lAccountSession.getAccounts( lCustomer.getId() );
            Iterator k = lAccounts.iterator();
            while( k.hasNext() ) {
               AccountData lAccount = (AccountData) k.next();
               lAccountSession.removeAccount( lAccount.getId() );
            }
            lCustomerSession.removeCustomer( lCustomer.getId() );
         }
         lBankSession.removeBank( lBank.getId() );
      }
      log.debug( "setUp() ends" );
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.