Monday, August 31, 2009

Project 2a

Due date: Fri, 11 Sep
Individual project


An understanding of
  • web service access through HTTP
  • authentication and authorization for web service access 
  • web service access through specific client libraries
Familiarity with
Part 1 (4 points)

Perform the following steps:
  • Create a Google account if you don't yet have one.
  • Sign into Google Base and create a few items through the web interface.
  • Following the ClientLogin documentation, use cURL to obtain an authorization token for your account (without using Captcha). For each request parameter, use a -d argument for cURL. Your response should contain three lines, one of which begins with Auth=. The following value is the authorization token you will use in subsequent requests.
  • Now take a look at your list of items using the following HTTP GET request (all on one line):
    • curl -H 'Authorization: GoogleLogin auth=YourToken'
  • In this list, you should see the embedded URLs of the individual items. Select and copy one of them. Now delete the item by submitting an HTTP DELETE request with the same Auth header as before directly to the item's URL.
  • Take another look at the list. The item you deleted should no longer be there.
Part 2 (6 points)

Perform the following steps:
  • Obtain a Google Base API key for installed applications.
  • Check out the GDataJavaClientTest example from the course repository, then update its Maven dependencies (right-click on project root node > Maven > Update Dependencies). There should be no more compile-time errors (as indicated by red Xs).
  • Enter your API key and your authorization token in the test/ file. All the existing JUnit tests should now pass (run them by right-clicking on the project root node > Run As > JUnit Test). 
  • Add another test method (with the @Test annotation) that does the following:
    • Insert several items of item type TestOnly, each with a float-unit attribute indicating the item's price.
    • Iterate through your feed and count the items with this item type and compute their average price. Use assertions to ensure that the item count and average price are as expected.
    • Iterate through your feed again to increase each item's price by the same percentage.
    • Iterate through your feed one more time to compute the new average. Check that it has gone up by the same percentage.
    • Iterate through your feed to delete all items you created at the beginning of this test method.
    • Iterate through your feed one last time to make sure the items are gone.
  • Part 1: Screenshot or other form of transcript of your complete command-line interaction with Google Base.
  • Part 2: Complete, working project with the additional test case.
Please follow these online submission instructions. Submission by email, especially to the mailing list, is highly discouraged.

No comments: