hierarchical project management system

58
CSIE/NTUT Object-Oriented Analysis and Design Hierarchical Project Management System The homework #6 for Object-Oriented Analysis Design Course, Spring 2006. (Updated with comment/suggestions in the final presentation) Written by Chang, Chuan-Wen (#94419012)

Upload: samuel90

Post on 31-Aug-2014

1.163 views

Category:

Business


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Hierarchical Project Management System

CSIE/NTUT

Object-Oriented Analysis and Design Hierarchical Project Management System The homework #6 for Object-Oriented Analysis Design Course, Spring 2006. (Updated with comment/suggestions in the final presentation)

Written by Chang, Chuan-Wen (#94419012)

Page 2: Hierarchical Project Management System
Page 3: Hierarchical Project Management System

OOAD Homework (Spring 2006) 1

Page 4: Hierarchical Project Management System

TABLE OF CONTENTS

1. REQUIREMENT DOCUMENT......................................................................................4 1.1 Revision History 4 1.2 Problem Statement 6 1.3 System Context Diagram 7 1.4 Summary of System Features 8 1.5 Use Cases 9

1.5.1 Use Cases Diagram 9 1.5.2 User Authentication and Authorization 10 1.5.3 Management Users 10 1.5.4 Register Project 11 1.5.5 Manage Project 12 1.5.6 Feedback Task Execution Status 13 1.5.7 Information Reporting 14

1.6 Non-Functional Requirements and Constraints 15 1.7 Data Dictionary 16 1.8 Software Environment 17

2. DOMAIN CLASS MODEL...........................................................................................18 2.1 Domain Class Model Showing Only Concepts 18 2.2 Add Associations 19 2.3 Add Attributes 21

3. CLASS DESIGN.........................................................................................................22 3.1 Use-Case Realizations with GRASP Patterns 22

3.1.1 Choose the most significant use-case, identify system events, and draw a system sequence diagram for that use case. 22 3.1.2 Write a contract for each system operation (system event). 24 3.1.3 Draw a sequence diagram for each system event you identified, and label with the GRASP patterns to describe how you assign responsibilities. 26

3.2 Design Class Model 29

5. IMPLEMENTATION CLASS MODEL.........................................................................30 5.1 Draw an implementation class diagram for your system (including associations, attributes and methods) 30 5.2 Show the difference between implementation class model and design class model 31 5.3 Calculate Line of Code 32

6. PROGRAMMING ......................................................................................................34 6.1 Snapshots of system execution (optional) 34 6.2 Source Code Listing 35

OOAD Homework (Spring 2006) 2

Page 5: Hierarchical Project Management System

7. UNIT TESTING ........................................................................................................49 7.1 Snapshots of testing result (optional) 49 7.2 Unit Testing Code Listing 49

8. IMPLEMENTATION CLASS MODEL 2 .....................................................................56 Draw an implementation class diagram for your system (including associations, attributes (optional) and methods) 56

OOAD Homework (Spring 2006) 3

Page 6: Hierarchical Project Management System

1. REQUIREMENT DOCUMENT

1.1 Revision History

Date Major Modifications Summary Measurement

Mar 6, 2006 Problem statement drafted,

Homework #1 published

Total 3 hours

Mar 22, 2006 Document format revised,

System context diagram drafted,

Summary of System Feature drafted,

Use Case Diagram drafted,

Use Case drafted,

Non-functional and constraints drafted,

Data Dictionary drafted,

Software Environment drafted,

Homework #2 published

06/03/19 15:00~ 06/03/19 17:30

06/03/22 13:15~ 06/03/22 15:45

06/03/22 18:30~ 06/03/22 21:00

Total 7.5 hours

Mar 24, 2006 Bug-correct to Use Case Diagram

Homework #2 re-published

06/03/24 12:15 06/03/24 12:30

Total 0.25 hour

Apr 04, 2006 to

Apr 05, 2006

Document format and content revised (recommended by TA)

New Use case (UC-04, UC-05, UC-06) drafted.

Domain Class Model Showing Only Concepts drafted.

Add Associations drafted.

Homework #3 published

06/04/04 15:00 06/04/04 19:30

06/04/04 21:00 06/04/04 22:30

06/04/05 19:00 06/04/05 23:00

Total 10 hours

Apr 19, 2006 to

Apr 21, 2006

Use-Case Realizations with GRASP Patterns drafted

Design Class Model drafted

Homework #4 published

06/04/19 19:00 06/04/19 22:00

06/04/20 19:00 06/04/21 03:30

06/04/21 13:00

OOAD Homework (Spring 2006) 4

Page 7: Hierarchical Project Management System

06/04/21 17:30

Total hours 16 hours

May 7, 2006 to

May 9, 2006

Add some description on project manager's benefits (by provides a global view to the managed projects) in project statement section.

More information to the System Context Diagram.

Merge UC-02-01 and UC-02-02 into UC-02 User Management use case

Change some use-cases' name with the format of “verb+noun”

In each contracts, Change the "System" into "System Controller" to avoid confusing.

Remove all interfaces in the User Interface to avoid define the interface precisely during design phase.

UC-04 Implementation & Unit-testing

Homework #5 published

06/05/07 16:00 06/05/07 17:30

06/05/07 22:00 06/05/08 05:00

06/05/08 21:00 06/05/09 06:00

06/05/09 13:00 06/05/09 16:30

06/05/09 19:30 06/05/09 20:30

Total 20 hour

May 29, 2006 to

Jun 12, 2006

UC-06 Implementation & Unit-testing

Final report preparation

Final report slide finished.

Homework #6 published

07/05/29 21:00 07/05/29 22:30

07/06/01 22:00 07/06/02 02:30

07/06/02 23:00 07/06/03 05:00

07/06/11 13:00 07/06/11 16:00

07/06/11 11:00 07/06/12 02:00

Total 18 hour

Jun 12, 2006 to

Jun 13, 2006

Homework #6 Revised (after final presentation)

Homework #6 re-published

07/06/12 09:00 07/06/13 01:33

Total 4.5 hour

Total time spent for this project: 79.25 (hr.)

OOAD Homework (Spring 2006) 5

Page 8: Hierarchical Project Management System

1.2 Problem Statement

Project Management System (PMS) had been widely used in organizations which allow everyone (include Project Manager or Project Member) related to the project can get the most up-to-date information anytime, anywhere. Project Management is not only useful in software development, but also in many mature processes, such as building a house or bridge. Many years ago, the age without software, project management was done through pen and paper. Project Managers wrote down their design and task required in order to finish their final goal, and used traditional way such as getting the project task status by phone or mail. However, it’s hard to get a whole view of the entire project. With the support of IT technology, it is not difficult to implement an online PMS to support those real-time project management activities.

A Project is an information collection which includes general information such as Project Title, Proprietor, Start Date and Finish Date, etc, and a number of related tasks in order to finish the project which planned by a people who is in charge on the project, called Project Manager. A Task usually assign to a people (usually called project members) who is familiar with it. For management purposes, a task usually includes a Task Title which describes the task, a Resource about the team member assigned to the task, a Task Start Date and a Task Finish Date which indicate the time of the task started and finished actually. Other information may also be logged into task information which could aim on advance analysis activities such as process performance analysis to project members.

Compare to most of the PMS systems available today, this system should provide an extra support on large projects. A large project mentioned here indicates a long-term or multi-phase project which may be controlled by several project managers. Like a normal, regular project, a large project itself will be assigned a project manager for overall project planning. Additionally, the project manager may separate this large project (usually called Parent Project) into some smaller projects (usually called Child Projects) and assign different project managers for those smaller projects. The relationship between the parent project and child projects is called “Hierarchical”. In conclusion, the project separation has already been a practical strategy and adapted in enterprises already but not widely supported by most PMS available today. A major purpose of this Hierarchical Project Management System (HPMS) is designed to provide a system which could handle this situation.

Like most project management system today, the HPMS provides a view to project managers about the actual task executing status based on the task executing results which feedback by those project members. Moreover, HPMS also provides a global view to those project managers who manage many small projects through integrated information which aggregated with every tasks status from every small projects.

OOAD Homework (Spring 2006) 6

Page 9: Hierarchical Project Management System

1.3 System Context Diagram

Figure 1 shows the System Contet Diagram of this Hierarchical Project Management System.

Browser in Employee's Workstation

Browser in Employee's Workstation

Central Management

System

Browser in IT staff's

Workstation

Project Manager

Project Member Administrator

Browser in Remote Users'

Workstation

Remote Users

System Boundary

Not included during the first phase

Web Server & Storage

Figure 1, The System context diagram of the Hierarchical Project Management System

Deploy this system to an environment which including employees’ workstations (used by project manager and project member) and IT staffs’ workstations within the coporate network—the corpNet (might be extended to across the Internet in the future). The administrator use it’s workstation (located in MIS department, denoted in “IT staff’s workstation”; Other regular users include project managers and members use their laptop which denoted in “Employee’s Workstation” to access the “Central Management System”, which hosted in headquarter’s server room.

The Central Management System provides central host applications and a storage for PMS system, regular users and administrator access this system through those applications hosted in Central Management System. Each user of this system which identified by their ID and role will got a set of system functions, to support their responsibilities of project amangement.

OOAD Homework (Spring 2006) 7

Page 10: Hierarchical Project Management System

1.4 Summary of System Features

The following system features is identified as following items.

Feature ID Feature Descriptions

FEA-01 All user should identify theirelf in order to use any feature of this system.

FEA-02 Separation of responsibilities. Depends on the the role of current user, only limited functions available could be accessed.

FEA-03 Support Project-Tasks (1 to many) project management relationship

FEA-04 Support Master Project-Child Projects (1 to many) project Management relationship

FEA-05 Provides project-level information reporting for each Project Manager for management and audit purpose.

FEA-06 Web-based system architecture, allow all system users can access this system, anytime, everywhere (within corpNet)

FEA-07 Use text file (XML) as primary storage, no RDBMS is required for this system.

OOAD Homework (Spring 2006) 8

Page 11: Hierarchical Project Management System

1.5 Use Cases

1.5.1 Use Cases Diagram

Administrator

Project Manager

Project Member

Hierarchical Project Management System (HPMS)

User Authentication and Authorization

Manage Users

Register Project

Manage Project

Feedback Task Execution Status

Information Reporting

Figure 2, The Use Case Diagram for Hierarchical Project Management System

Those use cases identified this time are listed in the following table.

Use Case ID Use Case

UC-01 User Authentication and Authorization

UC-02 Manage Users

UC-03 Register Project

OOAD Homework (Spring 2006) 9

Page 12: Hierarchical Project Management System

UC-04 Manage Project

UC-05 Feedback Task Execution Status

UC-06 Information Reporting

1.5.2 User Authentication and Authorization

Use Case ID UC-01

Summary A user get authenticated and authorized by his/her id and password, and then could access a predefined function set, depends on his/her role associated.

Primary Actor User

Precondition n/a

Description 1. A user accesses this system through a workstation in the corpNet.

2. The user enters his/her identification to login this system.

3. System logs his/her name, current time into the system access log.

4. System shows a list of functions accessible by the user, determined by this/her role.

Exception 2a: System responses an error message when the identification provided by the user not exists in system’s user database.

Post Condition User is gain access to this system, and can access any function granted by this system.

1.5.3 Management Users

Use Case ID UC-02

Summary A user with administrator permission creates a new user account for the system.

Primary Actor Administrator

OOAD Homework (Spring 2006) 10

Page 13: Hierarchical Project Management System

Precondition A user belongs to “administrator” role had already login to this system.

Description 1. The administrator accesses the “User Maintenance” function.

2. System shows a user list current exists in the user database.

3. The administrator starts the “Create a User”, the “Update a User”, or the “Delete a User” action.

3a. Administrator creates a new user with the new user’s name, credential (a unique logon id and password), and the role will be play by the new user.

3b. Administrator update an existing user’s information with the user’s, credential (a unique logon id and password), and the role will be play by the existing user.

3c. Administrator delete an current user by enter the user’s name.

4. System response an confirmation message to the administrator.

Exception 4a: System responses an error message when the user id was duplicated with other user in system’s user database.

4b: System responses an error message when the user name, user id had not entered.

Post Condition A new user account will be saved in the system’s user database after this operation success.

1.5.4 Register Project

Use Case ID UC-03

Summary A user with administrator permission registers a new project to the system.

Primary Actor Administrator

Precondition A user belongs to “administrator” role had already login this system.

Description 1. The administrator accesses the “Project Registration”

OOAD Homework (Spring 2006) 11

Page 14: Hierarchical Project Management System

function to start a project registration.

2. The administrator enters a project id, the name, description, started date and finished date of the new project.

3. The administrator may also assign a project manager to this new project. A project manager is a user with “Project Manager” role.

4. The administrator save this new project into system.

Exception 2a: System responses an error message when the project id is duplicated with other project in system’s project database.

2b: System responses an error message when the project id, project name, start date, or end date had not entered.

Post Condition The new project will be registered to the system’s project database after this operation success.

1.5.5 Manage Project

Use Case ID UC-04

Summary A user with project manager permission manages the project which already assign to him/her.

Primary Actor Project Manager

Precondition A user belongs to “Project Manager” role had already login this system.

Description 1. The project manager accesses the “Manage Project” function to start a project management.

2. The system returns a list contains projects which already assigned to him/her.

3. The project manager picks a project.

4. The project manager manages the picked project.

4a. Split a project into some child projects:

1. The project manager separates this project into some smaller projects. Those smaller projects can be treated as standalone

OOAD Homework (Spring 2006) 12

Page 15: Hierarchical Project Management System

projects (project)

2. Project manger assigns a unique project id and name, and a project manager for those new child projects.

4b. Manage Tasks:

1. The project manager divides this project into several tasks.

2. Each task information includes a task name, started date, finished date, and a task owner who associated a project member role.

5. The project manager save the process results.

Exception 2a: System responses an error message and terminates this case when no any project contains in the return list.

Post Condition New child projects or project tasks will be stored into this system after this operation success.

1.5.6 Feedback Task Execution Status

Use Case ID UC-05

Summary A user with project member permission feedback the task execution status of a task assigned to him/her..

Primary Actor Project Member

Precondition A user belongs to “project member” role had already login this system.

Description 1. The project member accesses the “Task Execution Status Feedback” function to start a Status Feedback.

2. The system returns a tasks list grouped by project which already had assigned to him/her, which contains tasks which already assigned to him/her.

3. The project member picks a task.

4. The project member feedback the task execution status to the picked task by enters actual started date, actual finished date, the number of line of code and the number of classes created.

OOAD Homework (Spring 2006) 13

Page 16: Hierarchical Project Management System

5. The project member saves this task executing status.

Exception 2a: System responses an error message and terminates this case when no any task contains in the return list.

Post Condition The task executing results will be stored into this system after this operation success.

1.5.7 Information Reporting

Use Case ID UC-06

Summary A user with project manager permission queries the overall project executing results to the projects which already assigned to him/her.

Primary Actor Project Manager

Precondition A user belongs to “Project Manager” role had already login this system.

Description 1. The project manager accesses the “Task Information Reporting” function to start an information reporting.

2. The system returns a list which contains projects which already assigned to him/her.

3. The project manager picks a project.

4. The system displays all tasks information belongs to the picked project. Those tasks should be sorted by the task start date; if the picked project is a master project, those tasks information should be sorted by child project first, then by the task start date in same child project. Each task information should includes task name, started date, finished date, actual started date, and status (progress in percentage).

Exception 2a: System responses an error message and terminates this case when no any project contains in the return list.

Post Condition n/a

OOAD Homework (Spring 2006) 14

Page 17: Hierarchical Project Management System

1.6 Non-Functional Requirements and Constraints

The non-functional functional requirements and any constraint identified currently is listed in the follows.

NFR ID Category Description

NFR-01 Security All user’s operation should be logged in system’s access log.

NFR-02 Availability This system should provide non-stop service during 9 to 5 in every regular working days.

NFR-03 Supportability This helpdesk of this system could feedback first response within 1 hour after a request received.

NFR-04 Dev. Tools This system should be developmented based on on Microsoft’s Windows Platform and .Net technology.

NFR-05 Dev. Tools No any RDBMS (such as Microsoft SQL Server) could be used within this system.

OOAD Homework (Spring 2006) 15

Page 18: Hierarchical Project Management System

1.7 Data Dictionary

Term Definition or Description

Administrator Represents a user with administrator role associated. A user with administrator permission usually performs system-wide operations such as user management and project registration.

Child Project See Project

Master Project See Project

Project A project used here is represent a completed work coorsponding to a business contract. A project should be assigned a project manager for task planning, resource planning and progress monitoring. A project could associated with a number of tasks in order to fulfill the contract’s requirements. Sometimes a large project (called Master Project) could separate into some smaller projects (called Child Project) for better manageability.

Project Manager Represents a user with project manager role associated. A user with project manager permission usually performs project-wide operations such as project separation and resource allocation.

Project Member Represents a user with project member role associated. A user with project member permission usually performs task-wide operations such as task execution status feedback.

Role; User Role Role, or User Role represents one of system defined permissions. A role could be associated to a user, this indicates a user is granted a set of permission which defined with the specific role.

There are three system-defined roles including administrator”, project manager and project member.

Task A Task is a unique job to be completed for a specific project.

User A user is a basic concept of valid system users. With some authorization, a user can be associated with one or many system-define roles (see Role) to perform their jobs.

(Listed in alphabetic order)

OOAD Homework (Spring 2006) 16

Page 19: Hierarchical Project Management System

1.8 Software Environment

Software Platform: Microsoft Windows Server 2003+

Development language/Tool: Microsoft C# and other Microsoft .Net Technonology (such as ASP.Net) will be used, and the major development tool will be Microsoft Visual Studio.Net.

OOAD Homework (Spring 2006) 17

Page 20: Hierarchical Project Management System

2. DOMAIN CLASS MODEL

2.1 Domain Class Model Showing Only Concepts

Figure 3, HPMS Classes identified

Figure 4, Eliminateing unnecessary classes

OOAD Homework (Spring 2006) 18

Page 21: Hierarchical Project Management System

2.2 Add Associations

Verb phases

System generates List of Functions

List of Functions contains Functions

System generates Project List

System generates Task List

System generates User List

User List consists of Administrators, Project Managers, and Project Members

An Administrator creates other Administrators, Project Managers, and Project Members

Administators, Project Managers, and Project Members read List of Functions

An Administrator creates Projects

Project Manager manages projects

A Project (master project) separates into some projects (child project)

A Project contains some tasks

Task have a Task Execution Result

Project Manager feedbacks Task Execution Result

Project Manager read Project related information

Figure 5, Associations of classes identified

OOAD Homework (Spring 2006) 19

Page 22: Hierarchical Project Management System

Consist of

Consist of

Consist of

Create

Manage

Contains

Separate

Contains

Contains

Feedback

Have

Consist of

Generate

Generate

GenerateGenerate

Create

Create

Create

Read

Read

Project ManagerUser List

Project List

Project Member

Function

Administrator

Task List

System

List of Functions

Task

Task Executing Result

Project

1

1

1 *

1

1

1

1

1

1

1

*

*

*

11

1

*

*

1

1

*

1

*

1

*

1

*

1* 1*

1

1

1

*

Read

Read

Read

1 11

1

1

1

1

1

1 *

Figure 6, Class model with associations

OOAD Homework (Spring 2006) 20

Page 23: Hierarchical Project Management System

2.3 Add Attributes

Figure 7, Class model with associations and attributes

OOAD Homework (Spring 2006) 21

Page 24: Hierarchical Project Management System

3. CLASS DESIGN

3.1 Use-Case Realizations with GRASP Patterns

3.1.1 Choose the most significant use-case, identify system events, and draw a system sequence diagram for that use case.

The work for this section is to choose the most significant use-case, identify system events, and draw a system sequence diagram for that use case. After review those use-cases identified currently, I identify the Project Management (ref. to section 1.5.6) should be the most significant use-case, due to the variety of the processes of this use-case is the most core different with other project management systems.

The system events identified are listed in the following table.

System event Contract #

requestProjectListByManager CO1

pickProject CO2

startProjectManagement CO3

specifyManagementType CO4

createChildProject CO5

CreateTask CO6

SaveAndClose C07

OOAD Homework (Spring 2006) 22

Page 25: Hierarchical Project Management System

Figure 8 shows the system sequence diagram for the manage project use case (UC-04).

Figure 8, The system sequence diagram for

“Project Managment” use-case (UC-04)

OOAD Homework (Spring 2006) 23

Page 26: Hierarchical Project Management System

3.1.2 Write a contract for each system operation (system event).

Contract CO1: requestProjectListByManager

Operation: requestProjectListByManager (userID: string)

Cross References: Use Cases: UC-04

Precondition A project manager already logins into this system, and invoke the “Manage Project” function.

Postconditions: System conducts a project list which includes all projects which managed by him/her. And the information for each project are ID and name for each project.

Contract CO2: pickProject

Operation: pickProject(projectID: string)

Cross References: Use Cases: UC-04

Precondition The system had returns the project list

Postconditions: System knows about which project had been selected by the project manager.

Contract CO3: startProjectManagement

Operation: startProjectManagement()

Cross References: Use Cases: UC-04

Precondition A project manager had already pick a project for manage.

Postconditions: System conducts a project aggregated information (includes project – parent paroject/child projects, and tasks information) to the project which picked by the project manager in Contract CO2.

Contract CO4: specifyManageType

Operation: specifyManageType(type: string)

Cross References: Use Cases: UC-04

Precondition The selected project had been opened by the system (by pcikProject method).

Postconditions: The management type (either Split Project or Create

OOAD Homework (Spring 2006) 24

Page 27: Hierarchical Project Management System

Tasks) for the project selected by project manager had made, and known by the system.

Contract CO5: createChildProject

Operation: createChildProject(projectID: string, projectName: string, userID: string)

Cross References: Use Cases: UC-04

Precondition The management type “Split Project” was specified for current project management process.

Postconditions: A new child project (which identified by projected, named in projectName, and managed by userID) was created.

The new created child project had been associated to the project which current managed.

Contract CO6: createTask

Operation: createTask(taskName: string, startDate: date, finished-Date: date, userID: string)

Cross References: Use Cases: UC-04

Precondition The management type “Create Tasks” was specified for current project management process.

Postconditions: A new task was created and associated to the project which current managed.

Contract CO7: saveAndClose

Operation: saveAndClose

Cross References: Use Cases: UC-04

Precondition The selected project had been opened by the system. Some child projects or tasks may also been created.

Postconditions: Based on the management type which specified by project manager, either the newly created projects or tasks were stored in the system data store.

The project management process was finished.

OOAD Homework (Spring 2006) 25

Page 28: Hierarchical Project Management System

3.1.3 Draw a sequence diagram for each system event you identified, and label with the GRASP patterns to describe how you assign responsibilities.

The following figures shows the sequence diagram for each system event.

Figure 9, The sequence diagram for “requestProjectListByManager” system event

:SystemController

pickProject(projectID)

Project Name

:Librarian

requestProjectInfo(projectID)

1

:StoreManager

requestProjectInfo(projectID)

Project Name

2

createProject(projectID, projectName) :Project3

Creator3

Information Expert3

Low Coupling3

Controller1, 2, 3

High Cohesion

Figure 10, The sequence diagram for “pickProject” system event

OOAD Homework (Spring 2006) 26

Page 29: Hierarchical Project Management System

Figure 11, The sequence diagram for “startProjectManagement” system event

Figure 12, The sequence diagram for “specifyManagementType” system event

Figure 13, The sequence diagram for “createChildProject” system event

OOAD Homework (Spring 2006) 27

Page 30: Hierarchical Project Management System

Figure 14, The sequence diagram for “CreateTask” system event

Figure 15, The sequence diagram for “SaveAndClose” system event

OOAD Homework (Spring 2006) 28

Page 31: Hierarchical Project Management System

3.2 Design Class Model

Figure 16, Domain class diagram (for Project Management, #UC-04)

OOAD Homework (Spring 2006) 29

Page 32: Hierarchical Project Management System

5. IMPLEMENTATION CLASS MODEL

5.1 Draw an implementation class diagram for your system (including associations, attributes and methods)

Figure 17, Implementation class diagram (for Project Management, #UC-04)

OOAD Homework (Spring 2006) 30

Page 33: Hierarchical Project Management System

5.2 Show the difference between implementation class model and design class model

Table 5.2.1, Comparison with design and implementation class

Class Method Design Imp. requestProjectListByManager No Yes pickProject Yes Yes startProjectManagement Yes Yes specifyManageType Yes Yes createChildProject Yes Yes createTask Yes Yes deleteChildProject No Yes deleteTask No Yes

SystemController

saveAndClose Yes Yes requestProjectListByManager Yes Yes requestProjectInfo Yes Yes setManageType Yes Yes createChildProject Yes Yes createTask Yes Yes saveAndClose Yes Yes getProjectInfo No Yes deleteProject No Yes

Librarian

deleteTask No Yes createProject Yes (constructor) setManageType Yes Yes createChildProject Yes Yes createAChildProject Yes No createTask Yes Yes getProjectInfoforSave Yes No getProjectInfo Yes Yes close Yes Yes InitProjectInfo No Yes deleteChildProject No Yes

AbstractProject (Replace the original Project class)

deleteTask No Yes LeafProject No (constructor) InitProjectInfo No Yes getProjectInfo No Yes createChildProject No Yes deleteChildProject No Yes createTask No Yes

LeafProject

deleteTask No Yes CompositeProject No (constructor) InitProjectInfo No Yes getProjectInfo No Yes createChildProject No Yes deleteChildProject No Yes

CompositeProject

createTask No Yes

OOAD Homework (Spring 2006) 31

Page 34: Hierarchical Project Management System

deleteTask No Yes createATask Yes (constructor) getTaskInfo Yes Yes

Task

close Yes Yes requestProjectListByManager Yes Yes requestProjectInfo Yes Yes

StorageManager

saveProjectInfo Yes Yes StorageManagerXML No (constructor) requestProjectListByManager No Yes requestProjectInfo No Yes saveProjectInfo No Yes GetRootProjectID No Yes clearProjectInfoAllByProjectID No Yes

StorageManagerXML

insertProjectInfoIntoStorage No Yes ProjectList createProjectList Yes Yes

XMLInsertNode No Yes XMLInsertNodeXML No Yes

Utility

DateToString No Yes GlobalParameters (n/a) No Yes ProjectInfo (n/a) No Yes ProjectInList (n/a) No Yes

Table 5.2.2, Summary of implementation class/method changed

Class # of added # of removed # of modified Class 6 0 4 Method (count with private method)

36 (29+7) 2 0

5.3 Calculate Line of Code

Table 5.3.1, Line of Code of Classes

No Class Name # of Methods Line of Code in Class (without

comment) 1 SystemController 9 49 2 Librarian 9 197 3 AbstractProject 9 24 4 LeafProject 7 97 5 CompositeProject 7 97 6 Task 3 39 7 StorageManager 3 13 8 StorageManagerXML 7 197 9 ProjectList 1 19 10 Utility 3 34

OOAD Homework (Spring 2006) 32

Page 35: Hierarchical Project Management System

11 GlobalParameters 0 6 12 ProjectInfo 0 10 13 ProjectInList 0 5

Subtotal 58 787 1 UC-04 HTML (n/a) 155 2 UC-04 Code-Behind (n/a) 752 3 UC-06 HTML (n/a) 67 4 UC-06 Code-Behind (n/a) 288

Subtotal (n/a) 1262 1 Unit Test (n/a) 224

Summary 58 2273 (Class(es) related to user interface prototyping was not counted)

OOAD Homework (Spring 2006) 33

Page 36: Hierarchical Project Management System

6. PROGRAMMING

6.1 Snapshots of system execution (optional)

Figure 18, Snapshot – 1 of System Execution (for UC-04)

OOAD Homework (Spring 2006) 34

Page 37: Hierarchical Project Management System

Figure 19, Snapshot – 2 of System Execution (for UC-04)

6.2 Source Code Listing

HPMSLibs.cs 001: using System; 002: using System.Collections.Generic; 003: using System.Text; 004: 005: using System.Collections; 006: using System.IO; 007: using System.Xml; 008: 009: namespace HPMSLibs 010: { 011: //=== Global Parameters === 012: public static class GlobalParameters 013: { 014: //For XML storage 015: public static string AppPath = @"c:\HPMS\Data"; 016: public static string XMLFile_Project = @"Projects.xml"; 017: } 018: 019: //=== Support Classes & ENUM 020: public class ProjectInList

OOAD Homework (Spring 2006) 35

Page 38: Hierarchical Project Management System

021: { 022: public string ProjectID = ""; 023: public string ProjectName = ""; 024: } 025: 026: public class ProjectInfo 027: { 028: public string ProjectID = ""; 029: public string ProjectName = ""; 030: public string ProjectManagerID = ""; 031: public string ParentProjectID = ""; 032: public ManageType MgmtType = ManageType.undefined; 033: public ArrayList Projects = new ArrayList(); 034: public ArrayList Tasks = new ArrayList(); 035: } 036: 037: public enum ManageType 038: { 039: undefined, splitProjects, splitTasks 040: } 041: 042: public static class Utility 043: { 044: public static XmlNode XMLInsertNode(XmlDocument xDoc, XmlNode xTarget, string sElementName, string sValue) 045: { 046: XmlNode xNode = xDoc.CreateElement(sElementName); 047: xNode.InnerText = sValue; 048: xTarget.AppendChild(xNode); 049: return xNode; 050: } 051: 052: public static XmlNode XMLInsertNodeXML(XmlDocument xDoc, XmlNode xTarget, string sElementName, string sValue) 053: { 054: XmlNode xNode = xDoc.CreateElement(sElementName); 055: xNode.InnerXml = sValue; 056: xTarget.AppendChild(xNode); 057: return xNode; 058: } 059: 060: public static string DateToString(DateTime dtDate) 061: { 062: string sDateString = ""; 063: if (dtDate.Year != 1) 064: { 065: string sYear = "0000" + dtDate.Year.ToString(); 066: sYear = sYear.Substring(sYear.Length - 4); 067: string sMonth = "00" + dtDate.Month.ToString(); 068: sMonth = sMonth.Substring(sMonth.Length - 2); 069: string sDay = "00" + dtDate.Day.ToString(); 070: sDay = sDay.Substring(sDay.Length - 2); 071: sDateString = sYear + "/" + sMonth + "/" + sDay; 072: } 073: return sDateString; 074: } 075: } 076: 077: //=== [Class] ProjectList 078: public class ProjectList 079: { 080: public ArrayList alProjects = new ArrayList(); 081: 082: public void createProjectList(string XMLProjects) 083: { 084: alProjects.Clear(); 085: 086: XmlDocument xProjects = new XmlDocument(); 087: xProjects.LoadXml(XMLProjects); 088: foreach(XmlNode xPrj in xProjects.DocumentElement.ChildNodes)

OOAD Homework (Spring 2006) 36

Page 39: Hierarchical Project Management System

089: { 090: ProjectInList PrjInList = new ProjectInList(); 091: PrjInList.ProjectID = xPrj.SelectSingleNode("ID").InnerText; 092: PrjInList.ProjectName = xPrj.SelectSingleNode("Name").InnerText; 093: alProjects.Add(PrjInList); 094: } 095: } 096: } 097: 098: //=== [Abstract Class] StorageManager 099: abstract public class StorageManager 100: { 101: protected ProjectList plPrjList; 102: 103: public StorageManager() 104: { 105: plPrjList = new ProjectList(); 106: } 107: 108: abstract public ArrayList requestProjectListByManager(string UserID); 109: abstract public ProjectInfo requestProjectInfo(string ProjectID); 110: abstract public bool saveProjectInfo(XmlDocument xProjectDoc); 111: } 112: 113: //=== [Class] StorageManagerXML 114: public class StorageManagerXML : StorageManager 115: { 116: private DirectoryInfo diStorage; 117: 118: public StorageManagerXML() 119: { 120: DirectoryInfo diStorage = new DirectoryInfo(GlobalParameters.AppPath); 121: } 122: 123: public override ArrayList requestProjectListByManager(string UserID) 124: { 125: XmlDocument xResults = new XmlDocument(); 126: xResults.LoadXml("<Projects />"); 127: 128: diStorage = new DirectoryInfo(GlobalParameters.AppPath); 129: XmlDocument xProjects = new XmlDocument(); 130: xProjects.Load(diStorage.FullName + @"\" + GlobalParameters.XMLFile_Project); 131: XmlNodeList xProjectByManager = xProjects.DocumentElement.SelectNodes("//Project[@Manager=\"" + UserID + "\"]");132: foreach (XmlNode xProject in xProjectByManager) 133: { 134: XmlNode xPrj = xResults.CreateElement("Project"); 135: 136: Utility.XMLInsertNode(xResults, xPrj, "ID", xProject.Attributes["ID"].Value); 137: Utility.XMLInsertNode(xResults, xPrj, "Name", xProject.Attributes["Name"].Value); 138: 139: xResults.DocumentElement.AppendChild(xPrj); 140: } 141: this.plPrjList.createProjectList(xResults.InnerXml); 142: return this.plPrjList.alProjects; 143: } 144: 145: public override ProjectInfo requestProjectInfo(string ProjectID) 146: { 147: ProjectInfo PrjInfo = new ProjectInfo(); 148: 149: diStorage = new DirectoryInfo(GlobalParameters.AppPath);

OOAD Homework (Spring 2006) 37

Page 40: Hierarchical Project Management System

150: XmlDocument xProjects = new XmlDocument(); 151: xProjects.Load(diStorage.FullName + @"\" + GlobalParameters.XMLFile_Project); 152: XmlNode xProject = xProjects.DocumentElement.SelectSingleNode("//Project[@ID=\"" + ProjectID + "\"]"); 153: 154: PrjInfo.ProjectID = xProject.Attributes["ID"].Value; 155: PrjInfo.ProjectName = xProject.Attributes["Name"].Value; 156: PrjInfo.ProjectManagerID = xProject.Attributes["Manager"].Value; 157: PrjInfo.ParentProjectID = xProject.Attributes["ParentProject"].Value; 158: string sMgmtType = xProject.Attributes["ManageType"].Value; 159: if (sMgmtType == "0") 160: { 161: PrjInfo.MgmtType = ManageType.undefined; 162: } 163: else 164: { 165: if (sMgmtType == "1") 166: { 167: PrjInfo.MgmtType = ManageType.splitProjects; 168: 169: //Process Child Projects 170: XmlNodeList xChildProjects = xProject.SelectNodes("ChildProjects/ChildProject"); 171: foreach (XmlNode xChildProject in xChildProjects) 172: { 173: string projectID = xChildProject.Attributes["ID"].Value; 174: AbstractProject ChildProject = new LeafProject(this, "", "", "", ""); 175: ChildProject.InitProjectInfo(projectID); 176: PrjInfo.Projects.Add(ChildProject); 177: } 178: } 179: else 180: { 181: PrjInfo.MgmtType = ManageType.splitTasks; 182: 183: //Process Tasks 184: XmlNodeList xTasks = xProject.SelectNodes("Tasks/Task"); 185: foreach (XmlNode xTask in xTasks) 186: { 187: //Process Task 188: string sProjectID = ProjectID; 189: string sTaskID = xTask.Attributes["ID"].Value; 190: string sTaskName = xTask.Attributes["Name"].Value; 191: DateTime dtStartDate; 192: string sStartDate = xTask.Attributes["StartDate"].Value; 193: if (sStartDate == "") 194: dtStartDate = new DateTime(); 195: else 196: dtStartDate = new DateTime(int.Parse(sStartDate.Substring(0, 4)), int.Parse(sStartDate.Substring(5, 2)), int.Parse(sStartDate.Substring(8, 2))); 197: DateTime dtFinishDate; 198: string sFinishDate = xTask.Attributes["FinishDate"].Value; 199: if (sFinishDate == "") 200: dtFinishDate = new DateTime(); 201: else 202: dtFinishDate = new DateTime(int.Parse(sFinishDate.Substring(0, 4)), int.Parse(sFinishDate.Substring(5, 2)), int.Parse(sFinishDate.Substring(8, 2)));203: string sProjectMemberID = xTask.Attributes["ProjectMemberID"].Value;

OOAD Homework (Spring 2006) 38

Page 41: Hierarchical Project Management System

204: 205: //Process Task Progress 206: string sTaskProgress = ""; 207: XmlNodeList xTaskResults = xTask.SelectNodes("TaskProgress"); 208: if (xTaskResults.Count > 0) 209: { 210: sTaskProgress = xTaskResults[0].InnerXml.ToString(); 211: } 212: 213: Task task = new Task(ProjectID, sTaskID, sTaskName, dtStartDate, dtFinishDate, sProjectMemberID, sTaskProgress); 214: PrjInfo.Tasks.Add(task); 215: } 216: } 217: } 218: 219: return PrjInfo; 220: } 221: 222: public override bool saveProjectInfo(XmlDocument xProjectDoc) 223: { 224: bool bResult = true; 225: 226: diStorage = new DirectoryInfo(GlobalParameters.AppPath); 227: XmlDocument xProjects = new XmlDocument(); 228: xProjects.Load(diStorage.FullName + @"\" + GlobalParameters.XMLFile_Project); 229: 230: this.clearProjectInfoAllByProjectID(xProjects, this.GetRootProjectID(xProjectDoc)); 231: this.insertProjectInfoIntoStorage(xProjects, xProjectDoc.DocumentElement); 232: 233: xProjects.Save(diStorage.FullName + @"\" + GlobalParameters.XMLFile_Project); 234: 235: return bResult; 236: } 237: 238: private string GetRootProjectID(XmlDocument xProject) 239: { 240: return xProject.SelectSingleNode("Project").SelectSingleNode("ID").InnerText; 241: } 242: 243: private void clearProjectInfoAllByProjectID(XmlDocument xProjects, string ProjectID) 244: { 245: XmlNode xProject = xProjects.DocumentElement.SelectSingleNode("//Project[@ID=\"" + ProjectID + "\"]"); 246: if (xProject.Attributes["ManageType"].Value == "1") 247: { 248: XmlNodeList xChildProjects = xProject.SelectNodes("ChildProjects/ChildProject"); 249: foreach (XmlNode xChildProject in xChildProjects) 250: { 251: this.clearProjectInfoAllByProjectID(xProjects, xChildProject.Attributes["ID"].Value); 252: } 253: } 254: xProjects.DocumentElement.RemoveChild(xProject); 255: } 256: 257: private void insertProjectInfoIntoStorage(XmlDocument xProjects, XmlElement xProject) 258: { 259: string ProjectID = xProject.SelectSingleNode("ID").InnerText;

OOAD Homework (Spring 2006) 39

Page 42: Hierarchical Project Management System

260: string ProjectName = xProject.SelectSingleNode("Name").InnerText; 261: string Manager = xProject.SelectSingleNode("Manager").InnerText; 262: string ParentProject = xProject.SelectSingleNode("ParentProject").InnerText; 263: string ManageType = xProject.SelectSingleNode("ManageType").InnerText; 264: 265: XmlNode xProjectNode = Utility.XMLInsertNode(xProjects, (XmlNode)xProjects.DocumentElement, "Project", ""); 266: ((XmlElement)xProjectNode).SetAttribute("ID", ProjectID); 267: ((XmlElement)xProjectNode).SetAttribute("Name", ProjectName); 268: ((XmlElement)xProjectNode).SetAttribute("Manager", Manager); 269: ((XmlElement)xProjectNode).SetAttribute("ParentProject", ParentProject); 270: ((XmlElement)xProjectNode).SetAttribute("ManageType", ManageType); 271: 272: if (ManageType == "1") 273: { 274: XmlNode xChildPrjs = Utility.XMLInsertNode(xProjects, xProjectNode, "ChildProjects", ""); 275: 276: XmlNodeList xChildProjects = xProject.SelectNodes("ChildProjects/ChildProject/Project"); 277: foreach (XmlNode xChildProject in xChildProjects) 278: { 279: this.insertProjectInfoIntoStorage(xProjects, (XmlElement)xChildProject); 280: 281: XmlNode xChildPrj = Utility.XMLInsertNode(xProjects, xChildPrjs, "ChildProject", ""); 282: ((XmlElement)xChildPrj).SetAttribute("ID", xChildProject.SelectSingleNode("ID").InnerText); 283: } 284: } 285: 286: if (ManageType == "2") 287: { 288: XmlNode xTasks = Utility.XMLInsertNode(xProjects, xProjectNode, "Tasks", ""); 289: 290: XmlNodeList xChildTasks = xProject.SelectNodes("Tasks/Task/Task"); 291: foreach (XmlNode xChildTask in xChildTasks) 292: { 293: string TaskID = xChildTask.SelectSingleNode("ID").InnerText; 294: string TaskName = xChildTask.SelectSingleNode("Name").InnerText; 295: string StartDate = xChildTask.SelectSingleNode("StartDate").InnerText; 296: string FinishDate = xChildTask.SelectSingleNode("FinishDate").InnerText; 297: string ProjectMemberID = xChildTask.SelectSingleNode("ProjectMemberID").InnerText; 298: 299: XmlNode xTask = Utility.XMLInsertNode(xProjects, xTasks, "Task", ""); 300: ((XmlElement)xTask).SetAttribute("ID", TaskID); 301: ((XmlElement)xTask).SetAttribute("Name", TaskName); 302: ((XmlElement)xTask).SetAttribute("StartDate", StartDate); 303: ((XmlElement)xTask).SetAttribute("FinishDate", FinishDate); 304: ((XmlElement)xTask).SetAttribute("ProjectMemberID", ProjectMemberID); 305: 306: string sTaskProgress = "";

OOAD Homework (Spring 2006) 40

Page 43: Hierarchical Project Management System

307: XmlNodeList xTaskProgressInfo = xChildTask.SelectNodes("TaskProgress"); 308: if(xTaskProgressInfo.Count>0) 309: sTaskProgress = xTaskProgressInfo[0].InnerText; 310: XmlNode xTaskProgress = Utility.XMLInsertNodeXML(xProjects, xTask, "TaskProgress", sTaskProgress); 311: } 312: } 313: } 314: } 315: 316: //=== [Class] Librarian 317: public class Librarian 318: { 319: StorageManager sm = new StorageManagerXML(); 320: private AbstractProject currentManagedProject; 321: 322: public ArrayList requestProjectListByManager(string UserID) 323: { 324: return sm.requestProjectListByManager(UserID); 325: } 326: 327: public void requestProjectInfo(string ProjectID) 328: { 329: if(currentManagedProject!=null) 330: currentManagedProject.close(); 331: 332: currentManagedProject = new LeafProject(sm, "", "", "", ""); 333: currentManagedProject.InitProjectInfo(ProjectID); 334: if (currentManagedProject.IsComposite) 335: { 336: currentManagedProject = new CompositeProject(sm, "", "", "", ""); 337: currentManagedProject.InitProjectInfo(ProjectID); 338: } 339: } 340: 341: public void setManageType(ManageType MgmtType) 342: { 343: //currentManagedProject.setManageType(MgmtType); 344: 345: string sProjectID = currentManagedProject.projectID; 346: if (MgmtType == ManageType.splitProjects) 347: { 348: currentManagedProject = new CompositeProject(sm, "", "", "", ""); 349: currentManagedProject.InitProjectInfo(sProjectID); 350: } 351: if (MgmtType == ManageType.splitTasks) 352: { 353: currentManagedProject = new LeafProject(sm, "", "", "", ""); 354: currentManagedProject.InitProjectInfo(sProjectID); 355: } 356: } 357: 358: public bool createProject(string ProjectID, string ProjectName, string UserID) 359: { 360: bool bResult = false; 361: if (this.sm != null) 362: if (this.currentManagedProject != null) 363: bResult = this.currentManagedProject.createChildProject(ProjectID, ProjectName, UserID); 364: return bResult; 365: } 366: 367: public bool deleteProject(string ProjectID) 368: { 369: bool bResult = false;

OOAD Homework (Spring 2006) 41

Page 44: Hierarchical Project Management System

370: if (this.sm != null) 371: if (this.currentManagedProject != null) 372: bResult = this.currentManagedProject.deleteChildProject(ProjectID); 373: return bResult; 374: } 375: 376: public bool createTask(string TaskID, string TaskName, DateTime StartDate, DateTime FinishedDate, string UserID, string TaskProgress) 377: { 378: bool bResult = false; 379: if (this.sm != null) 380: if (this.currentManagedProject != null) 381: bResult = this.currentManagedProject.createTask(TaskID, TaskName, StartDate, FinishedDate, UserID, TaskProgress); 382: return bResult; 383: } 384: 385: public bool deleteTask(string TaskID) 386: { 387: bool bResult = false; 388: if (this.sm != null) 389: if (this.currentManagedProject != null) 390: bResult = this.currentManagedProject.deleteTask(TaskID); 391: return bResult; 392: } 393: 394: public bool saveAndClose() 395: { 396: return this.sm.saveProjectInfo(this.currentManagedProject.getProjectInfo()); 397: } 398: 399: public XmlDocument getProjectInfo() 400: { 401: return this.currentManagedProject.getProjectInfo(); 402: } 403: } 404: 405: //=== [Class] SystemController 406: public class SystemController 407: { 408: private Librarian Lib = new Librarian(); 409: 410: public ArrayList requestProjectListByManager(string UserID) 411: { 412: return Lib.requestProjectListByManager(UserID); 413: } 414: 415: public XmlDocument startProjectManagement() 416: { 417: return this.Lib.getProjectInfo(); 418: } 419: 420: public void pickProject(string ProjectID) 421: { 422: Lib.requestProjectInfo(ProjectID); 423: } 424: 425: public void specifyManageType(ManageType MgmtType) 426: { 427: Lib.setManageType(MgmtType); 428: } 429: 430: public bool createChildProject(string ProjectID, string ProjectName, string UserID) 431: { 432: return this.Lib.createProject(ProjectID, ProjectName, UserID); 433: }

