Examples of AccountData


Examples of org.jboss.test.bank.interfaces.AccountData

      setOwner(data.getOwner());
   }
  
   public AccountData getData()
   {
      AccountData data = new AccountData();
      data.setId(id);
      data.setBalance(balance);
      data.setOwner(owner);
      return data;
   }
View Full Code Here

Examples of org.jboss.test.bankiiop.interfaces.AccountData

      setOwner(data.getOwner());
   }
  
   public AccountData getData()
   {
      AccountData data = new AccountData();
      data.setId(id);
      data.setBalance(balance);
      data.setOwner(owner);
      return data;
   }
View Full Code Here

Examples of org.jboss.test.bankiiop.interfaces.AccountData

      Iterator i = accts.iterator();
      while(i.hasNext())
      {
         Account acct = (Account)PortableRemoteObject.narrow(i.next(),
                                                             Account.class);
         AccountData data = acct.getData();
         getLog().debug(data.getId()+"("+data.getOwner().getName()+"):"+data.getBalance());
         acct.withdraw(data.getBalance()); // Clear
      }
     
      teller.remove();
   }
View Full Code Here

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

                  }
               }
               mLog.debug( "run(), tread id: " + mId + ", create or find account" );
               // Get accounts and decide if to create a new account
               List lAccounts = (List) getCustomerSession().getAccounts( lCustomer.getId() );
               AccountData lAccount = null;
               if( lRandom.nextInt( 100 ) < 5 ) {
                  try {
                     lAccount = getCustomerSession().createAccount(
                        lCustomer.getId(), lRandom.nextInt( 3 ), 123
                     );
                     mLog.debug( "run(), thread id: " + mId + ", created account: " + lAccount );
                  }
                  catch( CreateException ce ) {
                  }
               }
               if( lAccount == null ) {
                  lAccount = (AccountData) lAccounts.get( lRandom.nextInt( lAccounts.size() ) );
                  mLog.debug( "run(), thread id: " + mId + ", got account: " + lAccount );
               }
               if( lAccount == null ) {
                  throw new RuntimeException( "Could not find an account" );
               }
               // Do some business methods
               int lLoops = lRandom.nextInt( 10 );
               for( int i = 0; i < lLoops; i++ ) {
                  int lSelection = lRandom.nextInt( 4 );
                  mLog.debug( "run(), thread: " + mId + ", business selection : " + lSelection );
                  switch( lSelection ) {
                     case 0:
                        // Withdraw money when balance is greater than 50
                        if( lAccount.getBalance() > 50 ) {
                           getAccountSession().withdraw( lAccount.getId(), lRandom.nextInt( 50 ) );
                        }
                        break;
                     case 1:
                        if( lAccounts.size() > 1 && lAccount.getBalance() > 50 ) {
                           AccountData lOtherAccount = null;
                           while( true ) {
                              lOtherAccount = (AccountData) lAccounts.get( lRandom.nextInt( lAccounts.size() ) );
                              if( lOtherAccount.getType() != lAccount.getType() ) {
                                 // Found another account type
                                 break;
                              }
                           }
                           while( true ) {
                              try {
                                 getAccountSession().transfer( lAccount.getId(), lOtherAccount.getId(), lRandom.nextInt( 50 ) );
                                 break;
                              }
                              catch( ServerException se ) {
                                 checkServerException( se );
                              }
                           }
                        }
                        break;
                     case 2:
                        if( lAccount.getBalance() > 50 ) {
                           List lCustomers = (List) getBankSession().getCustomers( lBank.getId() );
                           if( lCustomers.size() > 1 ) {
                              CustomerData lOtherCustomer = null;
                              while( true ) {
                                 lOtherCustomer = (CustomerData) lCustomers.get( lRandom.nextInt( lCustomers.size() ) );
                                 if( !lOtherCustomer.getId().equals( lCustomer.getId() ) ) {
                                    break;
                                 }
                              }
                              List lAccounts2 = (List) getAccountSession().getAccounts( lOtherCustomer.getId() );
                              if( lAccounts2.size() > 0 ) {
                                 AccountData lOtherAccount = (AccountData) lAccounts2.get( lRandom.nextInt( lAccounts2.size() ) );
                                 while( true ) {
                                    try {
                                       getAccountSession().transfer( lAccount.getId(), lOtherAccount.getId(), lRandom.nextInt( 50 ) );
                                       break;
                                    }
                                    catch( ServerException se ) {
                                       checkServerException( se );
                                    }
View Full Code Here

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

      // 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.AccountData

            // 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() );
      }
View Full Code Here

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

    * @ejb:interface-method view-type="remote"
    **/
   public AccountData createAccount( String pCustomerId, int pType, float pInitialDeposit )
      throws CreateException, RemoteException
   {
      AccountData lData = new AccountData();
      lData.setCustomerId( pCustomerId );
      lData.setType( pType );
      lData.setBalance( pInitialDeposit );
      Account lAccount = getAccountHome().create( lData );
      AccountData lNew = lAccount.getData();
      getTransactionHome().create(
         lNew.getId(),
         Constants.INITIAL_DEPOSIT,
         pInitialDeposit,
         "Account Creation"
      );
      return lNew;
View Full Code Here

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

   }
  
   private void removeAccount( Account pAccount )
      throws RemoveException, CreateException, RemoteException
   {
      AccountData lData = pAccount.getData();
      pAccount.remove();
      getTransactionHome().create(
         lData.getId(),
         Constants.FINAL_WITHDRAW,
         lData.getBalance(),
         "Account Closure"
      );
   }
View Full Code Here

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

      throws FinderException, RemoteException
   {
      Account lAccount = getAccountHome().findByPrimaryKey(
         new AccountPK( pAccountId )
      );
      AccountData lData = lAccount.getData();
      lData.setBalance( lData.getBalance() + pAmount );
      lAccount.setData( lData );
      try {
         getTransactionHome().create(
            lData.getId(),
            Constants.DEPOSIT,
            pAmount,
            "Account Deposit"
         );
      }
View Full Code Here

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

      throws FinderException, RemoteException
   {
      Account lAccount = getAccountHome().findByPrimaryKey(
         new AccountPK( pAccountId )
      );
      AccountData lData = lAccount.getData();
      lData.setBalance( lData.getBalance() - pAmount );
      lAccount.setData( lData );
      try {
         getTransactionHome().create(
            lData.getId(),
            Constants.WITHDRAW,
            pAmount,
            "Account Withdraw"
         );
      }
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.