This site hosted by Free.ProHosting.com
Google

 

 

 

 

Section 3

 

 

System Test Plan


Collaborative Tool

 

[DLS1] 

Initial System Test Plan

 

 

[DLS2] 


Table of Content

Table of Content 3

1.0 System Test Cases. 4

Account Administration Test Cases. 4

System Support Test Cases. 5

Chair Test Cases. 5

Project Administration Test Cases. 5

Edit Control of Session Documents. 5

2.0 Unit Test 5

2.1 RPC Unit Test 5

Modules Under Test 5

Test Description. 5

Test Driver Source Code: XmlTest 5

Test Sample Output 5

2.2 Project Unit Test 5

Modules Under Test: 5

Test Description. 5

Test Driver Source Code: ProjectTestDriver 5

Test Sample Output 5

Appendix A – RPC Source Code. 5

Encode Class Source Code. 5

Decode Class Source Code. 5

Appendix B – Project Source Code. 5

Project Client 5

Project Server 5


1.0 System Test Cases

Account Administration Test Cases

 

Test case ID:

1

Test Case Description

Attempt to create a new account using a username that has been previously registered by the system.

Requirements being tested:

System account admin #2 and 3

Non-participant # 1

Pre-condition:

The user does not have a registered account in the system

Testing procedures:

 

1) Launch the CT Client.

 

2) The following dialogue box appears.


 

 

3) Click the “Create Account” button.

 

4) The following panel is displayed.


 

5) Enter a username and password into the corresponding fields. (Name, email, position and department are optional fields).

 

6) Click OK.

 

7) The panel disappears, and a message “New account created” is displayed at the bottom of the previous dialogue box.

 

8. Repeat steps 3 through 6, attempting to register another user account with the same username as chosen in step 5.

 

Expected results:

 

  1. The system shall create a new account for the new user
  2. If the username is not currently registered, the system shall assign the username to the new non-participant
  3. If the username has already been registered, notify the non-participant to choose a different username by displaying the message “Username already exists.”

 

Testing history

Date

Result

Success / Fail?

Nov 10, 2002

Result as expected

Passed

Nov 16, 2002 19:00

Result as expected.

Passed

 

Test case ID:

2

Test Case Description:

Tests a registered user’s ability to log into the system.

Requirements being tested:

System account admin #4

Non-participant #2

Pre-condition:

The user has a registered account in the system.

Testing procedures:

 

1) Launch the CT Client.

 

2) The following dialogue appears.


 

3) Type in a valid username and password.

 

4) The login dialogue box disappears, and the following window is shown “Login successful” is displayed at the bottom left corner of the window indicating success.

 

 

Expected results:

 

Login is successful and the main window of CT is shown.

 

Testing history

Date

Result

Success / Fail?

Nov 10, 2002

Result as expected

Passed

Nov 16, 2002 19:00

Result as expected.

Passed

 


 

Test case ID:

3

Test Case Description:

Tests that any latent notifications are given to the user when he or she first logs into the system. Furthermore it tests that project and document lists are properly displayed in the project tree.

Requirements being tested:

System account admin #5

Pre-condition:

The user has logged in and is a participant in one or more projects. Furthermore, there has been a transcript and related document(s) stored. The participant, “User3”, has been added to a project, “Test 9a” while he or she was not logged in.

Testing procedures:

 

1) Log into the system with username “User3” and password.

2) The following window appears (“Login successful” is displayed at the bottom left corner of the window).

 

Expected results:

 

For the specific user, the main window shall provide information about the projects in which that user is a participant and any transcripts and/or documents relating to these projects. Status changes to any of these projects will be displayed in the notification window shown above.

 


 

Testing history

Date

Result

Success / Fail?

Nov 10, 2002

-Project Tree and Document Tree correct,

  Transcript GUI update not ready

-Notification GUI update not ready

 

Failed

Nov 16, 2002 19:00

- Project Tree and Document Tree correct,

- Transcript GUI update not ready

- Notification GUI update partially ready

- Participant is not yet notified of his/her participating active projects

Failed

Nov 17, 2002

Result as expected

Passed

 

Test case ID:

4

Requirement being tested:

Participant #3

Pre-condition:

The user has logged in successfully.

Testing procedures:

1. Click the “Logout” button at the bottom left corner of the main window.

 

2. The “User Authentication” dialogue box pops up, and the “Logout successful” message is shown at the bottom left corner of the main window.

 

 

Expected results:

 

The current user will be logged out and any sessions in which they are a participant shall be notified. In addition, any sessions in which this user is a chair shall become inactive. The main window shall be cleared of any data pertaining to the user and the username shall become available once again for logging in.

 


 

Testing history

Date

Result

Success / Fail?

Nov 10, 2002

-Notification not ready

-Participant logout ok.

-Chair logout doesn’t logout all participants

Failed

Nov 16, 2002 19:00

- Same results as of Nov 10, 2002.

Failed

Nov 17, 2002

Result as expected

Passed

System Support Test Cases

 

Test case ID:

5

Test Case Description:

Tests that the system can support multiple concurrent active projects.

Requirements being tested:

System support #7

Pre-condition:

The system has two or more registered users who are participants in two or more projects.

Testing procedures:

 

1)      Start an instance of the AMC server.

2)      Start an instance of the ClientGUI (clientGUI A).

3)      Log into the system using clientGUI A with username/password A.

4)      Activate a project (project A).

5)      Start another instance of ClientGUI (clientGUI B).

6)      Log on the system using clientGUI B with username/password B (using the same AMC server as in clientGUI A).

7)      Activate a project (project B).

8)      Both users A and B start chatting in their corresponding ClientGUIs.

 

Expected results:

 

Both GUI should function normally without any problem or conflict.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

Result as expected

Passed

Nov 16, 2002 19:00

Result as expected

Passed


Chair Test Cases

 

Test case ID:

6

Test Case Description

Tests that the chair can delete one or more of his or her projects. Other participants of these projects should be notified of their deletion.

Requirements being tested:

Chair #1

Pre-condition:

The user has logged into the system and is the chair of projects A and B.

Testing procedures:

 

 

 

1)      In the CT project tree, click project A.

2)      Click the “Delete Project” button at the right of the main window.

3)      Project A disappears from the project tree on the left of the main window.

4)      In the CT project tree, click project B.

5)      Click the “Delete Project” button at the right of the main window.

6)      Project B disappears from the project tree on the left of main window.

 


 

Expected results:

 

  1. Projects A and B should be deleted from the system
  2. Projects A and B should be deleted from project trees of users who were participants in either of these projects.

 

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Delete project successful