OOAD Homework (Spring 2006) 42

Page 45: Hierarchical Project Management System

434: 435: public bool deleteChildProject(string ProjectID) 436: { 437: return this.Lib.deleteProject(ProjectID); 438: } 439: 440: public bool CreateTask(string TaskID, string TaskName, DateTime StartDate, DateTime FinishedDate, string UserID, string TaskProgress) 441: { 442: return this.Lib.createTask(TaskID, TaskName, StartDate, FinishedDate, UserID, TaskProgress); 443: } 444: 445: public bool deleteTask(string TaskID) 446: { 447: return this.Lib.deleteTask(TaskID); 448: } 449: 450: public bool SaveAndClose() 451: { 452: return this.Lib.saveAndClose(); 453: } 454: } 455: }

ProjectTask_v1.cs 001: using System; 002: using System.Collections.Generic; 003: using System.Text; 004: 005: using System.Collections; 006: using System.Xml; 007: 008: namespace HPMSLibs 009: { 010: //=== [Class] Task 011: public class Task 012: { 013: private string projectID; 014: public string taskID; 015: private string taskName; 016: private DateTime startDate; 017: private DateTime finishedDate; 018: private string projectMemberID; 019: private string taskProgress; //It's ok this time because it's POC only! 020: 021: public Task(string ProjectID, string TaskID, string TaskName, DateTime StartDate, DateTime FinishedDate, string ProjectMemberID, string TaskProgress) 022: { 023: projectID = ProjectID; 024: taskID = TaskID; 025: taskName = TaskName; 026: startDate = StartDate; 027: finishedDate = FinishedDate; 028: projectMemberID = ProjectMemberID; 029: taskProgress = TaskProgress; 030: } 031: 032: public void Close() 033: { 034: // No implementation code for this member function currently. 035: } 036: 037: public XmlDocument getTaskInfo() 038: { 039: XmlDocument xTask = new XmlDocument();

OOAD Homework (Spring 2006) 43

Page 46: Hierarchical Project Management System

040: xTask.LoadXml("<Task />"); 041: Utility.XMLInsertNode(xTask, xTask.DocumentElement, "ID", this.taskID); 042: Utility.XMLInsertNode(xTask, xTask.DocumentElement, "Name", this.taskName); 043: Utility.XMLInsertNode(xTask, xTask.DocumentElement, "StartDate", Utility.DateToString(this.startDate)); 044: Utility.XMLInsertNode(xTask, xTask.DocumentElement, "FinishDate", Utility.DateToString(this.finishedDate)); 045: Utility.XMLInsertNode(xTask, xTask.DocumentElement, "ProjectMemberID", this.projectMemberID); 046: Utility.XMLInsertNode(xTask, xTask.DocumentElement, "TaskProgress", this.taskProgress); 047: return xTask; 048: } 049: } 050: }

