killbill-aplcache
Changes
beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java 1(+0 -1)
beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationInvoiceWithRepairLogic.java 16(+0 -16)
beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java 15(+7 -8)
Details
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
index df5e508..c2d7df1 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
@@ -698,7 +698,6 @@ public class TestOverdueIntegration extends TestOverdueBase {
addDaysAndCheckForCompletion(5);
busHandler.pushExpectedEvents(NextEvent.INVOICE_ADJUSTMENT);
invoiceUserApi.insertExternalChargeForBundle(account.getId(), bundle.getId(), BigDecimal.TEN, "For overdue", new LocalDate(2012, 5, 6), Currency.USD, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 6), null, InvoiceItemType.EXTERNAL_CHARGE, BigDecimal.TEN));
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java
index b4a1067..6b228f7 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java
@@ -72,7 +72,6 @@ public class TestBundleTransfer extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
clock.addDays(40);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
// BUNDLE TRANSFER
@@ -82,7 +81,6 @@ public class TestBundleTransfer extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
transferApi.transferBundle(account.getId(), newAccount.getId(), "externalKey", clock.getUTCNow(), false, false, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(newAccount.getId(), callContext);
@@ -125,7 +123,6 @@ public class TestBundleTransfer extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
clock.addDays(32);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
// BUNDLE TRANSFER
@@ -135,7 +132,6 @@ public class TestBundleTransfer extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
transferApi.transferBundle(account.getId(), newAccount.getId(), "externalKey", clock.getUTCNow(), false, false, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
// Verify the BCD of the new account
@@ -186,7 +182,6 @@ public class TestBundleTransfer extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
clock.addDays(32);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
// BUNDLE TRANSFER
@@ -198,7 +193,6 @@ public class TestBundleTransfer extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE_ADJUSTMENT);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
transferApi.transferBundle(account.getId(), newAccount.getId(), "externalKey", clock.getUTCNow(), false, true, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestCustomFieldApi.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestCustomFieldApi.java
index a3f4003..398e870 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestCustomFieldApi.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestCustomFieldApi.java
@@ -129,7 +129,7 @@ public class TestCustomFieldApi extends TestIntegrationBase {
List<CustomField> fields = new ArrayList<CustomField>();
fields.add(f);
customFieldApi.addCustomFields(fields, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
}
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 44c41aa..bea25d3 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
@@ -423,7 +423,6 @@ public class TestIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
log.info("Moving clock from" + clock.getUTCNow() + " to " + clock.getUTCNow().plusDays(28));
clock.addDays(28);// 26 / 5
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
busHandler.pushExpectedEvent(NextEvent.PHASE);
@@ -431,24 +430,20 @@ public class TestIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
log.info("Moving clock from" + clock.getUTCNow() + " to " + clock.getUTCNow().plusDays(3));
clock.addDays(3);// 29 / 5
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
log.info("Moving clock from" + clock.getUTCNow() + " to " + clock.getUTCNow().plusDays(10));
clock.addDays(10);// 8 / 6
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
log.info("Moving clock from" + clock.getUTCNow() + " to " + clock.getUTCNow().plusDays(18));
clock.addDays(18);// 26 / 6
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
log.info("Moving clock from" + clock.getUTCNow() + " to " + clock.getUTCNow().plusDays(3));
clock.addDays(3);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
}
@@ -470,7 +465,7 @@ public class TestIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.BLOCK, NextEvent.CANCEL);
baseEntitlement.cancelEntitlementWithPolicy(EntitlementActionPolicy.IMMEDIATE, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
final String newProductName = "Pistol";
final DefaultEntitlement newBaseEntitlement = createBaseEntitlementAndCheckForCompletion(account.getId(), "bundleKey", newProductName, ProductCategory.BASE, term, NextEvent.CREATE, NextEvent.INVOICE);
@@ -528,16 +523,16 @@ public class TestIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
clock.addDeltaFromReality(AT_LEAST_ONE_MONTH_MS);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 3, 2), new LocalDate(2012, 4, 2), InvoiceItemType.RECURRING, new BigDecimal("249.95")));
// PAUSE THE ENTITLEMENT
DefaultEntitlement entitlement = (DefaultEntitlement) entitlementApi.getEntitlementForId(baseEntitlement.getId(), callContext);
- busHandler.pushExpectedEvent(NextEvent.PAUSE);
+ busHandler.pushExpectedEvents(NextEvent.PAUSE, NextEvent.BLOCK);
busHandler.pushExpectedEvent(NextEvent.INVOICE_ADJUSTMENT);
entitlementApi.pause(entitlement.getBundleId(), clock.getUTCNow().toLocalDate(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 2, callContext,
new ExpectedInvoiceItemCheck(new LocalDate(2012, 3, 2), new LocalDate(2012, 4, 2), InvoiceItemType.RECURRING, new BigDecimal("249.95")),
@@ -551,10 +546,10 @@ public class TestIntegration extends TestIntegrationBase {
// MOVE CLOCK FORWARD ADN CHECK THERE IS NO NEW INVOICE
clock.addDeltaFromReality(AT_LEAST_ONE_MONTH_MS);
- busHandler.pushExpectedEvent(NextEvent.RESUME);
+ busHandler.pushExpectedEvents(NextEvent.RESUME, NextEvent.BLOCK);
busHandler.pushExpectedEvent(NextEvent.INVOICE);
entitlementApi.resume(entitlement.getBundleId(), clock.getUTCNow().toLocalDate(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 3, callContext,
@@ -589,7 +584,7 @@ public class TestIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
clock.addDeltaFromReality(AT_LEAST_ONE_MONTH_MS);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(accountId, callContext);
assertNotNull(invoices);
assertEquals(invoices.size(), 2);
@@ -599,14 +594,14 @@ public class TestIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
clock.addDeltaFromReality(AT_LEAST_ONE_MONTH_MS);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
}
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
busHandler.pushExpectedEvent(NextEvent.PHASE);
clock.addDeltaFromReality(AT_LEAST_ONE_MONTH_MS);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(accountId, callContext);
assertNotNull(invoices);
@@ -617,7 +612,7 @@ public class TestIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.INVOICE);
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
clock.addDeltaFromReality(AT_LEAST_ONE_MONTH_MS);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
}
invoices = invoiceUserApi.getInvoicesByAccount(accountId, callContext);
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java
index b2f9dae..3029437 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java
@@ -210,7 +210,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
@Inject
protected IDBI idbi;
- @javax.inject.Inject
+ @Inject
protected CacheControllerDispatcher controlCacheDispatcher;
protected TestApiListener busHandler;
@@ -231,6 +231,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
}
protected void assertListenerStatus() {
+ assertTrue(busHandler.isCompleted(DELAY));
if (isListenerFailed) {
log.error(listenerFailedMsg);
Assert.fail(listenerFailedMsg);
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationInvoiceWithRepairLogic.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationInvoiceWithRepairLogic.java
index f3c8124..d815446 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationInvoiceWithRepairLogic.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationInvoiceWithRepairLogic.java
@@ -98,7 +98,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT);
// Move the clock to 2012-05-02
clock.addDays(31);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -118,7 +117,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE_ADJUSTMENT);
invoiceUserApi.insertInvoiceItemAdjustment(account.getId(), invoices.get(1).getId(), invoices.get(1).getInvoiceItems().get(0).getId(), clock.getUTCToday(),
BigDecimal.TEN, account.getCurrency(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -190,7 +188,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
// Move the clock to 2012-04-04
clock.addDays(3);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
//
@@ -215,7 +212,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT);
// Move the clock to 2012-05-02
clock.addDays(28);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -304,7 +300,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
// Move the clock to 2012-06-08
clock.addMonths(1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -347,7 +342,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
// Move the clock to 2012-07-08
clock.addMonths(1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -417,7 +411,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
// Move out of trials for interesting invoices adjustments
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT);
clock.addDays(30);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -450,7 +443,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addMonths(1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -474,7 +466,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addMonths(1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -531,7 +522,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
// Move out of trials for interesting invoices adjustments
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT);
clock.addDays(40);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -545,7 +535,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
//
changeEntitlementAndCheckForCompletion(bpEntitlement, productName, BillingPeriod.MONTHLY, BillingActionPolicy.IMMEDIATE, NextEvent.CHANGE, NextEvent.INVOICE, NextEvent.INVOICE_ADJUSTMENT);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -569,7 +558,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addMonths(1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -596,7 +584,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addMonths(1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -637,7 +624,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
// Move out of trials for interesting invoices adjustments
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT);
clock.addDays(40);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -659,7 +645,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
iias.put(invoice1.getInvoiceItems().get(0).getId(), new BigDecimal("10.00"));
busHandler.pushExpectedEvents(NextEvent.INVOICE_ADJUSTMENT);
paymentApi.createRefundWithItemsAdjustments(account, payment1.getId(), iias, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
@@ -700,7 +685,6 @@ public class TestIntegrationInvoiceWithRepairLogic extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addMonths(1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
index 1a2a0de..0744c47 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
@@ -74,7 +74,6 @@ public class TestIntegrationWithAutoInvoiceOffTag extends TestIntegrationBase {
@Test(groups = {"slow"}, enabled = true)
public void testAutoInvoiceOffAccount() throws Exception {
clock.setTime(new DateTime(2012, 5, 1, 0, 3, 42, 0));
- busHandler.pushExpectedEvents(NextEvent.TAG);
add_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
// set next invoice to fail and create network
@@ -85,21 +84,21 @@ public class TestIntegrationWithAutoInvoiceOffTag extends TestIntegrationBase {
assertEquals(invoices.size(), 0);
clock.addDays(10); // DAY 10 still in trial
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
assertEquals(invoices.size(), 0);
busHandler.pushExpectedEvents(NextEvent.PHASE);
clock.addDays(30); // DAY 40 out of trial
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
assertEquals(invoices.size(), 0);
busHandler.pushExpectedEvents(NextEvent.TAG, NextEvent.INVOICE, NextEvent.PAYMENT);
remove_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
assertEquals(invoices.size(), 1);
@@ -121,7 +120,7 @@ public class TestIntegrationWithAutoInvoiceOffTag extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.PHASE);
clock.addDays(40); // DAY 40 out of trial
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
assertEquals(invoices.size(), 1); //No additional invoices generated
@@ -147,20 +146,20 @@ public class TestIntegrationWithAutoInvoiceOffTag extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT);
clock.addDays(40); // DAY 40 out of trial
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
assertEquals(invoices.size(), 3); // Only one additional invoice generated
}
-
private void add_AUTO_INVOICING_OFF_Tag(final UUID id, final ObjectType type) throws TagDefinitionApiException, TagApiException {
+ busHandler.pushExpectedEvent(NextEvent.TAG);
tagApi.addTag(id, type, ControlTagType.AUTO_INVOICING_OFF.getId(), callContext);
+ assertListenerStatus();
final List<Tag> tags = tagApi.getTagsForObject(id, type, callContext);
assertEquals(tags.size(), 1);
}
-
private void remove_AUTO_INVOICING_OFF_Tag(final UUID id, final ObjectType type) throws TagDefinitionApiException, TagApiException {
tagApi.removeTag(id, type, ControlTagType.AUTO_INVOICING_OFF.getId(), callContext);
}
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java
index fb11858..b01f4c4 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java
@@ -95,7 +95,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addDays(40); // After trial
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
assertEquals(invoices.size(), 2);
@@ -108,7 +108,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.PAYMENT);
remove_AUTO_PAY_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
addDelayBceauseOfLackOfCorrectSynchro();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
@@ -139,7 +139,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addDays(40); // After trial
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
assertEquals(invoices.size(), 2);
@@ -153,7 +153,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
paymentPlugin.makeNextPaymentFailWithError();
busHandler.pushExpectedEvents(NextEvent.PAYMENT_ERROR);
remove_AUTO_PAY_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
addDelayBceauseOfLackOfCorrectSynchro();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
@@ -171,7 +171,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
// MOVE TIME FOR RETRY TO HAPPEN
busHandler.pushExpectedEvents(NextEvent.PAYMENT);
clock.addDays(nbDaysBeforeRetry + 1);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
for (Invoice cur : invoices) {
@@ -201,7 +201,6 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
busHandler.pushExpectedEvents(NextEvent.PHASE);
busHandler.pushExpectedEvents(NextEvent.INVOICE);
clock.addDays(31); // After trial
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
@@ -217,7 +216,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
paymentPlugin.makeNextPaymentFailWithError();
busHandler.pushExpectedEvents(NextEvent.PAYMENT_ERROR);
remove_AUTO_PAY_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
addDelayBceauseOfLackOfCorrectSynchro();
@@ -237,7 +236,6 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
// MOVE TIME FOR RETRY TO HAPPEN -> WILL BE DISCARDED SINCE AUTO_PAY_OFF IS SET
clock.addDays(nbDaysBeforeRetry + 1);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
@@ -254,13 +252,13 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
// REMOVE AUTO_PAY_OFF -> WILL SCHEDULE A PAYMENT_RETRY
paymentPlugin.clear();
remove_AUTO_PAY_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
addDelayBceauseOfLackOfCorrectSynchro();
//
busHandler.pushExpectedEvents(NextEvent.PAYMENT);
clock.addDays(nbDaysBeforeRetry + 1);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
invoices = invoiceApi.getInvoicesByAccount(account.getId(), callContext);
@@ -279,7 +277,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
private void add_AUTO_PAY_OFF_Tag(final UUID id, final ObjectType type) throws TagDefinitionApiException, TagApiException {
busHandler.pushExpectedEvent(NextEvent.TAG);
tagApi.addTag(id, type, ControlTagType.AUTO_PAY_OFF.getId(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
final List<Tag> tags = tagApi.getTagsForObject(id, type, callContext);
assertEquals(tags.size(), 1);
@@ -288,7 +286,7 @@ public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
private void remove_AUTO_PAY_OFF_Tag(final UUID id, final ObjectType type) throws TagDefinitionApiException, TagApiException {
busHandler.pushExpectedEvent(NextEvent.TAG);
tagApi.removeTag(id, type, ControlTagType.AUTO_PAY_OFF.getId(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
}
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java
index 047e313..8c65150 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java
@@ -97,7 +97,7 @@ public class TestRepairIntegration extends TestIntegrationBase {
}
clock.addDeltaFromReality(it.toDurationMillis());
if (!inTrial) {
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
}
final boolean ifRepair = false;
if (ifRepair) {
@@ -131,7 +131,7 @@ public class TestRepairIntegration extends TestIntegrationBase {
busHandler.pushExpectedEvent(NextEvent.PAYMENT);
busHandler.pushExpectedEvent(NextEvent.REPAIR_BUNDLE);
repairApi.repairBundle(bundleRepair, false, callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
final DefaultSubscriptionBase newAoSubscription = (DefaultSubscriptionBase) aoEntitlement1.getSubscriptionBase();
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestSubscription.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestSubscription.java
index b72e822..e7cca7e 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestSubscription.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestSubscription.java
@@ -42,7 +42,6 @@ import static org.testng.Assert.assertTrue;
public class TestSubscription extends TestIntegrationBase {
-
@Test(groups = "slow")
public void testForcePolicy() throws Exception {
// We take april as it has 30 days (easier to play with BCD)
@@ -69,7 +68,6 @@ public class TestSubscription extends TestIntegrationBase {
// Move out of trials for interesting invoices adjustments
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT);
clock.addDays(40);
- assertTrue(busHandler.isCompleted(DELAY));
assertListenerStatus();
List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), callContext);
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestTagApi.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestTagApi.java
index bd56395..690e132 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestTagApi.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestTagApi.java
@@ -54,11 +54,11 @@ public class TestTagApi extends TestIntegrationBase {
public void testApiTagOnAccount() throws Exception {
busHandler.pushExpectedEvents(NextEvent.TAG);
tagUserApi.addTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.AUTO_INVOICING_OFF.getId(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
busHandler.pushExpectedEvents(NextEvent.TAG);
tagUserApi.addTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.AUTO_PAY_OFF.getId(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
List<Tag> tags = tagUserApi.getTagsForAccount(account.getId(), callContext);
Assert.assertEquals(tags.size(), 2);
@@ -97,18 +97,18 @@ public class TestTagApi extends TestIntegrationBase {
//
busHandler.pushExpectedEvents(NextEvent.TAG_DEFINITION);
final TagDefinition tagDefinition = tagUserApi.createTagDefinition("foo", "foo desc", callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
//
// Add 2 Tags on the invoice (1 control tag and 1 user tag)
//
busHandler.pushExpectedEvents(NextEvent.TAG);
tagUserApi.addTag(invoice.getId(), ObjectType.INVOICE, ControlTagType.WRITTEN_OFF.getId(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
busHandler.pushExpectedEvents(NextEvent.TAG);
tagUserApi.addTag(invoice.getId(), ObjectType.INVOICE, tagDefinition.getId(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
List<Tag> tags = tagUserApi.getTagsForAccount(account.getId(), callContext);
Assert.assertEquals(tags.size(), 2);
@@ -127,7 +127,7 @@ public class TestTagApi extends TestIntegrationBase {
//
busHandler.pushExpectedEvents(NextEvent.TAG);
tagUserApi.addTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.AUTO_PAY_OFF.getId(), callContext);
- assertTrue(busHandler.isCompleted(DELAY));
+ assertListenerStatus();
tags = tagUserApi.getTagsForAccount(account.getId(), callContext);
Assert.assertEquals(tags.size(), 3);