TestClient.java
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:

Java编程

开发平台:

Java

  1. package examples.command;
  2. import javax.ejb.*;
  3. import javax.naming.*;
  4. import java.rmi.*;
  5. import javax.rmi.*;
  6. import java.util.*;
  7. /**
  8.  * Sample client code which manipulates a Bank Account Entity Bean.
  9.  */
  10. public class TestClient {
  11. public static void main(String[] args) throws Exception {
  12. try {
  13.             TransferFundsCommand transferCommand = new TransferFundsCommand();
  14.             transferCommand.setDepositAccountID("1");
  15.             transferCommand.setWithdrawAccountID("2");
  16.             transferCommand.setTransferAmount(50);
  17. System.out.println("before "+ transferCommand.hashCode());
  18.             transferCommand = (TransferFundsCommand) CommandExecutor.execute(transferCommand);
  19. System.out.println("after " +transferCommand.hashCode());
  20.             System.out.println(transferCommand.getDepositAccountBalance());
  21.             System.out.println(transferCommand.getWithdrawAccountBalance());
  22. }
  23. catch (CommandException e) {
  24. System.out.println(e.getWrappedException().getMessage());
  25. e.printStackTrace();
  26. }
  27. }
  28. }