Test cases and small fixes

1. Added unit tests for analytics and some basic tests for the express server.
2.  The analytics example in `sample/basics` was based on Express 4.x. Changed it to make it runnable on 3.x
3.  If some records failed to get uploaded, add them to the queue to retry them. On `flush()`, the remote API responds back with the number of records it successfully pushed and the number that it failed. Add the number of failed ones back to the buffer. The records are processed sequentially so if 5 records are rejected, they will always be the last 5 ones.
     
Yes, they return a JSON of the form {accepted: X. rejected: Y, warnings:
""};

On Mon, Sep 8, 2014 at 9:51 PM, Scott Ganyo <notifications@github.com>
wrote:

> In analytics/apigee/lib/apigeeanalytics.js:
>
> > @@ -64,9 +63,11 @@ ApigeeAnalyticsSpi.prototype.flush = function(recordsQueue, cb) {
> >        if (err || resp.statusCode != 200) {
> >          cb(err || new Error('error from server: ' + resp.statusCode), recordsToBeUploaded);
> >        } else {
> > -        cb();
> > +        resp.body.rejected > 0 ? cb(undefined, recordsQueue.slice(recordsQueue.length - resp.body.rejected))
>
> Apigee will return a 200 success and still return # of rejected records?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/apigee-127/volos/pull/39/files#r17282146>.
>



-- 
Dibyajyoti Mukherjee
814-795-6820
LinkedIn <http://www.linkedin.com/in/dibyom>