killbill-uncached

Details

diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java
index edd74f3..759d63b 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java
@@ -117,6 +117,7 @@ public class TestIntegration extends TestIntegrationBase {
                 new PlanPhaseSpecifier(productName, ProductCategory.BASE, term, planSetName, null), null, context));
         assertNotNull(baseSubscription);
         assertTrue(busHandler.isCompleted(DELAY));
+        assertListenerStatus();
    
         // MOVE CLOCK A LITTLE BIT-- STILL IN TRIAL
         Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(3));
@@ -128,6 +129,8 @@ public class TestIntegration extends TestIntegrationBase {
         subscriptionDataFromSubscription(entitlementUserApi.createSubscription(bundle.getId(),
                 new PlanPhaseSpecifier("Telescopic-Scope", ProductCategory.ADD_ON, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null), null, context));
         assertTrue(busHandler.isCompleted(DELAY));
+        assertListenerStatus();
+
         
         busHandler.pushExpectedEvent(NextEvent.CREATE);
         busHandler.pushExpectedEvent(NextEvent.INVOICE);
@@ -135,20 +138,46 @@ public class TestIntegration extends TestIntegrationBase {
         SubscriptionData aoSubscription2 = subscriptionDataFromSubscription(entitlementUserApi.createSubscription(bundle.getId(),
                 new PlanPhaseSpecifier("Laser-Scope", ProductCategory.ADD_ON, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null), null, context)); 
         assertTrue(busHandler.isCompleted(DELAY));
-        
+        assertListenerStatus();
 
         // MOVE CLOCK A LITTLE BIT MORE -- EITHER STAY IN TRIAL OR GET OUT   
-        int duration = 35;
-        it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(duration));
-        busHandler.pushExpectedEvent(NextEvent.PHASE);
+        
         busHandler.pushExpectedEvent(NextEvent.PHASE);
-        busHandler.pushExpectedEvent(NextEvent.PHASE);            
+        busHandler.pushExpectedEvent(NextEvent.PHASE);          
         busHandler.pushExpectedEvent(NextEvent.INVOICE);
         busHandler.pushExpectedEvent(NextEvent.PAYMENT);
-        clock.addDeltaFromReality(it.toDurationMillis());
+        busHandler.pushExpectedEvent(NextEvent.INVOICE);
+        busHandler.pushExpectedEvent(NextEvent.PAYMENT);
+        clock.addDays(28);// 26 / 5
+        assertTrue(busHandler.isCompleted(DELAY));
+        assertListenerStatus();
+        
+        
+        busHandler.pushExpectedEvent(NextEvent.PHASE);       
+        busHandler.pushExpectedEvent(NextEvent.INVOICE);
+        busHandler.pushExpectedEvent(NextEvent.PAYMENT);
+        clock.addDays(3);// 29 / 5
+        assertTrue(busHandler.isCompleted(DELAY));
+        assertListenerStatus();
+       
+        
+        clock.addDays(10);// 8 / 6
+        assertTrue(busHandler.isCompleted(DELAY));
+        assertListenerStatus();
+       
+        
+       
+        busHandler.pushExpectedEvent(NextEvent.INVOICE);
+        busHandler.pushExpectedEvent(NextEvent.PAYMENT);
+        clock.addDays(18);// 26 / 6
         assertTrue(busHandler.isCompleted(DELAY));
+        assertListenerStatus();
         
+        clock.addDays(3);
+        assertTrue(busHandler.isCompleted(DELAY));
         assertListenerStatus();
+        
+
     }
    
     @Test(groups = {"slow"})