⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customertest.java

📁 本教程介绍j2ee企业开发方面的知识
💻 JAVA
字号:
/* * * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. *  * This software is the proprietary information of Sun Microsystems, Inc.   * Use is subject to license terms. *  */import java.util.*;import com.sun.ebank.ejb.customer.*;import com.sun.ebank.ejb.exception.*;import com.sun.ebank.util.*;import java.rmi.RemoteException;public class CustomerTest {    private CustomerController customerController;    public CustomerTest(CustomerController customerController) {        this.customerController = customerController;        runTests();    }     private void runTests() {        try {            // create a new customer            String customerId =                 customerController.createCustomer("Smith", "Joe", "Q",                "123 Forest Ave.", "Cupertino", "CA", "95014",                "408-863-1234", "joe.smith@j2ee");            System.out.println(customerId);            System.out.println();            // remove a customer            customerController.removeCustomer("105");            // get customer details by customerId            CustomerDetails cd = customerController.getDetails("101");            DisplayDetails.print(cd);            System.out.println();            // get customer details by accountId            ArrayList customers =                 customerController.getCustomersOfAccount("5001");             printArray(customers);            // get customer details by lastName            ArrayList cust =                customerController.getCustomersOfLastName("Jones");             printArray(cust);            // change a customer's name            customerController.setName("Flux", "Bernard", "W", customerId);            // change a customer's address            customerController.setAddress("44 Madison Ave.", "New York",                "NY", "10001", "111-555-6677", "trane@muse.org", customerId);       } catch (RemoteException ex) {           System.err.println               ("Caught a RemoteException. "  + ex.getMessage());       } catch (CustomerNotFoundException ex) {           System.err.println               ("Caught a CustomerNotFoundException. "  + ex.getMessage());       } // catch    } // runTests    private void printArray(ArrayList list) {                Iterator i = list.iterator();        while (i.hasNext()) {            CustomerDetails details = (CustomerDetails)i.next();            System.out.println();            DisplayDetails.print(details);        }    } // printArray} // class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -