killbill-aplcache

Details

diff --git a/entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiAddOn.java b/entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiAddOn.java
index 60cddef..505270c 100644
--- a/entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiAddOn.java
+++ b/entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiAddOn.java
@@ -21,6 +21,7 @@ import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
+import org.apache.commons.lang.NotImplementedException;
 import org.joda.time.DateTime;
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -38,6 +39,7 @@ import com.ning.billing.catalog.api.PlanPhase;
 import com.ning.billing.catalog.api.PlanSpecifier;
 import com.ning.billing.catalog.api.PriceListSet;
 import com.ning.billing.catalog.api.ProductCategory;
+import com.ning.billing.catalog.api.TimeUnit;
 import com.ning.billing.entitlement.api.ApiTestListener.NextEvent;
 import com.ning.billing.entitlement.api.TestApiBase;
 import com.ning.billing.entitlement.api.user.Subscription.SubscriptionState;
@@ -281,7 +283,7 @@ public class TestUserApiAddOn extends TestApiBase {
     }
 
     //TODO MDW - debugging reenable if you find this
-    @Test(enabled=false, groups={"slow"})
+    @Test(enabled=true, groups={"slow"})
     public void testAddonCreateWithSubscriptionAlign() {
 
         try {
@@ -353,7 +355,28 @@ public class TestUserApiAddOn extends TestApiBase {
            testListener.pushExpectedEvent(NextEvent.PHASE);
 
            // MOVE THROUGH TIME TO GO INTO EVERGREEN
-           someTimeLater = aoCurrentPhase.getDuration();
+           
+           // Talk with Stephane about this fix. It seemed that the add on phase change was not appearing in the queue
+           // hypothesis is that waiting a period that is exactly the duration of the phase might be an instant too short
+           // depending how the comparison works
+           //someTimeLater = aoCurrentPhase.getDuration();
+           someTimeLater = new Duration() {
+               @Override
+               public TimeUnit getUnit() {
+                   return TimeUnit.DAYS;
+               }
+
+               @Override
+               public int getNumber() {
+                   return 32;
+               }
+
+               @Override
+               public DateTime addToDateTime(DateTime dateTime) {
+                   throw new NotImplementedException();
+               }
+           };
+           
            clock.addDeltaFromReality(someTimeLater);
            assertTrue(testListener.isCompleted(5000));