entitlement: refactor DefaultEntitlementApi

Introduce EventsStream, an object that contains all of the states
required to answer entitlement queries.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
entitlement: refactor DefaultEntitlement

Make it use the new EventsStream object.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Fix timeline API ordering issues and test against real seen scenario (new test testWithOverdueOfflineAndClear)
Fix SubscriptionBundleTimeline events ordering so entitlement events occur prior to billing events for a specifc subscription and a guven effectiveDate

Note 1: The reordering function is actually not generic enough, but considering our events that should work. Will take a second pass to see if it can be improved.
Note 2: Need to revist algo to detect wriong condition and add warn logging

Tests should pass with that commit.
beatrix: override default tables names for external bus

Make sure that the internal and external buses don't share the same tables names
or some events won't be dispatched to the right listeners.

See discussion https://groups.google.com/forum/#!msg/killbilling-users/x3o1-EjR3V0/ZJ-PJYFM_M0J

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
entitlement: move the add-ons cancellation computation to EventsStream

This gets rid of the BlockingStateDao cycle in EntitlementUtils.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
pom.xml: update killbill-oss-parent to 0.5.6

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Merge remote-tracking branch 'origin/master' into entitlement-bug-fixes