-Notification not integrated

Conditional passed

Nov 16, 2002 19:00

- Delete project successful.

- Notification not integrated.

Conditionally passed

Nov 17, 2002

Result as expected

Passed

 

Test case ID:

7

Test Case Description

Tests that a chair can activate any of his or her projects as displayed in the project tree.

Requirements being tested:

Chair #2

Pre-condition:

The user (user A) has logged into the system and is the chair of inactive projects A and B. Another user (user B) is a participant of both projects and is also logged in.


 


Testing procedures:

 

1)      In the CT project tree, click project A.

2)      Click the “Activate Project” button at the right of the main window.

3)      “Project A is activated” is shown in the Notification field at the right bottom of the main window of both users A and B.

4)      In the CT project tree, click project B.

5)      Click the “Activated Project” button at the right of the main window.

6)      “Project B is activated” is shown in the Notification field at the right bottom of the main window of both users A and B.


Expected results:

 

Projects A and B should become active and abilities such as shared editing and dialog should become available.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Successful, except notification not integrated

Conditional Passed

Nov 16, 2002 19:00

- Successful.

- Notification integrated.

Passed

 


 

Test case ID:

8

Test Case Description

Tests that a chair can inactivate a project which in turn ends the session. Any participants in that session shall be removed from it immediately and notification of this change shall be sent.

Requirement being tested:

Chair #3

Pre-condition:

The user (user A) has logged into the system and is the chair of an activated project A. Another user (user B), a participant of project A, is logged into the system and has joined the Project A session.

Testing procedures:

 

1)      In the CT project tree, click project A.

2)      Click the “Inactivate Project” button at the right of the main window.

3)      The message, “Project A is inactivated”, is shown in the Notification field at the right bottom of the main window of the chair (user A).

4)      “Project A is inactivated ” and “Session of Project A is closed” is shown in the Notification field at the right bottom of the main window of user B.

5)      User B is automatically forced to leave the session.

 



 

Expected results:

 

Project A should be inactivated. User B shall be forced to leave the session.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Participant not forced out of the session when chair deactivates a project

-Notification not integrated

Failed

Nov 16, 2002 19:00

- Participant forced to leave session.

- Notification integrated.

Passed

 

Test case ID:

9

Test Case Description

Tests a chair’s ability to add participants to any of his or her projects. Notification of this addition should be sent to the new participant.

Requirements being tested:

Chair #4

Pre-condition:

The user (User1) has logged into the system and is the chair of project “Test 9a”.

Another user (User3) has logged in and is not a participant of project “Test 9a”.


 

Testing procedures:

 

1)      In the CT project tree, click project “Test 9a”.

2)      Click the “Edit Participant List” button on the right of the main window.

3)      A participant list window pops up showing all participants of the system.

4)      Click the check box at the end of the “User3” info line.

5)      A check mark should appear in the check box

6)      Click OK.

7)      “User3 is added to Project Test 9a” is shown in the Notification field at the right bottom of the main window of “Users1” and “User3”.

8)      Project “Test 9a” should appear in the project tree in “User3’s” main window.

 


 

Expected results:


User3 should be added to Project Test 9a and that project should be available in User3’s project tree.

 

Testing History

Date

Result

Success / Fail?

Nov 10,2002

-Add participant to project successful

-Notification not integrated

Conditional passed

Nov 16, 2002 19:00

- Add participant to project successful.

- Notification integrated.

Passed

 

Test case ID:

10

Test Case Description

Test a chair’s ability to remove participants from any of his or her projects. A notification of this change should be sent to any participants that are affected by this change.

Requirements being tested:

Chair #5

Pre-condition:

The user (user A) has logged in the system and is the chair of a project A.

Another user (user B) has logged in and is a participant of project A.


 

Testing procedures:

 

1)      Click the “project A” in the project tree on left side of the main window.

2)      Click the “Edit Participant List” button on the right of main window.

3)      A participant list window pops up showing all participants in the system.

4)      Click the check box at the end of user B’s info.

5)      The check should disappear from the check box.

6)      Click OK.

7)      “User B is deleted from Project A” is shown in the Notification window at the bottom of user A and B’s main window.

8)      Project A should disappear from the project tree in user B’s main window.

 

<<Include a screen shot showing the Edit Project List button / notification field / project tree>>

 

Expected results:

 

  1. User B should be deleted from Project A.
  2. Project A should no longer appear in user B’s main window

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Project tree not refreshed about being removed from a project

-Notification not integrated

Failed

Nov 16, 2002 19:00

- Project tree refreshed.

- Notification integrated.

Passed

 


Project Administration Test Cases

 

Test case ID:

11

Test Case Description:

A user becomes the chair of a project by creating a new project. Thus to become chair of an existing project, that user would have to attempt to create a project with the same project name (ID)

Requirements being tested:

Project Admin 9.a

Participant 17

Pre-condition:

- Another user has created a project named “Test 9a” and is the chair of that project.

- Current User is successfully logged into the system

Testing procedures:

 

1) Click “New Project” button

2) Fill in the “New Project” dialog box as shown below. Note that the project name is case sensitive.


3) Click “Create Project.

 

Expected Results:

 

“New Project” dialog status bar should display: “Project name already exists.”

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

Result as expected

Passed

Nov 16, 2002 19:00

Result as expected.

Passed

 


 

Test case ID:

12

Test Case Description:

The transcript documents a session. Thus each time a chair activates and then inactivates a session, a new transcript file will be generated and added to the project’s transcript list. A new transcript shall be created for each project activation / inactivation pair.

Requirements being tested:

Project Admin 10, 16, 17

Participant 4

Pre-condition:

- Current user is the chair of a project that is currently inactive. For this test, Project is named “Test 9a”

Testing procedures:

 

1) Click “Test 9a” in the project selection panel

2) Click “Activate Project”

 


The status bar will be updated to display the following:

 


and the “Inactivate Project” button will be enable while disabling “Activate Project”

 

3) After some elapsed time as indicated by the status bar, click “Inactivate Project”

4) Repeat steps 1 – 3.

 


 

Expected Results:

 

The screen will return to the state shown in the figure above. The Project panel will now have two transcripts displayed as shown below.

 

One transcript for each of the two sessions created during the procedure above including the date, start time and end times.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

Transcript not integrated with GUI yet

Failed

Nov 16, 2002 19:00

Results as expected.

Passed

 

Test case ID:

13

Test Case Description:

A client instance can only support one active session at a time, but the system can handle multiple sessions created by multiple clients.

Requirements being tested:

Project Admin 11

Pre-condition:

Two clients are open and two separate users are logged in. Each user should be the chair of at least one project. For this test, “User1” is the chair of “Test 9a” and “User2” is the chair of “Test 11”.

Testing procedures:

 

1) Click “Test 9a” in “User1’s” client widow.

2) Click “Activate Project”

3) Click “Test 11” in “User2’s” client window.

4) Click “Activate Project”

5) After some elapsed time, click “Inactivate Project” in each of the two client windows.

 

Expected Results:

 

When both of the clients have activated concurrent sessions, the following two screens will be displayed. Note that “User1” is a participant of “Test 11” and “User2” is a participant of “Test 9a”. This is done so that each client will show updates for both projects.

 

User1 Client window:


User2 Client window:

 


When each of the concurrent sessions are closed, the Project tree will be updated as follows showing the two new session transcripts proving a session was created:

 

Testing History

Date

Result

Success / Fail?

Nov 11, 2002

-multiple session ok

-transcript not integrated

Failed

Nov 16, 2002 19:00

Results as expected.

Passed

 

Test case ID:

14

Test Case Description:

The current user will attempt to join a currently activated session.

Requirements being tested:

Project Admin 12, 18

Pre-condition:

Two users exist and are participants in a common project. One of the users must be that project’s chair. For this test, “User1” is the chair of project “Test 9a” and “User2” is a participant of that project.


 

Testing procedures:

 

1) Click “Test 9a” in “User2’s” client window.

2) Click “Join Session”

 


3) After some time has elapsed, click “Leave Session”

 

Expected Results:

 

The changes during the session are logged in the notification panel shown below. To show that other users can see these changes, the notification panel for “User1” is shown after procedures 1 through 3 are executed above.

 


 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

Result as expected

Passed

Nov 16, 2002 19:00

Result as expected

Passed

 


 

Test case ID:

15

Test Case Description:

Attempt to send a dialog message when the current user does not have control of the dialog.

Requirements being tested:

Project Admin 13.a and 13.b

Pre-condition:

Three separate users are logged in to three separate clients. All three are participants the same project and one is the chair. This common project has been activated and the remaining users have joined the active session of that project. Chair has dialog control.

Testing procedures:

 

1) Type a sentence in “User2’s” client window message box.

2)

Click “Send” in “User2’s” client window.

3) Click “Release Turn” in “User1’s” client window.

4) Repeat steps 1 and 2.

5) Click “Request Turn” in “User3’s” client window.

6) Click “Request Turn” in “User2’s” client window.

7) Repeat steps 1 and 2.

8) Type a sentence in “User3’s” client window message box.

9) When the button activates, click “Send” in “User3’s” client window

10) Click “Release Turn” in “User3’s” client window.

11) When the button activates, click “Send” in “User2’s” client window

 

Expected Results:

 

For steps 1 through 10 above, the “Send” button should remain inactive in “User2’s” client window. When the “Release Turn” button has been pressed in step 3, none of the users should be able to send a message as the dialogue queue is now empty. When “User3” and “User2” have requested a turn, “User2” should still be unable to send a message until “User3” has released his or her turn in step 9. At this point, “User2” is at the head of the queue and should therefore be able to send a message. Also tested is that the chair, “User1” is given dialog control immediately after activating the session.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Dialog Queue Ok

-Send Message button should be inactive when user does not have control

Conditional passed

Nov 16, 2002

- Dialogue queue ok.

- Send message button properly disabled.

Passed

 


 

Test case ID:

16

Test Case Description:

The following tests the dialog queue and its onscreen display. During each step, the changes in the queue should be visible to all clients logged into the session. Only the user at the head of the queue should be able to send a message.

Requirements being tested:

Project Admin 13.c, 13.d, 13.e, 13.f

Pre-condition:

Three separate users are logged in to three separate clients. All three are participants the same project and one is the chair. This common project has been activated and the remaining users have joined the active session of that project. Chair has released his or her turn. For this test, the common project is “Test 9a” and the users are “User1”, “User2”, and “User3”. “User1” is the project chair.

Testing procedures:

 

1) Type a sentence in each client’s message box.

2) Click “Request Turn” in “User3’s” client window.

3) Click “Request Turn” in “User2’s” client window.

4) Click “Request Turn” in “User1’s” client window.

 

All clients’ “Request Turn Queue” windows should look like the following. Note that “User3’s” “Send” button is now active.

 

5) Click “Release Turn” in “User3’s” client window.

 

Note “User2’s” “Send” button is now active and “User3” is missing from the “Request Turn Queue” window.

6) Click “Request Turn” in “User3’s” client window. The queue should be as follows:

 

 

7) Click “Release Turn” in “User2’s” client window.

8) Click “Release Turn” in “User1’s” client window.

9) Repeat steps 3 and 4. Queue should look as follows:

 

10) Click “Move to Front of Queue” in “User1’s” client window. Note that “User1” is not at the head of the queue, but at position 2. When “User3” releases his or her turn, “User1” will be given control ahead of”User2”.

11) Repeat steps 7 and 8 with “User3” and “User1”

12) Repeat steps 3 and 4 substituting “User3” for “User2” Queue should look as follows:

 Note “User2” has control.

 

13) Click “Gain Dialog Control” in “User1’s” client window.

 

 

Note that unlike step 10, “User1” is now at the head of the queue and “User2” is now missing.” “User1” now has immediate control of the dialog as indicated by the active “Send” button in “User1’s” client window.

 


 

Expected Results:

 

The “Request Turn Queue” window should be updated during each of the steps described above and match the screen captures as shown. At all times, only the user at the front of the queue should be able to send messages. If the chair clicks “Move to Front of Queue”, the chair should immediately be moved to the position behind the current user. If the chair clicks “Preempt Queue”, the chair should move directly to the head of the queue and receive dialog control immediately.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Result as expected, except the send message button should be disabled when user not in control

Conditional passed

Nov 16, 2002 19:00

- Result as expected.  Send message button properly disabled.

Passed

 

Test case ID:

17

Test Case Description:

Show a dialog between several participants of a project. When a third user logs in and joins the session, the previous dialog is downloaded and displayed to this user.

Requirements being tested:

Project Admin 13.g and 13.h

Participant 10, 11, 16

Pre-condition:

A project with at least 3 participants exists and is active. Two users are logged in and have joined the active session of that project. A third user is logged in but has not yet joined the session. For this test, the common project is “Test 9a” and the users are “User1”, “User2”, and “User3”. “User1” is the project chair.

Testing procedures:

 