ProjectTask_v2.cs

001: using System; 002: using System.Collections.Generic; 003: using System.Text; 004: 005: using System.Xml; 006: using System.Collections; 007: 008: namespace HPMSLibs 009: { 010: abstract public class AbstractProject 011: { 012: protected StorageManager sm; 013: 014: public bool IsComposite; 015: public string projectID; 016: protected string projectName; 017: protected string projectManagerID; 018: protected string parentProject; 019: 020: abstract public void InitProjectInfo(string ProjectID); 021: 022: public void close() 023: { 024: // No implementation code for this member function currently. 025: } 026: 027: abstract public XmlDocument getProjectInfo(); 028: 029: abstract public bool createChildProject(string ProjectID, string ProjectName, string UserID); 030: abstract public bool deleteChildProject(string ProjectID); 031: abstract public bool createTask(string TaskID, string TaskName, DateTime StartDate, DateTime FinishedDate, string UserID, string TaskProgress); 032: abstract public bool deleteTask(string TaskID); 033: } 034: 035: public class LeafProject : AbstractProject 036: { 037: private ArrayList Tasks = new ArrayList(); 038: 039: public LeafProject(StorageManager SM, string ProjectID, string ProjectName, string ProjectManagerID, string ParentProject) 040: { 041: sm = SM; 042: projectID = ProjectID; 043: projectName = ProjectName; 044: projectManagerID = ProjectManagerID; 045: parentProject = ParentProject; 046: Tasks = new ArrayList();

OOAD Homework (Spring 2006) 44

Page 47: Hierarchical Project Management System

047: 048: IsComposite = false; 049: } 050: 051: public override void InitProjectInfo(string ProjectID) 052: { 053: ProjectInfo PrjInfo = this.sm.requestProjectInfo(ProjectID); 054: projectID = PrjInfo.ProjectID; 055: projectName = PrjInfo.ProjectName; 056: projectManagerID = PrjInfo.ProjectManagerID; 057: parentProject = PrjInfo.ParentProjectID; 058: foreach (Task task in PrjInfo.Tasks) 059: { 060: Tasks.Add(task); 061: } 062: 063: if (PrjInfo.MgmtType == ManageType.splitProjects) 064: IsComposite = true; 065: if (PrjInfo.MgmtType == ManageType.splitTasks) 066: IsComposite = false; 067: if (PrjInfo.MgmtType == ManageType.undefined) 068: IsComposite = false; 069: } 070: 071: public override XmlDocument getProjectInfo() 072: { 073: XmlDocument xProject = new XmlDocument(); 074: xProject.LoadXml("<Project />"); 075: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "ID", projectID); 076: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "Name", projectName); 077: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "Manager", projectManagerID); 078: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "ParentProject", parentProject); 079: 080: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "ManageType", "2"); 081: XmlElement xTasks = xProject.CreateElement("Tasks"); 082: foreach (Task task in Tasks) 083: { 084: XmlElement xTask = xProject.CreateElement("Task"); 085: XmlDocument xTaskDoc = task.getTaskInfo(); 086: xTask.InnerXml = xTaskDoc.OuterXml; 087: xTasks.AppendChild(xTask); 088: } 089: xProject.DocumentElement.AppendChild(xTasks); 090: 091: return xProject; 092: } 093: 094: public override bool createChildProject(string ProjectID, string ProjectName, string UserID) 095: { 096: return false; 097: } 098: 099: public override bool deleteChildProject(string ProjectID) 100: { 101: return false; 102: } 103: 104: public override bool createTask(string TaskID, string TaskName, DateTime StartDate, DateTime FinishedDate, string UserID, string TaskProgress) 105: { 106: bool bResult = false; 107: 108: Task task = new Task(this.projectID, TaskID, TaskName, StartDate, FinishedDate, UserID, TaskProgress);

OOAD Homework (Spring 2006) 45

Page 48: Hierarchical Project Management System

109: this.Tasks.Add(task); 110: bResult = true; 111: 112: return bResult; 113: } 114: 115: public override bool deleteTask(string TaskID) 116: { 117: bool bResult = false; 118: 119: for (int iCnt = 0; iCnt < this.Tasks.Count; iCnt++) 120: { 121: if (((Task)this.Tasks[iCnt]).taskID == TaskID) 122: { 123: this.Tasks.RemoveAt(iCnt); 124: bResult = true; 125: break; 126: } 127: } 128: 129: return bResult; 130: } 131: } 132: 133: public class CompositeProject : AbstractProject 134: { 135: private ArrayList ChildProjects = new ArrayList(); 136: 137: public CompositeProject(StorageManager SM, string ProjectID, string ProjectName, string ProjectManagerID, string ParentProject) 138: { 139: sm = SM; 140: projectID = ProjectID; 141: projectName = ProjectName; 142: projectManagerID = ProjectManagerID; 143: parentProject = ParentProject; 144: ChildProjects = new ArrayList(); 145: 146: IsComposite = true; 147: } 148: 149: public override void InitProjectInfo(string ProjectID) 150: { 151: ProjectInfo PrjInfo = sm.requestProjectInfo(ProjectID); 152: projectID = PrjInfo.ProjectID; 153: projectName = PrjInfo.ProjectName; 154: projectManagerID = PrjInfo.ProjectManagerID; 155: parentProject = PrjInfo.ParentProjectID; 156: foreach (AbstractProject project in PrjInfo.Projects) 157: { 158: ChildProjects.Add(project); 159: } 160: 161: if (PrjInfo.MgmtType == ManageType.splitProjects) 162: IsComposite = true; 163: if (PrjInfo.MgmtType == ManageType.splitTasks) 164: IsComposite = false; 165: if (PrjInfo.MgmtType == ManageType.undefined) 166: IsComposite = false; 167: } 168: 169: public override XmlDocument getProjectInfo() 170: { 171: XmlDocument xProject = new XmlDocument(); 172: xProject.LoadXml("<Project />"); 173: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "ID", projectID); 174: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "Name", projectName); 175: Utility.XMLInsertNode(xProject, xProject.DocumentElement,

OOAD Homework (Spring 2006) 46

Page 49: Hierarchical Project Management System

"Manager", projectManagerID); 176: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "ParentProject", parentProject); 177: 178: Utility.XMLInsertNode(xProject, xProject.DocumentElement, "ManageType", "1"); 179: XmlElement xChildProjects = xProject.CreateElement("ChildProjects"); 180: foreach (AbstractProject ChildProject in ChildProjects) 181: { 182: XmlElement xChildProject = xProject.CreateElement("ChildProject"); 183: XmlDocument xChildProjectDoc = ChildProject.getProjectInfo(); 184: xChildProject.InnerXml = xChildProjectDoc.OuterXml; 185: xChildProjects.AppendChild(xChildProject); 186: } 187: xProject.DocumentElement.AppendChild(xChildProjects); 188: 189: return xProject; 190: } 191: 192: public override bool createChildProject(string ProjectID, string ProjectName, string UserID) 193: { 194: bool bResult = false; 195: 196: AbstractProject project = new LeafProject(this.sm, ProjectID, ProjectName, UserID, this.projectID); 197: this.ChildProjects.Add(project); 198: bResult = true; 199: 200: return bResult; 201: } 202: 203: public override bool deleteChildProject(string ProjectID) 204: { 205: bool bResult = false; 206: 207: for (int iCnt = 0; iCnt < this.ChildProjects.Count; iCnt++) 208: { 209: if (((AbstractProject)this.ChildProjects[iCnt]).projectID == ProjectID) 210: { 211: this.ChildProjects.RemoveAt(iCnt); 212: bResult = true; 213: break; 214: } 215: } 216: 217: return bResult; 218: } 219: 220: public override bool createTask(string TaskID, string TaskName, DateTime StartDate, DateTime FinishedDate, string UserID, string TaskProgress) 221: { 222: return false; 223: } 224: 225: public override bool deleteTask(string TaskID) 226: { 227: return false; 228: } 229: } 230: }

