CSC 217 Lab 04: Integrating WolfScheduler
into PackScheduler
To integrate WolfScheduler
into PackScheduler
, you will focus on three packages:
edu.ncsu.csc216.pack_scheduler.course
: integrate classes fromWolfScheduler
edu.ncsu.csc216.pack_scheduler.io
: integrate classes fromWolfScheduler
edu.ncsu.csc216.pack_scheduler.catalog
: create a new class using pieces fromWolfScheduler
The existing Student
, StudentRecordIO
, StudentDirectory
, and StudentDirectoryPanel
classes will remain unchanged.
Clone your GP3 project into your Workspace
Note: On-campus students, since you are working in pairs/threes, you will need to determine which of the projects you want to use as the WolfScheduler
source. Start with a discussion about which project should “move on”.
Clone your GP3 WolfScheduler
project into your lab workspace, if it isn’t there already.
edu.ncsu.csc216.pack_scheduler.course
Package
Complete the following steps to integrate the course classes from WolfScheduler
into PackScheduler
Copy in the src/
files:
- Create a new package
edu.ncsu.csc216.pack_scheduler.course
in thesrc/
folder ofPackScheduler
- Select the
Activity
,Conflict
,ConflictException
, andCourse
classes from your Guided Project 3WolfScheduler
and copy them into the newedu.ncsu.csc216.pack_scheduler.course
package in thesrc/
folder ofPackScheduler
.
Copy in the test/
files:
- Create a new package
edu.ncsu.csc216.pack_scheduler.course
in thetest/
folder ofPackScheduler
- Select the
ActivityTest
,ConflictExceptionTest
, andCourseTest
classes from your Guided Project 3WolfScheduler
and copy them into the newedu.ncsu.csc216.pack_scheduler.course
package in thetest/
folder ofPackScheduler
.
Update your tests to remove any references to Event
so that PackScheduler
compiles. This may mean that some tests will be deleted, and that’s ok if they are no longer needed. There will likely be several tests in ConflictExceptionTest
that will need to be deleted due to conflict checks involving Event
s.
Run your tests and ensure there is no regression in functionality.
Implement the Comparable<Course>
interface in Course
. Write new tests in CourseTest
to ensure that the compareTo()
method works correctly by looking at the Course
name
and then section
during the comparison.
edu.ncsu.csc216.pack_scheduler.io
Package
With PackScheduler
there isn’t a need for Event
s (they could be added later, so Activity
will remain as a super class), therefore, CourseRecordIO
can take over the responsibility of both reading in course records and writing course records to a file.
You may either 1) copy in CourseRecordIO
from your Guided Project 1 submission or 2) copy in CourseRecordIO
from your Guided Project 3 submission and integrate/refactor the ActivityRecordIO.writeActivityRecords()
method in CourseRecordIO
. Either way, edu.ncsu.csc216.pack_scheduler.io
will contain CourseRecordIO
and StudentRecordIO
in the src/
folder of PackScheduler
when the integration is complete.
Follow a similar procedure to copy/integrate/refactor CourseRecordIOTest
into the edu.ncsu.csc216.pack_scheduler.io
package in the test/
folder of PackScheduler
.
You will need to update imports that have *.wolf_scheduler.*
to use *.pack_scheduler.*
instead.
Additionally, copy all of the test-files/
from Guided Project 3 into PackScheduler
needed for your tests to pass.
Run your tests and ensure there is no regression in functionality. There is no additional functionality in the edu.ncsu.csc216.pack_scheduler.io
package.
edu.ncsu.csc216.pack_scheduler.catalog
Package
The WolfScheduler
class in the WolfScheduler
project cannot be directly used as is in the PackScheduler
project. The WolfScheduler
class has two responsibilities: to hold the catalog and to schedule courses. Only the catalog functionality is currently needed in the PackScheduler
project. You’ll create the CourseCatalog
class and use the WolfScheduler
project WolfScheduler
class and the StudentDirectory
class to help you implement CourseCatalog
.
Create a new package edu.ncsu.csc216.pack_scheduler.catalog
in the src/
and test/
folders of PackScheduler
.
Create the CourseCatalog
class to match the provided design and implement the methods by pulling code from WolfScheduler
or using StudentDirectory
for reference.
Additionally, create CourseCatalogTest
in the test/
folder. Reuse tests from WolfSchedulerTest
or use StudentDirectoryTest
for reference to write tests to drive your development.
For CourseCatalog
you will use the SortedList
collection rather than ArrayList
.
-catalog: SortedList<Course>
: aCourseCatalog
has aSortedList
ofCourse
s that make up the catalog+CourseCatalog()
: constructs an emptycatalog
+newCourseCatalog(): void
: constructs an emptycatalog
+loadCoursesFromFile(fileName:String): void
: loads course records into thecatalog
. AnyFileNotFoundException
s are caught and anIllegalArgumentException
is thrown to the client.+addCourseToCatalog(name:String, title:String, section:String, credits:int, instructorId:String, meetingDays:String, startTime:int, endTime:int): boolean
: adds aCourse
with the following fields to thecatalog
and returns true if theCourse
is added and false if theCourse
already exists in the catalog. If there is an error constructing theCourse
, theIllegalArgumentException
is allowed to propagate to the client.+removeCourseFromCatalog(name:String, section:String): boolean
: returns true if theCourse
is removed from thecatalog
and false if theCourse
is not in thecatalog
.+getCourseFromCatalog(name:String, section:String): Course
: returns theCourse
from thecatalog
with the givenname
andsection
. Returns null if theCourse
isn’t in thecatalog
.+getCourseCatalog(): String[][]
: returns thename
,section
,title
, and meeting information forCourse
s in thecatalog
.+saveCourseCatalog(fileName:String): void
: saves thecatalog
course records to the given file. AnyIOException
s are caught and anIllegalArgumentException
is thrown to the client.
Run Unit Tests
Run all of your unit tests and ensure that they pass!
Push to GitHub
Push your PackScheduler
project to GitHub
- Add the unstaged changes to the index.
- Commit and push changes. Remember to use a meaningful commit message describing how you have changed the code.
Since we can’t automate black box tests, you won’t need to check Jenkins. But you should make sure that your Black Box Test Plan was submitted!
Reminder: Staging and Pushing to GitHub
GitHub Resources: