killbill-aplcache

Work on integration test

2/2/2012 4:25:45 PM

Details

diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/inv_ent/TestBasic.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/inv_ent/TestBasic.java
index 9665d8d..9bbc9b9 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/inv_ent/TestBasic.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/inv_ent/TestBasic.java
@@ -170,7 +170,21 @@ public class TestBasic {
     }
 
     @Test(groups = "fast", enabled = true)
-    public void testBasePlanComplete() throws Exception {
+    public void testBasePlanCompleteWithBillingDayInPast() throws Exception {
+        testBasePlanComplete(clock.getUTCNow().minusDays(1).getDayOfMonth());
+    }
+
+    @Test(groups = "fast", enabled = false)
+    public void testBasePlanCompleteWithBillingDayPresent() throws Exception {
+        testBasePlanComplete(clock.getUTCNow().getDayOfMonth());
+    }
+
+    @Test(groups = "fast", enabled = false)
+    public void testBasePlanCompleteWithBillingDayInFuture() throws Exception {
+        testBasePlanComplete(clock.getUTCNow().plusDays(1).getDayOfMonth());
+    }
+
+    private void testBasePlanComplete(int billingDay) throws Exception {
         long DELAY = 5000;
 
         Account account = accountUserApi.createAccount(getAccountData(), null, null);
@@ -190,6 +204,8 @@ public class TestBasic {
         SubscriptionData subscription = (SubscriptionData) entitlementUserApi.createSubscription(bundle.getId(),
                 new PlanPhaseSpecifier(productName, ProductCategory.BASE, term, planSetName, null), null);
         assertNotNull(subscription);
+
+
         assertTrue(busHandler.isCompleted(DELAY));
         log.info("testSimple passed first busHandler checkpoint.");
 
@@ -208,6 +224,9 @@ public class TestBasic {
         String newPlanSetName = PriceListSet.DEFAULT_PRICELIST_NAME;
         String newProductName = "Assault-Rifle";
         subscription.changePlan(newProductName, newTerm, newPlanSetName, clock.getUTCNow());
+
+        Thread.sleep(600000);
+
         assertTrue(busHandler.isCompleted(DELAY));
         log.info("testSimple passed second busHandler checkpoint.");
 
diff --git a/beatrix/src/test/resources/catalogSample.xml b/beatrix/src/test/resources/catalogSample.xml
index 966ebf1..8c91a71 100644
--- a/beatrix/src/test/resources/catalogSample.xml
+++ b/beatrix/src/test/resources/catalogSample.xml
@@ -231,7 +231,11 @@ Use Cases to do:
 						<number>30</number>
 					</duration>
 					<billingPeriod>NO_BILLING_PERIOD</billingPeriod>
-					<fixedPrice></fixedPrice>
+					<fixedPrice>
+                                          <price><currency>GBP</currency><value>29.95</value></price>
+                                          <price><currency>EUR</currency><value>29.95</value></price>
+                                          <price><currency>USD</currency><value>1.95</value></price>
+                                        </fixedPrice>
 				    <!-- no price implies $0 -->
 				</phase>
 			</initialPhases>
@@ -258,6 +262,9 @@ Use Cases to do:
 					</duration>
 					<billingPeriod>NO_BILLING_PERIOD</billingPeriod>
 					<fixedPrice>
+                                          <price><currency>GBP</currency><value>29.95</value></price>
+                                          <price><currency>EUR</currency><value>29.95</value></price>
+                                          <price><currency>USD</currency><value>2.95</value></price>
 					</fixedPrice>
 				</phase>
 			</initialPhases>