killbill-memoizeit

Changes

account/pom.xml 10(+10 -0)

beatrix/pom.xml 16(+14 -2)

catalog/pom.xml 10(+10 -0)

entitlement/pom.xml 10(+10 -0)

invoice/pom.xml 10(+10 -0)

jaxrs/pom.xml 10(+10 -0)

junction/pom.xml 10(+10 -0)

osgi/pom.xml 11(+10 -1)

overdue/pom.xml 17(+17 -0)

payment/pom.xml 16(+16 -0)

server/pom.xml 10(+10 -0)

tenant/pom.xml 10(+10 -0)

usage/pom.xml 10(+10 -0)

util/pom.xml 10(+10 -0)

util/src/main/java/com/ning/billing/util/clock/Clock.java 34(+0 -34)

util/src/main/java/com/ning/billing/util/clock/DefaultClock.java 106(+0 -106)

util/src/test/java/com/ning/billing/util/clock/ClockMock.java 133(+0 -133)

util/src/test/java/com/ning/billing/util/clock/OldClockMock.java 167(+0 -167)

util/src/test/java/com/ning/billing/util/clock/TestClockMock.java 71(+0 -71)

Details

account/pom.xml 10(+10 -0)

diff --git a/account/pom.xml b/account/pom.xml
index e8b4697..2a242d6 100644
--- a/account/pom.xml
+++ b/account/pom.xml
@@ -76,6 +76,16 @@
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.inject</groupId>
             <artifactId>javax.inject</artifactId>
             <scope>provided</scope>

beatrix/pom.xml 16(+14 -2)

diff --git a/beatrix/pom.xml b/beatrix/pom.xml
index 8abd8e9..01421db 100644
--- a/beatrix/pom.xml
+++ b/beatrix/pom.xml
@@ -96,8 +96,6 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
-        <!-- TEST SCOPE -->
-
         <dependency>
             <groupId>com.ning.billing</groupId>
             <artifactId>killbill-osgi</artifactId>
@@ -148,6 +146,20 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-queue</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
         </dependency>
diff --git a/beatrix/src/main/java/com/ning/billing/beatrix/extbus/PersistentExternalBus.java b/beatrix/src/main/java/com/ning/billing/beatrix/extbus/PersistentExternalBus.java
index 1e32c6e..b01518d 100644
--- a/beatrix/src/main/java/com/ning/billing/beatrix/extbus/PersistentExternalBus.java
+++ b/beatrix/src/main/java/com/ning/billing/beatrix/extbus/PersistentExternalBus.java
@@ -27,6 +27,7 @@ import org.skife.jdbi.v2.IDBI;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.ning.billing.ObjectType;
 import com.ning.billing.account.api.Account;
 import com.ning.billing.account.api.AccountApiException;
 import com.ning.billing.beatrix.bus.api.ExternalBus;
@@ -35,6 +36,7 @@ import com.ning.billing.beatrix.extbus.dao.ExtBusSqlDao;
 import com.ning.billing.bus.PersistentBus.EventBusException;
 import com.ning.billing.bus.PersistentBusConfig;
 import com.ning.billing.notification.plugin.api.ExtBusEvent;
+import com.ning.billing.notification.plugin.api.ExtBusEventType;
 import com.ning.billing.queue.PersistentQueueBase;
 import com.ning.billing.util.Hostname;
 import com.ning.billing.util.bus.DefaultBusService;
