collector: fix test exception

22839f032c5a0e3502dbe0e1e5822b6294bdc987 broke the TestModulesFactory
by not installing the EmbeddedJettyJerseyModule module.

Reported-by: David Stryker <dstryker@ning.com>
Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
This checkin, in branch dev-dstryker, adds an event_categories table
that maps string names of event categories into integer category ids,
as well as the caches for the mapping.  Everywhere that we used to use
event categories in the timeline mechanisms, we now use event category
ids.

This checkin also fixes a bug in timeline aggregation; provides for
per-aggregation-level counts of timelines to aggregate; and increases
the max aggregation level to 3.

Finally, this checkin adds an end_time column to timeline_chunks table
and TimelineChunks class.

All unit tests pass with these changes.

util/src/main/java/com/ning/arecibo/util/timeline/CategoryIdAndSampleKind.java:

    New unit that encapsulates an event category id/sample kind pair.

collector-client-support/src/main/java/com/ning/arecibo/collector/rest/DefaultCollectorClient.java:

    Add a fix for a Sun JDK compile error.

collector/src/main/java/com/ning/arecibo/collector/guice/CachingDefaultTimelineDAOProvider.java:

    Conform to CachingTimelineDAO constructor arg change.

collector/src/main/java/com/ning/arecibo/collector/guice/CollectorConfig.java:

    Add a parameter for the max number of event categories.

    Change maxAggregationLevel to 3.

    Add a parameter that gives, for each aggregation level, the number
    of chunks we must find in order to aggregate.

collector/src/main/java/com/ning/arecibo/collector/persistent/TimelineAggregator.java:

    Use eventCategoryIds rather than eventCategories.

    Supply endTime to the TimelineChunk constructor.

    Accomodate the differing number of chunks to aggregate for
    different aggregation levels.

    Fix bug that caused different eventCategoryIds to be aggregated
    together.

collector/src/main/java/com/ning/arecibo/collector/persistent/TimelineEventHandler.java:

    Conform to the change from category to categoryId.

    Pass accumulatorEndTime to extractTimelineChunkAndReset().

    getOrAdd the eventType to get the id.

    Pass the id to getOrAddSampleKind().

collector/src/main/java/com/ning/arecibo/collector/process/EventsUtils.java:

    Delete getSampleKindFromEventAttribute().

collector/src/main/java/com/ning/arecibo/collector/resources/HostDataResource.java:

    Conform to the changed args and return values of dao methods that deal with sampleKindIds.

    Every place we used to accept a query parameter that specified
    sampleKind, now accept eventCategory,sampleKind.

    Add a new endpoint, getHostSamplesUsingIds(), and cause all the
    existing sample endpoints to translate host names to host ids, and
    eventCategory,sampleKinds into sampleIds, and call the new method.

    Change writeJsonForAllChunks to accept ids rather than strings for
    hosts and sample kinds.

    Add @VisibleForTesting method findSampleKindIdsForHosts.

    Add private utility methods to translate lists of hosts and
    eventCategory,sampleKinds into ids.

collector/src/main/resources/collector.sql:

    Add table event_categories.

    Add event_category_id column to sample_kinds.

    Add end_time column to timeline_chunks.

collector/src/main/resources/com/ning/arecibo/collector/persistent/TimelineAggregatorDAO.sql.stg:

    Replace event_category with event_category_id.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineDAO.java:

    Add methods for event categories.

    For sample kind methods, conform to the use of eventCategoryId.

collector/src/test/java/com/ning/arecibo/collector/MockTimelineDAO.java:

    Synchronize get methods, since the insert methods are synchonized.

    Add support for event category methods.

    Conform to the other TimelineDAO method changes.

collector/src/test/java/com/ning/arecibo/collector/TestEventCollectorServer.java:
collector/src/test/java/com/ning/arecibo/collector/TestTimelineChunkAndTimes.java:
collector/src/test/java/com/ning/arecibo/collector/TestTimelineHostEventAccumulator.java:
collector/src/test/java/com/ning/arecibo/collector/persistent/TestDefaultTimelineDAO.java:
collector/src/test/java/com/ning/arecibo/collector/persistent/TestTimelineAggregator.java:
collector/src/test/java/com/ning/arecibo/collector/persistent/TestTimelineEventHandler.java:
collector/src/test/java/com/ning/arecibo/collector/process/TestCollectorEventProcessor.java:
collector/src/test/java/com/ning/arecibo/collector/process/TestInMemoryCollectorEventProcessor.java:
collector/src/test/java/com/ning/arecibo/collector/process/TestSamplesReplayer.java:
collector/src/test/java/com/ning/arecibo/collector/resources/TestHostDataResource.java:

    Conform to sample kind and event category changes.

util/src/main/java/com/ning/arecibo/util/timeline/CachingTimelineDAO.java:

    Add support for event category methods, and add caches and
    monitored getters for event categories.

    Conform to the other TimelineDAO method changes.

util/src/main/java/com/ning/arecibo/util/timeline/DefaultTimelineDAO.java:

    Conform to the TimelineDAO method changes.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineChunk.java:

    Support endTime.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineChunkAccumulator.java:

    Conform to the addition of TimelineChunk.endTime.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineChunkAndTimes.java:

    Replace eventCategory with eventCategoryId, and add endTime to
    TimelineChunk constructor call.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineChunkBinder.java:

    Bind endTime.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineChunkMapper.java:

    Add endTime to TimelineChunk constructor call.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineHostEventAccumulator.java:

    Replace use of eventCategory with eventCategoryId.

    When logging sampleKind, also long eventCategoryId.

util/src/main/java/com/ning/arecibo/util/timeline/TimelineTimes.java:
util/src/main/java/com/ning/arecibo/util/timeline/TimelineTimesBinder.java:
util/src/main/java/com/ning/arecibo/util/timeline/TimelineTimesMapper.java:

    Replace use of eventCategory with eventCategoryId.

util/src/main/java/com/ning/arecibo/util/timeline/persistent/TimelineDAOQueries.java:

    Add eventCategory methods.

    Pass eventCategoryId into the sampleKinds get and add methods.

util/src/main/resources/com/ning/arecibo/util/timeline/persistent/TimelineDAOQueries.sql.stg:

    Add eventCategory templates.

    Pass eventCategoryId into the sampleKinds get and add templates.

util/src/test/java/com/ning/arecibo/util/timeline/TestSampleCoder.java:
util/src/test/java/com/ning/arecibo/util/timeline/TestSampleCompression.java:
util/src/test/java/com/ning/arecibo/util/timeline/TestTimelineChunkAndTimesToJson.java:
util/src/test/java/com/ning/arecibo/util/timeline/TestTimelineTimes.java:

    Pass eventCategoryId instead of eventCategory.

util/src/test/java/com/ning/arecibo/util/timeline/TestTimelineChunkAccumulator.java:

    Pass eventCategoryId instead of eventCategory.

    Add endTime arg to extractTimelineChunkAndReset().
Fix braino in TimelineAggregator that caused timeline chunks to be dropped if they weren't the first for a given sample kind
Merge branch 'dev-dstryker' into collector-ng
Merge branch 'collector-ng' of github.com:ning/Arecibo into collector-ng