1) Click “Request Turn” in “User1’s” client window.

2) Type sample dialog in the message box and click “Send”. Below is the result shown in both “User1” and “User2’s” dialog window

 

 

3) Click “Release Turn” in “User1’s” client window.

4) Click “Request Turn” in “User2’s” client window.

5) Type sample dialog in the message box and click “Send”.

6) Click “Test 9a” in “User3’s” client window.

7) Click “Join Session”.

8) Click the “Dialog” tab

9) Click “Release Turn” in “User2’s” client window

10) Click “Request Turn” in “User3’s” client window

 

9) Type sample dialog in “User3’s” message box

10) Click “Send” in “User3’s” client window.

 

Expected Results:

 

All client windows should update the dialog window whenever a message is sent in any client window. When a user joins the session late, the previous dialog should appear within that user’s dialog window as show above.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

Result as expected

Passed

Nov 16, 2002 19:00

Result as expected.

Passed

 


Edit Control of Session Documents

 

Test case ID:

18

Test Case Description:

Add documents to an inactive and active project and ensure that only one document at a time can be edited. Also ensure that only one user can edit at any given time.

Requirements being tested:

Edit Control 14.a, 14.b, 14.c, 14.d, 14.l, 14.m

Participant 6, 12

Pre-condition:

A project with at least 2 participants exists. For this test, “User1” is the chair and “User2” is a participant in project “Test 9a”. This project is inactive and both users are logged in.

Testing procedures:

 

1) Click “Test 9a” in “User2’s” client window.

2) Click “Add Documents” in “User2’s” client window.

The following dialog box appears:


3) Enter the data as shown and click “Create Document”. The document will appear in the project tree under “Test 9a”.

 

4) Click “Test 9a” in “User1’s” client window.

5) Click “Activate Project”.

6) Click “Join Session” in “User2’s” client window.

7) Repeat steps 2 and 3 using “User2 Document2” as the Document name.

 

8) Click the “Document” Tab in both “User1” and “User2’s” client windows.

9) Click “User2 Document1” in “User2’s” project tree.

10) Click “Activate Document”.

11) Click “User2 Document2” in “User1’s” project tree.

12) Click “Activate Document”. Document should remain inactive.

13) Click “User2 Document1” in “User1’s” project tree.

14) Attempt to edit this document in “User1’s” edit window.

15) Attempt to edit this document in “User2’s” edit window.

16) Click “Save Document” in “User2’s” client window.

17) Click “Inactivate Project” in “User1’s” “Project” window

 

Expected Results:

 

Documents should be added to the project tree whenever they are created whether the project is active or not. Only one document should be active at any time for the project and one user should have editing control of that document. When it is saved, the document’s version number should be incremented by 1. The results of this test should match the screen shot above

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Editing not disabled in GUI when user not in control

-Doc tree updated properly when doc added

-Notification not integrated

Failed

Nov 16, 2002 19:00

- Result as expected.

Passed

 


 

Test case ID:

19

Test Case Description:

Collectively edit a document and view the changes in all client windows simultaneously.

Requirements being tested:

Edit Control 14.e, 14.f, 14.g, 14.h, 14.i, 14.j, 14.n

Participant 5, 8, 9, 13, 14

Pre-condition:

A project exists which contains at least 1 document and has at least 3 participants. The project is active and at least 3 participants have joined the session. For this test, project “Test 9a” will be used and document “User2 Document1” will be edited. “User1”, “User2” and “User3” have joined the session and “User1” is the chair.

Testing procedures:

 

1) Click the “Document” tab in all three client windows.

2) Click “User2 Document1” in “User1’s” project tree.

3) Click “Activate Document”.

4) Click “User2 Document1” in “User2’s” project tree.

5) Click “Request Turn”

6) Click “User2 Document1” in “User3’s” project tree.

7) Click “Request Turn”

 

8) Edit the document in “User1’s” edit window. Changes should appear in all other user’s edit windows

9) Click “Save Document” in “User1’s” client window.

10) Attempt to edit the document in “User2” and “User3’s” edit window. This should fail.

11) Click “Release Turn” in “User1’s” client window.

13) Attempt to edit the document in “User2’s” edit window.

14) Click “Save Document” in “User1’s” client window.

15) Click “Release Turn” in “User2’s” client window.

 

 

16) Attempt to edit the document in “User3’s” edit window.

17) Click “Release Turn” in “User3’s” client window.

18) Attempt to edit the document in “User1’s” edit window.

19) Click “Inactivate Document”

The following dialog should appear:

 

<<***Insert save dialog here***>>

 

20) Click “Inactivate Project” in “User1’s” “Project” window.

 

Expected Results:

 

The user at the head of the queue should be the only person who can edit the active document. When the queue is empty, edit control should be available to the project chair. Documents can be saved at any time as in steps 9 and 14. If the document is inactivated before it is saved, the user should be given the opportunity to save the document at that time.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Editing is displayed in all participants of a session

-Edit Control not integrated with GUI yet, but should be similar to Dialog Control which is tested to work.

Conditional

passed

Nov 16, 2002 19:00

- Results as expected.

Passed

 

Test case ID:

20

Test Case Description:

The following tests the edit queue and its onscreen display. During each step, the changes in the queue should be visible to all clients logged into the session. Only the user at the head of the queue should be able to edit a document.

Requirements being tested:

Edit Control 14.k, 14.i

Pre-condition:

Three separate users are logged in to three separate clients. All three are participants the same project and one is the chair. This common project has been activated and the remaining users have joined the active session of that project. The chair has released his or her turn. For this test, the common project is “Test 9a” and the users are “User1”, “User2”, and “User3”. “User1” is the project chair.


 

Testing procedures:

 

1) Type a sentence in each client’s message box.

2) Click “Request Turn” in “User3’s” client window.

3) Click “Request Turn” in “User2’s” client window.

4) Click “Request Turn” in “User1’s” client window.

 

All clients’ “Request Turn Queue” windows should look like the following. Note that “User3’s” “Send” button is now active.

5) Click “Release Turn” in “User3’s” client window.

 

Note “User2’s” “Send” button is now active and “User3” is missing from the “Request Turn Queue” window.

6) Click “Request Turn” in “User3’s” client window. The queue should be as follows:

 

 

7) Click “Release Turn” in “User2’s” client window.

8) Click “Release Turn” in “User1’s” client window.

9) Repeat steps 3 and 4. Queue should look as follows:

 

10) Click “Move to Front of Queue” in “User1’s” client window. Note that “User1” is not at the head of the queue, but at position 2. When “User3” releases his or her turn, “User1” will be given control ahead of”User2”.

11) Repeat steps 7 and 8 with “User3” and “User1”

12) Repeat steps 3 and 4 substituting “User3” for “User2” Queue should look as follows:

 Note “User2” has control.

 

13) Click “Gain Edit Control” in “User1’s” client window.

 

 

Note that unlike step 10, “User1” is now at the head of the queue and “User2” is now missing.” “User1” now has immediate control of the document editing.

 

Expected Results:

 

The “Request Turn Queue” window should be updated during each of the steps described above and match the screen captures as shown. At all times, only the user at the front of the queue should be able to activate and edit a document. If the chair clicks “Move to Front of Queue”, the chair should immediately move to the position behind the current user. If the chair clicks “Preempt Queue”, the chair should move directly to the head of the queue and receive edit control immediately.

 

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Edit Control not integrated with GUI yet, but should be similar to Dialog Control which is tested to work.

Conditional

passed

Nov 16, 2002 19:00

- Results as expected.

Passed

 


 

Test case ID:

21

Test Case Description:

Testing that dialog and document editing can be run concurrently. Also testing that all participants in a session are removed from a session when the chair logs out.

Requirements being tested:

Edit Control 15,19

Pre-condition:

A project exists that has at least 2 users and contains at least one document. The project is active and at least one other participant other than the chair has joined the session. For this test, project “Test 9a” will be used and “User1” and “User2” will be logged in and participants in the session.

Testing procedures:

 

1)      Click the “Discussion” tab in both client windows

2)      Referring to Test Case ID 17, perform steps 1 through 5

3)      Referring to Test Case ID 19, perform steps 1 through 9 omitting 6 and 7

4)      Click the “Project” tab in “User1’s” client window

5)      Click “Inactivate Project”

 

Expected Results:

 

Both discussion and document editing should run concurrently. When the chair finally inactivates the session in step 5, all other users should be forced out of the session. The following message appears in “User2’s” notification window as proof of this action.

Testing History

Date

Result

Success / Fail?

Nov 10, 2002

-Participant of a session not forced out when the chair logs out

-Notification not integrated

Failed

Nov 16, 2002 19:00

- Result as expected.

Passed

 


2.0 Unit Test

2.1 RPC Unit Test

 

Modules Under Test

  • RPC Encode
  • RPC Decode

 

Test Description

The RPC Test driver is used to test the functionality of the following modules in the RPC package:

 

com.eece419.ct.rpc.encode:

  • Encode(java.lang.String methodName)
  • setReturnChannel(int channel)
  • setIntParam(int intParam)
  • setStringParam(java.lang.String stringParam)
  • setBoolParam(boolean boolParam)
  • setObjParam(java.lang.Object objParam)
  • encodeXML()

 

com.eece419.ct.rpc.decode:

  • Decode(java.lang.String xmlString)
  • getMethodName()
  • getReturnChannel()
  • getIntParam()
  • getStrParam()
  • getBoolParam()
  • getObjParam()

 

In the test driver, the Encode class is used to encode a method named “Testing”. The return channel and 2 samples of each parameter type (Integer, String, Boolean and Java Object) are also encoded with the  “Testing” method. Two Vectors of strings are used to test the functionality of the Java Object Encoding and Decoding. The following code demonstrates the testing of the Encode class.

 

Vector testVector1 = new Vector(); //setup a vector to be encoded

testVector1.add("object1");

testVector1.add("object2");

testVector1.add("object3");

 

Vector testVector2 = new Vector(); //setup the 2nd vector

testVector2.add("object4");

testVector2.add("object5");

testVector2.add("object6");

 

Encode testEncode = new Encode("TESTING"); //encode method "testing"

testEncode.setReturnChannel(120); //set return channel

testEncode.setIntParam(123); //set 1st Integer Parameter

testEncode.setStringParam("This is 1st string"); //set 1st string parameter

testEncode.setIntParam(456); //set 2nd integer parameter

testEncode.setBoolParam(true); //set 1st boolean parameter

testEncode.setStringParam("This is 2nd string"); //set 2nd string parameter

testEncode.setObjParam(testVector1); //set 1st object parameter

testEncode.setBoolParam(false); //set 2nd boolean parameter

testEncode.setObjParam(testVector2); //set 2nd object parameter

 

String xmlEncode = testEncode.encodeXML();

 

The resulting XML string from the Encode class is going to input into the Decode class. The Decode class will parse the XML string and display the obtained method name, return channel and parameters. The follow code demonstrates the testing of the Decode class.

 

Decode testDecode = new Decode(xmlEncode); //decode xml

 

System.out.println("Method Name: " + testDecode.getMethodName());

//get method name from xml

System.out.println("ReturnChannel: " + testDecode.getReturnChannel());

//get return channel

System.out.println("1st Integer Parameter: " + testDecode.getIntParam());

//get 1st integer param

System.out.println("2nd Integer Parameter: " + testDecode.getIntParam());

//get 2nd integer param

System.out.println("1st String Parameter: " + testDecode.getStrParam());

//get 1st string param

System.out.println("2nd String Parameter: " + testDecode.getStrParam());

//get 2nd string param

System.out.println("1st Boolean Parameter: " + testDecode.getBoolParam()); //get 1st boolean param

System.out.println("2nd Boolean Parameter: " + testDecode.getBoolParam()); //get 2nd boolean param

 

Vector decodeVector1 = (Vector)testDecode.getObjParam(); //get 1st vector

Vector decodeVector2 = (Vector)testDecode.getObjParam(); //get 2nd vector

 

System.out.print("\nItems from testVector1: ");

//display content of the first vector

for(int i=0; i<decodeVector1.size(); i++) {

  System.out.print(decodeVector1.get(i) + " ");

}

 

System.out.print("\nItems from testVector2: ");

//display content of the 2nd vector

for(int i=0; i<decodeVector2.size(); i++) {

    System.out.print(decodeVector2.get(i) + " ");

}

 

The following illustrates the attributes that the Decode has obtained from the XML string created by the Encode test code.

 

Method Name: TESTING

ReturnChannel: 120

1st Integer Parameter: 123

2nd Integer Parameter: 456

1st String Parameter: This is 1st string

2nd String Parameter: This is 2nd string

1st Boolean Parameter: true

2nd Boolean Parameter: false

 

Items from testVector1: object1 object2 object3

Items from testVector2: object4 object5 object6

 

 


Test Driver Source Code: XmlTest

 

package com.eece419.ct.rpc;

 

import javax.xml.parsers.DocumentBuilderFactory;

import javax.xml.parsers.DocumentBuilder;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.InputSource;

import org.xml.sax.SAXException;

import org.w3c.dom.*;

import java.lang.*;

import java.io.*;

import java.util.*;

 

class XmlTest{

 

    public static void main(String argv[]) {

 

        Vector testVector1 = new Vector(); //setup a vector to be encoded

        testVector1.add("object1");

        testVector1.add("object2");

        testVector1.add("object3");

 

        Vector testVector2 = new Vector(); //setup the 2nd vector

        testVector2.add("object4");

        testVector2.add("object5");

        testVector2.add("object6");

 

 

        Encode testEncode = new Encode("TESTING"); //encode method "testing"

        testEncode.setReturnChannel(120); //set return channel

        testEncode.setIntParam(123); //set 1st Integer Parameter

        testEncode.setStringParam("This is 1st string"); //set 1st string parameteer

        testEncode.setIntParam(456); //set 2nd integer parameter

        testEncode.setBoolParam(true); //set 1st boolean parameter

        testEncode.setStringParam("This is 2nd string"); //set 2nd string parameter

        testEncode.setObjParam(testVector1); //set 1st object parameter

        testEncode.setBoolParam(false); //set 2nd boolean parameter

        testEncode.setObjParam(testVector2); //set 2nd object parameter

 

        String xmlEncode = testEncode.encodeXML();

        System.out.println("\n" + xmlEncode + "\n");

 

        Decode testDecode = new Decode(xmlEncode); //decode xml

 

        System.out.println("Method Name: " + testDecode.getMethodName()); //get method name from xml

        System.out.println("ReturnChannel: " + testDecode.getReturnChannel()); //get return channel

        System.out.println("1st Integer Parameter: " + testDecode.getIntParam()); //get 1st integer param

        System.out.println("2nd Integer Parameter: " + testDecode.getIntParam()); //get 2nd integer param

        System.out.println("1st String Parameter: " + testDecode.getStrParam()); //get 1st string param

        System.out.println("2nd String Parameter: " + testDecode.getStrParam()); //get 2nd string param

        System.out.println("1st Boolean Parameter: " + testDecode.getBoolParam()); //get 1st boolean param

        System.out.println("2nd Boolean Parameter: " + testDecode.getBoolParam()); //get 2nd boolean param

 

        Vector decodeVector1 = (Vector)testDecode.getObjParam(); //get 1st vector

        Vector decodeVector2 = (Vector)testDecode.getObjParam(); //get 2nd vector

 

        System.out.print("\nItems from testVector1: "); //display content of the first vector

        for(int i=0; i<decodeVector1.size(); i++) {

          System.out.print(decodeVector1.get(i) + " ");

        }

 

        System.out.print("\nItems from testVector2: "); //display content of the 2nd vector

        for(int i=0; i<decodeVector2.size(); i++) {

          System.out.print(decodeVector2.get(i) + " ");

        }

 

    }

}

 

Test Sample Output

<RPC1.0><methodname>TESTING</methodname><returnchannel>120</returnchannel><params><int>123</int><string>This is 1st string</string><int>456</int><bool>true</bool><string>This is 2nd string</string><object>¬í@#nnn;@#005;sr@#nnn;@#016;java.util.VectorÙ?}[?;‾@#001;@#002;@#nnn;@#003;I@#nnn;@#017;capacityIncrementI@#nnn;@#012;elementCount[@#nnn;@#011;elementDatat@#nnn;@#019;[Ljava/lang/Object;xp@#nnn;@#nnn;@#nnn;@#nnn;@#nnn;@#nnn;@#nnn;@#003;ur@#nnn;@#019;[Ljava.lang.Object;?ÎX?@#016;s)l@#002;@#nnn;@#nnn;xp@#nnn;@#nnn;@#nnn;

t@#nnn;@#007;object1t@#nnn;@#007;object2t@#nnn;@#007;object3ppppppp</object><bool>false</bool><object>¬í@#nnn;@#005;sr@#nnn;@#016;java.util.VectorÙ?}[?;‾@#001;@#002;@#nnn;@#003;I@#nnn;@#017;capacityIncrementI@#nnn;@#012;elementCount[@#nnn;@#011;elementDatat@#nnn;@#019;[Ljava/lang/Object;xp@#nnn;@#nnn;@#nnn;@#nnn;@#nnn;@#nnn;@#nnn;@#003;ur@#nnn;@#019;[Ljava.lang.Object;?ÎX?@#016;s)l@#002;@#nnn;@#nnn;xp@#nnn;@#nnn;@#nnn;

t@#nnn;@#007;object4t@#nnn;@#007;object5t@#nnn;@#007;object6ppppppp</object></params></RPC1.0>

 

 

Method Name: TESTING

ReturnChannel: 120

1st Integer Parameter: 123

2nd Integer Parameter: 456

1st String Parameter: This is 1st string

2nd String Parameter: This is 2nd string

1st Boolean Parameter: true

2nd Boolean Parameter: false

 

Items from testVector1: object1 object2 object3

 

Items from testVector2: object4 object5 object6


2.2 Project Unit Test

 

Modules Under Test:

  • Directory (client/server)
  • PersistentStore (client/server)
  • Project (client/server)
  • ParticipantInfo
  • ProjectInfo

 

Test Description

This unit test verifies the functionality provided by the Project client/server package. It starts a project server, and then instantiates a project client to make the project function calls.

This test verifies the following main project functionality:

o       Createproject

o       addParticipantToProject

o       isChairOfProject

o       isPartOfProject

o       getProjectParticipants

o       getParticipatingProjects

o       deleteParticipantFromProject

o       addDocument

o       deleteDocument

o       getDocList

 

Since the projectInfo and participantInfo data classes are stored in the PersistentStore, and the Directory is used to store/retrieve the keys associated with each data object in PersistentStore, the test first starts the PersistentStore client/server and the Directory client/server. Each data object update requires a key look up, and a retrieve/store operation in the PersistentStore.

 

The test first manually adds new ParticipantInfo objects to the PersistentStore, and creates two projects using a proper chair userID. Then, the test adds participants to project A, and verifies different userID’s as the participant or the chair of the project. It then tests the getProjectParticipants function, and displays a list of project participants of project A. It tests the getParticipatingProjects function, and displays a list of projects participated by user2. Two users a deleted from project A, and the resulting list of participants of project A is displayed. The test then adds and removes document to the project, and displays the resulting document list of the project.

 


Test Driver Source Code: ProjectTestDriver

 

public class ProjectTestDriver {

 

