Details
diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
index ec65082..3d5c66a 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
@@ -102,49 +102,4 @@ public class TestIntegrationWithAutoInvoiceOffTag extends TestIntegrationBase {
assertEquals(invoices.size(), 1);
}
- @Test(groups = "slow")
- public void testAutoInvoiceOffSingleSubscription() throws Exception {
- clock.setTime(new DateTime(2012, 5, 1, 0, 3, 42, 0));
-
- // set next invoice to fail and create network
- final DefaultEntitlement bpEntitlement = createBaseEntitlementAndCheckForCompletion(account.getId(), "externalKey", productName, ProductCategory.BASE, term, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
- assertNotNull(bpEntitlement);
-
- Collection<Invoice> invoices = invoiceApi.getInvoicesByAccount(account.getId(), false, false, callContext);
- assertEquals(invoices.size(), 1); // first invoice is generated immediately after creation can't reliably stop it
-
- add_AUTO_INVOICING_OFF_Tag(bpEntitlement.getSubscriptionBase().getBundleId(), ObjectType.BUNDLE);
-
- busHandler.pushExpectedEvents(NextEvent.PHASE);
- clock.addDays(40); // DAY 40 out of trial
- assertListenerStatus();
-
- invoices = invoiceApi.getInvoicesByAccount(account.getId(), false, false, callContext);
- assertEquals(invoices.size(), 1); //No additional invoices generated
- }
-
- @Test(groups = "slow")
- public void testAutoInvoiceOffMultipleSubscriptions() throws Exception {
- clock.setTime(new DateTime(2012, 5, 1, 0, 3, 42, 0));
-
- // set next invoice to fail and create network
- final DefaultEntitlement bpEntitlement = createBaseEntitlementAndCheckForCompletion(account.getId(), "externalKey", productName, ProductCategory.BASE, term, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
- assertNotNull(bpEntitlement);
-
- final DefaultEntitlement bpEntitlement2 = createBaseEntitlementAndCheckForCompletion(account.getId(), "whatever", productName, ProductCategory.BASE, term, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
- assertNotNull(bpEntitlement2);
-
- Collection<Invoice> invoices = invoiceApi.getInvoicesByAccount(account.getId(), false, false, callContext);
- assertEquals(invoices.size(), 2); // first invoice is generated immediately after creation can't reliably stop it
-
- add_AUTO_INVOICING_OFF_Tag(bpEntitlement.getSubscriptionBase().getBundleId(), ObjectType.BUNDLE);
-
- busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.PHASE, NextEvent.NULL_INVOICE, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
- clock.addDays(40); // DAY 40 out of trial
- assertListenerStatus();
-
- invoices = invoiceApi.getInvoicesByAccount(account.getId(), false, false, callContext);
- assertEquals(invoices.size(), 3); // Only one additional invoice generated
- }
-
}
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestTag.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestTag.java
index d46a568..c72d4c4 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestTag.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestTag.java
@@ -118,8 +118,12 @@ public class TestTag extends TestJaxrsBase {
final Subscription subscriptionJson = createSubscription(account.getAccountId(), "87544332", "Shotgun",
ProductCategory.BASE, BillingPeriod.MONTHLY, true);
+ int nbAllowedControlTagType = 0;
for (final ControlTagType controlTagType : ControlTagType.values()) {
- accountApi.createAccountTags(account.getAccountId(), ImmutableList.<UUID>of(controlTagType.getId()), requestOptions);
+ if (controlTagType.getApplicableObjectTypes().contains(ObjectType.ACCOUNT)) {
+ accountApi.createAccountTags(account.getAccountId(), ImmutableList.<UUID>of(controlTagType.getId()), requestOptions);
+ nbAllowedControlTagType++;
+ }
}
final TagDefinition bundleTagDefInput = new TagDefinition(null, false, "bundletagdef", "nothing special", ImmutableList.<ObjectType>of(ObjectType.TRANSACTION), null);
@@ -131,7 +135,7 @@ public class TestTag extends TestJaxrsBase {
Assert.assertEquals(allBundleTags.size(), 1);
final Tags allAccountTags = accountApi.getAllTags(account.getAccountId(), null, requestOptions);
- Assert.assertEquals(allAccountTags.size(), ControlTagType.values().length + 1);
+ Assert.assertEquals(allAccountTags.size(), nbAllowedControlTagType + 1);
final Tags allBundleTagsForAccount = accountApi.getAllTags(account.getAccountId(), ObjectType.BUNDLE, requestOptions);
Assert.assertEquals(allBundleTagsForAccount.size(), 1);
@@ -140,18 +144,25 @@ public class TestTag extends TestJaxrsBase {
@Test(groups = "slow", description = "Can search system tags")
public void testSystemTagsPagination() throws Exception {
final Account account = createAccount();
+
+ int nbAllowedControlTagType = 0;
for (final ControlTagType controlTagType : ControlTagType.values()) {
- accountApi.createAccountTags(account.getAccountId(), ImmutableList.<UUID>of(controlTagType.getId()), requestOptions);
+ if (controlTagType.getApplicableObjectTypes().contains(ObjectType.ACCOUNT)) {
+ accountApi.createAccountTags(account.getAccountId(), ImmutableList.<UUID>of(controlTagType.getId()), requestOptions);
+ nbAllowedControlTagType++;
+ }
}
final Tags allTags = accountApi.getAccountTags(account.getAccountId(), requestOptions);
- Assert.assertEquals(allTags.size(), ControlTagType.values().length);
+ Assert.assertEquals(allTags.size(), nbAllowedControlTagType);
for (final ControlTagType controlTagType : ControlTagType.values()) {
- Assert.assertEquals(tagApi.searchTags(controlTagType.toString(), requestOptions).size(), 1);
- // TODO Hack until we fix client api
+ if (controlTagType.getApplicableObjectTypes().contains(ObjectType.ACCOUNT)) {
+ Assert.assertEquals(tagApi.searchTags(controlTagType.toString(), requestOptions).size(), 1);
+ // TODO Hack until we fix client api
- Assert.assertEquals(tagApi.searchTags(UTF8UrlEncoder.encodePath(controlTagType.getDescription()), requestOptions).size(), 1);
+ Assert.assertEquals(tagApi.searchTags(UTF8UrlEncoder.encodePath(controlTagType.getDescription()), requestOptions).size(), 1);
+ }
}
}
diff --git a/util/src/test/java/org/killbill/billing/util/tag/api/TestDefaultTagUserApi.java b/util/src/test/java/org/killbill/billing/util/tag/api/TestDefaultTagUserApi.java
index 059101e..3134e51 100644
--- a/util/src/test/java/org/killbill/billing/util/tag/api/TestDefaultTagUserApi.java
+++ b/util/src/test/java/org/killbill/billing/util/tag/api/TestDefaultTagUserApi.java
@@ -62,7 +62,7 @@ public class TestDefaultTagUserApi extends UtilTestSuiteWithEmbeddedDB {
checkPagination(0);
eventsListener.pushExpectedEvent(NextEvent.TAG);
- tagUserApi.addTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.WRITTEN_OFF.getId()), callContext);
+ tagUserApi.addTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.AUTO_INVOICING_OFF.getId()), callContext);
assertListenerStatus();
checkPagination(1);
@@ -70,7 +70,7 @@ public class TestDefaultTagUserApi extends UtilTestSuiteWithEmbeddedDB {
// Verify the tag was saved
final List<Tag> tags = tagUserApi.getTagsForObject(accountId, ObjectType.ACCOUNT, true, callContext);
Assert.assertEquals(tags.size(), 1);
- Assert.assertEquals(tags.get(0).getTagDefinitionId(), ControlTagType.WRITTEN_OFF.getId());
+ Assert.assertEquals(tags.get(0).getTagDefinitionId(), ControlTagType.AUTO_INVOICING_OFF.getId());
Assert.assertEquals(tags.get(0).getObjectId(), accountId);
Assert.assertEquals(tags.get(0).getObjectType(), ObjectType.ACCOUNT);
// Verify the account_record_id was populated
@@ -86,7 +86,7 @@ public class TestDefaultTagUserApi extends UtilTestSuiteWithEmbeddedDB {
});
eventsListener.pushExpectedEvent(NextEvent.TAG);
- tagUserApi.removeTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.WRITTEN_OFF.getId()), callContext);
+ tagUserApi.removeTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.AUTO_INVOICING_OFF.getId()), callContext);
assertListenerStatus();
List<Tag> remainingTags = tagUserApi.getTagsForObject(accountId, ObjectType.ACCOUNT, false, callContext);
@@ -96,7 +96,7 @@ public class TestDefaultTagUserApi extends UtilTestSuiteWithEmbeddedDB {
// Add again the tag
eventsListener.pushExpectedEvent(NextEvent.TAG);
- tagUserApi.addTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.WRITTEN_OFF.getId()), callContext);
+ tagUserApi.addTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.AUTO_INVOICING_OFF.getId()), callContext);
assertListenerStatus();
remainingTags = tagUserApi.getTagsForObject(accountId, ObjectType.ACCOUNT, false, callContext);
@@ -106,7 +106,7 @@ public class TestDefaultTagUserApi extends UtilTestSuiteWithEmbeddedDB {
// Delete again
eventsListener.pushExpectedEvent(NextEvent.TAG);
- tagUserApi.removeTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.WRITTEN_OFF.getId()), callContext);
+ tagUserApi.removeTags(accountId, ObjectType.ACCOUNT, ImmutableList.<UUID>of(ControlTagType.AUTO_INVOICING_OFF.getId()), callContext);
assertListenerStatus();
remainingTags = tagUserApi.getTagsForObject(accountId, ObjectType.ACCOUNT, false, callContext);
diff --git a/util/src/test/java/org/killbill/billing/util/tag/dao/TestDefaultTagDao.java b/util/src/test/java/org/killbill/billing/util/tag/dao/TestDefaultTagDao.java
index 3a23739..2d3f9b6 100644
--- a/util/src/test/java/org/killbill/billing/util/tag/dao/TestDefaultTagDao.java
+++ b/util/src/test/java/org/killbill/billing/util/tag/dao/TestDefaultTagDao.java
@@ -168,7 +168,7 @@ public class TestDefaultTagDao extends UtilTestSuiteWithEmbeddedDB {
@Test(groups = "slow")
public void testInsertMultipleTags() throws TagApiException {
final UUID objectId = UUID.randomUUID();
- final ObjectType objectType = ObjectType.INVOICE_ITEM;
+ final ObjectType objectType = ObjectType.ACCOUNT;
eventsListener.pushExpectedEvent(NextEvent.TAG);
final Tag tag = new DescriptiveTag(ControlTagType.AUTO_INVOICING_OFF.getId(), objectType, objectId, internalCallContext.getCreatedDate());