@@ -100,7 +102,13 @@ public class PersistentExternalBus extends PersistentQueueBase implements Extern
 
         int result = 0;
         for (final ExtBusEventEntry cur : events) {
-            final UUID accountId = getAccountIdFromRecordId(cur.getAccountRecordId(), context);
+            // The accountRecordId for a newly created account is not set
+            final UUID accountId;
+            if (cur.getObjectType() == ObjectType.ACCOUNT && cur.getExtBusType() == ExtBusEventType.ACCOUNT_CREATION) {
+                accountId = cur.getObjectId();
+            } else {
+                accountId = getAccountIdFromRecordId(cur.getAccountRecordId(), context);
+            }
             final ExtBusEvent event = new DefaultBusEvent(cur.getExtBusType(), cur.getObjectType(), cur.getObjectId(), accountId, null);
             result++;
             // STEPH exception handling is done by GUAVA-- logged a bug Issue-780
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestBasicOSGIWithTestBundle.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestBasicOSGIWithTestBundle.java
index a3de7a6..d02c542 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestBasicOSGIWithTestBundle.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestBasicOSGIWithTestBundle.java
@@ -95,6 +95,7 @@ public class TestBasicOSGIWithTestBundle extends TestOSGIBase {
 
         // Create an account and expect test bundle listen to KB events and write the external name in its table
         final Account account = createAccountWithNonOsgiPaymentMethod(getAccountData(1));
+
         assertTor.assertPluginReceievdAccountCreationEvent(account.getExternalKey());
 
         // Retrieve the PaymentPluginApi that the test bundle registered
diff --git a/beatrix/src/test/resources/beatrix.properties b/beatrix/src/test/resources/beatrix.properties
index 2bca29c..54816cb 100644
--- a/beatrix/src/test/resources/beatrix.properties
+++ b/beatrix/src/test/resources/beatrix.properties
@@ -4,9 +4,9 @@ killbill.entitlement.dao.ready.max=1
 killbill.payment.engine.notifications.sleep=100
 killbill.invoice.engine.notifications.sleep=100
 killbill.entitlement.engine.notifications.sleep=100
-killbill.billing.util.persistent.bus.sleep=100
-killbill.billing.util.persistent.bus.nbThreads=1
-killbill.billing.util.persistent.bus.prefetch=1
+killbill.billing.persistent.bus.sleep=100
+killbill.billing.persistent.bus.nbThreads=1
+killbill.billing.persistent.bus.prefetch=1
 user.timezone=UTC
 killbill.payment.retry.days=8,8,8,8,8,8,8,8
 killbill.osgi.bundle.install.dir=/var/tmp/beatrix-bundles

catalog/pom.xml 10(+10 -0)

diff --git a/catalog/pom.xml b/catalog/pom.xml
index e6b6e97..5c981dd 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -59,6 +59,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>

entitlement/pom.xml 10(+10 -0)

diff --git a/entitlement/pom.xml b/entitlement/pom.xml
index ec44ba6..94cb83a 100644
--- a/entitlement/pom.xml
+++ b/entitlement/pom.xml
@@ -89,6 +89,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.inject</groupId>
             <artifactId>javax.inject</artifactId>
             <scope>provided</scope>
diff --git a/entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/DefaultEntitlementDao.java b/entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/DefaultEntitlementDao.java
index 0b13bbc..342ef63 100644
--- a/entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/DefaultEntitlementDao.java
+++ b/entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/DefaultEntitlementDao.java
@@ -931,7 +931,7 @@ public class DefaultEntitlementDao implements EntitlementDao {
         try {
             final NotificationQueue subscriptionEventQueue = notificationQueueService.getNotificationQueue(Engine.ENTITLEMENT_SERVICE_NAME,
                                                                                                            Engine.NOTIFICATION_QUEUE_NAME);
-            subscriptionEventQueue.recordFutureNotificationFromTransaction(entitySqlDaoWrapperFactory.getSqlDao(), effectiveDate, notificationKey, context.getUserToken(), context.getAccountRecordId(), context.getTenantRecordId());
+             subscriptionEventQueue.recordFutureNotificationFromTransaction(entitySqlDaoWrapperFactory.getSqlDao(), effectiveDate, notificationKey, context.getUserToken(), context.getAccountRecordId(), context.getTenantRecordId());
         } catch (NoSuchNotificationQueue e) {
             throw new RuntimeException(e);
         } catch (IOException e) {
diff --git a/entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/MockEntitlementDaoMemory.java b/entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/MockEntitlementDaoMemory.java
index 5a24ff0..f33c15f 100644
--- a/entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/MockEntitlementDaoMemory.java
+++ b/entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/MockEntitlementDaoMemory.java
@@ -417,7 +417,7 @@ public class MockEntitlementDaoMemory implements EntitlementDao {
         try {
             final NotificationQueue subscriptionEventQueue = notificationQueueService.getNotificationQueue(Engine.ENTITLEMENT_SERVICE_NAME,
                                                                                                            Engine.NOTIFICATION_QUEUE_NAME);
-            subscriptionEventQueue.recordFutureNotificationFromTransaction(transactionalDao.getSqlDao(), effectiveDate, notificationKey, context.getUserToken(), context.getAccountRecordId(), context.getTenantRecordId());
+            subscriptionEventQueue.recordFutureNotificationFromTransaction(null, effectiveDate, notificationKey, context.getUserToken(), context.getAccountRecordId(), context.getTenantRecordId());
         } catch (NoSuchNotificationQueue e) {
             throw new RuntimeException(e);
         } catch (IOException e) {
diff --git a/entitlement/src/test/resources/entitlement.properties b/entitlement/src/test/resources/entitlement.properties
index 1fcab63..2f86266 100644
--- a/entitlement/src/test/resources/entitlement.properties
+++ b/entitlement/src/test/resources/entitlement.properties
@@ -2,7 +2,7 @@ killbill.catalog.uri=file:src/test/resources/testInput.xml
 killbill.entitlement.dao.claim.time=60000
 killbill.entitlement.dao.ready.max=1
 killbill.entitlement.engine.notifications.sleep=100
-killbill.billing.util.persistent.bus.sleep=100
-killbill.billing.util.persistent.bus.nbThreads=1
-killbill.billing.util.persistent.bus.prefetch=1
+killbill.billing.persistent.bus.sleep=100
+killbill.billing.persistent.bus.nbThreads=1
+killbill.billing.persistent.bus.prefetch=1
 user.timezone=UTC

invoice/pom.xml 10(+10 -0)

diff --git a/invoice/pom.xml b/invoice/pom.xml
index a395bf5..0b71a28 100644
--- a/invoice/pom.xml
+++ b/invoice/pom.xml
@@ -89,6 +89,16 @@
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.inject</groupId>
             <artifactId>javax.inject</artifactId>
             <scope>provided</scope>

jaxrs/pom.xml 10(+10 -0)

diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml
index e185516..05bd20c 100644
--- a/jaxrs/pom.xml
+++ b/jaxrs/pom.xml
@@ -60,6 +60,16 @@
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
         </dependency>

junction/pom.xml 10(+10 -0)

diff --git a/junction/pom.xml b/junction/pom.xml
index 4453b23..c6190f7 100644
--- a/junction/pom.xml
+++ b/junction/pom.xml
@@ -83,6 +83,16 @@
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>
diff --git a/junction/src/test/resources/resource.properties b/junction/src/test/resources/resource.properties
index 840728c..c95c378 100644
--- a/junction/src/test/resources/resource.properties
+++ b/junction/src/test/resources/resource.properties
@@ -2,7 +2,7 @@ killbill.catalog.uri=file:src/test/resources/catalogSample.xml
 killbill.entitlement.dao.claim.time=60000
 killbill.entitlement.dao.ready.max=1
 killbill.entitlement.engine.notifications.sleep=500
-killbill.billing.util.persistent.bus.prefetch=1
+killbill.billing.persistent.bus.prefetch=1
 user.timezone=UTC
 
 

osgi/pom.xml 11(+10 -1)

diff --git a/osgi/pom.xml b/osgi/pom.xml
index 6267134..c19166e 100644
--- a/osgi/pom.xml
+++ b/osgi/pom.xml
@@ -56,7 +56,6 @@
             <groupId>com.ning.billing</groupId>
             <artifactId>killbill-util</artifactId>
         </dependency>
-        <!-- TEST SCOPE -->
         <dependency>
             <groupId>com.ning.billing</groupId>
             <artifactId>killbill-util</artifactId>
@@ -64,6 +63,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
diff --git a/osgi-bundles/bundles/meter/pom.xml b/osgi-bundles/bundles/meter/pom.xml
index 77e36f1..5b951f5 100644
--- a/osgi-bundles/bundles/meter/pom.xml
+++ b/osgi-bundles/bundles/meter/pom.xml
@@ -73,6 +73,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
             <scope>provided</scope>

overdue/pom.xml 17(+17 -0)

diff --git a/overdue/pom.xml b/overdue/pom.xml
index d528268..a0d5ad5 100644
--- a/overdue/pom.xml
+++ b/overdue/pom.xml
@@ -83,6 +83,23 @@
             <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-queue</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
diff --git a/overdue/src/main/java/com/ning/billing/ovedue/notification/DefaultOverdueCheckPoster.java b/overdue/src/main/java/com/ning/billing/ovedue/notification/DefaultOverdueCheckPoster.java
index 2335771..690f627 100644
--- a/overdue/src/main/java/com/ning/billing/ovedue/notification/DefaultOverdueCheckPoster.java
+++ b/overdue/src/main/java/com/ning/billing/ovedue/notification/DefaultOverdueCheckPoster.java
@@ -17,7 +17,13 @@
 package com.ning.billing.ovedue.notification;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.annotation.Nullable;
 
 import org.joda.time.DateTime;
 import org.skife.jdbi.v2.IDBI;
@@ -31,7 +37,6 @@ import com.ning.billing.notificationq.NotificationQueue;
 import com.ning.billing.notificationq.NotificationQueueService;
 import com.ning.billing.notificationq.NotificationQueueService.NoSuchNotificationQueue;
 import com.ning.billing.overdue.service.DefaultOverdueService;
-import com.ning.billing.queue.PersistentQueueBase;
 import com.ning.billing.util.cache.CacheControllerDispatcher;
 import com.ning.billing.util.callcontext.InternalCallContext;
 import com.ning.billing.util.clock.Clock;
@@ -42,6 +47,9 @@ import com.ning.billing.util.entity.dao.EntitySqlDaoTransactionalJdbiWrapper;
 import com.ning.billing.util.entity.dao.EntitySqlDaoWrapperFactory;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
 import com.google.inject.Inject;
 
 public class DefaultOverdueCheckPoster implements OverdueCheckPoster {
@@ -135,19 +143,23 @@ public class DefaultOverdueCheckPoster implements OverdueCheckPoster {
                                                                                    final NotificationQueue checkOverdueQueue,
                                                                                    final Blockable overdueable,
                                                                                    final InternalCallContext context) {
-        final List<Notification> notifications = new ArrayList<Notification>();
-
-        final List<Notification> candidates = checkOverdueQueue.getFutureNotificationsForAccountFromTransaction(context.getAccountRecordId(), entitySqlDaoWrapperFactory.getSqlDao());
-        for (final Notification candidate : candidates) {
-            if (OverdueCheckNotificationKey.class.getName().equals(candidate.getNotificationKeyClass())) {
-                final OverdueCheckNotificationKey key = PersistentQueueBase.deserializeEvent(candidate.getNotificationKeyClass(), candidate.getNotificationKey());
 
-                if (Type.get(overdueable).equals(key.getType()) && overdueable.getId().equals(key.getUuidKey())) {
-                    notifications.add(candidate);
-                }
+        final Map<Notification, OverdueCheckNotificationKey> candidates = checkOverdueQueue.getFutureNotificationsForAccountAndTypeFromTransaction(OverdueCheckNotificationKey.class, context.getAccountRecordId(), entitySqlDaoWrapperFactory.getSqlDao());
+        final Map<Notification, OverdueCheckNotificationKey> notifications = Maps.filterEntries(candidates, new Predicate<Entry<Notification, OverdueCheckNotificationKey>>() {
+            @Override
+            public boolean apply(@Nullable final Entry<Notification, OverdueCheckNotificationKey> input) {
+                final OverdueCheckNotificationKey notificationKey = input.getValue();
+                return (Type.get(overdueable).equals(notificationKey.getType()) && overdueable.getId().equals(notificationKey.getUuidKey()));
             }
-        }
+        });
 
-        return notifications;
+        final List<Notification> result = new ArrayList(notifications.keySet());
+        Collections.sort(result, new Comparator<Notification>() {
+            @Override
+            public int compare(final Notification o1, final Notification o2) {
+                return o1.getEffectiveDate().compareTo(o2.getEffectiveDate());
+            }
+        });
+        return result;
     }
 }
diff --git a/overdue/src/test/java/com/ning/billing/ovedue/notification/TestDefaultOverdueCheckPoster.java b/overdue/src/test/java/com/ning/billing/ovedue/notification/TestDefaultOverdueCheckPoster.java
index d5e39f7..ee2aeab 100644
--- a/overdue/src/test/java/com/ning/billing/ovedue/notification/TestDefaultOverdueCheckPoster.java
+++ b/overdue/src/test/java/com/ning/billing/ovedue/notification/TestDefaultOverdueCheckPoster.java
@@ -81,7 +81,7 @@ public class TestDefaultOverdueCheckPoster extends OverdueTestSuiteWithEmbeddedD
         insertOverdueCheckAndVerifyQueueContent(otherOverdueable, 15, 5);
 
         // Verify the final content of the queue
-        Assert.assertEquals(overdueQueue.getFutureNotificationsForAccount(internalCallContext.getAccountRecordId()).size(), 2);
+        Assert.assertEquals(overdueQueue.getFutureNotificationsForAccountAndType(OverdueCheckNotificationKey.class, internalCallContext.getAccountRecordId()).size(), 2);
     }
 
     private void insertOverdueCheckAndVerifyQueueContent(final Blockable overdueable, final int nbDaysInFuture, final int expectedNbDaysInFuture) throws IOException {
diff --git a/overdue/src/test/resources/resource.properties b/overdue/src/test/resources/resource.properties
index 840728c..c95c378 100644
--- a/overdue/src/test/resources/resource.properties
+++ b/overdue/src/test/resources/resource.properties
@@ -2,7 +2,7 @@ killbill.catalog.uri=file:src/test/resources/catalogSample.xml
 killbill.entitlement.dao.claim.time=60000
 killbill.entitlement.dao.ready.max=1
 killbill.entitlement.engine.notifications.sleep=500
-killbill.billing.util.persistent.bus.prefetch=1
+killbill.billing.persistent.bus.prefetch=1
 user.timezone=UTC
 
 

payment/pom.xml 16(+16 -0)

diff --git a/payment/pom.xml b/payment/pom.xml
index fca1716..33817a4 100644
--- a/payment/pom.xml
+++ b/payment/pom.xml
@@ -97,6 +97,22 @@
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-queue</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>com.ning.billing.plugin</groupId>
             <artifactId>killbill-plugin-api-payment</artifactId>
         </dependency>
diff --git a/payment/src/test/resources/payment.properties b/payment/src/test/resources/payment.properties
index ae3d222..6ab0fc1 100644
--- a/payment/src/test/resources/payment.properties
+++ b/payment/src/test/resources/payment.properties
@@ -1,4 +1,4 @@
 killbill.payment.failure.retry.start.sec=3600
 killbill.payment.failure.retry.multiplier=1
 killbill.payment.failure.retry.max.attempts=3
-killbill.billing.util.persistent.bus.prefetch=1
+killbill.billing.persistent.bus.prefetch=1

server/pom.xml 10(+10 -0)

diff --git a/server/pom.xml b/server/pom.xml
index bc0f921..b9a94f5 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -146,6 +146,16 @@
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>com.ning.jetty</groupId>
             <artifactId>ning-service-skeleton-base</artifactId>
         </dependency>
diff --git a/server/src/test/resources/killbill.properties b/server/src/test/resources/killbill.properties
index 74606df..209607c 100644
--- a/server/src/test/resources/killbill.properties
+++ b/server/src/test/resources/killbill.properties
@@ -30,9 +30,9 @@ com.ning.core.server.jetty.logPath=/var/tmp/.logs
 killbill.payment.engine.notifications.sleep=100
 killbill.invoice.engine.notifications.sleep=100
 killbill.entitlement.engine.notifications.sleep=100
-killbill.billing.util.persistent.bus.sleep=100
-killbill.billing.util.persistent.bus.nbThreads=1
-killbill.billing.util.persistent.bus.prefetch=1
+killbill.billing.persistent.bus.sleep=100
+killbill.billing.persistent.bus.nbThreads=1
+killbill.billing.persistent.bus.prefetch=1
 # Local DB 
 #com.ning.billing.dbi.test.useLocalDb=true
 

tenant/pom.xml 10(+10 -0)

diff --git a/tenant/pom.xml b/tenant/pom.xml
index f069f67..2522dc0 100644
--- a/tenant/pom.xml
+++ b/tenant/pom.xml
@@ -64,6 +64,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>

usage/pom.xml 10(+10 -0)

diff --git a/usage/pom.xml b/usage/pom.xml
index abe7a67..6af4734 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -59,6 +59,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>

util/pom.xml 10(+10 -0)

diff --git a/util/pom.xml b/util/pom.xml
index 0756925..a947f76 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -93,6 +93,16 @@
             <artifactId>killbill-util</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-util</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>com.ning.billing.plugin</groupId>
             <artifactId>killbill-plugin-api-notification</artifactId>
         </dependency>
diff --git a/util/src/test/java/com/ning/billing/KillbillConfigSource.java b/util/src/test/java/com/ning/billing/KillbillConfigSource.java
index 0382a6e..1897575 100644
--- a/util/src/test/java/com/ning/billing/KillbillConfigSource.java
+++ b/util/src/test/java/com/ning/billing/KillbillConfigSource.java
@@ -35,10 +35,10 @@ public class KillbillConfigSource implements ConfigSource {
         this.properties.put("user.timezone", "UTC");
 
         // Speed up the notification queue
-        this.properties.put("killbill.billing.util.notificationq.sleep", "100");
+        this.properties.put("killbill.billing.notificationq.sleep", "100");
         // Speed up the bus
-        this.properties.put("killbill.billing.util.persistent.bus.sleep", "100");
-        this.properties.put("killbill.billing.util.persistent.bus.nbThreads", "1");
+        this.properties.put("killbill.billing.persistent.bus.sleep", "100");
+        this.properties.put("killbill.billing.persistent.bus.nbThreads", "1");
     }
 
     public String getString(final String propertyName) {
diff --git a/util/src/test/java/com/ning/billing/util/tag/dao/TestDefaultTagDefinitionDao.java b/util/src/test/java/com/ning/billing/util/tag/dao/TestDefaultTagDefinitionDao.java
index 6ea6e0c..13947ad 100644
--- a/util/src/test/java/com/ning/billing/util/tag/dao/TestDefaultTagDefinitionDao.java
+++ b/util/src/test/java/com/ning/billing/util/tag/dao/TestDefaultTagDefinitionDao.java
@@ -64,6 +64,7 @@ public class TestDefaultTagDefinitionDao extends UtilTestSuiteWithEmbeddedDB {
         final TagDefinitionModelDao createdTagDefinition = tagDefinitionDao.create(definitionName, description, internalCallContext);
         Assert.assertEquals(createdTagDefinition.getName(), definitionName);
         Assert.assertEquals(createdTagDefinition.getDescription(), description);
+
         Assert.assertTrue(eventsListener.isCompleted(2000));
 
         // Make sure we can retrieve it via the DAO