官术网_书友最值得收藏!

Setting up the project

As we've seen in previous chapters, Rational Team Concert represents a software project as a Project Area. The project area defines the project deliverables, team structure, process, schedule, and more. A project area is stored as a top-level or root item in a repository and references project artifacts and stores the relationships between these artifacts. Access to a project area and its artifacts is controlled by permissions.

Similar to what we did when importing the JUnit sample project in the previous chapter, we are going to create a project area, only this time for the BookManager Application. Log in to the Rational Team Server as administrator. This can be done either from the Team Server web application or from the Rational Team Concert client. In the web application, go to Project Area Management from the main toolbar and create a new project area by clicking Create Project Area. Remember that a project area cannot be deleted from the repository; however, it can be archived, which places it in an inactive state.

Setting up the project

At the time of creating the project area, we would need to enter some important attributes of the project, as follows:

  • Project Name: This is the name key that will be used throughout the system.
  • Process Template: Select the process template that our team uses.
  • Members: Select the team members of the team for this project. We can select the users from the global list provided by the Rational Team Server.
  • Administrator: Remember to add an administrator to the project, which enables the administrator to add permissions, roles, and so on.

Once we click on the Save button, it takes a few minutes for the team server to create the project area. As an administrator, we can also tweak into the timelines, roles, permissions, and access control.

Once the project area is created, the Rational Team Server prompts us if we would like to send the project invitations to the new users as shown in the next screenshot:

Setting up the project

Once we select the users and confirm to send the invitations, we will be prompted to review the team invitation that is generated by the Rational Team Server.

Setting up the project

With this, the process of setting up the BookManager Project team area is complete. Now go to the Rational Team Concert's client, navigate to Team Artifacts view, and right-click to add a new project area as shown in the following screenshot:

Setting up the project

In the next step, we will import the SVN dump file into the Rational Team Concert.

Importing the subversion dump

In this section, we will see different steps to import the source code from the subversion to the Rational Team Server. Assume that the code is being developed and versioned in subversion. It is assumed that the administrator has already created the subversion dump file and it is available for use. We can download the project dump file and other source code from the Packt Publishing website.

In the first phase, we specify the subversion dump file and destination, which is a component in a repository workspace. In the second phase, the importer opens the dump file and displays the folders that can be selected for import and a list of subversion user names that we can map to Rational Team Server users.

Importing the subversion dump file is done from the Rational Team Concert client. From the client, open File | Import, as shown in the following screenshot:

Importing the subversion dump

In the Import dialog, select the Jazz Source Control | SVN Dump File and click on Next. Notice that we could also import the Change Set Archive and ClearCase Stream or Branch into the Rational Team Server repository, as shown next:

Importing the subversion dump

Select the dump file by navigating and selecting the appropriate file through the Browse button. Optionally, to save a compressed dump file, select Save a compressed version of the dump file for additional imports, as shown next:

Tip

We cannot enter a ZIP file that contains the SVN dump file. Make sure that the SVN dump (<filename>.dump) file is extracted from the ZIP file.

Importing the subversion dump

Create a new repository workspace and new component by selecting Create a new repository workspace named: and type a name for the new workspace. The import creates a new workspace and component. The component has the same name as the workspace, as shown next:

Importing the subversion dump

To specify a baseline name in the Post Import Baseline Name field, type a new baseline name. To generate baselines for branch and tag points, select Create baselines for branch and tag points. To specify a text file encoding in the text file encoding pane, select Other in the drop-down list, select an encoding type. To reconcile existing and imported files, select Reconcile any overlap between existing imported files and folders. To specify a revision range to import, in the Revisions to import pane, select Import all revisions within the specified range; in the Start Revision and End Revision fields, specify the revision range as shown next:

Importing the subversion dump

