Prog272 Midterm2014

Elvenware Logo


Prog 272 Midterm 2014

This document describes the Winter 2014 midterm for Prog 272.


Insert the entire contents of Shakespeare.json (Shakespeare's 154 Sonnets) into a MongoDb collection called Poems.

Your program must be able to do several things:

Extra credit:

When the program comes up you should just display HTML with a series of buttons on it. Pick one of the buttons to read in a list of poems, select a poem, etc.

The Documents

The documents you store in the database should have at least four fields:

The Shakespeare.json file has two fields, so you will have to use search and replace to add the new fields. I suggest doing the work of adding new fields in Notepad++.

You should run grunt jshint across your files and confirm that all the JS files come back clean. Have it set up so that I can just run grunt jshint and get back a result.xml file that is clean.


The program should run as web app and inside a Cordova app.

The data should be stored both in your local linux database and in MongoLab.

It is essential that the copies of your Cordova and Web project should have unique names when loaded in Eclipse. I will not accept a project with a name like HelloWorld. The web project should be called MidtermWeb-LastName, and the mobile app should be called MidtermCordova_LastName, where LastName is your last name.

Turn it In

Put your code for both projects in a folder and commit the code to a folder in your repository called Week07-Midterm. Submit a URL that points at your folder on GitHub.

When you turn it in, it should connect automatically to MongoLab.

In the root of the Week07-Midterm folder include screen shots of the web app working on your linux box. Also include a screenshot of the Cordova program running on your phone or on an Androidx86 or similar virtual device.

I have not yet decided about unit tests. Please check back later.


RegEx: Sonnet\s(\d+)

Unit Tests

You must include:

On the client side include:

Example Async:

it("Integration test makes a real AJAX request", function(done) {
    textLoader.loadFile("Sources.html", function(responseText) {
        var bar = $(responseText).filter('#paragraph04').html();
        expect(bar).toBe('Fine time.');

Example Spy:

it("Tests that loadFile is called with Sources.html", function() {
    // get is stubbed and never really called
    spyOn($, "get");
    textLoader.loadFile("Sources.html", function(data) {
    expect($.get).toHaveBeenCalledWith("Sources.html",     jasmine.any(Function));

Connection Pool