In this assignment, you will make a few changes to the Cinequest client.
Check out a fresh new copy of the Cinequest repo. Do not check in the code into your personal repo. Do not submit the entire code with your homework. Instead, submit a patch that transforms the version that's currently on Github to your solution.
Android team: Be sure to check this out into a different project from your team work. You will also need to make a different workspace since you can't have two workspaces with projects that have the same name.
Push the personal repo after you complete each part, with an updated report.txt
in a directory cs175/hw04
. When you are completely done,
add hw04.patch
, and push again.
1. Look at the createWebConnection
method in the AndroidPlatform
class. That's a leftover from a previous refactoring. There used to be a need for a WebConnection
because Blackberry had a very different mechanism. We want to use HttpUrlConnection
instead, which works fine for Android and the JavaSE testing platform. The ConnectionHelper
class already does most of the required work, except for setPostParameters
. Move that method from JavaSEWebConnection
to ConnectionHelper
. Then fix up the second parse
method in JavaSEPlatform
. Eliminate JavaSEWebConnection
entirely.
In your report, summarize your steps. Push your report.
2. Find a test in JavaCommonTest
that uses that parse
method. What is the test? What happens when you run it?
3. Now repeat the same for AndroidPlatform
. Eliminate AndroidWebConnection
and WebConnection
, using ConnectionHelper
instead. How did you do this? Push your report.
4. Now look at the second parse
method in both AndroidPlatform
and JavaSEPlatform
. They both do the same thing in the same way. Move the AndroidPlatform
code into the Platform
superclass and remove the methods from both subclasses. Push your report.
5. Now make a patch. First commit your work, then run
cd cinequest git commit -a -m "Homework 4" git format-patch -1 --stdout > path/to/cs175/hw03/hw04.patch
Describe your patch. Using a couple of examples, tell me in report.txt
what the codes and numbers mean.
6. Test your patch by cloning the repo again into /tmp
and applying it:
cd cinequest git apply path/to/cs175/hw04/hw04.patch
Then build the program on the command line. How did you do that? (Hint: You need to run android update project --path .
in two directories.) What happened when you did?
Be sure to push your repo one last time.