Unit Testing


To test the Network Information application:

  1. Set the path of the bin directory of J2SDK by executing the following command at the command prompt:

     set path=%path%;D:\j2sdk1.4.0_02\bin; 
  1. Set the classpath of the lib directory of J2SDK by executing the following command at the command prompt:

     set classpath = %classpath%;d:\j2sdk1.4.0_02\lib; 
  1. Copy the NetCompFrame.java, NetCompConnect.java, CompInfo, and CompInfoDialog.java files to a folder on your computer. On the command prompt, use the cd command to move to the folder where you have copied the Java files. Compile the files using the following javac command:

     javac *.java 
  1. To run the Network Information application, specify the following command at the command prompt:

     java NetCompFrame 

    The above command opens the main window of the Network Information application, as shown in Figure 7-2.

  1. Select the Echo option from the Service/Protocol combo box and specify the host IP address, such as 192.168.0.36. If you do not specify the IP address, an Error dialog box appears, as shown in Figure 7-3:

    this figure shows an error dialog box.
    Figure 7-3: Error Dialog Box

  1. If you specify a wrong host IP address, another Error dialog box appears, as shown in Figure 7-4:

    this figure shows an error dialog box.
    Figure 7-4: Error Dialog Box with Error Message

  1. Click the Display List button of the Network Information application. A list of network computers appears in the Network Computer list box, as shown in Figure 7-5:

    this figure shows the list of network computers that are present in the host address domain.
    Figure 7-5: Network Information Application Window with Ehco Service

  1. Select an IP address, such as 192.168.0.89, from the Network Computer list box. A Echo Response dialog box opens, as shown in Figure 7-6:

    this figure shows the echo time of the computer, 192.168.0.89.
    Figure 7-6: Echo Response Dialog Box

  1. Select the Date/Time option from the Service/Protocol combo box and specify the host IP address, such as 192.168.0.36.

  2. Click the Display List button of the Network Information application. A list of network computers appears in the Network Computer list box, as shown in Figure 7-7:

    this figure shows the list of network computers that are present in the host address domain.
    Figure 7-7: Network Information Application Window with Date Time Service

  1. Select an IP address, such as 192.168.0.89, from the Network Computer list box. A System Date & Time dialog box opens, as shown in Figure 7-8:

    this figure shows the current system date and time of the computer, 192.168.0.89.
    Figure 7-8: System Date and Time Dialog Box




Java InstantCode. Developing Applications Using Java NIO
Java InstantCode. Developing Applications Using Java NIO
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 55

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net