CVS Class Practice: Part 1

You are given a project under the EmployeeProject folder on the /usr/people/classes/CS230/handouts/CVSI. This project contains the following files:

1.  Class Employee in EmployeeProject/edu/csbsju/cs which stores data on an employee (name, salary and hire date) along with getter methods and a method to give a raise to an employee when desired

2.  Class Driver in EmployeeProject which creates an instance of class Employee, gives the employee a 5% raise, and displays the employee information

3.  Other (non java) files in almost all of your project folders

Type the following on a Shell Terminal to get a copy of this folder (assuming your csci230bin directory is under your home – if not, change accordingly)

cp –r /net/people/classes/CS230/handouts/CVSI/EmployeeProject/ ~/csci230bin

You are to do this exercise in teams of two by launching two shell terminals simultaneously (which simulates two users working concurrently) – make sure each shell terminal points to different directory (so that they won’t overwrite one another).

Step 1:  You are to import your EmployeeProject into our CVS repository (cvs import) using a different project name of your choice – include your last names in the project name (e.g.: something like RahalMillerEmployee will do just fine). Prior to importing, make sure that

·  $CVSROOT points to the CVS repository at /home/cvs/ (setenv CVSROOT /home/cvs/). Alternatively, you may use the –d option with all your cvs commands (e.g.
cvs –d /home/cvs/ import) --- not as convenient as the first option

·  DO NOT import any non-java files that are currently in the project folder by including an appropriate .cvsignore file in every folder inside your project

BTW, if you ever want to delete an imported project from the CVS repository for any reason, do so using rm –rf CVS_MODULE_NAME

Step 2:  Open two Shell terminals and checkout a copy of the whole project on each (cvs co) – make sure each shell terminal points to different directory (so that they won’t overwrite one another). ALSO MAKE SURE THAT YOU setenv CVSROOT /home/cvs/CS230 again since this is a new terminal.

Step 3:  First Change:

·  Shell terminal 1: Update the Driver class by deleting the 5% raise statement in the main method

·  Shell terminal 2: Update the Employee class by creating a new toString() method which returns a string containing the employee information (returns the concatenation of all instance variables)

·  Run the cvs diff command on both terminals to view any differences.

·  Commit your changes back to the repository on both terminals

o  Remember to supply a meaningful log message for your commit

o  In case of any errors, run the update command (cvs update) to update your sandbox

·  What can you conclude from this step?

Step 4:  On both shell terminals, remove the old checked out projects and checkout new copies of the project

Step 5:  Second Change:

·  Shell terminal 1: Update the Driver class by adding a 10% raise statement in main method

·  Shell terminal 2: Update the Driver class by changing the print statement to call the toString() method instead of trying to get each piece separately

·  Run the cvs diff command on both terminals to view any differences

·  Commit your changes back to the repository on both terminals

o  Remember to supply a meaningful log message for your commit

o  In case of any errors, run the update command (cvs update) to update your sandbox

·  What can you conclude from this step?

Step 6:  On both shell terminals, remove the old checked out projects and checkout new copies of the project

Step 7:  Third Change:

·  Shell terminal 1: Update the Employee class by changing the raise to be specified in absolute value (e.g. $100 or $500) instead of percentage (i.e. change method raiseSalary)

·  Shell terminal 2: Update the Employee class by changing the raise to be specified as a value between 0 and 1 instead of a percentage (i.e. change method raiseSalary to public void raiseSalary(double fraction) and the code accordingly)

·  Run the cvs diff command on both terminals to view any differences

·  Commit your changes back to the repository on both terminals

o  Remember to supply a meaningful log message for your commit

o  In case of any errors, run the update command (cvs update) to update your sandbox

·  What can you conclude from this step?

Step 8:  From now on, you can work with just one Shell terminal. Close one of the two terminals. Run the cvs log command on the project. Go through the output and try to understand it. This applies to the master copy.

Step 9:  Run the cvs status command on your project. Go through the output and try to understand it. This applies to the local (sandbox) copy.

Step 10:  Add a new Manager.java file (class Manager extends class Employee) to folder EmployeeProject/edu/csbsju/cs in your sandbox. This class has one additional private String office field, an updated constructor, a getter for the office location field and an updated toString() method. Commit this addition to the repository. Did you run into any problems? How did you resolve them?

Step 11:  Remove the Manager.java file from folder edu/csbsju/cs in your sandbox. Commit the addition to the repository. Did you run into any problems? How did you resolve them?