    public static void main(String argv[]) {

 

        AMCServer server = new AMCServer(AMCServer.DEFAULT_SERVER_PORT);

        server.initialize();

        DirectoryServer ds = new DirectoryServer("localhost");

        PersistentStoreServer ps = new PersistentStoreServer("C:\\ProjectTest");

        ProjectServer projS = new ProjectServer();

        AMCClient client = new AMCClient("localhost");

        client.attach();

        ProjectClient projC = new ProjectClient(client);

 

 

        //add new participants manually for test

        DirectoryClient directory = new DirectoryClient(client);

        PersistentStoreClient pStorage = new PersistentStoreClient(client);

 

        ParticipantInfo part1 = new ParticipantInfo("user1", "pwdA");

        ParticipantInfo part2 = new ParticipantInfo("user2", "pwdB");

        ParticipantInfo part3 = new ParticipantInfo("user3", "pwdC");

        ParticipantInfo part4 = new ParticipantInfo("user4", "pwdC");

 

        try {

            int part1Key = pStorage.addItem(part1);

            int part2Key = pStorage.addItem(part2);

            int part3Key = pStorage.addItem(part3);

            int part4Key = pStorage.addItem(part4);

 

            directory.setAttribute(DirectoryNames.USER + "." + "user1", new Integer(part1Key));

            directory.setAttribute(DirectoryNames.USER + "." + "user2", new Integer(part2Key));

            directory.setAttribute(DirectoryNames.USER + "." + "user3", new Integer(part3Key));

            directory.setAttribute(DirectoryNames.USER + "." + "user4", new Integer(part4Key));

 

        }

        catch (Exception e) {

            System.out.println("exception" + e);

        }

 

        //create projects

        if (projC.createProject("projA", "user1", "description blah.")) {

            System.out.println("Create Project projA successful");

        }

        else {

            System.out.println("Create Project projA failed");

        }

        if(projC.createProject("projB", "user2", "dajhdksahdsjka.")) {

            System.out.println("Create project projB successful");

        }

        else {

            System.out.println("Create Project projB failed");

        }

        //chair user1 add participant to project

        if(projC.addParticipantToProject("projA", "user4", "user1")) {

            System.out.println("Add user4 to projA successful");

        } else {

            System.out.println("Add user4 to ProjA failed");

        }

        if(projC.addParticipantToProject("projA", "user3", "user1")) {

            System.out.println("Add user3 to projA successful");

        } else {

            System.out.println("Add user3 to ProjA failed");

        }

        if(projC.addParticipantToProject("projA", "user2", "user1")) {

            System.out.println("Add user2 to projA successful");

        } else {

            System.out.println("Add user2 to projA failed");

        }

 

        //check chair

        if(projC.isChairOfProject("projA", "user1")) {

           System.out.println("user1 is chair of projA");

        }

        if(projC.isChairOfProject("projA", "user2")) {

           System.out.println("user2 is chair of projA");  //user2 is not chair of projA

        }

        //check participant

        if(projC.isPartOfProject("projA", "user3")) {

           System.out.println("user3 is in projA");

        }

        if(projC.isPartOfProject("projB", "user4")) {

           System.out.println("user4 is in projB");     //user 4 is not part of projB

        }

 

        System.out.println("projA participants:");

        String participant;

        Vector partListInProjA = projC.getProjectParticipants("projA");

        for (int i =0; i < partListInProjA.size(); i++) {

            participant = (String)partListInProjA.elementAt(i);

            System.out.println("part" + i + " is " +  participant);

        }

 

        //check user2 participating projects (2 of them)

        System.out.println("user2 participating projects:");

        String project;

        Vector projList = projC.getParticipatingProjects("user2");

        for (int i = 0; i < projList.size(); i++) {

            project = (String)projList.elementAt(i);

            System.out.println("proj" + i + " is " +  project);

        }

 

        if (projC.deleteParticipantFromProject("projA", "user4", "user1")) {

            System.out.println("delete user4 from projA successful");

        }

        if (projC.deleteParticipantFromProject("projA", "user3", "user1")) {

            System.out.println("delete user3 from projA successful");

        }

 

        System.out.println("after delete from projA, projA has");

        partListInProjA = projC.getProjectParticipants("projA");

        for (int i =0; i < partListInProjA.size(); i++) {

            participant = (String)partListInProjA.elementAt(i);

            System.out.println("part" + i + " is " +  participant);

        }

 

        //chair user2 adds participants to projB

        if(projC.addParticipantToProject("projB", "user4", "user2")) {

            System.out.println("Add user4 to projB successful");

        } else {

            System.out.println("Add user4 to ProjB failed");

        }

        if(projC.addParticipantToProject("projB", "user3", "user2")) {

            System.out.println("Add user3 to projB successful");

        } else {

            System.out.println("Add user3 to ProjB failed");

        }

 

        //test get document list of project

        projC.addDocument("projA", "doc1");

        projC.addDocument("projA", "doc2");

        projC.addDocument("projA", "doc3");

        Vector docList = projC.getDocList("projA");

        System.out.println("doclist is"+docList);

 

        if( projC.deleteDocument("projA", "user1", "doc1")) {

           System.out.println("projA deleted doc1");

        }

        if (projC.deleteDocument("projA", "user1", "doc2")) {

           System.out.println("projA deleted doc2");

        }

        docList = projC.getDocList("projA");

        System.out.println("doclist is"+docList);

 

        // test delete project

        if (projC.deleteProject("projB", "user2")) {

            System.out.println("deleteProject projB successful");

        } else {

            System.out.println("deleteProject fail");

        }

 

 

        //try added to projB again should throw an exception

    /*if(projC.addParticipantToProject("projB", "user4", "user2")) {

       System.out.println("Add user4 to projB successful");

    } else {

       System.out.println("Add user4 to ProjB failed");

    }*/

 

    }

 

}

 

 

 

 

 

Test Sample Output

 

Create Project projA successful                        //create project A

Create project projB successful                        //create project B

Add user4 to projA successful                         //add participants to project A

Add user3 to projA successful

Add user2 to projA successful

user1 is chair of projA                                      //check chair of project A

user3 is in projA                                               //check user of project A

projA participants:                                             //check project participants of project A

part0 is user4

part1 is user3

part2 is user2

user2 participating projects:                             //check participating projects of user2

proj0 is projA

proj1 is projB

delete user4 from projA successful                  //delete user4

delete user3 from projA successful                  //delete user3

after delete from projA, projA has                   //check project participants of project A

part0 is user2                                                  

Add user4 to projB successful                         //add participants to project B

