killbill-memoizeit
Changes
account/pom.xml 2(+1 -1)
analytics/pom.xml 2(+1 -1)
api/pom.xml 2(+1 -1)
beatrix/pom.xml 2(+1 -1)
catalog/pom.xml 2(+1 -1)
entitlement/pom.xml 2(+1 -1)
entitlement/src/main/java/com/ning/billing/entitlement/api/migration/DefaultEntitlementMigrationApi.java 11(+8 -3)
entitlement/src/main/java/com/ning/billing/entitlement/api/transfer/DefaultEntitlementTransferApi.java 5(+5 -0)
invoice/pom.xml 2(+1 -1)
jaxrs/pom.xml 2(+1 -1)
junction/pom.xml 2(+1 -1)
overdue/pom.xml 2(+1 -1)
overdue/src/main/java/com/ning/billing/overdue/calculator/BillingStateCalculatorBundle.java 19(+16 -3)
payment/pom.xml 2(+1 -1)
pom.xml 2(+1 -1)
server/pom.xml 16(+14 -2)
tenant/pom.xml 2(+1 -1)
usage/pom.xml 2(+1 -1)
util/pom.xml 2(+1 -1)
Details
account/pom.xml 2(+1 -1)
diff --git a/account/pom.xml b/account/pom.xml
index 7707797..8a9d801 100644
--- a/account/pom.xml
+++ b/account/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-account</artifactId>
analytics/pom.xml 2(+1 -1)
diff --git a/analytics/pom.xml b/analytics/pom.xml
index 8c8fb50..a889014 100644
--- a/analytics/pom.xml
+++ b/analytics/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-analytics</artifactId>
diff --git a/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java b/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
index b0e1e1d..6ceacf9 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
@@ -42,18 +42,24 @@ import com.ning.billing.util.events.UserTagCreationInternalEvent;
import com.ning.billing.util.events.UserTagDefinitionCreationInternalEvent;
import com.ning.billing.util.events.UserTagDefinitionDeletionInternalEvent;
import com.ning.billing.util.events.UserTagDeletionInternalEvent;
+import com.ning.billing.util.globallocker.GlobalLock;
+import com.ning.billing.util.globallocker.GlobalLocker;
+import com.ning.billing.util.globallocker.GlobalLocker.LockerType;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Inject;
public class AnalyticsListener {
+ private static final int NB_LOCK_TRY = 5;
+
private final BusinessSubscriptionTransitionDao bstDao;
private final BusinessAccountDao bacDao;
private final BusinessInvoiceDao invoiceDao;
private final BusinessOverdueStatusDao bosDao;
private final BusinessInvoicePaymentDao bipDao;
private final BusinessTagDao tagDao;
+ private final GlobalLocker locker;
private final InternalCallContextFactory internalCallContextFactory;
@Inject
@@ -63,6 +69,7 @@ public class AnalyticsListener {
final BusinessOverdueStatusDao bosDao,
final BusinessInvoicePaymentDao bipDao,
final BusinessTagDao tagDao,
+ final GlobalLocker locker,
final InternalCallContextFactory internalCallContextFactory) {
this.bstDao = bstDao;
this.bacDao = bacDao;
@@ -70,6 +77,8 @@ public class AnalyticsListener {
this.bosDao = bosDao;
this.bipDao = bipDao;
this.tagDao = tagDao;
+ // TODO: use accountRecordId when switching to internal events and acquire the lock for all refreshes
+ this.locker = locker;
this.internalCallContextFactory = internalCallContextFactory;
}
@@ -93,7 +102,15 @@ public class AnalyticsListener {
@Subscribe
public void handleAccountCreation(final AccountCreationInternalEvent event) {
- bacDao.accountUpdated(event.getId(), createCallContext(event));
+ GlobalLock lock = null;
+ try {
+ lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_ANALYTICS, event.getId().toString(), NB_LOCK_TRY);
+ bacDao.accountUpdated(event.getId(), createCallContext(event));
+ } finally {
+ if (lock != null) {
+ lock.release();
+ }
+ }
}
@Subscribe
@@ -102,7 +119,15 @@ public class AnalyticsListener {
return;
}
- bacDao.accountUpdated(event.getAccountId(), createCallContext(event));
+ GlobalLock lock = null;
+ try {
+ lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_ANALYTICS, event.getAccountId().toString(), NB_LOCK_TRY);
+ bacDao.accountUpdated(event.getAccountId(), createCallContext(event));
+ } finally {
+ if (lock != null) {
+ lock.release();
+ }
+ }
}
@Subscribe
diff --git a/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountDao.java b/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountDao.java
index 56fb66e..2977ace 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/BusinessAccountDao.java
@@ -86,6 +86,7 @@ public class BusinessAccountDao {
public void updateAccountInTransaction(final BusinessAccount bac, final BusinessAccountSqlDao transactional, final InternalCallContext context) {
log.info("ACCOUNT UPDATE " + bac);
transactional.deleteAccount(bac.getAccountId().toString(), context);
+ // Note! There is a window of doom here since we use read committed transactional level by default
transactional.createAccount(bac, context);
}
diff --git a/analytics/src/main/java/com/ning/billing/analytics/BusinessSubscriptionTransitionDao.java b/analytics/src/main/java/com/ning/billing/analytics/BusinessSubscriptionTransitionDao.java
index 05581aa..5afe9a9 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/BusinessSubscriptionTransitionDao.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/BusinessSubscriptionTransitionDao.java
@@ -134,7 +134,9 @@ public class BusinessSubscriptionTransitionDao {
bundle.getAccountId(),
account.getExternalKey(),
subscription.getId(),
- event.getRequestedTransitionTime(),
+ // Note! The system cancel event requested time is the effective time when the subscription
+ // is cancelled, which is the effective time of the cancel event
+ event.getEffectiveTransitionTime(),
new BusinessSubscriptionEvent(BusinessSubscriptionEvent.EventType.SYSTEM_CANCEL, businessEvent.getCategory()),
prevSubscription,
nextSubscription
diff --git a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessSubscription.java b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessSubscription.java
index 18d85cc..91e4023 100644
--- a/analytics/src/main/java/com/ning/billing/analytics/model/BusinessSubscription.java
+++ b/analytics/src/main/java/com/ning/billing/analytics/model/BusinessSubscription.java
@@ -24,15 +24,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ning.billing.analytics.utils.Rounder;
+import com.ning.billing.catalog.api.BillingPeriod;
import com.ning.billing.catalog.api.Catalog;
import com.ning.billing.catalog.api.CatalogApiException;
import com.ning.billing.catalog.api.Currency;
-import com.ning.billing.catalog.api.Duration;
import com.ning.billing.catalog.api.Plan;
import com.ning.billing.catalog.api.PlanPhase;
import com.ning.billing.catalog.api.Product;
import com.ning.billing.catalog.api.ProductCategory;
-import com.ning.billing.catalog.api.TimeUnit;
import com.ning.billing.entitlement.api.user.Subscription;
import static com.ning.billing.entitlement.api.user.Subscription.SubscriptionState;
@@ -44,8 +43,6 @@ public class BusinessSubscription {
private static final Logger log = LoggerFactory.getLogger(BusinessSubscription.class);
- private static final BigDecimal DAYS_IN_MONTH = BigDecimal.valueOf(30);
- private static final BigDecimal MONTHS_IN_YEAR = BigDecimal.valueOf(12);
private static final Currency USD = Currency.valueOf("USD");
private final String productName;
@@ -145,7 +142,7 @@ public class BusinessSubscription {
tmpPrice = new BigDecimal(0);
}
price = tmpPrice;
- mrr = getMrrFromISubscription(thePhase.getDuration(), price);
+ mrr = getMrrFromBillingPeriod(thePhase.getBillingPeriod(), price);
} else {
price = BigDecimal.ZERO;
mrr = BigDecimal.ZERO;
@@ -210,7 +207,7 @@ public class BusinessSubscription {
tmpPrice = new BigDecimal(0);
}
price = tmpPrice;
- mrr = getMrrFromISubscription(currentPhase.getDuration(), price);
+ mrr = getMrrFromBillingPeriod(currentPhase.getBillingPeriod(), price);
} else {
price = BigDecimal.ZERO;
mrr = BigDecimal.ZERO;
@@ -289,23 +286,12 @@ public class BusinessSubscription {
return state;
}
- static BigDecimal getMrrFromISubscription(final Duration duration, final BigDecimal price) {
- if (duration == null || duration.getUnit() == null || duration.getNumber() == 0) {
+ static BigDecimal getMrrFromBillingPeriod(final BillingPeriod period, final BigDecimal price) {
+ if (period == null || period.getNumberOfMonths() == 0) {
return BigDecimal.ZERO;
}
- if (duration.getUnit().equals(TimeUnit.UNLIMITED)) {
- return BigDecimal.ZERO;
- } else if (duration.getUnit().equals(TimeUnit.DAYS)) {
- return price.multiply(DAYS_IN_MONTH).multiply(BigDecimal.valueOf(duration.getNumber()));
- } else if (duration.getUnit().equals(TimeUnit.MONTHS)) {
- return price.divide(BigDecimal.valueOf(duration.getNumber()), Rounder.SCALE, BigDecimal.ROUND_HALF_UP);
- } else if (duration.getUnit().equals(TimeUnit.YEARS)) {
- return price.divide(BigDecimal.valueOf(duration.getNumber()), Rounder.SCALE, RoundingMode.HALF_UP).divide(MONTHS_IN_YEAR, Rounder.SCALE, RoundingMode.HALF_UP);
- } else {
- log.error("Unknown duration [" + duration + "], can't compute mrr");
- return null;
- }
+ return price.divide(BigDecimal.valueOf(period.getNumberOfMonths()), Rounder.SCALE, RoundingMode.HALF_UP);
}
@Override
diff --git a/analytics/src/test/java/com/ning/billing/analytics/MockDuration.java b/analytics/src/test/java/com/ning/billing/analytics/MockDuration.java
index 6810e0e..2167156 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/MockDuration.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/MockDuration.java
@@ -23,53 +23,6 @@ import com.ning.billing.catalog.api.Duration;
import com.ning.billing.catalog.api.TimeUnit;
public class MockDuration {
- public static Duration MONHTLY() {
- return new Duration() {
- @Override
- public TimeUnit getUnit() {
- return TimeUnit.MONTHS;
- }
-
- @Override
- public int getNumber() {
- return 1;
- }
-
- @Override
- public DateTime addToDateTime(final DateTime dateTime) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Period toJodaPeriod() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- public static Duration YEARLY() {
- return new Duration() {
- @Override
- public TimeUnit getUnit() {
- return TimeUnit.YEARS;
- }
-
- @Override
- public int getNumber() {
- return 1;
- }
-
- @Override
- public DateTime addToDateTime(final DateTime dateTime) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Period toJodaPeriod() {
- throw new UnsupportedOperationException();
- }
- };
- }
public static Duration UNLIMITED() {
return new Duration() {
diff --git a/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessSubscription.java b/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessSubscription.java
index 7a2cbd7..604d511 100644
--- a/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessSubscription.java
+++ b/analytics/src/test/java/com/ning/billing/analytics/model/TestBusinessSubscription.java
@@ -28,9 +28,9 @@ import com.ning.billing.analytics.AnalyticsTestSuite;
import com.ning.billing.analytics.MockDuration;
import com.ning.billing.analytics.MockPhase;
import com.ning.billing.analytics.MockProduct;
+import com.ning.billing.catalog.api.BillingPeriod;
import com.ning.billing.catalog.api.Catalog;
import com.ning.billing.catalog.api.CatalogService;
-import com.ning.billing.catalog.api.Duration;
import com.ning.billing.catalog.api.PhaseType;
import com.ning.billing.catalog.api.Plan;
import com.ning.billing.catalog.api.PlanPhase;
@@ -43,19 +43,71 @@ import com.ning.billing.mock.MockSubscription;
import static com.ning.billing.catalog.api.Currency.USD;
public class TestBusinessSubscription extends AnalyticsTestSuite {
- private final Duration MONTHLY = MockDuration.MONHTLY();
- private final Duration YEARLY = MockDuration.YEARLY();
+
final Object[][] catalogMapping = {
- {MONTHLY, 229.0000, 229.0000},
- {MONTHLY, 19.9500, 19.9500},
- {MONTHLY, 14.9500, 14.9500},
- {MONTHLY, 12.9500, 12.9500},
- {YEARLY, 19.9500, 1.6625},
- {YEARLY, 399.0000, 33.2500},
- {YEARLY, 29.9500, 2.4958},
- {YEARLY, 59.0000, 4.9167},
- {YEARLY, 18.2900, 1.5242},
- {YEARLY, 49.0000, 4.0833}};
+ {BillingPeriod.NO_BILLING_PERIOD, 369.9500, 0.0000},
+ {BillingPeriod.NO_BILLING_PERIOD, 429.9500, 0.0000},
+ {BillingPeriod.NO_BILLING_PERIOD, 999.9500, 0.0000},
+ {BillingPeriod.NO_BILLING_PERIOD, 2300.0000, 0.0000},
+ {BillingPeriod.MONTHLY, 2.9500, 2.9500},
+ {BillingPeriod.MONTHLY, 3.9500, 3.9500},
+ {BillingPeriod.MONTHLY, 6.9500, 6.9500},
+ {BillingPeriod.MONTHLY, 7.0000, 7.0000},
+ {BillingPeriod.MONTHLY, 7.9500, 7.9500},
+ {BillingPeriod.MONTHLY, 9.0000, 9.0000},
+ {BillingPeriod.MONTHLY, 9.9500, 9.9500},
+ {BillingPeriod.MONTHLY, 11.9500, 11.9500},
+ {BillingPeriod.MONTHLY, 12.4500, 12.4500},
+ {BillingPeriod.MONTHLY, 12.9500, 12.9500},
+ {BillingPeriod.MONTHLY, 14.9500, 14.9500},
+ {BillingPeriod.MONTHLY, 15.0000, 15.0000},
+ {BillingPeriod.MONTHLY, 16.9500, 16.9500},
+ {BillingPeriod.MONTHLY, 19.0000, 19.0000},
+ {BillingPeriod.MONTHLY, 19.9500, 19.9500},
+ {BillingPeriod.MONTHLY, 24.9500, 24.9500},
+ {BillingPeriod.MONTHLY, 29.0000, 29.0000},
+ {BillingPeriod.MONTHLY, 29.9500, 29.9500},
+ {BillingPeriod.MONTHLY, 31.0000, 31.0000},
+ {BillingPeriod.MONTHLY, 34.9500, 34.9500},
+ {BillingPeriod.MONTHLY, 39.0000, 39.0000},
+ {BillingPeriod.MONTHLY, 39.9500, 39.9500},
+ {BillingPeriod.MONTHLY, 49.0000, 49.0000},
+ {BillingPeriod.MONTHLY, 49.9500, 49.9500},
+ {BillingPeriod.MONTHLY, 59.9500, 59.9500},
+ {BillingPeriod.MONTHLY, 79.0000, 79.0000},
+ {BillingPeriod.MONTHLY, 99.0000, 99.0000},
+ {BillingPeriod.MONTHLY, 139.0000, 139.0000},
+ {BillingPeriod.MONTHLY, 209.0000, 209.0000},
+ {BillingPeriod.MONTHLY, 229.0000, 229.0000},
+ {BillingPeriod.MONTHLY, 274.5000, 274.5000},
+ {BillingPeriod.MONTHLY, 549.0000, 549.0000},
+ {BillingPeriod.ANNUAL, 18.2900, 1.5242},
+ {BillingPeriod.ANNUAL, 19.9500, 1.6625},
+ {BillingPeriod.ANNUAL, 29.9500, 2.4958},
+ {BillingPeriod.ANNUAL, 49.0000, 4.0833},
+ {BillingPeriod.ANNUAL, 59.0000, 4.9167},
+ {BillingPeriod.ANNUAL, 149.9500, 12.4958},
+ {BillingPeriod.ANNUAL, 159.9500, 13.3292},
+ {BillingPeriod.ANNUAL, 169.9500, 14.1625},
+ {BillingPeriod.ANNUAL, 183.2900, 15.2742},
+ {BillingPeriod.ANNUAL, 199.9500, 16.6625},
+ {BillingPeriod.ANNUAL, 219.9500, 18.3292},
+ {BillingPeriod.ANNUAL, 239.9000, 19.9917},
+ {BillingPeriod.ANNUAL, 249.9500, 20.8292},
+ {BillingPeriod.ANNUAL, 319.0000, 26.5833},
+ {BillingPeriod.ANNUAL, 349.9500, 29.1625},
+ {BillingPeriod.ANNUAL, 399.0000, 33.2500},
+ {BillingPeriod.ANNUAL, 399.9500, 33.3292},
+ {BillingPeriod.ANNUAL, 458.2900, 38.1908},
+ {BillingPeriod.ANNUAL, 499.9500, 41.6625},
+ {BillingPeriod.ANNUAL, 549.9500, 45.8292},
+ {BillingPeriod.ANNUAL, 599.9000, 49.9917},
+ {BillingPeriod.ANNUAL, 599.9500, 49.9958},
+ {BillingPeriod.ANNUAL, 624.9500, 52.0792},
+ {BillingPeriod.ANNUAL, 799.0000, 66.5833},
+ {BillingPeriod.ANNUAL, 999.0000, 83.2500},
+ {BillingPeriod.ANNUAL, 2299.0000, 191.5833},
+ {BillingPeriod.ANNUAL, 5499.0000, 458.2500}};
private Product product;
private Plan plan;
@@ -85,11 +137,11 @@ public class TestBusinessSubscription extends AnalyticsTestSuite {
public void testMrrComputation() throws Exception {
int i = 0;
for (final Object[] object : catalogMapping) {
- final Duration duration = (Duration) object[0];
+ final BillingPeriod billingPeriod = (BillingPeriod) object[0];
final double price = (Double) object[1];
final double expectedMrr = (Double) object[2];
- final BigDecimal computedMrr = BusinessSubscription.getMrrFromISubscription(duration, BigDecimal.valueOf(price));
+ final BigDecimal computedMrr = BusinessSubscription.getMrrFromBillingPeriod(billingPeriod, BigDecimal.valueOf(price));
Assert.assertEquals(computedMrr.doubleValue(), expectedMrr, "Invalid mrr for product #" + i);
i++;
}
api/pom.xml 2(+1 -1)
diff --git a/api/pom.xml b/api/pom.xml
index 823c5ce..d59dfe3 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-api</artifactId>
diff --git a/api/src/main/java/com/ning/billing/ErrorCode.java b/api/src/main/java/com/ning/billing/ErrorCode.java
index 1489181..b62ab79 100644
--- a/api/src/main/java/com/ning/billing/ErrorCode.java
+++ b/api/src/main/java/com/ning/billing/ErrorCode.java
@@ -60,7 +60,7 @@ public enum ErrorCode {
ENT_GET_INVALID_BUNDLE_ID(1081, "Could not find a bundle matching id %s"),
ENT_INVALID_SUBSCRIPTION_ID(1082, "Unknown subscription %s"),
ENT_GET_INVALID_BUNDLE_KEY(1083, "Could not find a bundle matching key %s"),
- ENT_GET_NO_SUCH_BASE_SUBSCRIPTION(1084, "Could not base subscription for bundle %s"),
+ ENT_GET_NO_SUCH_BASE_SUBSCRIPTION(1084, "Could not find base subscription for bundle %s"),
/* Repair */
ENT_REPAIR_INVALID_DELETE_SET(1091, "Event %s is not deleted for subscription %s but prior events were"),
@@ -82,6 +82,9 @@ public enum ErrorCode {
ENT_BUNDLE_IS_OVERDUE_BLOCKED(1090, "Changes to this bundle are blocked by overdue enforcement (%s : %s)"),
ENT_ACCOUNT_IS_OVERDUE_BLOCKED(1091, "Changes to this account are blocked by overdue enforcement (%s)"),
+ /* Transfer */
+ ENT_TRANSFER_INVALID_EFF_DATE(1106, "Invalid effective date for transfer: %s"),
+
/*
*
* Range 2000 : CATALOG
beatrix/pom.xml 2(+1 -1)
diff --git a/beatrix/pom.xml b/beatrix/pom.xml
index 96279f1..1ee374b 100644
--- a/beatrix/pom.xml
+++ b/beatrix/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-beatrix</artifactId>
catalog/pom.xml 2(+1 -1)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index ddd3cb5..759b78c 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-catalog</artifactId>
entitlement/pom.xml 2(+1 -1)
diff --git a/entitlement/pom.xml b/entitlement/pom.xml
index 4faa99e..c9dd572 100644
--- a/entitlement/pom.xml
+++ b/entitlement/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-entitlement</artifactId>
diff --git a/entitlement/src/main/java/com/ning/billing/entitlement/api/migration/DefaultEntitlementMigrationApi.java b/entitlement/src/main/java/com/ning/billing/entitlement/api/migration/DefaultEntitlementMigrationApi.java
index f08e351..e836d59 100644
--- a/entitlement/src/main/java/com/ning/billing/entitlement/api/migration/DefaultEntitlementMigrationApi.java
+++ b/entitlement/src/main/java/com/ning/billing/entitlement/api/migration/DefaultEntitlementMigrationApi.java
@@ -170,10 +170,13 @@ public class DefaultEntitlementMigrationApi implements EntitlementMigrationApi {
private List<EntitlementEvent> toEvents(final SubscriptionData subscriptionData, final DateTime now, final DateTime ctd, final TimedMigration[] migrationEvents, final CallContext context) {
ApiEventMigrateEntitlement creationEvent = null;
final List<EntitlementEvent> events = new ArrayList<EntitlementEvent>(migrationEvents.length);
- DateTime subsciptionCancelledDate = null;
+
+ // The first event date after the MIGRATE_ENTITLEMENT event
+ DateTime nextEventDate = null;
for (final TimedMigration cur : migrationEvents) {
if (cur.getEventType() == EventType.PHASE) {
+ nextEventDate = nextEventDate != null && nextEventDate.compareTo(cur.getEventTime()) < 0 ? nextEventDate : cur.getEventTime();
final PhaseEvent nextPhaseEvent = PhaseEventData.createNextPhaseEvent(cur.getPhase().getName(), subscriptionData, now, cur.getEventTime());
events.add(nextPhaseEvent);
@@ -198,10 +201,11 @@ public class DefaultEntitlementMigrationApi implements EntitlementMigrationApi {
break;
case CHANGE:
+ nextEventDate = nextEventDate != null && nextEventDate.compareTo(cur.getEventTime()) < 0 ? nextEventDate : cur.getEventTime();
events.add(new ApiEventChange(builder));
break;
case CANCEL:
- subsciptionCancelledDate = cur.getEventTime();
+ nextEventDate = nextEventDate != null && nextEventDate.compareTo(cur.getEventTime()) < 0 ? nextEventDate : cur.getEventTime();
events.add(new ApiEventCancel(builder));
break;
default:
@@ -214,7 +218,8 @@ public class DefaultEntitlementMigrationApi implements EntitlementMigrationApi {
if (creationEvent == null || ctd == null) {
throw new EntitlementError(String.format("Could not create migration billing event ctd = %s", ctd));
}
- if (subsciptionCancelledDate == null || subsciptionCancelledDate.isAfter(ctd)) {
+ // Only add the MIGRATE_BILLING event if there is no event prior to that that will trigger the first invoice.
+ if (nextEventDate == null || nextEventDate.isAfter(ctd)) {
events.add(new ApiEventMigrateBilling(creationEvent, ctd));
}
Collections.sort(events, new Comparator<EntitlementEvent>() {
diff --git a/entitlement/src/main/java/com/ning/billing/entitlement/api/transfer/DefaultEntitlementTransferApi.java b/entitlement/src/main/java/com/ning/billing/entitlement/api/transfer/DefaultEntitlementTransferApi.java
index a2da70a..4a6a2b1 100644
--- a/entitlement/src/main/java/com/ning/billing/entitlement/api/transfer/DefaultEntitlementTransferApi.java
+++ b/entitlement/src/main/java/com/ning/billing/entitlement/api/transfer/DefaultEntitlementTransferApi.java
@@ -187,6 +187,11 @@ public class DefaultEntitlementTransferApi implements EntitlementTransferApi {
try {
final DateTime effectiveTransferDate = transferDate == null ? clock.getUTCNow() : transferDate;
+ if (effectiveTransferDate.isAfter(clock.getUTCNow())) {
+ // The transfer event for the migrated bundle will be the first one, which cannot be in the future
+ // (entitlement always expects the first event to be in the past)
+ throw new EntitlementTransferApiException(ErrorCode.ENT_TRANSFER_INVALID_EFF_DATE, effectiveTransferDate);
+ }
final SubscriptionBundle bundle = dao.getSubscriptionBundleFromAccountAndKey(sourceAccountId, bundleKey, internalCallContext);
if (bundle == null) {
diff --git a/entitlement/src/test/java/com/ning/billing/entitlement/api/migration/TestMigration.java b/entitlement/src/test/java/com/ning/billing/entitlement/api/migration/TestMigration.java
index ccdc80a..aefdfbe 100644
--- a/entitlement/src/test/java/com/ning/billing/entitlement/api/migration/TestMigration.java
+++ b/entitlement/src/test/java/com/ning/billing/entitlement/api/migration/TestMigration.java
@@ -192,7 +192,6 @@ public abstract class TestMigration extends TestApiBase {
assertEquals(subscription.getCurrentPlan().getName(), "assault-rifle-monthly");
assertEquals(subscription.getChargedThroughDate(), trialDate.plusDays(30));
- testListener.pushExpectedEvent(NextEvent.MIGRATE_BILLING);
testListener.pushExpectedEvent(NextEvent.PHASE);
final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(30));
invoice/pom.xml 2(+1 -1)
diff --git a/invoice/pom.xml b/invoice/pom.xml
index b292f95..c351e93 100644
--- a/invoice/pom.xml
+++ b/invoice/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-invoice</artifactId>
diff --git a/invoice/src/main/java/com/ning/billing/invoice/InvoiceDispatcher.java b/invoice/src/main/java/com/ning/billing/invoice/InvoiceDispatcher.java
index d9f2afd..4c8ba26 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/InvoiceDispatcher.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/InvoiceDispatcher.java
@@ -132,7 +132,7 @@ public class InvoiceDispatcher {
final boolean dryRun, final CallContext context) throws InvoiceApiException {
GlobalLock lock = null;
try {
- lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT, accountId.toString(), NB_LOCK_TRY);
+ lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, accountId.toString(), NB_LOCK_TRY);
return processAccountWithLock(accountId, targetDate, dryRun, context);
} catch (LockFailedException e) {
jaxrs/pom.xml 2(+1 -1)
diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml
index 0763efe..da5edbc 100644
--- a/jaxrs/pom.xml
+++ b/jaxrs/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-jaxrs</artifactId>
junction/pom.xml 2(+1 -1)
diff --git a/junction/pom.xml b/junction/pom.xml
index 07c4ad3..8a3f1a2 100644
--- a/junction/pom.xml
+++ b/junction/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-junction</artifactId>
overdue/pom.xml 2(+1 -1)
diff --git a/overdue/pom.xml b/overdue/pom.xml
index 2bed6f1..7c3fc23 100644
--- a/overdue/pom.xml
+++ b/overdue/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-overdue</artifactId>
diff --git a/overdue/src/main/java/com/ning/billing/overdue/calculator/BillingStateCalculatorBundle.java b/overdue/src/main/java/com/ning/billing/overdue/calculator/BillingStateCalculatorBundle.java
index 4934889..226ef40 100644
--- a/overdue/src/main/java/com/ning/billing/overdue/calculator/BillingStateCalculatorBundle.java
+++ b/overdue/src/main/java/com/ning/billing/overdue/calculator/BillingStateCalculatorBundle.java
@@ -24,6 +24,7 @@ import java.util.UUID;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalDate;
+import com.ning.billing.ErrorCode;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
import com.ning.billing.catalog.api.BillingPeriod;
@@ -60,13 +61,14 @@ public class BillingStateCalculatorBundle extends BillingStateCalculator<Subscri
this.accountApi = accountApi;
}
+
@Override
public BillingStateBundle calculateBillingState(final SubscriptionBundle bundle, final InternalTenantContext context) throws OverdueException {
try {
final Account account = accountApi.getAccountById(bundle.getAccountId(), context);
final SortedSet<Invoice> unpaidInvoices = unpaidInvoicesForBundle(bundle.getId(), bundle.getAccountId(), account.getTimeZone(), context);
- final Subscription basePlan = entitlementApi.getBaseSubscription(bundle.getId(), context);
+ final Subscription basePlan = getBasePlanIfExist(bundle.getId(), context);
final UUID id = bundle.getId();
final int numberOfUnpaidInvoices = unpaidInvoices.size();
@@ -131,6 +133,19 @@ public class BillingStateCalculatorBundle extends BillingStateCalculator<Subscri
return result;
}
+ private Subscription getBasePlanIfExist(UUID bundleId, final InternalTenantContext context) throws EntitlementUserApiException {
+ try {
+ final Subscription basePlan = entitlementApi.getBaseSubscription(bundleId, context);
+ return basePlan;
+ } catch (EntitlementUserApiException e) {
+ if (e.getCode() == ErrorCode.ENT_GET_NO_SUCH_BASE_SUBSCRIPTION.getCode()) {
+ // No base plan probably a STANDALONE subscription in a bundle
+ return null;
+ }
+ throw e;
+ }
+ }
+
private boolean invoiceHasAnItemFromBundle(final Invoice invoice, final UUID bundleId) {
for (final InvoiceItem item : invoice.getInvoiceItems()) {
if (item.getBundleId() != null && item.getBundleId().equals(bundleId)) {
@@ -139,6 +154,4 @@ public class BillingStateCalculatorBundle extends BillingStateCalculator<Subscri
}
return false;
}
-
-
}
payment/pom.xml 2(+1 -1)
diff --git a/payment/pom.xml b/payment/pom.xml
index fb4f99d..c7f1054 100644
--- a/payment/pom.xml
+++ b/payment/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-payment</artifactId>
diff --git a/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
index a816b3b..78a8742 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
@@ -129,42 +129,42 @@ public class PaymentMethodProcessor extends ProcessorBase {
public List<PaymentMethod> refreshPaymentMethods(final String pluginName, final Account account, final InternalCallContext context)
throws PaymentApiException {
+ // Don't hold the account lock while fetching the payment methods
+ final PaymentPluginApi pluginApi = pluginRegistry.getPlugin(pluginName);
+ final List<PaymentMethodPlugin> pluginPms;
+ try {
+ pluginPms = pluginApi.getPaymentMethodDetails(account.getExternalKey(), context.toCallContext());
+ // The method should never return null by convention, but let's not trust the plugin...
+ if (pluginPms == null) {
+ return ImmutableList.<PaymentMethod>of();
+ }
+ } catch (PaymentPluginApiException e) {
+ // STEPH all errors should also take a pluginName
+ throw new PaymentApiException(ErrorCode.PAYMENT_REFRESH_PAYMENT_METHOD, account.getId(), e.getErrorMessage());
+ }
return new WithAccountLock<List<PaymentMethod>>().processAccountWithLock(locker, account.getExternalKey(), new WithAccountLockCallback<List<PaymentMethod>>() {
@Override
public List<PaymentMethod> doOperation() throws PaymentApiException {
- final PaymentPluginApi pluginApi;
- try {
- pluginApi = pluginRegistry.getPlugin(pluginName);
- final List<PaymentMethodPlugin> pluginPms = pluginApi.getPaymentMethodDetails(account.getExternalKey(), context.toCallContext());
- // The method should never return null by convention, but let's not trust the plugin...
- if (pluginPms == null) {
- return ImmutableList.<PaymentMethod>of();
- }
+ final List<PaymentMethodModelDao> finalPaymentMethods = new ArrayList<PaymentMethodModelDao>();
+ for (final PaymentMethodPlugin cur : pluginPms) {
+ final PaymentMethod input = new DefaultPaymentMethod(account.getId(), pluginName, cur);
+ final PaymentMethodModelDao pmModel = new PaymentMethodModelDao(input.getId(), input.getCreatedDate(), input.getUpdatedDate(),
+ input.getAccountId(), input.getPluginName(), input.isActive(),
+ input.getPluginDetail().getExternalPaymentMethodId());
+ finalPaymentMethods.add(pmModel);
+ }
- final List<PaymentMethodModelDao> finalPaymentMethods = new ArrayList<PaymentMethodModelDao>();
- for (final PaymentMethodPlugin cur : pluginPms) {
- final PaymentMethod input = new DefaultPaymentMethod(account.getId(), pluginName, cur);
- final PaymentMethodModelDao pmModel = new PaymentMethodModelDao(input.getId(), input.getCreatedDate(), input.getUpdatedDate(),
- input.getAccountId(), input.getPluginName(), input.isActive(),
- input.getPluginDetail().getExternalPaymentMethodId());
- finalPaymentMethods.add(pmModel);
+ final List<PaymentMethodModelDao> refreshedPaymentMethods = paymentDao.refreshPaymentMethods(account.getId(),
+ finalPaymentMethods,
+ context);
+ return ImmutableList.<PaymentMethod>copyOf(Collections2.transform(refreshedPaymentMethods, new Function<PaymentMethodModelDao, PaymentMethod>() {
+ @Override
+ public PaymentMethod apply(final PaymentMethodModelDao input) {
+ return new DefaultPaymentMethod(input, getPaymentMethodDetail(pluginPms, input.getExternalId()));
}
-
- final List<PaymentMethodModelDao> refreshedPaymentMethods = paymentDao.refreshPaymentMethods(account.getId(),
- finalPaymentMethods,
- context);
- return ImmutableList.<PaymentMethod>copyOf(Collections2.transform(refreshedPaymentMethods, new Function<PaymentMethodModelDao, PaymentMethod>() {
- @Override
- public PaymentMethod apply(final PaymentMethodModelDao input) {
- return new DefaultPaymentMethod(input, getPaymentMethodDetail(pluginPms, input.getExternalId()));
- }
- }));
- } catch (PaymentPluginApiException e) {
- // STEPH all errors should also take a pluginName
- throw new PaymentApiException(ErrorCode.PAYMENT_REFRESH_PAYMENT_METHOD, account.getId(), e.getErrorMessage());
- }
+ }));
}
});
}
diff --git a/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java b/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
index 97fa98c..22a48fe 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
@@ -167,7 +167,7 @@ public abstract class ProcessorBase {
throws PaymentApiException {
GlobalLock lock = null;
try {
- lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT, accountExternalKey, NB_LOCK_TRY);
+ lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, accountExternalKey, NB_LOCK_TRY);
return callback.doOperation();
} catch (LockFailedException e) {
final String format = String.format("Failed to lock account %s", accountExternalKey);
pom.xml 2(+1 -1)
diff --git a/pom.xml b/pom.xml
index 8d35dd7..34ea43d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
<packaging>pom</packaging>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<name>killbill</name>
<description>Library for managing recurring subscriptions and the associated billing</description>
<url>http://github.com/ning/killbill</url>
server/pom.xml 16(+14 -2)
diff --git a/server/pom.xml b/server/pom.xml
index 69cea7b..a519a55 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-server</artifactId>
@@ -27,7 +27,7 @@
<jetty.version>8.1.2.v20120308</jetty.version>
<logback.version>1.0.1</logback.version>
<metrics.version>2.1.2</metrics.version>
- <skeleton.version>0.1.4</skeleton.version>
+ <skeleton.version>0.1.7</skeleton.version>
<async-http-client.version>1.7.1</async-http-client.version>
</properties>
@@ -293,6 +293,18 @@
</resources>
<plugins>
<plugin>
+ <groupId>io.tesla.jettyconsole</groupId>
+ <artifactId>jetty-console-maven-plugin</artifactId>
+ <version>1.47</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>createconsole</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
tenant/pom.xml 2(+1 -1)
diff --git a/tenant/pom.xml b/tenant/pom.xml
index a9d5065..d4a8b18 100644
--- a/tenant/pom.xml
+++ b/tenant/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-tenant</artifactId>
usage/pom.xml 2(+1 -1)
diff --git a/usage/pom.xml b/usage/pom.xml
index 51a87e4..a86c557 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-usage</artifactId>
util/pom.xml 2(+1 -1)
diff --git a/util/pom.xml b/util/pom.xml
index ecce113..4ac0019 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>com.ning.billing</groupId>
<artifactId>killbill</artifactId>
- <version>0.1.40-SNAPSHOT</version>
+ <version>0.1.41-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>killbill-util</artifactId>
diff --git a/util/src/main/java/com/ning/billing/util/globallocker/GlobalLocker.java b/util/src/main/java/com/ning/billing/util/globallocker/GlobalLocker.java
index 7c59a47..9b1f3d8 100644
--- a/util/src/main/java/com/ning/billing/util/globallocker/GlobalLocker.java
+++ b/util/src/main/java/com/ning/billing/util/globallocker/GlobalLocker.java
@@ -23,7 +23,7 @@ public interface GlobalLocker {
Boolean isFree(final LockerType service, final String lockKey);
public enum LockerType {
- // Global ACCOUNT locking
- ACCOUNT
+ ACCOUNT_FOR_INVOICE_PAYMENTS,
+ ACCOUNT_FOR_ANALYTICS
}
}
diff --git a/util/src/main/java/com/ning/billing/util/globallocker/MySqlGlobalLocker.java b/util/src/main/java/com/ning/billing/util/globallocker/MySqlGlobalLocker.java
index 248aeef..e2853c0 100644
--- a/util/src/main/java/com/ning/billing/util/globallocker/MySqlGlobalLocker.java
+++ b/util/src/main/java/com/ning/billing/util/globallocker/MySqlGlobalLocker.java
@@ -27,7 +27,8 @@ public class MySqlGlobalLocker implements GlobalLocker {
private static final Logger logger = LoggerFactory.getLogger(MySqlGlobalLocker.class);
- private static final long DEFAULT_TIMEOUT = 5L; // 5 seconds
+ // Note that we could hold the lock while talking to the payment gateway, hence be generous in the timeout length
+ private static final long DEFAULT_TIMEOUT = 10L; // 10 seconds
private final IDBI dbi;
private long timeout;
@@ -58,7 +59,6 @@ public class MySqlGlobalLocker implements GlobalLocker {
}
private GlobalLock lock(final String lockName) throws LockFailedException {
-
final Handle h = dbi.open();
final MySqlGlobalLockerDao dao = h.attach(MySqlGlobalLockerDao.class);
@@ -70,13 +70,13 @@ public class MySqlGlobalLocker implements GlobalLocker {
try {
dao.releaseLock(lockName);
} finally {
- if (h != null) {
- h.close();
- }
+ h.close();
}
}
};
} else {
+ // Make sure to close the handle if we couldn't obtain the lock (otherwise we would leak connections)
+ h.close();
return null;
}
}
diff --git a/util/src/test/java/com/ning/billing/util/globallocker/TestMysqlGlobalLocker.java b/util/src/test/java/com/ning/billing/util/globallocker/TestMysqlGlobalLocker.java
index 3604a8f..99b218a 100644
--- a/util/src/test/java/com/ning/billing/util/globallocker/TestMysqlGlobalLocker.java
+++ b/util/src/test/java/com/ning/billing/util/globallocker/TestMysqlGlobalLocker.java
@@ -57,7 +57,7 @@ public class TestMysqlGlobalLocker extends UtilTestSuiteWithEmbeddedDB {
final String lockName = UUID.randomUUID().toString();
final GlobalLocker locker = new MySqlGlobalLocker(dbi);
- final GlobalLock lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT, lockName, 3);
+ final GlobalLock lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName, 3);
dbi.inTransaction(new TransactionCallback<Void>() {
@Override
@@ -67,11 +67,11 @@ public class TestMysqlGlobalLocker extends UtilTestSuiteWithEmbeddedDB {
return null;
}
});
- Assert.assertEquals(locker.isFree(LockerType.ACCOUNT, lockName), Boolean.FALSE);
+ Assert.assertEquals(locker.isFree(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName), Boolean.FALSE);
boolean gotException = false;
try {
- locker.lockWithNumberOfTries(LockerType.ACCOUNT, lockName, 1);
+ locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName, 1);
} catch (LockFailedException e) {
gotException = true;
}
@@ -79,7 +79,7 @@ public class TestMysqlGlobalLocker extends UtilTestSuiteWithEmbeddedDB {
lock.release();
- Assert.assertEquals(locker.isFree(LockerType.ACCOUNT, lockName), Boolean.TRUE);
+ Assert.assertEquals(locker.isFree(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName), Boolean.TRUE);
}
public static final class TestMysqlGlobalLockerModule extends AbstractModule {