The following screenshot lets us map the SVN users to Jazz Users. Rational Team Concert allows us to choose how we want to map the users, as follows:

  • Prompt for Jazz users once the SVN user IDs are discovered: When we want to defer the mapping of usernames until the SVN usernames are discovered.
  • Do not map SVN users to Jazz users: When we do not want any relation between SVN users to Rational Team Server users.
  • Automatically map SVN users to Jazz users with the same id and create any missing users: When we want automatic discovery of the usernames and we want Rational Team Server to create any missing usernames automatically.
  • Use the mappings entered below: When we know exactly which SVN usernames map to Rational Team Server users.
    Importing the subversion dump
  • If we are not sure of the structure of the subversion repository, select Prompt to determine what folders to import when the SVN repository folder structure is known.
  • To import a path as a top-level folder in the target component, select Import the paths specified below as top-level folders in the target component. To add a path, click on Add Path, and in the Add Path dialog box, type the path name in the Path field and click on OK. To load a set of paths saved to a file, click on Load and navigate to the file. To save the file to a specified location, click on Save.
  • To import a path as a component root, select Import the path specified below as the root of the component. To edit a path, select it and then click on Edit. In the Path field of the Edit dialog, change the path and click on OK.

We have the complete project directly under the SVN trunk, so choose to Import the path specified below as the root of the component, as shown in the following screenshot:

Importing the subversion dump

Rational Team Concert reads the complete SVN dump file, discovers the users, and asks us which source folders to import. As we have the complete project under the top-level, click on Add Projects, as shown next:

Importing the subversion dump

Now, the user IDs from the SVN dump file are discovered and Rational Team Concert displays the users. Notice that there are two user IDs, and one SVN user ID is already mapped to a Jazz user ID, as shown next:

Importing the subversion dump

For the other SVN user ID (smadhuvarsu), which does not have the corresponding Jazz user ID, select the respective Jazz user ID and click on Finish. This completes the SVN dump import.

Note

Mapping the users between the SVN system and Jazz Team Server is a very important feature for administrators. It is not uncommon that the usernames are different across an organization's systems.

Importing the subversion dump

Rational Team Concert's team has imported the complete SVN dump (read the usernames) and read the source code and revisions. This provides a seamless experience when working with team server source control. The Team Artifacts view shows an overview of the project as shown in the next screenshot. However, we need to do a few things first to be able to work with it, which are as follows:

  1. The BookManager project component is added to the Components under the My Repository Workspaces.
  2. The BookManager project repository is added to the My Repository Workspaces.
    Importing the subversion dump

Once the project area, repository, and components are set up, it's time to load the source code and work on it. We import the source code by selecting the component from Repository Workspace, right-clicking, and selecting Load….

Importing the subversion dump

The Load... action invokes a wizard that gives us a choice of how we would like to load the projects. As we have an Eclipse project, select Find and load Eclipse projects. Components, that are not developed as Eclipse projects can be imported and set up from the root folders as shown next:

Importing the subversion dump

The wizard lists all the available projects from the root directory of the repository. We can select the appropriate project and optionally select where the source code should be imported.

Importing the subversion dump

Once the import source code is finished, the component is loaded and the source code is visible in the Package Explorer.

Importing the subversion dump

Project source code

Now that we have the code from the BookManager project, let's look at how the source code is organized. This section serves to give an introduction and overview of the application and the technologies used.

The BookManager source is comprised of servlets and JSPs, as well as some Java beans for persistence. These operate in the Apache Struts and Hibernate frameworks; therefore, we also have the libraries needed for these along with the configuration files that tell these components how to work together. The building and packaging is done using ANT, a popular, robust open source build system available from the Apache Project. The build.xml file controls this build process.

These sources in turn are organized in packages, as shown in the following screenshot of the Package Explorer in Rational Team Client:

Project source code

Each package is represented by a directory under src and contains the following:

  • admin: A command-line administrative utility that allows one to create user accounts (both administrative and non-administrative), as well as the full Derby database schema, populated with demo data.
  • client.action: It has the Struts ActionServlet classes containing the required execute() method, that perform the business logic for each user-generated action.
  • client.interceptor: It has the interceptor classes for log in and log out. It always validates for an authenticated session.
  • client.jsp: It has all the JSP pages responsible for the UI representation on the client.
  • lib: It has the library files necessary for all the third-party utilities we use, including Derby, Hibernate, and Struts.
  • resources.hibernate: It has the Hibernate config file for the database connection and also the domain mapping file for the Book entity.
  • resources.web: It has the resources such as web.xml, struts.xml, and style.css that are needed to deploy as a web application.
  • server.beans: It has the domain objects, implemented as simple Java beans with the required getters and setters.
  • server.services: It has the Hibernate persistence utilities that handle the connections, CRUD functions, and so on.