Figure 20, Source Code – HPMSLibs.cs

OOAD Homework (Spring 2006) 47

Page 50: Hierarchical Project Management System

OOAD Homework (Spring 2006) 48

Page 51: Hierarchical Project Management System

7. UNIT TESTING

7.1 Snapshots of testing result (optional)

Figure 21, Snapshot – Unit Test Result (for UC-04)

7.2 Unit Testing Code Listing

001: using System; 002: using System.Collections.Generic; 003: using System.Text; 004: 005: using NUnit.Framework; 006: using HPMSLibs; 007: using System.Xml; 008: using System.Collections; 009: 010: namespace HPMSLibs 011: { 012: [TestFixture] 013: public class HPMSLibs_UnitTest 014: { 015: private ProjectInfo tProjectInfo;

OOAD Homework (Spring 2006) 49

Page 52: Hierarchical Project Management System

016: private XmlDocument xProject; 017: private ProjectList tProjectList; 018: private StorageManagerXML tStorageManagerXML; 019: private ArrayList alProjects; 020: private Task tTask; 021: private AbstractProject tProject; 022: private Librarian tLibrarian; 023: private SystemController tSystemController; 024: 025: [SetUp] 026: protected void SetUp() 027: { 028: tProjectInfo = new ProjectInfo(); 029: xProject = new XmlDocument(); 030: tProjectList = new ProjectList(); 031: tStorageManagerXML = new StorageManagerXML(); 032: alProjects = new ArrayList(); 033: tLibrarian = new Librarian(); 034: tSystemController = new SystemController(); 035: } 036: 037: [Test] 038: public void Class_GlobalParameters() 039: { 040: Assert.AreEqual(@"c:\HPMS\Data", GlobalParameters.AppPath); 041: Assert.AreEqual(@"Projects.xml", GlobalParameters.XMLFile_Project); 042: } 043: 044: [Test] 045: public void Class_ProjectInfo() 046: { 047: Assert.AreEqual(ManageType.undefined, tProjectInfo.MgmtType); 048: Assert.AreEqual(@"", tProjectInfo.ParentProjectID); 049: Assert.AreEqual(@"", tProjectInfo.ProjectID); 050: Assert.AreEqual(@"", tProjectInfo.ProjectManagerID); 051: Assert.AreEqual(@"", tProjectInfo.ProjectName); 052: Assert.AreEqual(0, tProjectInfo.Projects.Count); 053: Assert.AreEqual(0, tProjectInfo.Tasks.Count); 054: } 055: 056: [Test] 057: public void Class_Utility_XMLInsertNode() 058: { 059: xProject.LoadXml("<Projects />"); 060: XmlNode xNewNode1 = Utility.XMLInsertNode(xProject, xProject.DocumentElement, "Test1", "ABC"); 061: Assert.AreEqual("<Projects><Test1>ABC</Test1></Projects>", xProject.OuterXml); 062: Assert.AreEqual("<Test1>ABC</Test1>", xNewNode1.OuterXml); 063: XmlNode xNewNode2 = Utility.XMLInsertNode(xProject, xProject.DocumentElement, "Test2", ""); 064: Assert.AreEqual("<Test2></Test2>", xNewNode2.OuterXml); 065: } 066: 067: [Test] 068: public void Class_Utility_DateToString() 069: { 070: Assert.AreEqual("2000/01/01", Utility.DateToString(new DateTime(2000, 1, 1))); 071: Assert.AreEqual("1990/01/31", Utility.DateToString(new DateTime(1990, 1, 31))); 072: Assert.AreEqual("2005/02/28", Utility.DateToString(new DateTime(2005, 2, 28))); 073: Assert.AreEqual("1990/07/31", Utility.DateToString(new DateTime(1990, 7, 31))); 074: Assert.AreEqual("1990/08/31", Utility.DateToString(new DateTime(1990, 8, 31))); 075: Assert.AreEqual("2004/02/29", Utility.DateToString(new DateTime(2004, 2, 29)));

OOAD Homework (Spring 2006) 50

Page 53: Hierarchical Project Management System

076: } 077: 078: [Test] 079: public void Class_ProjectList() 080: { 081: Assert.AreEqual(0, tProjectList.alProjects.Count); 082: tProjectList.createProjectList("<Projects></Projects>"); 083: Assert.AreEqual(0, tProjectList.alProjects.Count); 084: tProjectList.createProjectList("<Projects><Project><ID>PRJ001</ID><Name>Project1</Name></Project></Projects>"); 085: Assert.AreEqual(1, tProjectList.alProjects.Count); 086: Assert.AreEqual("PRJ001", ((ProjectInList)tProjectList.alProjects[0]).ProjectID); 087: Assert.AreEqual("Project1", ((ProjectInList)tProjectList.alProjects[0]).ProjectName); 088: tProjectList.createProjectList("<Projects><Project><ID>PRJ001</ID><Name>Project1</Name></Project><Project><ID>PRJ002</ID><Name>Project2</Name></Project></Projects>"); 089: Assert.AreEqual(2, tProjectList.alProjects.Count); 090: Assert.AreEqual("PRJ001", ((ProjectInList)tProjectList.alProjects[0]).ProjectID); 091: Assert.AreEqual("Project1", ((ProjectInList)tProjectList.alProjects[0]).ProjectName); 092: Assert.AreEqual("PRJ002", ((ProjectInList)tProjectList.alProjects[1]).ProjectID); 093: Assert.AreEqual("Project2", ((ProjectInList)tProjectList.alProjects[1]).ProjectName); 094: tProjectList.createProjectList("<Projects><Project><ID>PRJ001</ID><Name>Project1</Name></Project><Project><ID>PRJ002</ID><Name>Project2</Name></Project><Project><ID></ID><Name></Name></Project></Projects>"); 095: Assert.AreEqual(3, tProjectList.alProjects.Count); 096: Assert.AreEqual("PRJ001", ((ProjectInList)tProjectList.alProjects[0]).ProjectID); 097: Assert.AreEqual("Project1", ((ProjectInList)tProjectList.alProjects[0]).ProjectName); 098: Assert.AreEqual("PRJ002", ((ProjectInList)tProjectList.alProjects[1]).ProjectID); 099: Assert.AreEqual("Project2", ((ProjectInList)tProjectList.alProjects[1]).ProjectName); 100: Assert.AreEqual("", ((ProjectInList)tProjectList.alProjects[2]).ProjectID); 101: Assert.AreEqual("", ((ProjectInList)tProjectList.alProjects[2]).ProjectName); 102: } 103: 104: [Test] 105: public void Class_StorageManagerXML() 106: { 107: alProjects = tStorageManagerXML.requestProjectListByManager(""); 108: Assert.AreEqual(0, alProjects.Count); 109: alProjects = tStorageManagerXML.requestProjectListByManager("94419001"); 110: Assert.AreEqual(0, alProjects.Count); 111: alProjects = tStorageManagerXML.requestProjectListByManager("94419012"); 112: Assert.AreEqual(2, alProjects.Count); 113: Assert.AreEqual("PRJ001", ((ProjectInList)alProjects[0]).ProjectID); 114: Assert.AreEqual("Intranet Portal Project", ((ProjectInList)alProjects[0]).ProjectName); 115: Assert.AreEqual("PRJ002", ((ProjectInList)alProjects[1]).ProjectID); 116: Assert.AreEqual("Marketing Information Warehouse", ((ProjectInList)alProjects[1]).ProjectName); 117: tProjectInfo = tStorageManagerXML.requestProjectInfo("PRJ002");118: Assert.AreEqual("PRJ002", tProjectInfo.ProjectID);

OOAD Homework (Spring 2006) 51

Page 54: Hierarchical Project Management System

119: Assert.AreEqual("Marketing Information Warehouse", tProjectInfo.ProjectName); 120: Assert.AreEqual("PRJ001", tProjectInfo.ParentProjectID); 121: Assert.AreEqual("94419012", tProjectInfo.ProjectManagerID); 122: Assert.AreEqual(ManageType.splitTasks, tProjectInfo.MgmtType); 123: Assert.AreEqual(0, tProjectInfo.Projects.Count); 124: Assert.AreEqual(6, tProjectInfo.Tasks.Count); 125: Assert.AreEqual("<Task><ID>TSK002.001</ID><Name>Envision</Name><StartDate>2006/03/09</StartDate><FinishDate>2006/03/15</FinishDate><ProjectMemberID>94419012</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;2006/03/10&lt;/ActualStart&gt;&lt;ActualFinish&gt;2006/03/15&lt;/ActualFinish&gt;&lt;Status&gt;100&lt;/Status&gt;</TaskProgress></Task>", ((Task)tProjectInfo.Tasks[0]).getTaskInfo().OuterXml); 126: Assert.AreEqual("<Task><ID>TSK002.002</ID><Name>Planning</Name><StartDate>2006/03/18</StartDate><FinishDate>2006/04/30</FinishDate><ProjectMemberID>94419012</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;2006/03/18&lt;/ActualStart&gt;&lt;ActualFinish&gt;2006/04/28&lt;/ActualFinish&gt;&lt;Status&gt;100&lt;/Status&gt;</TaskProgress></Task>", ((Task)tProjectInfo.Tasks[1]).getTaskInfo().OuterXml); 127: Assert.AreEqual("<Task><ID>TSK002.003</ID><Name>Developing</Name><StartDate>2006/05/01</StartDate><FinishDate>2006/05/15</FinishDate><ProjectMemberID>94419013</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;2006/05/01&lt;/ActualStart&gt;&lt;ActualFinish&gt;2006/05/17&lt;/ActualFinish&gt;&lt;Status&gt;100&lt;/Status&gt;</TaskProgress></Task>", ((Task)tProjectInfo.Tasks[2]).getTaskInfo().OuterXml); 128: Assert.AreEqual("<Task><ID>TSK002.004</ID><Name>Environment Preparation</Name><StartDate>2006/05/16</StartDate><FinishDate>2006/05/20</FinishDate><ProjectMemberID>94419013</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;&lt;/ActualStart&gt;&lt;ActualFinish&gt;&lt;/ActualFinish&gt;&lt;Status&gt;0&lt;/Status&gt;</TaskProgress></Task>", ((Task)tProjectInfo.Tasks[3]).getTaskInfo().OuterXml); 129: Assert.AreEqual("<Task><ID>TSK002.005</ID><Name>Deployment</Name><StartDate>2006/05/16</StartDate><FinishDate>2006/07/15</FinishDate><ProjectMemberID>94419013</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;&lt;/ActualStart&gt;&lt;ActualFinish&gt;&lt;/ActualFinish&gt;&lt;Status&gt;0&lt;/Status&gt;</TaskProgress></Task>", ((Task)tProjectInfo.Tasks[4]).getTaskInfo().OuterXml); 130: Assert.AreEqual("<Task><ID>TSK002.006</ID><Name>Stablizing</Name><StartDate>2006/07/16</StartDate><FinishDate>2006/07/31</FinishDate><ProjectMemberID>94419012</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;&lt;/ActualStart&gt;&lt;ActualFinish&gt;&lt;/ActualFinish&gt;&lt;Status&gt;0&lt;/Status&gt;</TaskProgress></Task>", ((Task)tProjectInfo.Tasks[5]).getTaskInfo().OuterXml); 131: tProjectInfo = tStorageManagerXML.requestProjectInfo("PRJ001");132: Assert.AreEqual("PRJ001", tProjectInfo.ProjectID); 133: Assert.AreEqual("Intranet Portal Project", tProjectInfo.ProjectName); 134: Assert.AreEqual("", tProjectInfo.ParentProjectID); 135: Assert.AreEqual("94419012", tProjectInfo.ProjectManagerID); 136: Assert.AreEqual(ManageType.splitProjects, tProjectInfo.MgmtType); 137: Assert.AreEqual(2, tProjectInfo.Projects.Count); 138: Assert.AreEqual("<Project><ID>PRJ002</ID><Name>Marketing Information Warehouse</Name><Manager>94419012</Manager><ParentProject>PRJ001</ParentProject><ManageType>2</ManageType>" 139: + "<Tasks>" 140: + "<Task><Task><ID>TSK002.001</ID><Name>Envision</Name><StartDate>2006/03/09</StartDate><FinishDate>2006/03/15</FinishDate><ProjectMemberID>94419012</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;2006/03/10&lt;/ActualStart&gt;&lt;ActualFinish&gt;2006/03/15&lt;/ActualFinish&gt;&lt;Status&gt;100&lt;/Status&gt;</TaskProgress></Task></Task>" 141: + "<Task><Task><ID>TSK002.002</ID><Name>Planning</Name><StartDate>2006/03/18</StartDate><FinishDate>2006/04/30</FinishDate><ProjectMemberID>94419012</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;2006/03/18&lt;/ActualStart&gt;&lt;ActualFinish&gt;2006/04/28&lt;/ActualFinish&gt;&lt;Status&gt;100&lt;/Status&gt;</TaskProgress></Task></Task>"

OOAD Homework (Spring 2006) 52

Page 55: Hierarchical Project Management System

142: + "<Task><Task><ID>TSK002.003</ID><Name>Developing</Name><StartDate>2006/05/01</StartDate><FinishDate>2006/05/15</FinishDate><ProjectMemberID>94419013</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;2006/05/01&lt;/ActualStart&gt;&lt;ActualFinish&gt;2006/05/17&lt;/ActualFinish&gt;&lt;Status&gt;100&lt;/Status&gt;</TaskProgress></Task></Task>" 143: + "<Task><Task><ID>TSK002.004</ID><Name>Environment Preparation</Name><StartDate>2006/05/16</StartDate><FinishDate>2006/05/20</FinishDate><ProjectMemberID>94419013</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;&lt;/ActualStart&gt;&lt;ActualFinish&gt;&lt;/ActualFinish&gt;&lt;Status&gt;0&lt;/Status&gt;</TaskProgress></Task></Task>" 144: + "<Task><Task><ID>TSK002.005</ID><Name>Deployment</Name><StartDate>2006/05/16</StartDate><FinishDate>2006/07/15</FinishDate><ProjectMemberID>94419013</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;&lt;/ActualStart&gt;&lt;ActualFinish&gt;&lt;/ActualFinish&gt;&lt;Status&gt;0&lt;/Status&gt;</TaskProgress></Task></Task>"145: + "<Task><Task><ID>TSK002.006</ID><Name>Stablizing</Name><StartDate>2006/07/16</StartDate><FinishDate>2006/07/31</FinishDate><ProjectMemberID>94419012</ProjectMemberID><TaskProgress>&lt;ActualStart&gt;&lt;/ActualStart&gt;&lt;ActualFinish&gt;&lt;/ActualFinish&gt;&lt;Status&gt;0&lt;/Status&gt;</TaskProgress></Task></Task>"146: + "</Tasks>" 147: + "</Project>", ((AbstractProject)tProjectInfo.Projects[0]).getProjectInfo().OuterXml); 148: Assert.AreEqual(0, tProjectInfo.Tasks.Count); 149: } 150: 151: [Test] 152: public void Class_Task() 153: { 154: tTask = new Task("", "", "", new DateTime(2006, 3, 1), new DateTime(2006, 3, 31), "", ""); 155: Assert.AreEqual("<Task><ID></ID><Name></Name><StartDate>2006/03/01</StartDate><FinishDate>2006/03/31</FinishDate><ProjectMemberID></ProjectMemberID><TaskProgress></TaskProgress></Task>", tTask.getTaskInfo().OuterXml); 156: tTask.Close(); 157: tTask = new Task("", "", "", new DateTime(2006, 3, 1), new DateTime(2006, 3, 31), "", ""); 158: tTask = new Task("PRJ001", "TASK001.001", "UnitTest", new DateTime(2006, 3, 1), new DateTime(2006, 3, 31), "94419012", ""); 159: Assert.AreEqual("<Task><ID>TASK001.001</ID><Name>UnitTest</Name><StartDate>2006/03/01</StartDate><FinishDate>2006/03/31</FinishDate><ProjectMemberID>94419012</ProjectMemberID><TaskProgress></TaskProgress></Task>", tTask.getTaskInfo().OuterXml); 160: } 161: 162: [Test] 163: public void Class_Project() 164: { 165: StorageManager sm = new StorageManagerXML(); 166: tProject = new LeafProject(sm, "", "", "", ""); 167: tProject.InitProjectInfo("PRJ003"); 168: Assert.AreEqual("<Project><ID>PRJ003</ID><Name>Procurement Information Warehouse</Name><Manager>94419013</Manager><ParentProject>001</ParentProject><ManageType>2</ManageType><Tasks><Task><Task><ID>TSK003.001</ID><Name>Envision</Name><StartDate></StartDate><FinishDate></FinishDate><ProjectMemberID></ProjectMemberID><TaskProgress></TaskProgress></Task></Task><Task><Task><ID>TSK003.002</ID><Name>Planning</Name><StartDate></StartDate><FinishDate></FinishDate><ProjectMemberID></ProjectMemberID><TaskProgress></TaskProgress></Task></Task></Tasks></Project>", tProject.getProjectInfo().OuterXml); 169: tProject = new LeafProject(sm, "", "", "", ""); 170: Assert.AreEqual("<Project><ID></ID><Name></Name><Manager></Manager><ParentProject></ParentProject><ManageType>2</ManageType><Tasks /></Project>", tProject.getProjectInfo().OuterXml); 171: tProject.close(); 172:

OOAD Homework (Spring 2006) 53

Page 56: Hierarchical Project Management System

Assert.AreEqual("<Project><ID></ID><Name></Name><Manager></Manager><ParentProject></ParentProject><ManageType>2</ManageType><Tasks /></Project>", tProject.getProjectInfo().OuterXml); 173: tProject = new LeafProject(sm, "PRJ001", "Project1", "94419012", "PRJ002"); 174: Assert.AreEqual("<Project><ID>PRJ001</ID><Name>Project1</Name><Manager>94419012</Manager><ParentProject>PRJ002</ParentProject><ManageType>2</ManageType><Tasks /></Project>", tProject.getProjectInfo().OuterXml); 175: tProject.close(); 176: Assert.AreEqual("<Project><ID>PRJ001</ID><Name>Project1</Name><Manager>94419012</Manager><ParentProject>PRJ002</ParentProject><ManageType>2</ManageType><Tasks /></Project>", tProject.getProjectInfo().OuterXml); 177: Assert.AreEqual(false, tProject.createChildProject("PRJ003", "Project3", "94419013")); 178: Assert.AreEqual(true, tProject.createTask("TSK001.001", "Task1", new DateTime(2005, 3, 1), new DateTime(2005, 3, 31), "94419013", "")); 179: } 180: 181: [Test] 182: public void Class_Librarian() 183: { 184: alProjects = tLibrarian.requestProjectListByManager(""); 185: Assert.AreEqual(0, alProjects.Count); 186: alProjects = tLibrarian.requestProjectListByManager("94419001"); 187: Assert.AreEqual(0, alProjects.Count); 188: alProjects = tLibrarian.requestProjectListByManager("94419012"); 189: Assert.AreEqual(2, alProjects.Count); 190: Assert.AreEqual("PRJ001", ((ProjectInList)alProjects[0]).ProjectID); 191: Assert.AreEqual("Intranet Portal Project", ((ProjectInList)alProjects[0]).ProjectName); 192: Assert.AreEqual("PRJ002", ((ProjectInList)alProjects[1]).ProjectID); 193: Assert.AreEqual("Marketing Information Warehouse", ((ProjectInList)alProjects[1]).ProjectName); 194: tLibrarian.requestProjectInfo("PRJ003"); 195: //tLibrarian.setManageType(ManageType.undefined); 196: //Assert.AreEqual(false, tLibrarian.createProject("PRJ003", "Project3", "94419013")); 197: //Assert.AreEqual(false, tLibrarian.createTask("TSK001.001", "Task1", new DateTime(2005, 3, 1), new DateTime(2005, 3, 31), "94419013", "")); 198: tLibrarian.setManageType(ManageType.splitProjects); 199: Assert.AreEqual(true, tLibrarian.createProject("PRJ003", "Project3", "94419013")); 200: Assert.AreEqual(false, tLibrarian.createTask("TSK001.001", "Task1", new DateTime(2005, 3, 1), new DateTime(2005, 3, 31), "94419013", "")); 201: tLibrarian.setManageType(ManageType.splitTasks); 202: Assert.AreEqual(false, tLibrarian.createProject("PRJ003", "Project3", "94419013")); 203: Assert.AreEqual(true, tLibrarian.createTask("TSK001.001", "Task1", new DateTime(2005, 3, 1), new DateTime(2005, 3, 31), "94419013", "")); 204: } 205: 206: [Test] 207: public void Class_SystemController() 208: { 209: alProjects = tSystemController.requestProjectListByManager("");210: Assert.AreEqual(0, alProjects.Count); 211: alProjects = tSystemController.requestProjectListByManager("94419001"); 212: Assert.AreEqual(0, alProjects.Count); 213: alProjects = tSystemController.requestProjectListByManager("94419012"); 214: Assert.AreEqual(2, alProjects.Count); 215: Assert.AreEqual("PRJ001", ((ProjectInList)alProjects[0]).ProjectID);

OOAD Homework (Spring 2006) 54

Page 57: Hierarchical Project Management System

216: Assert.AreEqual("Intranet Portal Project", ((ProjectInList)alProjects[0]).ProjectName); 217: Assert.AreEqual("PRJ002", ((ProjectInList)alProjects[1]).ProjectID); 218: Assert.AreEqual("Marketing Information Warehouse", ((ProjectInList)alProjects[1]).ProjectName); 219: tSystemController.pickProject("PRJ003"); 220: Assert.AreEqual(false, tSystemController.createChildProject("PRJ003", "Project3", "94419013")); 221: Assert.AreEqual(true, tSystemController.CreateTask("TSK001.001", "Task1", new DateTime(2005, 3, 1), new DateTime(2005, 3, 31), "94419013", "")); 222: } 223: } 224: }

Figure 22, Source Code – HPMSLibs_UT.cs

OOAD Homework (Spring 2006) 55

Page 58: Hierarchical Project Management System

8. IMPLEMENTATION CLASS MODEL 2

Draw an implementation class diagram for your system (including associations, attributes (optional) and methods)

Figure 23, Implementation class diagram (for Project Management, #UC-04)

Actually, the 2 implementation class diagrams are identical for implementation iteration 1 (figure 19) and 2 (figure 23) because no any classes or methods were created or deleted.

OOAD Homework (Spring 2006) 56