Add user3 to projB successful

doclist is[doc1, doc2, doc3]                             //check doc list of project A(after doc added)

projA deleted doc1                                              //delete documents

projA deleted doc2

doclist is[doc3]                                                 //check doc list of project A (after doc deleted)

deleteProject projB successful                         //delete project B


Appendix A – RPC Source Code

 

Encode Class Source Code

 

package com.eece419.ct.rpc;

 

import java.lang.*;

import java.io.*;

 

/**

 * The Encode class is responsible for encoding a XML string for RPC. Users can set a remote method's names and

 * its parameters with the methods provided by this class, and it will encode the input information into

 * a XML String <p>

 * $Source: D:/Web/cvs/cvsrepo/repo/CollaborativeTool/src/com/eece419/ct/RPC/Encode.java,v $<br>

 * Last updated by $Author: kenneth $<br>

 * $Date: 2002/11/05 02:02:04 $<br>

 * $Revision: 1.7 $<br>

 * $State: Exp $<br>

 * @author Idon Wong<br>

 */

 

public class Encode extends RPCCoding {

   

    final static String VERSION_TAG = "<" + VERSION + ">";

    final static String VERSION_ENDTAG = "</" + VERSION + ">";

    final static String METHODNAME_TAG = "<" + METHODNAME + ">";

    final static String METHODNAME_ENDTAG = "</" + METHODNAME + ">";

    final static String RETURNCHANNEL_TAG = "<" + RETURNCHANNEL + ">";

    final static String RETURNCHANNEL_ENDTAG = "</" + RETURNCHANNEL + ">";

    final static String PARAMS_TAG = "<" + PARAMS + ">";

    final static String PARAMS_ENDTAG = "</" + PARAMS + ">";

    final static String INTEGER_TAG = "<" + INTEGER + ">";

    final static String INTEGER_ENDTAG = "</" + INTEGER + ">";

    final static String BOOLEAN_TAG = "<" + BOOLEAN + ">";

    final static String BOOLEAN_ENDTAG = "</" + BOOLEAN + ">";

    final static String STRING_TAG = "<" + STRING + ">";

    final static String STRING_ENDTAG = "</" + STRING + ">";

    final static String OBJECT_TAG = "<" + OBJECT + ">";

    final static String OBJECT_ENDTAG = "</" + OBJECT + ">";

   

   

    private String methodName;

    private String returnChannel;

    private StringBuffer parameters = new StringBuffer();

   

    /**

     * Encode.java - The contructor will start preparing a XML string with the provided remote method name. It surrounds the

     * method name with "methodname" XML tags, all of which will be later encoded into a XML string.

     * @param methodName the name of the remote method that will be encode into XML.

     */

    public Encode(String methodName) {

        if(!(methodName.equals(null)) && !(methodName.equals(""))) {

            this.methodName = METHODNAME_TAG + methodName + METHODNAME_ENDTAG;

        }

        else {

            System.err.println("No Method Name!");

        }

    }

   

    /**

     * Marshal a return channel so that the code at the server side can return a parameter to the stub through

     * this channel.

     * @param channel the return channel through which the return parameter will be returned from the server.

     */

    public void setReturnChannel(int channel) {

        this.returnChannel = RETURNCHANNEL_TAG + Integer.toString(channel) + RETURNCHANNEL_ENDTAG;

    }

   

    /**

     * Marshalling an integer parameter of the passing method for RPC encoding.

     * @param intParam the integer parameter that is going to be marshalled.

     */

    public void setIntParam(int intParam) {

        parameters.append(INTEGER_TAG + intParam + INTEGER_ENDTAG);

    }

   

    /**

     * Marshalling a boolean parameter of the passing method for RPC encoding.

     * @param boolParam the boolean parameter that is going to be marshalled.

     */

    public void setBoolParam(boolean boolParam) {

        parameters.append(BOOLEAN_TAG + boolParam + BOOLEAN_ENDTAG);

    }

   

    /**

     * Marshalling a string parameter of the passing method for RPC encoding.

     * @param stringParam the string parameter that is going to be marshalled.

     */

    public void setStringParam(String stringParam) {

        parameters.append(STRING_TAG + xmlCharsEncode(stringParam) + STRING_ENDTAG);

    }

   

    /**

     * Marshalling a java object parameter of the passing method for RPC encoding.

     * @param objParam the java object parameter that is going to be marshalled.

     */

    public void setObjParam(Object objParam) {

        ByteArrayOutputStream  baStream = new ByteArrayOutputStream(); //init byte array

       

        try{

            ObjectOutputStream objStream = new ObjectOutputStream(baStream); //translate object to byte

            objStream.writeObject(objParam);

            parameters.append(OBJECT_TAG + xmlCharsEncode(baStream.toString(OBJ_ENCODING))  + OBJECT_ENDTAG); //encode into string

        } catch( Exception e ) {

            e.printStackTrace();

        }

    }

   

    /**

     * Encode the method name and all its parameters into a XML formatted string

     * @return the encoded XML string.

     */

    public String encodeXML() {

        StringBuffer encodeString = new StringBuffer();

       

        encodeString.append(VERSION_TAG);

        encodeString.append(methodName);

        encodeString.append(returnChannel);

        encodeString.append(PARAMS_TAG + parameters + PARAMS_ENDTAG);

        encodeString.append(VERSION_ENDTAG);

       

        return encodeString.toString();

    }

   

/*

  encode illegal xml char into "@#XXX;" where XXX is the ASCII code int of the character. The char null is encode to

  "@#nnn;"

 */

    private String xmlCharsEncode(String xml) {

       

        StringBuffer xmlString = new StringBuffer(xml);

        char xmlChar;

        String encode;

       

        for(int i=0;i<xmlString.length();i++) {

            xmlChar = xmlString.charAt(i);

            //identify illegal chars

            if(!( (xmlChar == 0x9) || (xmlChar == 0xA) || (xmlChar == 0xD) || ((xmlChar>=0x20) && (xmlChar<=0xD7FF)) || ((xmlChar>=0xE000) && (xmlChar<=0xFFFD)) || ((xmlChar>=0x10000) && (xmlChar<=0x10FFFF)))

            || xmlChar == '<' || xmlChar == '>' || xmlChar == '&' ) {

                xmlString.deleteCharAt(i); //remove illegal char

                if(xmlChar==0x0) { //encode null to @#nnn;

                    encode = "@#nnn;";

                }

                else {

                    if((int)xmlChar<10) { //encode char to their ASCII int

                        encode = "@#00"+(int)xmlChar+";";

                    }