Building and running the application

Now that we've imported the source, we're ready to build, deploy, and execute the finished application.

From the Rational Team Concert client, go to External Tools | External Tools Configuration and create a new Ant Build configuration. Remember to use the same build file defined on the project (called, by convention, build.xml). The build file is available on the project root of the client.

Building and running the application

Once the Ant Build configuration is set up, add the configuration to the External Tools' Favorite menu, and run the BookManager_AntBuild configuration, which compiles the sources and creates both the standalone admin.jar (for the command-line administrative utility) and an application WAR file that can be deployed to any standard servlet container.

Building and running the application

Admin utility

The bookmanager-admin.jar file is an executable JAR that provides a simple command-line administrative interface for managing the database and users for the BookManager application. There are options to create and list users, and assign them administrative roles. It can also be used to populate the database schema with sample data from the comma-separated value (csv) file created during the build.

Before we run the web-based application, let's use the bookmanager-admin.jar to create some administrative and non-administrative users, and populate the database with sample data. Copy the bookmanager-admin.jar and samplebooks.csv files created from the BookManager build to the <tomcatHome>/bin directory. Open a command prompt and go to <tomcatHome>/bin. We assume that the java path is already set and we can run java from the command line. To create a user, enter the following command line:

java -jar bookmanager-admin.jar adduser <username> <password> <usertype>

Select the username of our choice, and a password that will be SHA encrypted. If we wish to make this user an administrator, enter "admin" for the usertype; otherwise enter "user."

If the BookManager database doesn't already exist, bookmanager-admin.jar will first create the necessary Derby files and schema, before adding the user.

We can use this utility to add as many administrative and non-administrative users as we like.

Admin utility

To see a list of existing users, along with their SHA encrypted password and their role, enter java -jar bookmanager-admin.jar listusers as shown next:

Admin utility

To populate the database with sample data, enter the following:

java -jar bookmanager-admin.jar popdb ./samplebooks.csv.
Admin utility

BookManager application

We're now ready to deploy the generated WAR file to any standard servlet container. In our case, we will use Apache Tomcat.

  1. Start the Tomcat server using the appropriate Tomcat utility. Make sure that this is a separate instance from the Rational Team Server, listening on a different port.
  2. Go to Management console. If we deployed Tomcat on 8080, browse to http://localhost:8080/manager/html.
  3. Select the WAR file generated by the build and click on Deploy.
  4. Once the application is deployed, we can access the application by browsing to http://localhost:8080/BookManager/welcome.jsp.
    BookManager application

If we log in as an admin user, the Welcome screen enables us to add, modify, delete, and list the books. Each time we add a new book, the application automatically redirects us to the List View action. Every screen in the application displays the current username and a logout facility.

BookManager application

All the actions in the application are represented by the breadcrumb widget, and as a user, we know exactly how to get to the Home screen. Try using the Add Books action to put more books in the database; we will see a simple web form with basic information about the book. Clicking Add will execute the appropriate Struts action, and save our new book in the Derby database, Hibernate. It should then appear on the list of books.

BookManager application

In the next chapters of this book, we will test the BookManager application and enhance it using Rational Team Concert client and server. In particular, we will get introduced in depth to various aspects of team server, collaboration, work items, planning, builds, and release management.

主站蜘蛛池模板: 尉氏县| 高台县| 镇平县| 望城县| 台湾省| 潢川县| 大邑县| 威信县| 翁牛特旗| 九龙坡区| 佛坪县| 张家港市| 昌宁县| 抚宁县| 鸡西市| 宝山区| 鄯善县| 山西省| 泗洪县| 黔东| 会宁县| 大荔县| 广汉市| 无棣县| 南京市| 淮南市| 司法| 贞丰县| 九寨沟县| 大姚县| 绍兴县| 渝中区| 会昌县| 漳平市| 河东区| 南阳市| 辽阳县| 林芝县| 山西省| 化州市| 蓝田县|