killbill-uncached

util: switch to killbill-commons for locker and db testing

8/4/2013 1:02:03 PM

Changes

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

beatrix/pom.xml 6(+5 -1)

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

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

overdue/pom.xml 6(+5 -1)

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

pom.xml 2(+1 -1)

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

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

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

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

util/src/main/java/com/ning/billing/util/globallocker/GlobalLocker.java 29(+0 -29)

util/src/main/java/com/ning/billing/util/globallocker/MySqlGlobalLocker.java 106(+0 -106)

util/src/main/java/com/ning/billing/util/globallocker/MySqlGlobalLockerDao.java 46(+0 -46)

util/src/test/java/com/ning/billing/dbi/H2TestingHelper.java 92(+0 -92)

util/src/test/java/com/ning/billing/dbi/MysqlTestingHelper.java 162(+0 -162)

util/src/test/java/com/ning/billing/mock/glue/MockDbHelperModule.java 46(+0 -46)

util/src/test/java/com/ning/billing/util/globallocker/MockGlobalLocker.java 75(+0 -75)

Details

diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 53b5724..e0ce11c 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -38,9 +38,10 @@
     <inspection_tool class="groupsTestNG" enabled="true" level="WARNING" enabled_by_default="true">
       <option name="groups">
         <value>
-          <list size="2">
+          <list size="3">
             <item index="0" class="java.lang.String" itemvalue="slow" />
             <item index="1" class="java.lang.String" itemvalue="fast" />
+            <item index="2" class="java.lang.String" itemvalue="mysql" />
           </list>
         </value>
       </option>
diff --git a/.idea/libraries/Maven__com_ning_billing_commons_killbill_jdbi_0_2_1.xml b/.idea/libraries/Maven__com_ning_billing_commons_killbill_jdbi_0_2_1.xml
new file mode 100644
index 0000000..75b770d
--- /dev/null
+++ b/.idea/libraries/Maven__com_ning_billing_commons_killbill_jdbi_0_2_1.xml
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+  <library name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1">
+    <CLASSES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/commons/killbill-jdbi/0.2.1/killbill-jdbi-0.2.1.jar!/" />
+    </CLASSES>
+    <JAVADOC>
+      <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/commons/killbill-jdbi/0.2.1/killbill-jdbi-0.2.1-javadoc.jar!/" />
+    </JAVADOC>
+    <SOURCES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/commons/killbill-jdbi/0.2.1/killbill-jdbi-0.2.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_ning_billing_commons_killbill_locker_0_2_1.xml b/.idea/libraries/Maven__com_ning_billing_commons_killbill_locker_0_2_1.xml
new file mode 100644
index 0000000..d21d67b
--- /dev/null
+++ b/.idea/libraries/Maven__com_ning_billing_commons_killbill_locker_0_2_1.xml
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+  <library name="Maven: com.ning.billing.commons:killbill-locker:0.2.1">
+    <CLASSES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/commons/killbill-locker/0.2.1/killbill-locker-0.2.1.jar!/" />
+    </CLASSES>
+    <JAVADOC>
+      <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/commons/killbill-locker/0.2.1/killbill-locker-0.2.1-javadoc.jar!/" />
+    </JAVADOC>
+    <SOURCES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/ning/billing/commons/killbill-locker/0.2.1/killbill-locker-0.2.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>
\ No newline at end of file
diff --git a/account/killbill-account.iml b/account/killbill-account.iml
index 97ec646..a213457 100644
--- a/account/killbill-account.iml
+++ b/account/killbill-account.iml
@@ -32,9 +32,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -47,8 +48,9 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />

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

diff --git a/account/pom.xml b/account/pom.xml
index 327f3d0..18974b3 100644
--- a/account/pom.xml
+++ b/account/pom.xml
@@ -83,6 +83,11 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
diff --git a/beatrix/killbill-beatrix.iml b/beatrix/killbill-beatrix.iml
index ab72da0..5e79e00 100644
--- a/beatrix/killbill-beatrix.iml
+++ b/beatrix/killbill-beatrix.iml
@@ -25,7 +25,7 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
     <orderEntry type="module" module-name="killbill-account" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.1.0" level="project" />
@@ -39,9 +39,10 @@
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-joda:2.0.1" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -58,11 +59,11 @@
     <orderEntry type="module" module-name="killbill-entitlement" />
     <orderEntry type="module" module-name="killbill-invoice" />
     <orderEntry type="module" module-name="killbill-invoice" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-junction" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
     <orderEntry type="module" module-name="killbill-junction" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-osgi" scope="TEST" />
     <orderEntry type="module" module-name="killbill-osgi-bundles-lib-killbill" scope="TEST" />
     <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
@@ -71,23 +72,24 @@
     <orderEntry type="library" scope="TEST" name="Maven: org.apache.felix:org.apache.felix.framework:4.0.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.apache.felix:org.osgi.core:1.0.1" level="project" />
     <orderEntry type="module" module-name="killbill-osgi-bundles-jruby" scope="TEST" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-concurrent:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-concurrent:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.jruby:jruby-complete:1.7.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.osgi:org.osgi.core:4.3.1" level="project" />
     <orderEntry type="module" module-name="killbill-osgi-bundles-test-beatrix" scope="TEST" />
     <orderEntry type="module" module-name="killbill-osgi-bundles-test-payment" scope="TEST" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-overdue" scope="TEST" />
     <orderEntry type="module" module-name="killbill-payment" />
     <orderEntry type="module" module-name="killbill-payment" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-subscription" />
     <orderEntry type="module" module-name="killbill-tenant" />
     <orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.1" level="project" />
     <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
     <orderEntry type="module" module-name="killbill-usage" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />

beatrix/pom.xml 6(+5 -1)

diff --git a/beatrix/pom.xml b/beatrix/pom.xml
index 1678381..0d0f20b 100644
--- a/beatrix/pom.xml
+++ b/beatrix/pom.xml
@@ -161,13 +161,17 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
         </dependency>
-
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
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 744af92..56287f9 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
@@ -37,10 +37,11 @@ import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import com.ning.billing.DBTestingHelper;
 import com.ning.billing.account.api.Account;
 import com.ning.billing.beatrix.osgi.SetupBundleWithAssertion;
 import com.ning.billing.catalog.api.Currency;
-import com.ning.billing.dbi.DBTestingHelper;
+import com.ning.billing.commons.embeddeddb.EmbeddedDB;
 import com.ning.billing.osgi.api.OSGIServiceRegistration;
 import com.ning.billing.osgi.glue.OSGIDataSourceConfig;
 import com.ning.billing.payment.plugin.api.PaymentInfoPlugin;
@@ -67,10 +68,10 @@ public class TestBasicOSGIWithTestBundle extends TestOSGIBase {
 
     @BeforeClass(groups = "slow")
     public void beforeClass() throws Exception {
-
-        final String jdbcConnection = getDBTestingHelper().getJdbcConnectionString();
-        final String userName = DBTestingHelper.USERNAME;
-        final String userPwd = DBTestingHelper.PASSWORD;
+        // Can't use the injected helper as Guice hasn't injected anything yet
+        final String jdbcConnection = DBTestingHelper.get().getJdbcConnectionString();
+        final String userName = DBTestingHelper.get().getUsername();
+        final String userPwd = DBTestingHelper.get().getPassword();
 
         System.setProperty(OSGIDataSourceConfig.DATA_SOURCE_PROP_PREFIX + "jdbc.url", jdbcConnection);
         System.setProperty(OSGIDataSourceConfig.DATA_SOURCE_PROP_PREFIX + "jdbc.user", userName);
@@ -90,7 +91,7 @@ public class TestBasicOSGIWithTestBundle extends TestOSGIBase {
     public void testBundleTest() throws Exception {
 
         // At this point test bundle should have been started already
-        final TestActivatorWithAssertion assertTor = new TestActivatorWithAssertion(getDBI());
+        final TestActivatorWithAssertion assertTor = new TestActivatorWithAssertion(dbi);
         assertTor.assertPluginInitialized();
 
         // Create an account and expect test bundle listen to KB events and write the external name in its table
diff --git a/catalog/killbill-catalog.iml b/catalog/killbill-catalog.iml
index 4ae2ab5..6b0ba11 100644
--- a/catalog/killbill-catalog.iml
+++ b/catalog/killbill-catalog.iml
@@ -32,10 +32,11 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -48,8 +49,8 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.slf4j:slf4j-simple:1.7.5" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.testng:testng:6.3.1" level="project" />
diff --git a/entitlement/killbill-entitlement.iml b/entitlement/killbill-entitlement.iml
index d02c962..4e209ba 100644
--- a/entitlement/killbill-entitlement.iml
+++ b/entitlement/killbill-entitlement.iml
@@ -22,7 +22,7 @@
     <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
     <orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-internal-api" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
@@ -35,9 +35,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -51,9 +52,10 @@
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
diff --git a/entitlement/pom.xml b/entitlement/pom.xml
index a29b63f..ffd8432 100644
--- a/entitlement/pom.xml
+++ b/entitlement/pom.xml
@@ -90,6 +90,11 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
diff --git a/entitlement/src/test/java/com/ning/billing/entitlement/block/TestDefaultBlockingApi.java b/entitlement/src/test/java/com/ning/billing/entitlement/block/TestDefaultBlockingApi.java
index 2085939..fa980aa 100644
--- a/entitlement/src/test/java/com/ning/billing/entitlement/block/TestDefaultBlockingApi.java
+++ b/entitlement/src/test/java/com/ning/billing/entitlement/block/TestDefaultBlockingApi.java
@@ -16,40 +16,30 @@
 
 package com.ning.billing.entitlement.block;
 
-import com.ning.billing.entitlement.EntitlementTestSuiteWithEmbeddedDB;
-import com.ning.billing.entitlement.api.BlockingState;
-import com.ning.billing.entitlement.api.Type;
-import com.ning.billing.util.svcapi.junction.DefaultBlockingState;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
 import org.skife.jdbi.v2.Handle;
 import org.skife.jdbi.v2.tweak.HandleCallback;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import com.ning.billing.entitlement.EntitlementTestSuiteWithEmbeddedDB;
+import com.ning.billing.entitlement.api.BlockingState;
+import com.ning.billing.entitlement.api.Type;
+import com.ning.billing.util.svcapi.junction.DefaultBlockingState;
 
 public class TestDefaultBlockingApi extends EntitlementTestSuiteWithEmbeddedDB {
 
     @Test(groups = "slow")
     public void testSetBlockingStateOnBundle() throws Exception {
         final UUID bundleId = UUID.randomUUID();
-        getDBI().withHandle(new HandleCallback<Void>() {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
-                handle.execute("DROP TABLE IF EXISTS bundles;\n" +
-                        "CREATE TABLE bundles (\n" +
-                        "    record_id int(11) unsigned NOT NULL AUTO_INCREMENT,\n" +
-                        "    id char(36) NOT NULL,\n" +
-                        "    external_key varchar(64) NOT NULL,\n" +
-                        "    account_id char(36) NOT NULL,\n" +
-                        "    last_sys_update_date datetime,\n" +
-                        "    account_record_id int(11) unsigned default null,\n" +
-                        "    tenant_record_id int(11) unsigned default null,\n" +
-                        "    PRIMARY KEY(record_id)\n" +
-                        ") ENGINE=innodb;");
-                handle.execute("insert into bundles (id, external_key, account_id, account_record_id) values (?, 'foo', ?, ?)",
-                        bundleId.toString(), UUID.randomUUID().toString(), internalCallContext.getAccountRecordId());
+                handle.execute("insert into bundles (id, external_key, account_id, created_by, created_date, updated_by, updated_date, account_record_id) values (?, 'foo', ?, ?, ?, ?, ?, ?)",
+                               bundleId.toString(), UUID.randomUUID().toString(), "TestDefaultBlockingApi", clock.getUTCNow(), "TestDefaultBlockingApi", clock.getUTCNow(), internalCallContext.getAccountRecordId());
                 return null;
             }
         });
@@ -62,7 +52,7 @@ public class TestDefaultBlockingApi extends EntitlementTestSuiteWithEmbeddedDB {
 
         Assert.assertEquals(resultState.getStateName(), blockingState.getStateName());
         // Verify the account_record_id was populated
-        getDBI().withHandle(new HandleCallback<Void>() {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 final List<Map<String, Object>> values = handle.select("select account_record_id from blocking_states where blockable_id = ?", bundleId.toString());
diff --git a/invoice/killbill-invoice.iml b/invoice/killbill-invoice.iml
index b04aee4..46d3476 100644
--- a/invoice/killbill-invoice.iml
+++ b/invoice/killbill-invoice.iml
@@ -39,9 +39,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -54,10 +55,11 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />

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

diff --git a/invoice/pom.xml b/invoice/pom.xml
index 11dbc7b..99907b3 100644
--- a/invoice/pom.xml
+++ b/invoice/pom.xml
@@ -96,6 +96,11 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
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 ccb4c4e..1e5c462 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/InvoiceDispatcher.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/InvoiceDispatcher.java
@@ -41,6 +41,9 @@ import com.ning.billing.account.api.AccountApiException;
 import com.ning.billing.bus.api.PersistentBus;
 import com.ning.billing.bus.api.PersistentBus.EventBusException;
 import com.ning.billing.catalog.api.Currency;
+import com.ning.billing.commons.locker.GlobalLock;
+import com.ning.billing.commons.locker.GlobalLocker;
+import com.ning.billing.commons.locker.LockFailedException;
 import com.ning.billing.subscription.api.user.SubscriptionUserApiException;
 import com.ning.billing.invoice.api.Invoice;
 import com.ning.billing.invoice.api.InvoiceApiException;
@@ -65,10 +68,7 @@ import com.ning.billing.util.events.BusInternalEvent;
 import com.ning.billing.util.events.EffectiveSubscriptionInternalEvent;
 import com.ning.billing.util.events.InvoiceAdjustmentInternalEvent;
 import com.ning.billing.util.events.InvoiceInternalEvent;
-import com.ning.billing.util.globallocker.GlobalLock;
-import com.ning.billing.util.globallocker.GlobalLocker;
-import com.ning.billing.util.globallocker.GlobalLocker.LockerType;
-import com.ning.billing.util.globallocker.LockFailedException;
+import com.ning.billing.util.globallocker.LockerType;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.subscription.SubscriptionInternalApi;
 import com.ning.billing.util.svcapi.junction.BillingEventSet;
@@ -140,7 +140,7 @@ public class InvoiceDispatcher {
                                   final boolean dryRun, final InternalCallContext context) throws InvoiceApiException {
         GlobalLock lock = null;
         try {
-            lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, accountId.toString(), NB_LOCK_TRY);
+            lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS.toString(), accountId.toString(), NB_LOCK_TRY);
 
             return processAccountWithLock(accountId, targetDate, dryRun, context);
         } catch (LockFailedException e) {
diff --git a/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteNoDB.java b/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteNoDB.java
index 1b2d56d..9c657f9 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteNoDB.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteNoDB.java
@@ -27,6 +27,7 @@ import org.testng.annotations.BeforeMethod;
 
 import com.ning.billing.GuicyKillbillTestSuiteNoDB;
 import com.ning.billing.bus.api.PersistentBus;
+import com.ning.billing.commons.locker.GlobalLocker;
 import com.ning.billing.invoice.api.InvoiceMigrationApi;
 import com.ning.billing.invoice.api.InvoicePaymentApi;
 import com.ning.billing.invoice.api.InvoiceUserApi;
@@ -37,7 +38,6 @@ import com.ning.billing.util.api.TagUserApi;
 import com.ning.billing.util.cache.CacheControllerDispatcher;
 import com.ning.billing.util.callcontext.InternalCallContextFactory;
 import com.ning.billing.clock.Clock;
-import com.ning.billing.util.globallocker.GlobalLocker;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.subscription.SubscriptionInternalApi;
 import com.ning.billing.util.svcapi.invoice.InvoiceInternalApi;
diff --git a/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteWithEmbeddedDB.java b/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteWithEmbeddedDB.java
index cbb2d96..33b5b93 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteWithEmbeddedDB.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/InvoiceTestSuiteWithEmbeddedDB.java
@@ -28,6 +28,7 @@ import org.testng.annotations.BeforeMethod;
 import com.ning.billing.GuicyKillbillTestSuiteWithEmbeddedDB;
 import com.ning.billing.bus.api.PersistentBus;
 import com.ning.billing.catalog.api.Currency;
+import com.ning.billing.commons.locker.GlobalLocker;
 import com.ning.billing.invoice.api.DefaultInvoiceService;
 import com.ning.billing.invoice.api.InvoiceMigrationApi;
 import com.ning.billing.invoice.api.InvoicePaymentApi;
@@ -42,7 +43,6 @@ import com.ning.billing.util.api.TagUserApi;
 import com.ning.billing.util.cache.CacheControllerDispatcher;
 import com.ning.billing.util.callcontext.InternalCallContextFactory;
 import com.ning.billing.clock.Clock;
-import com.ning.billing.util.globallocker.GlobalLocker;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.subscription.SubscriptionInternalApi;
 import com.ning.billing.util.svcapi.invoice.InvoiceInternalApi;
diff --git a/invoice/src/test/java/com/ning/billing/invoice/TestInvoiceHelper.java b/invoice/src/test/java/com/ning/billing/invoice/TestInvoiceHelper.java
index 653aa4e..e2d5357 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/TestInvoiceHelper.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/TestInvoiceHelper.java
@@ -38,6 +38,7 @@ import com.ning.billing.catalog.api.BillingPeriod;
 import com.ning.billing.catalog.api.Currency;
 import com.ning.billing.catalog.api.Plan;
 import com.ning.billing.catalog.api.PlanPhase;
+import com.ning.billing.commons.locker.GlobalLocker;
 import com.ning.billing.subscription.api.SubscriptionTransitionType;
 import com.ning.billing.subscription.api.user.Subscription;
 import com.ning.billing.invoice.api.Invoice;
@@ -60,7 +61,6 @@ import com.ning.billing.util.callcontext.InternalCallContext;
 import com.ning.billing.util.callcontext.InternalTenantContext;
 import com.ning.billing.clock.Clock;
 import com.ning.billing.util.entity.EntityPersistenceException;
-import com.ning.billing.util.globallocker.GlobalLocker;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.subscription.SubscriptionInternalApi;
 import com.ning.billing.util.svcapi.junction.BillingEvent;
@@ -132,7 +132,7 @@ public class TestInvoiceHelper {
     private final SubscriptionInternalApi subscriptionApi;
     private final  BusService busService;
     private final  InvoiceDao invoiceDao;
-    private final  GlobalLocker locker;
+    private final GlobalLocker locker;
     private final  Clock clock;
     private final InternalCallContext internalCallContext;
 
diff --git a/jaxrs/killbill-jaxrs.iml b/jaxrs/killbill-jaxrs.iml
index e635577..7c6a63d 100644
--- a/jaxrs/killbill-jaxrs.iml
+++ b/jaxrs/killbill-jaxrs.iml
@@ -31,10 +31,11 @@
     <orderEntry type="module" module-name="killbill-internal-api" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -47,8 +48,8 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
     <orderEntry type="library" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.0" level="project" />
diff --git a/junction/killbill-junction.iml b/junction/killbill-junction.iml
index 625d505..33fb202 100644
--- a/junction/killbill-junction.iml
+++ b/junction/killbill-junction.iml
@@ -22,7 +22,7 @@
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-internal-api" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
@@ -35,9 +35,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -51,11 +52,12 @@
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
     <orderEntry type="module" module-name="killbill-entitlement" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-entitlement:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-entitlement:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-entitlement" scope="TEST" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />

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

diff --git a/junction/pom.xml b/junction/pom.xml
index 7d3385c..aa5507c 100644
--- a/junction/pom.xml
+++ b/junction/pom.xml
@@ -101,6 +101,11 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
diff --git a/osgi/killbill-osgi.iml b/osgi/killbill-osgi.iml
index 4fb314e..dc72ca9 100644
--- a/osgi/killbill-osgi.iml
+++ b/osgi/killbill-osgi.iml
@@ -39,10 +39,11 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -55,8 +56,8 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
     <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.framework:4.0.3" level="project" />
     <orderEntry type="library" name="Maven: org.apache.felix:org.osgi.core:1.0.1" level="project" />
diff --git a/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml b/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml
index d101744..0263c39 100644
--- a/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml
+++ b/osgi-bundles/bundles/jruby/killbill-osgi-bundles-jruby.iml
@@ -19,7 +19,7 @@
     <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
     <orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:osgi-over-slf4j:1.7.5" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-concurrent:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-concurrent:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
     <orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
     <orderEntry type="library" name="Maven: org.jruby:jruby-complete:1.7.1" level="project" />
diff --git a/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml b/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml
index 3ed7ea3..d3bfb84 100644
--- a/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml
+++ b/osgi-bundles/defaultbundles/killbill-osgi-bundles-defaultbundles.iml
@@ -20,7 +20,7 @@
     <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
     <orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:osgi-over-slf4j:1.7.5" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-concurrent:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-concurrent:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
     <orderEntry type="library" name="Maven: org.jruby:jruby-complete:1.7.1" level="project" />
     <orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.3.1" level="project" />
diff --git a/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml b/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml
index 084031c..b1ced5a 100644
--- a/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml
+++ b/osgi-bundles/tests/payment/killbill-osgi-bundles-test-payment.iml
@@ -19,7 +19,7 @@
     <orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.3.1" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:osgi-over-slf4j:1.7.5" level="project" />
     <orderEntry type="module" module-name="killbill-util" production-on-test="" />
-    <orderEntry type="library" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.1.0" level="project" />
@@ -31,10 +31,11 @@
     <orderEntry type="module" module-name="killbill-internal-api" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: com.h2database:h2:1.3.158" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
diff --git a/overdue/killbill-overdue.iml b/overdue/killbill-overdue.iml
index c2e1e4b..69673b1 100644
--- a/overdue/killbill-overdue.iml
+++ b/overdue/killbill-overdue.iml
@@ -26,7 +26,7 @@
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-internal-api" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
@@ -39,9 +39,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -55,9 +56,10 @@
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />

overdue/pom.xml 6(+5 -1)

diff --git a/overdue/pom.xml b/overdue/pom.xml
index 63fb71a..d1c90a6 100644
--- a/overdue/pom.xml
+++ b/overdue/pom.xml
@@ -91,9 +91,13 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <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-queue</artifactId>
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 cdd1d14..0886f3a 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
@@ -52,7 +52,7 @@ public class TestDefaultOverdueCheckPoster extends OverdueTestSuiteWithEmbeddedD
     @BeforeMethod(groups = "slow")
     public void beforeMethod() throws Exception {
         super.beforeMethod();
-        entitySqlDaoTransactionalJdbiWrapper = new EntitySqlDaoTransactionalJdbiWrapper(getDBI(), clock, cacheControllerDispatcher, nonEntityDao);
+        entitySqlDaoTransactionalJdbiWrapper = new EntitySqlDaoTransactionalJdbiWrapper(dbi, clock, cacheControllerDispatcher, nonEntityDao);
 
         overdueQueue = notificationQueueService.getNotificationQueue(DefaultOverdueService.OVERDUE_SERVICE_NAME,
                                                                      DefaultOverdueCheckNotifier.OVERDUE_CHECK_NOTIFIER_QUEUE);
diff --git a/payment/killbill-payment.iml b/payment/killbill-payment.iml
index e0b44a0..fbf97a1 100644
--- a/payment/killbill-payment.iml
+++ b/payment/killbill-payment.iml
@@ -25,7 +25,7 @@
     <orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
     <orderEntry type="module" module-name="killbill-account" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-account:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.1.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.1.0" level="project" />
@@ -41,9 +41,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -56,14 +57,15 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-invoice" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-invoice:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-junction" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-junction:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.0" level="project" />

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

diff --git a/payment/pom.xml b/payment/pom.xml
index e944d53..36ea85c 100644
--- a/payment/pom.xml
+++ b/payment/pom.xml
@@ -104,6 +104,11 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
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 28def62..c2b3e15 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
@@ -33,6 +33,7 @@ import com.ning.billing.ErrorCode;
 import com.ning.billing.account.api.Account;
 import com.ning.billing.account.api.AccountApiException;
 import com.ning.billing.bus.api.PersistentBus;
+import com.ning.billing.commons.locker.GlobalLocker;
 import com.ning.billing.osgi.api.OSGIServiceRegistration;
 import com.ning.billing.payment.api.DefaultPaymentMethod;
 import com.ning.billing.payment.api.PaymentApiException;
@@ -49,7 +50,6 @@ import com.ning.billing.payment.provider.DefaultPaymentMethodInfoPlugin;
 import com.ning.billing.payment.provider.ExternalPaymentProviderPlugin;
 import com.ning.billing.util.callcontext.InternalCallContext;
 import com.ning.billing.util.callcontext.InternalTenantContext;
-import com.ning.billing.util.globallocker.GlobalLocker;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.invoice.InvoiceInternalApi;
 import com.ning.billing.util.svcapi.tag.TagInternalApi;
diff --git a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
index 5d79fb9..13c1b27 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
@@ -24,6 +24,7 @@ import com.ning.billing.account.api.Account;
 import com.ning.billing.account.api.AccountApiException;
 import com.ning.billing.bus.api.PersistentBus;
 import com.ning.billing.clock.Clock;
+import com.ning.billing.commons.locker.GlobalLocker;
 import com.ning.billing.invoice.api.Invoice;
 import com.ning.billing.invoice.api.InvoiceApiException;
 import com.ning.billing.osgi.api.OSGIServiceRegistration;
@@ -50,7 +51,6 @@ import com.ning.billing.util.callcontext.InternalTenantContext;
 import com.ning.billing.util.config.PaymentConfig;
 import com.ning.billing.util.events.BusInternalEvent;
 import com.ning.billing.util.events.PaymentErrorInternalEvent;
-import com.ning.billing.util.globallocker.GlobalLocker;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.invoice.InvoiceInternalApi;
 import com.ning.billing.util.svcapi.tag.TagInternalApi;
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 3f5ea77..7d0801c 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
@@ -31,6 +31,9 @@ import com.ning.billing.ObjectType;
 import com.ning.billing.account.api.Account;
 import com.ning.billing.bus.api.PersistentBus;
 import com.ning.billing.bus.api.PersistentBus.EventBusException;
+import com.ning.billing.commons.locker.GlobalLock;
+import com.ning.billing.commons.locker.GlobalLocker;
+import com.ning.billing.commons.locker.LockFailedException;
 import com.ning.billing.invoice.api.Invoice;
 import com.ning.billing.invoice.api.InvoiceApiException;
 import com.ning.billing.osgi.api.OSGIServiceRegistration;
@@ -42,10 +45,7 @@ import com.ning.billing.util.api.TagApiException;
 import com.ning.billing.util.callcontext.InternalCallContext;
 import com.ning.billing.util.callcontext.InternalTenantContext;
 import com.ning.billing.util.events.BusInternalEvent;
-import com.ning.billing.util.globallocker.GlobalLock;
-import com.ning.billing.util.globallocker.GlobalLocker;
-import com.ning.billing.util.globallocker.GlobalLocker.LockerType;
-import com.ning.billing.util.globallocker.LockFailedException;
+import com.ning.billing.util.globallocker.LockerType;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.invoice.InvoiceInternalApi;
 import com.ning.billing.util.svcapi.tag.TagInternalApi;
@@ -181,7 +181,7 @@ public abstract class ProcessorBase {
                 throws PaymentApiException {
             GlobalLock lock = null;
             try {
-                lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, accountExternalKey, NB_LOCK_TRY);
+                lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS.toString(), accountExternalKey, NB_LOCK_TRY);
                 return callback.doOperation();
             } catch (LockFailedException e) {
                 final String format = String.format("Failed to lock account %s", accountExternalKey);
diff --git a/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java
index 2a47887..3e529b5 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java
@@ -36,6 +36,7 @@ import com.ning.billing.ObjectType;
 import com.ning.billing.account.api.Account;
 import com.ning.billing.account.api.AccountApiException;
 import com.ning.billing.bus.api.PersistentBus;
+import com.ning.billing.commons.locker.GlobalLocker;
 import com.ning.billing.invoice.api.InvoiceApiException;
 import com.ning.billing.invoice.api.InvoiceItem;
 import com.ning.billing.osgi.api.OSGIServiceRegistration;
@@ -55,7 +56,6 @@ import com.ning.billing.util.callcontext.InternalCallContext;
 import com.ning.billing.util.callcontext.InternalCallContextFactory;
 import com.ning.billing.util.callcontext.InternalTenantContext;
 import com.ning.billing.util.callcontext.UserType;
-import com.ning.billing.util.globallocker.GlobalLocker;
 import com.ning.billing.util.svcapi.account.AccountInternalApi;
 import com.ning.billing.util.svcapi.invoice.InvoiceInternalApi;
 import com.ning.billing.util.svcapi.tag.TagInternalApi;

pom.xml 2(+1 -1)

diff --git a/pom.xml b/pom.xml
index b6a7a3d..cc0dca2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <artifactId>killbill-oss-parent</artifactId>
         <groupId>com.ning.billing</groupId>
-        <version>0.3.8</version>
+        <version>0.3.10</version>
     </parent>
     <artifactId>killbill</artifactId>
     <version>0.4.1-SNAPSHOT</version>
diff --git a/server/killbill-server.iml b/server/killbill-server.iml
index ac783b8..e94ed70 100644
--- a/server/killbill-server.iml
+++ b/server/killbill-server.iml
@@ -39,9 +39,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -67,7 +68,7 @@
     <orderEntry type="module" module-name="killbill-usage" />
     <orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
     <orderEntry type="module" module-name="killbill-beatrix" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-beatrix:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-beatrix:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-jaxrs" />
     <orderEntry type="library" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
     <orderEntry type="module" module-name="killbill-osgi" />
@@ -79,10 +80,11 @@
     <orderEntry type="library" name="Maven: org.apache.felix:org.osgi.core:1.0.1" level="project" />
     <orderEntry type="module" module-name="killbill-overdue" />
     <orderEntry type="module" module-name="killbill-payment" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-payment:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: com.ning.jetty:ning-service-skeleton-base:0.1.7" level="project" />
     <orderEntry type="library" name="Maven: com.ning:metrics.eventtracker-smile:4.1.2" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.0.1" level="project" />

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

diff --git a/server/pom.xml b/server/pom.xml
index d4834e2..ba6833e 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -153,6 +153,11 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
diff --git a/server/src/main/java/com/ning/billing/server/modules/DataSourceProvider.java b/server/src/main/java/com/ning/billing/server/modules/DataSourceProvider.java
new file mode 100644
index 0000000..9e9547a
--- /dev/null
+++ b/server/src/main/java/com/ning/billing/server/modules/DataSourceProvider.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2010-2013 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.server.modules;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Inject;
+import javax.inject.Provider;
+import javax.sql.DataSource;
+
+import org.skife.config.TimeSpan;
+
+import com.ning.jetty.jdbi.config.DaoConfig;
+
+import com.jolbox.bonecp.BoneCPConfig;
+import com.jolbox.bonecp.BoneCPDataSource;
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+
+public class DataSourceProvider implements Provider<DataSource> {
+
+    private final DaoConfig config;
+
+    @Inject
+    public DataSourceProvider(final DaoConfig config) {
+        this.config = config;
+    }
+
+    @Override
+    public DataSource get() {
+        return getDataSource();
+    }
+
+    private DataSource getDataSource() {
+        final DataSource ds;
+
+        // TODO PIERRE DaoConfig is in the skeleton
+        final String dataSource = System.getProperty("com.ning.jetty.jdbi.datasource", "c3p0");
+        if (dataSource.equals("c3p0")) {
+            ds = getC3P0DataSource();
+        } else if (dataSource.equals("bonecp")) {
+            ds = getBoneCPDatSource();
+        } else {
+            throw new IllegalArgumentException("DataSource " + dataSource + " unsupported");
+        }
+
+        return ds;
+    }
+
+    private DataSource getBoneCPDatSource() {
+        final BoneCPConfig dbConfig = new BoneCPConfig();
+        dbConfig.setJdbcUrl(config.getJdbcUrl());
+        dbConfig.setUsername(config.getUsername());
+        dbConfig.setPassword(config.getPassword());
+        dbConfig.setMinConnectionsPerPartition(config.getMinIdle());
+        dbConfig.setMaxConnectionsPerPartition(config.getMaxActive());
+        dbConfig.setConnectionTimeout(config.getConnectionTimeout().getPeriod(), config.getConnectionTimeout().getUnit());
+        dbConfig.setIdleMaxAge(config.getIdleMaxAge().getPeriod(), config.getIdleMaxAge().getUnit());
+        dbConfig.setMaxConnectionAge(config.getMaxConnectionAge().getPeriod(), config.getMaxConnectionAge().getUnit());
+        dbConfig.setIdleConnectionTestPeriod(config.getIdleConnectionTestPeriod().getPeriod(), config.getIdleConnectionTestPeriod().getUnit());
+        dbConfig.setPartitionCount(1);
+        dbConfig.setDisableJMX(false);
+
+        return new BoneCPDataSource(dbConfig);
+    }
+
+    private DataSource getC3P0DataSource() {
+        final ComboPooledDataSource cpds = new ComboPooledDataSource();
+        cpds.setJdbcUrl(config.getJdbcUrl());
+        cpds.setUser(config.getUsername());
+        cpds.setPassword(config.getPassword());
+        // http://www.mchange.com/projects/c3p0/#minPoolSize
+        // Minimum number of Connections a pool will maintain at any given time.
+        cpds.setMinPoolSize(config.getMinIdle());
+        // http://www.mchange.com/projects/c3p0/#maxPoolSize
+        // Maximum number of Connections a pool will maintain at any given time.
+        cpds.setMaxPoolSize(config.getMaxActive());
+        // http://www.mchange.com/projects/c3p0/#checkoutTimeout
+        // The number of milliseconds a client calling getConnection() will wait for a Connection to be checked-in or
+        // acquired when the pool is exhausted. Zero means wait indefinitely. Setting any positive value will cause the getConnection()
+        // call to time-out and break with an SQLException after the specified number of milliseconds.
+        cpds.setCheckoutTimeout(toMilliSeconds(config.getConnectionTimeout()));
+        // http://www.mchange.com/projects/c3p0/#maxIdleTime
+        // Seconds a Connection can remain pooled but unused before being discarded. Zero means idle connections never expire.
+        cpds.setMaxIdleTime(toSeconds(config.getIdleMaxAge()));
+        // http://www.mchange.com/projects/c3p0/#maxConnectionAge
+        // Seconds, effectively a time to live. A Connection older than maxConnectionAge will be destroyed and purged from the pool.
+        // This differs from maxIdleTime in that it refers to absolute age. Even a Connection which has not been much idle will be purged
+        // from the pool if it exceeds maxConnectionAge. Zero means no maximum absolute age is enforced.
+        cpds.setMaxConnectionAge(toSeconds(config.getMaxConnectionAge()));
+        // http://www.mchange.com/projects/c3p0/#idleConnectionTestPeriod
+        // If this is a number greater than 0, c3p0 will test all idle, pooled but unchecked-out connections, every this number of seconds.
+        cpds.setIdleConnectionTestPeriod(toSeconds(config.getIdleConnectionTestPeriod()));
+
+        return cpds;
+    }
+
+    private int toSeconds(final TimeSpan timeSpan) {
+        return toSeconds(timeSpan.getPeriod(), timeSpan.getUnit());
+    }
+
+    private int toSeconds(final long period, final TimeUnit timeUnit) {
+        return (int) TimeUnit.SECONDS.convert(period, timeUnit);
+    }
+
+    private int toMilliSeconds(final TimeSpan timeSpan) {
+        return toMilliSeconds(timeSpan.getPeriod(), timeSpan.getUnit());
+    }
+
+    private int toMilliSeconds(final long period, final TimeUnit timeUnit) {
+        return (int) TimeUnit.MILLISECONDS.convert(period, timeUnit);
+    }
+}
diff --git a/server/src/main/java/com/ning/billing/server/modules/DBIProvider.java b/server/src/main/java/com/ning/billing/server/modules/DBIProvider.java
index 66c5cdf..81d747f 100644
--- a/server/src/main/java/com/ning/billing/server/modules/DBIProvider.java
+++ b/server/src/main/java/com/ning/billing/server/modules/DBIProvider.java
@@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
 
 import javax.sql.DataSource;
 
-import org.skife.config.TimeSpan;
 import org.skife.jdbi.v2.DBI;
 import org.skife.jdbi.v2.TimingCollector;
 import org.skife.jdbi.v2.tweak.SQLLog;
@@ -38,9 +37,6 @@ import com.ning.jetty.jdbi.config.DaoConfig;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
-import com.jolbox.bonecp.BoneCPConfig;
-import com.jolbox.bonecp.BoneCPDataSource;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
 import com.yammer.metrics.core.MetricsRegistry;
 import com.yammer.metrics.jdbi.InstrumentedTimingCollector;
 import com.yammer.metrics.jdbi.strategies.BasicSqlNameStrategy;
@@ -49,12 +45,14 @@ public class DBIProvider implements Provider<DBI> {
 
     private static final Logger logger = LoggerFactory.getLogger(DBIProvider.class);
 
+    private final DataSource ds;
     private final MetricsRegistry metricsRegistry;
     private final DaoConfig config;
     private SQLLog sqlLog;
 
     @Inject
-    public DBIProvider(final MetricsRegistry metricsRegistry, final DaoConfig config) {
+    public DBIProvider(final DataSource ds, final MetricsRegistry metricsRegistry, final DaoConfig config) {
+        this.ds = ds;
         this.metricsRegistry = metricsRegistry;
         this.config = config;
     }
@@ -66,8 +64,6 @@ public class DBIProvider implements Provider<DBI> {
 
     @Override
     public DBI get() {
-        final DataSource ds = getDataSource();
-
         final DBI dbi = new DBI(ds);
         dbi.registerArgumentFactory(new UUIDArgumentFactory());
         dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory());
@@ -95,84 +91,4 @@ public class DBIProvider implements Provider<DBI> {
 
         return dbi;
     }
-
-    private DataSource getDataSource() {
-        final DataSource ds;
-
-        // TODO PIERRE DaoConfig is in the skeleton
-        final String dataSource = System.getProperty("com.ning.jetty.jdbi.datasource", "c3p0");
-        if (dataSource.equals("c3p0")) {
-            ds = getC3P0DataSource();
-        } else if (dataSource.equals("bonecp")) {
-            ds = getBoneCPDatSource();
-        } else {
-            throw new IllegalArgumentException("DataSource " + dataSource + " unsupported");
-        }
-
-        return ds;
-    }
-
-    private DataSource getBoneCPDatSource() {
-        final BoneCPConfig dbConfig = new BoneCPConfig();
-        dbConfig.setJdbcUrl(config.getJdbcUrl());
-        dbConfig.setUsername(config.getUsername());
-        dbConfig.setPassword(config.getPassword());
-        dbConfig.setMinConnectionsPerPartition(config.getMinIdle());
-        dbConfig.setMaxConnectionsPerPartition(config.getMaxActive());
-        dbConfig.setConnectionTimeout(config.getConnectionTimeout().getPeriod(), config.getConnectionTimeout().getUnit());
-        dbConfig.setIdleMaxAge(config.getIdleMaxAge().getPeriod(), config.getIdleMaxAge().getUnit());
-        dbConfig.setMaxConnectionAge(config.getMaxConnectionAge().getPeriod(), config.getMaxConnectionAge().getUnit());
-        dbConfig.setIdleConnectionTestPeriod(config.getIdleConnectionTestPeriod().getPeriod(), config.getIdleConnectionTestPeriod().getUnit());
-        dbConfig.setPartitionCount(1);
-        dbConfig.setDisableJMX(false);
-
-        return new BoneCPDataSource(dbConfig);
-    }
-
-    private DataSource getC3P0DataSource() {
-        final ComboPooledDataSource cpds = new ComboPooledDataSource();
-        cpds.setJdbcUrl(config.getJdbcUrl());
-        cpds.setUser(config.getUsername());
-        cpds.setPassword(config.getPassword());
-        // http://www.mchange.com/projects/c3p0/#minPoolSize
-        // Minimum number of Connections a pool will maintain at any given time.
-        cpds.setMinPoolSize(config.getMinIdle());
-        // http://www.mchange.com/projects/c3p0/#maxPoolSize
-        // Maximum number of Connections a pool will maintain at any given time.
-        cpds.setMaxPoolSize(config.getMaxActive());
-        // http://www.mchange.com/projects/c3p0/#checkoutTimeout
-        // The number of milliseconds a client calling getConnection() will wait for a Connection to be checked-in or
-        // acquired when the pool is exhausted. Zero means wait indefinitely. Setting any positive value will cause the getConnection()
-        // call to time-out and break with an SQLException after the specified number of milliseconds.
-        cpds.setCheckoutTimeout(toMilliSeconds(config.getConnectionTimeout()));
-        // http://www.mchange.com/projects/c3p0/#maxIdleTime
-        // Seconds a Connection can remain pooled but unused before being discarded. Zero means idle connections never expire.
-        cpds.setMaxIdleTime(toSeconds(config.getIdleMaxAge()));
-        // http://www.mchange.com/projects/c3p0/#maxConnectionAge
-        // Seconds, effectively a time to live. A Connection older than maxConnectionAge will be destroyed and purged from the pool.
-        // This differs from maxIdleTime in that it refers to absolute age. Even a Connection which has not been much idle will be purged
-        // from the pool if it exceeds maxConnectionAge. Zero means no maximum absolute age is enforced.
-        cpds.setMaxConnectionAge(toSeconds(config.getMaxConnectionAge()));
-        // http://www.mchange.com/projects/c3p0/#idleConnectionTestPeriod
-        // If this is a number greater than 0, c3p0 will test all idle, pooled but unchecked-out connections, every this number of seconds.
-        cpds.setIdleConnectionTestPeriod(toSeconds(config.getIdleConnectionTestPeriod()));
-
-        return cpds;
-    }
-
-    private int toSeconds(final TimeSpan timeSpan) {
-        return toSeconds(timeSpan.getPeriod(), timeSpan.getUnit());
-    }
-
-    private int toSeconds(final long period, final TimeUnit timeUnit) {
-        return (int) TimeUnit.SECONDS.convert(period, timeUnit);
-    }
-
-    private int toMilliSeconds(final TimeSpan timeSpan) {
-        return toMilliSeconds(timeSpan.getPeriod(), timeSpan.getUnit());
-    }
-
-    private int toMilliSeconds(final long period, final TimeUnit timeUnit) {
-        return (int) TimeUnit.MILLISECONDS.convert(period, timeUnit);
-    }
 }
diff --git a/server/src/main/java/com/ning/billing/server/modules/KillbillServerModule.java b/server/src/main/java/com/ning/billing/server/modules/KillbillServerModule.java
index bde80c8..cabcf5a 100644
--- a/server/src/main/java/com/ning/billing/server/modules/KillbillServerModule.java
+++ b/server/src/main/java/com/ning/billing/server/modules/KillbillServerModule.java
@@ -16,6 +16,8 @@
 
 package com.ning.billing.server.modules;
 
+import javax.sql.DataSource;
+
 import com.ning.billing.entitlement.glue.DefaultEntitlementModule;
 import org.skife.config.ConfigSource;
 import org.skife.config.SimplePropertyConfigSource;
@@ -89,6 +91,7 @@ public class KillbillServerModule extends AbstractModule {
         } catch (final Exception ignore) {
         }
         bind(IDBI.class).to(DBI.class).asEagerSingleton();
+        bind(DataSource.class).toProvider(DataSourceProvider.class).asEagerSingleton();
         bind(DBI.class).toProvider(DBIProvider.class).asEagerSingleton();
     }
 
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java b/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
index d326ec9..e1dff41 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
@@ -26,11 +26,14 @@ import java.util.Map;
 import javax.inject.Inject;
 import javax.servlet.Servlet;
 
+import com.ning.billing.DBTestingHelper;
+import com.ning.billing.commons.embeddeddb.EmbeddedDB;
 import com.ning.billing.entitlement.glue.DefaultEntitlementModule;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.joda.time.LocalDate;
 import org.skife.config.ConfigSource;
 import org.skife.config.ConfigurationObjectFactory;
+import org.skife.jdbi.v2.DBI;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeClass;
@@ -44,8 +47,6 @@ import com.ning.billing.api.TestApiListener;
 import com.ning.billing.beatrix.glue.BeatrixModule;
 import com.ning.billing.bus.api.PersistentBus;
 import com.ning.billing.catalog.glue.CatalogModule;
-import com.ning.billing.dbi.DBTestingHelper;
-import com.ning.billing.dbi.MysqlTestingHelper;
 import com.ning.billing.subscription.glue.DefaultSubscriptionModule;
 import com.ning.billing.invoice.api.InvoiceNotifier;
 import com.ning.billing.invoice.glue.DefaultInvoiceModule;
@@ -126,7 +127,7 @@ public class TestJaxrsBase extends KillbillClient {
         private final TestKillbillServerModule module;
 
 
-        public TestKillbillGuiceListener(final DBTestingHelper helper) {
+        public TestKillbillGuiceListener(final EmbeddedDB helper) {
             super();
             this.module = new TestKillbillServerModule(helper);
         }
@@ -152,9 +153,9 @@ public class TestJaxrsBase extends KillbillClient {
 
     public static class TestKillbillServerModule extends KillbillServerModule {
 
-        private final DBTestingHelper helper;
+        private final EmbeddedDB helper;
 
-        public TestKillbillServerModule(final DBTestingHelper helper) {
+        public TestKillbillServerModule(final EmbeddedDB helper) {
             super();
             this.helper = helper;
         }
@@ -198,7 +199,7 @@ public class TestJaxrsBase extends KillbillClient {
             install(new EmailModule(configSource));
             install(new CacheModule(configSource));
             install(new NonEntityDaoModule());
-            install(new TestGlobalLockerModule(helper));
+            install(new TestGlobalLockerModule(DBTestingHelper.get()));
             install(new CustomFieldModule());
             install(new TagStoreModule());
             install(new AuditModule());
@@ -255,7 +256,7 @@ public class TestJaxrsBase extends KillbillClient {
 
         //mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy());
 
-        busHandler = new TestApiListener(null, getDBTestingHelper().getDBI());
+        busHandler = new TestApiListener(null, dbi);
     }
 
     protected void loadConfig() {
@@ -264,9 +265,9 @@ public class TestJaxrsBase extends KillbillClient {
         }
 
         // For shiro (outside of Guice control)
-        System.setProperty("com.ning.jetty.jdbi.url", getDBTestingHelper().getJdbcConnectionString());
-        System.setProperty("com.ning.jetty.jdbi.user", MysqlTestingHelper.USERNAME);
-        System.setProperty("com.ning.jetty.jdbi.password", MysqlTestingHelper.PASSWORD);
+        System.setProperty("com.ning.jetty.jdbi.url", DBTestingHelper.get().getJdbcConnectionString());
+        System.setProperty("com.ning.jetty.jdbi.user", DBTestingHelper.get().getUsername());
+        System.setProperty("com.ning.jetty.jdbi.password", DBTestingHelper.get().getPassword());
     }
 
     @BeforeSuite(groups = "slow")
@@ -275,7 +276,7 @@ public class TestJaxrsBase extends KillbillClient {
         loadSystemPropertiesFromClasspath("/killbill.properties");
         loadConfig();
 
-        listener = new TestKillbillGuiceListener(getDBTestingHelper());
+        listener = new TestKillbillGuiceListener(helper);
         server = new HttpServer();
 
         server.configure(config, getListeners(), getFilters());
diff --git a/server/src/test/java/com/ning/billing/server/security/TestKillbillJdbcRealm.java b/server/src/test/java/com/ning/billing/server/security/TestKillbillJdbcRealm.java
index ac06a5a..b193de3 100644
--- a/server/src/test/java/com/ning/billing/server/security/TestKillbillJdbcRealm.java
+++ b/server/src/test/java/com/ning/billing/server/security/TestKillbillJdbcRealm.java
@@ -28,7 +28,6 @@ import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.ning.billing.dbi.MysqlTestingHelper;
 import com.ning.billing.jaxrs.TestJaxrsBase;
 import com.ning.billing.tenant.api.DefaultTenant;
 import com.ning.billing.tenant.dao.DefaultTenantDao;
@@ -50,16 +49,16 @@ public class TestKillbillJdbcRealm extends TestJaxrsBase {
         super.beforeMethod();
 
         // Create the tenant
-        final DefaultTenantDao tenantDao = new DefaultTenantDao(getDBI(), clock, cacheControllerDispatcher, new DefaultNonEntityDao(getDBI()));
+        final DefaultTenantDao tenantDao = new DefaultTenantDao(dbi, clock, cacheControllerDispatcher, new DefaultNonEntityDao(dbi));
         tenant = new DefaultTenant(UUID.randomUUID(), null, null, UUID.randomUUID().toString(),
                                    UUID.randomUUID().toString(), UUID.randomUUID().toString());
         tenantDao.create(new TenantModelDao(tenant), internalCallContext);
 
         // Setup the security manager
         final BoneCPConfig dbConfig = new BoneCPConfig();
-        dbConfig.setJdbcUrl(getDBTestingHelper().getJdbcConnectionString());
-        dbConfig.setUsername(MysqlTestingHelper.USERNAME);
-        dbConfig.setPassword(MysqlTestingHelper.PASSWORD);
+        dbConfig.setJdbcUrl(helper.getJdbcConnectionString());
+        dbConfig.setUsername(helper.getUsername());
+        dbConfig.setPassword(helper.getPassword());
 
         final KillbillJdbcRealm jdbcRealm;
         jdbcRealm = new KillbillJdbcRealm();
diff --git a/subscription/killbill-subscription.iml b/subscription/killbill-subscription.iml
index 0f477aa..e4852f4 100644
--- a/subscription/killbill-subscription.iml
+++ b/subscription/killbill-subscription.iml
@@ -27,7 +27,7 @@
     <orderEntry type="library" name="Maven: com.ning.billing:killbill-api:0.4.0" level="project" />
     <orderEntry type="library" name="Maven: joda-time:joda-time:2.0" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-catalog:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
     <orderEntry type="module" module-name="killbill-internal-api" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
@@ -40,9 +40,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -56,9 +57,10 @@
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-catalog" scope="TEST" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />
diff --git a/subscription/pom.xml b/subscription/pom.xml
index 3441f65..39f3fbf 100644
--- a/subscription/pom.xml
+++ b/subscription/pom.xml
@@ -95,6 +95,11 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
diff --git a/tenant/killbill-tenant.iml b/tenant/killbill-tenant.iml
index fca2df7..eb3d973 100644
--- a/tenant/killbill-tenant.iml
+++ b/tenant/killbill-tenant.iml
@@ -32,9 +32,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -47,8 +48,9 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />

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

diff --git a/tenant/pom.xml b/tenant/pom.xml
index 4ad953c..b656ab4 100644
--- a/tenant/pom.xml
+++ b/tenant/pom.xml
@@ -74,6 +74,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>
diff --git a/usage/killbill-usage.iml b/usage/killbill-usage.iml
index 5676b9d..a2d724f 100644
--- a/usage/killbill-usage.iml
+++ b/usage/killbill-usage.iml
@@ -31,9 +31,10 @@
     <orderEntry type="library" name="Maven: com.jolbox:bonecp:0.7.1.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.2" level="project" />
     <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.3.3" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
@@ -46,8 +47,9 @@
     <orderEntry type="library" name="Maven: javax.mail:mail:1.4.1" level="project" />
     <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
     <orderEntry type="module" module-name="killbill-util" scope="TEST" production-on-test="" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.3.7-SNAPSHOT" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing:killbill-util:test-jar:tests:0.4.1-SNAPSHOT" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj:5.0.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-mxj-db-files:5.0.12" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />

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

diff --git a/usage/pom.xml b/usage/pom.xml
index f7bd2ef..99f6f1e 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -69,6 +69,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>
diff --git a/util/killbill-util.iml b/util/killbill-util.iml
index 85ba252..77b0001 100644
--- a/util/killbill-util.iml
+++ b/util/killbill-util.iml
@@ -38,14 +38,16 @@
     <orderEntry type="module" module-name="killbill-internal-api" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-payment:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: org.skife.config:config-magic:0.14" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.0" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.0" level="project" />
-    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-clock:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-clock:test-jar:tests:0.2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-embeddeddb:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-locker:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-queue:0.2.1" level="project" />
+    <orderEntry type="library" name="Maven: com.ning.billing.commons:killbill-jdbi:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: org.jdbi:jdbi:2.39.1" level="project" />
     <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
     <orderEntry type="library" name="Maven: org.weakref:jmxutils:1.12" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.ning.billing.commons:killbill-queue:test-jar:tests:0.2.1" level="project" />
     <orderEntry type="library" name="Maven: com.ning.billing.plugin:killbill-plugin-api-notification:0.3.0" level="project" />
     <orderEntry type="library" name="Maven: com.samskivert:jmustache:1.5" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: mysql:mysql-connector-java:5.1.22" level="project" />

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

diff --git a/util/pom.xml b/util/pom.xml
index b1c7a7a..7af8373 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -89,6 +89,15 @@
         </dependency>
         <dependency>
             <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-embeddeddb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
+            <artifactId>killbill-locker</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ning.billing.commons</groupId>
             <artifactId>killbill-queue</artifactId>
         </dependency>
         <dependency>
diff --git a/util/src/main/java/com/ning/billing/util/glue/GlobalLockerModule.java b/util/src/main/java/com/ning/billing/util/glue/GlobalLockerModule.java
index c0245ac..b32bce2 100644
--- a/util/src/main/java/com/ning/billing/util/glue/GlobalLockerModule.java
+++ b/util/src/main/java/com/ning/billing/util/glue/GlobalLockerModule.java
@@ -16,8 +16,7 @@
 
 package com.ning.billing.util.glue;
 
-import com.ning.billing.util.globallocker.GlobalLocker;
-import com.ning.billing.util.globallocker.MySqlGlobalLocker;
+import com.ning.billing.commons.locker.GlobalLocker;
 
 import com.google.inject.AbstractModule;
 
@@ -25,6 +24,6 @@ public class GlobalLockerModule extends AbstractModule {
 
     @Override
     protected void configure() {
-        bind(GlobalLocker.class).to(MySqlGlobalLocker.class).asEagerSingleton();
+        bind(GlobalLocker.class).toProvider(MySqlGlobalLockerProvider.class).asEagerSingleton();
     }
 }
diff --git a/util/src/test/java/com/ning/billing/dbi/DBIProvider.java b/util/src/test/java/com/ning/billing/dbi/DBIProvider.java
index a54ee30..824e50e 100644
--- a/util/src/test/java/com/ning/billing/dbi/DBIProvider.java
+++ b/util/src/test/java/com/ning/billing/dbi/DBIProvider.java
@@ -16,8 +16,6 @@
 
 package com.ning.billing.dbi;
 
-import java.util.concurrent.TimeUnit;
-
 import javax.sql.DataSource;
 
 import org.skife.jdbi.v2.DBI;
@@ -39,24 +37,15 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
 
 public class DBIProvider implements Provider<IDBI> {
 
-    private final String jdbcUri;
-    private final String userName;
-    private final String userPwd;
+    private final DataSource ds;
 
     @Inject
-    public DBIProvider(final DbiConfig config) {
-        this(config.getJdbcUrl(), config.getUsername(), config.getPassword());
-    }
-
-    public DBIProvider(final String jdbcUri, final String userName, final String userPwd) {
-        this.jdbcUri = jdbcUri;
-        this.userName = userName;
-        this.userPwd = userPwd;
+    public DBIProvider(final DataSource ds) {
+        this.ds = ds;
     }
 
     @Override
     public IDBI get() {
-        final DataSource ds = getC3P0DataSource();
         final DBI dbi = new DBI(ds);
         dbi.registerArgumentFactory(new UUIDArgumentFactory());
         dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory());
@@ -72,29 +61,4 @@ public class DBIProvider implements Provider<IDBI> {
 
         return dbi;
     }
-
-
-
-    private DataSource getBoneCPDatSource() {
-        final BoneCPConfig dbConfig = new BoneCPConfig();
-        dbConfig.setJdbcUrl(jdbcUri);
-        dbConfig.setUsername(userName);
-        dbConfig.setPassword(userPwd);
-        dbConfig.setPartitionCount(1);
-        //dbConfig.setDefaultTransactionIsolation("READ_COMMITTED");
-        dbConfig.setDisableJMX(false);
-
-        final BoneCPDataSource ds = new BoneCPDataSource(dbConfig);
-        return ds;
-    }
-
-    private DataSource getC3P0DataSource() {
-        ComboPooledDataSource cpds = new ComboPooledDataSource();
-        cpds.setJdbcUrl(jdbcUri);
-        cpds.setUser(userName);
-        cpds.setPassword(userPwd);
-        cpds.setMinPoolSize(1);
-        cpds.setMaxPoolSize(10);
-        return cpds;
-    }
 }
diff --git a/util/src/test/java/com/ning/billing/GuicyKillbillTestNoDBModule.java b/util/src/test/java/com/ning/billing/GuicyKillbillTestNoDBModule.java
index 265f94e..77adf8d 100644
--- a/util/src/test/java/com/ning/billing/GuicyKillbillTestNoDBModule.java
+++ b/util/src/test/java/com/ning/billing/GuicyKillbillTestNoDBModule.java
@@ -16,20 +16,11 @@
 
 package com.ning.billing;
 
-
 import org.mockito.Mockito;
 import org.skife.jdbi.v2.IDBI;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ning.billing.dbi.DBTestingHelper;
-import com.ning.billing.dbi.H2TestingHelper;
-import com.ning.billing.dbi.MysqlTestingHelper;
 
 public class GuicyKillbillTestNoDBModule extends GuicyKillbillTestModule {
 
-    private final static Logger log = LoggerFactory.getLogger(GuicyKillbillTestNoDBModule.class);
-
     private void installDBI() {
         final IDBI idbi = Mockito.mock(IDBI.class);
         bind(IDBI.class).toInstance(idbi);
diff --git a/util/src/test/java/com/ning/billing/GuicyKillbillTestSuiteWithEmbeddedDB.java b/util/src/test/java/com/ning/billing/GuicyKillbillTestSuiteWithEmbeddedDB.java
index cfc6f22..1ac9403 100644
--- a/util/src/test/java/com/ning/billing/GuicyKillbillTestSuiteWithEmbeddedDB.java
+++ b/util/src/test/java/com/ning/billing/GuicyKillbillTestSuiteWithEmbeddedDB.java
@@ -17,6 +17,7 @@
 package com.ning.billing;
 
 import javax.inject.Inject;
+import javax.sql.DataSource;
 
 import org.skife.jdbi.v2.IDBI;
 import org.slf4j.Logger;
@@ -25,34 +26,30 @@ import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.BeforeSuite;
 
-import com.ning.billing.dbi.DBTestingHelper;
+import com.ning.billing.commons.embeddeddb.EmbeddedDB;
 
 public class GuicyKillbillTestSuiteWithEmbeddedDB extends GuicyKillbillTestSuite {
 
-    private static final Logger log = LoggerFactory.getLogger(KillbillTestSuiteWithEmbeddedDB.class);
+    private static final Logger log = LoggerFactory.getLogger(GuicyKillbillTestSuiteWithEmbeddedDB.class);
 
     @Inject
-    protected DBTestingHelper helper;
+    protected EmbeddedDB helper;
 
-    public DBTestingHelper getDBTestingHelper() {
-        return GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper();
-    }
+    @Inject
+    protected DataSource dataSource;
 
-    public IDBI getDBI() {
-        return GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper().getDBI();
-    }
+    @Inject
+    protected IDBI dbi;
 
     @BeforeSuite(groups = {"slow", "mysql"})
     public void beforeSuite() throws Exception {
-        GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper().start();
-        GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper().initDb();
-        GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper().cleanupAllTables();
+        DBTestingHelper.start();
     }
 
     @BeforeMethod(groups = {"slow", "mysql"})
     public void beforeMethod() throws Exception {
         try {
-            GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper().cleanupAllTables();
+            DBTestingHelper.get().cleanupAllTables();
         } catch (Exception ignored) {
         }
     }
@@ -62,13 +59,13 @@ public class GuicyKillbillTestSuiteWithEmbeddedDB extends GuicyKillbillTestSuite
         if (hasFailed()) {
             log.error("**********************************************************************************************");
             log.error("*** TESTS HAVE FAILED - LEAVING DB RUNNING FOR DEBUGGING - MAKE SURE TO KILL IT ONCE DONE ****");
-            log.error(GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper().getConnectionString());
+            log.error(DBTestingHelper.get().getCmdLineConnectionString());
             log.error("**********************************************************************************************");
             return;
         }
 
         try {
-            GuicyKillbillTestWithEmbeddedDBModule.getDBTestingHelper().stop();
+            DBTestingHelper.get().stop();
         } catch (Exception ignored) {
         }
     }
diff --git a/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java b/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java
index c5567a1..43810bd 100644
--- a/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java
+++ b/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java
@@ -16,38 +16,29 @@
 
 package com.ning.billing;
 
+import java.io.IOException;
+
+import javax.sql.DataSource;
 
 import org.skife.jdbi.v2.IDBI;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.testng.Assert;
 
-import com.ning.billing.dbi.DBTestingHelper;
-import com.ning.billing.dbi.H2TestingHelper;
-import com.ning.billing.dbi.MysqlTestingHelper;
+import com.ning.billing.commons.embeddeddb.EmbeddedDB;
 
 public class GuicyKillbillTestWithEmbeddedDBModule extends GuicyKillbillTestModule {
 
-    private static final Logger log = LoggerFactory.getLogger(GuicyKillbillTestWithEmbeddedDBModule.class);
-
-    private static final DBTestingHelper instance = getDBTestingHelper();
-
-    public static synchronized DBTestingHelper getDBTestingHelper() {
-        if (instance == null) {
-            if ("true".equals(System.getProperty("com.ning.billing.dbi.test.h2"))) {
-                log.info("Using h2 as the embedded database");
-                return new H2TestingHelper();
-            } else {
-                log.info("Using MySQL as the embedded database");
-                return new MysqlTestingHelper();
-            }
-        }
-        return instance;
-    }
-
     @Override
     protected void configure() {
         super.configure();
-        bind(DBTestingHelper.class).toInstance(instance);
-        bind(IDBI.class).toInstance(instance.getDBI());
+
+        final EmbeddedDB instance = DBTestingHelper.get();
+        bind(EmbeddedDB.class).toInstance(instance);
+
+        try {
+            bind(DataSource.class).toInstance(DBTestingHelper.get().getDataSource());
+            bind(IDBI.class).toInstance(DBTestingHelper.getDBI());
+        } catch (IOException e) {
+            Assert.fail(e.toString());
+        }
     }
 }
diff --git a/util/src/test/java/com/ning/billing/KillbillTestSuiteWithEmbeddedDB.java b/util/src/test/java/com/ning/billing/KillbillTestSuiteWithEmbeddedDB.java
index 20d2451..0ac8b85 100644
--- a/util/src/test/java/com/ning/billing/KillbillTestSuiteWithEmbeddedDB.java
+++ b/util/src/test/java/com/ning/billing/KillbillTestSuiteWithEmbeddedDB.java
@@ -27,45 +27,19 @@ import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.BeforeSuite;
 
-import com.ning.billing.dbi.DBTestingHelper;
-import com.ning.billing.dbi.H2TestingHelper;
-import com.ning.billing.dbi.MysqlTestingHelper;
-
 public class KillbillTestSuiteWithEmbeddedDB extends KillbillTestSuite {
 
     private static final Logger log = LoggerFactory.getLogger(KillbillTestSuiteWithEmbeddedDB.class);
 
-    protected static DBTestingHelper helper;
-
-    static {
-        if ("true".equals(System.getProperty("com.ning.billing.dbi.test.h2"))) {
-            log.info("Using h2 as the embedded database");
-            helper = new H2TestingHelper();
-        } else {
-            log.info("Using MySQL as the embedded database");
-            helper = new MysqlTestingHelper();
-        }
-    }
-
-    public static DBTestingHelper getDBTestingHelper() {
-        return helper;
-    }
-
-    public static IDBI getDBI() {
-        return helper.getDBI();
-    }
-
     @BeforeSuite(groups = {"slow", "mysql"})
     public void startMysqlBeforeTestSuite() throws IOException, ClassNotFoundException, SQLException, URISyntaxException {
-        helper.start();
-        helper.initDb();
-        helper.cleanupAllTables();
+        DBTestingHelper.start();
     }
 
     @BeforeMethod(groups = {"slow", "mysql"})
     public void cleanupTablesBetweenMethods() {
         try {
-            helper.cleanupAllTables();
+            DBTestingHelper.get().cleanupAllTables();
         } catch (Exception ignored) {
         }
     }
@@ -75,13 +49,13 @@ public class KillbillTestSuiteWithEmbeddedDB extends KillbillTestSuite {
         if (hasFailed()) {
             log.error("**********************************************************************************************");
             log.error("*** TESTS HAVE FAILED - LEAVING DB RUNNING FOR DEBUGGING - MAKE SURE TO KILL IT ONCE DONE ****");
-            log.error(helper.getConnectionString());
+            log.error(DBTestingHelper.get().getCmdLineConnectionString());
             log.error("**********************************************************************************************");
             return;
         }
 
         try {
-            helper.stop();
+            DBTestingHelper.get().stop();
         } catch (Exception ignored) {
         }
     }
diff --git a/util/src/test/java/com/ning/billing/mock/glue/MockGlobalLockerModule.java b/util/src/test/java/com/ning/billing/mock/glue/MockGlobalLockerModule.java
index 03fd184..5457791 100644
--- a/util/src/test/java/com/ning/billing/mock/glue/MockGlobalLockerModule.java
+++ b/util/src/test/java/com/ning/billing/mock/glue/MockGlobalLockerModule.java
@@ -16,8 +16,8 @@
 
 package com.ning.billing.mock.glue;
 
-import com.ning.billing.util.globallocker.GlobalLocker;
-import com.ning.billing.util.globallocker.MockGlobalLocker;
+import com.ning.billing.commons.locker.GlobalLocker;
+import com.ning.billing.commons.locker.memory.MemoryGlobalLocker;
 
 import com.google.inject.AbstractModule;
 
@@ -25,6 +25,6 @@ public class MockGlobalLockerModule extends AbstractModule {
 
     @Override
     protected void configure() {
-        bind(GlobalLocker.class).to(MockGlobalLocker.class).asEagerSingleton();
+        bind(GlobalLocker.class).to(MemoryGlobalLocker.class).asEagerSingleton();
     }
 }
diff --git a/util/src/test/java/com/ning/billing/util/audit/dao/TestDefaultAuditDao.java b/util/src/test/java/com/ning/billing/util/audit/dao/TestDefaultAuditDao.java
index 6fbc2a9..bdee1c6 100644
--- a/util/src/test/java/com/ning/billing/util/audit/dao/TestDefaultAuditDao.java
+++ b/util/src/test/java/com/ning/billing/util/audit/dao/TestDefaultAuditDao.java
@@ -45,7 +45,7 @@ public class TestDefaultAuditDao extends UtilTestSuiteWithEmbeddedDB {
         addTag();
 
         // Verify we get an audit entry for the tag_history table
-        final Handle handle = getDBI().open();
+        final Handle handle = dbi.open();
         final String tagHistoryString = (String) handle.select("select id from tag_history limit 1").get(0).get("id");
         handle.close();
 
diff --git a/util/src/test/java/com/ning/billing/util/cache/TestCache.java b/util/src/test/java/com/ning/billing/util/cache/TestCache.java
index 07680f1..f1c4570 100644
--- a/util/src/test/java/com/ning/billing/util/cache/TestCache.java
+++ b/util/src/test/java/com/ning/billing/util/cache/TestCache.java
@@ -73,7 +73,7 @@ public class TestCache extends UtilTestSuiteWithEmbeddedDB {
     @Test(groups = "slow")
     public void testCacheRecordId() throws Exception {
 
-        this.transactionalSqlDao = new EntitySqlDaoTransactionalJdbiWrapper(getDBI(), clock, controlCacheDispatcher, nonEntityDao);
+        this.transactionalSqlDao = new EntitySqlDaoTransactionalJdbiWrapper(dbi, clock, controlCacheDispatcher, nonEntityDao);
         final TagModelDao tag = new TagModelDao(clock.getUTCNow(), UUID.randomUUID(), UUID.randomUUID(), ObjectType.TAG);
 
         // Verify we start with nothing in the cache
diff --git a/util/src/test/java/com/ning/billing/util/callcontext/TestInternalCallContextFactory.java b/util/src/test/java/com/ning/billing/util/callcontext/TestInternalCallContextFactory.java
index 0508da6..edfb7e8 100644
--- a/util/src/test/java/com/ning/billing/util/callcontext/TestInternalCallContextFactory.java
+++ b/util/src/test/java/com/ning/billing/util/callcontext/TestInternalCallContextFactory.java
@@ -40,7 +40,7 @@ public class TestInternalCallContextFactory extends UtilTestSuiteWithEmbeddedDB 
         final UUID invoiceId = UUID.randomUUID();
         final Long accountRecordId = 19384012L;
 
-        getDBI().withHandle(new HandleCallback<Void>() {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 handle.execute("DROP TABLE IF EXISTS invoices;\n" +
@@ -75,7 +75,7 @@ public class TestInternalCallContextFactory extends UtilTestSuiteWithEmbeddedDB 
         final UUID accountId = UUID.randomUUID();
         final Long accountRecordId = 19384012L;
 
-        getDBTestingHelper().getDBI().withHandle(new HandleCallback<Void>() {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 // Note: we always create an accounts table, see MysqlTestingHelper
diff --git a/util/src/test/java/com/ning/billing/util/customfield/api/TestDefaultCustomFieldUserApi.java b/util/src/test/java/com/ning/billing/util/customfield/api/TestDefaultCustomFieldUserApi.java
index ac85be2..6fe8609 100644
--- a/util/src/test/java/com/ning/billing/util/customfield/api/TestDefaultCustomFieldUserApi.java
+++ b/util/src/test/java/com/ning/billing/util/customfield/api/TestDefaultCustomFieldUserApi.java
@@ -41,7 +41,7 @@ public class TestDefaultCustomFieldUserApi extends UtilTestSuiteWithEmbeddedDB {
         final UUID accountId = UUID.randomUUID();
         final Long accountRecordId = 19384012L;
 
-        getDBI().withHandle(new HandleCallback<Void>() {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 // Note: we always create an accounts table, see MysqlTestingHelper
@@ -60,7 +60,7 @@ public class TestDefaultCustomFieldUserApi extends UtilTestSuiteWithEmbeddedDB {
         Assert.assertEquals(customFields.size(), 1);
         Assert.assertEquals(customFields.get(0), customField);
         // Verify the account_record_id was populated
-        getDBTestingHelper().getDBI().withHandle(new HandleCallback<Void>() {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 final List<Map<String, Object>> values = handle.select("select account_record_id from custom_fields where object_id = ?", accountId.toString());
diff --git a/util/src/test/java/com/ning/billing/util/dao/TestNonEntityDao.java b/util/src/test/java/com/ning/billing/util/dao/TestNonEntityDao.java
index 153968f..efbe509 100644
--- a/util/src/test/java/com/ning/billing/util/dao/TestNonEntityDao.java
+++ b/util/src/test/java/com/ning/billing/util/dao/TestNonEntityDao.java
@@ -16,6 +16,7 @@
 
 package com.ning.billing.util.dao;
 
+import java.io.IOException;
 import java.util.Date;
 import java.util.UUID;
 
@@ -47,8 +48,7 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
 
 
     @Test(groups = "slow")
-    public void testRetrieveRecordIdFromObject() {
-
+    public void testRetrieveRecordIdFromObject() throws IOException {
         insertAccount();
 
         final Long resultRecordId = nonEntityDao.retrieveRecordIdFromObject(accountId, ObjectType.ACCOUNT, null);
@@ -56,8 +56,7 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
     }
 
     @Test(groups = "slow")
-    public void testRetrieveAccountRecordIdFromAccountObject() {
-
+    public void testRetrieveAccountRecordIdFromAccountObject() throws IOException {
         insertAccount();
 
         final Long resultAccountRecordId = nonEntityDao.retrieveAccountRecordIdFromObject(accountId, ObjectType.ACCOUNT, null);
@@ -66,8 +65,7 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
 
 
     @Test(groups = "slow")
-    public void testRetrieveAccountRecordIdFromTagDefinitionObject() {
-
+    public void testRetrieveAccountRecordIdFromTagDefinitionObject() throws IOException {
         insertTagDefinition();
 
         final Long resultAccountRecordId = nonEntityDao.retrieveAccountRecordIdFromObject(tagDefinitionId, ObjectType.TAG_DEFINITION, null);
@@ -76,8 +74,7 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
 
     // Not Tag_definition or account which are special
     @Test(groups = "slow")
-    public void testRetrieveAccountRecordIdFromOtherObject() {
-
+    public void testRetrieveAccountRecordIdFromOtherObject() throws IOException {
         insertTag();
 
         final Long resultAccountRecordId = nonEntityDao.retrieveAccountRecordIdFromObject(tagId, ObjectType.TAG, null);
@@ -85,8 +82,7 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
     }
 
     @Test(groups = "slow")
-    public void testRetrieveTenantRecordIdFromObject() {
-
+    public void testRetrieveTenantRecordIdFromObject() throws IOException {
         insertAccount();
 
         final Long resultTenantRecordId = nonEntityDao.retrieveTenantRecordIdFromObject(accountId, ObjectType.ACCOUNT, null);
@@ -94,15 +90,14 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
     }
 
     @Test(groups = "slow")
-    public void testRetrieveTenantRecordIdFromTenantObject() {
-
+    public void testRetrieveTenantRecordIdFromTenantObject() throws IOException {
         insertTenant();
 
         final Long resultTenantRecordId = nonEntityDao.retrieveTenantRecordIdFromObject(tenantId, ObjectType.TENANT, null);
         Assert.assertEquals(resultTenantRecordId, tenantRecordId);
     }
-    private void insertAccount() {
-        getDBI().withHandle(new HandleCallback<Void>() {
+    private void insertAccount() throws IOException {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 // Note: we always create an accounts table, see MysqlTestingHelper
@@ -113,8 +108,8 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
         });
     }
 
-    private void insertHistoryAccount() {
-        getDBI().withHandle(new HandleCallback<Void>() {
+    private void insertHistoryAccount() throws IOException {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 // Note: we always create an accounts table, see MysqlTestingHelper
@@ -126,8 +121,8 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
     }
 
 
-    private void insertTagDefinition() {
-        getDBI().withHandle(new HandleCallback<Void>() {
+    private void insertTagDefinition() throws IOException {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 // Note: we always create an accounts table, see MysqlTestingHelper
@@ -138,8 +133,8 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
         });
     }
 
-    private void insertTag() {
-        getDBI().withHandle(new HandleCallback<Void>() {
+    private void insertTag() throws IOException {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 // Note: we always create an accounts table, see MysqlTestingHelper
@@ -150,8 +145,8 @@ public class TestNonEntityDao extends UtilTestSuiteWithEmbeddedDB {
         });
     }
 
-    private void insertTenant() {
-        getDBI().withHandle(new HandleCallback<Void>() {
+    private void insertTenant() throws IOException {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 // Note: we always create an accounts table, see MysqlTestingHelper
diff --git a/util/src/test/java/com/ning/billing/util/dao/TestStringTemplateInheritanceWithJdbi.java b/util/src/test/java/com/ning/billing/util/dao/TestStringTemplateInheritanceWithJdbi.java
index ef86f5b..24abcd5 100644
--- a/util/src/test/java/com/ning/billing/util/dao/TestStringTemplateInheritanceWithJdbi.java
+++ b/util/src/test/java/com/ning/billing/util/dao/TestStringTemplateInheritanceWithJdbi.java
@@ -42,7 +42,7 @@ public class TestStringTemplateInheritanceWithJdbi extends UtilTestSuiteWithEmbe
 
     @Test(groups = "slow")
     public void testInheritQueries() throws Exception {
-        final KombuchaSqlDao dao = getDBI().onDemand(KombuchaSqlDao.class);
+        final KombuchaSqlDao dao = dbi.onDemand(KombuchaSqlDao.class);
 
         // Verify non inherited template
         Assert.assertEquals(dao.isIsTimeForKombucha(), clock.getUTCNow().getHourOfDay() == 17);
diff --git a/util/src/test/java/com/ning/billing/util/export/dao/TestDatabaseExportDao.java b/util/src/test/java/com/ning/billing/util/export/dao/TestDatabaseExportDao.java
index 9e2184b..17739b1 100644
--- a/util/src/test/java/com/ning/billing/util/export/dao/TestDatabaseExportDao.java
+++ b/util/src/test/java/com/ning/billing/util/export/dao/TestDatabaseExportDao.java
@@ -50,7 +50,7 @@ public class TestDatabaseExportDao extends UtilTestSuiteWithEmbeddedDB {
 
         final String tableNameA = "test_database_export_dao_a";
         final String tableNameB = "test_database_export_dao_b";
-        getDBTestingHelper().getDBI().withHandle(new HandleCallback<Void>() {
+        dbi.withHandle(new HandleCallback<Void>() {
             @Override
             public Void withHandle(final Handle handle) throws Exception {
                 handle.execute("drop table if exists " + tableNameA);
diff --git a/util/src/test/java/com/ning/billing/util/globallocker/TestGlobalLockerModule.java b/util/src/test/java/com/ning/billing/util/globallocker/TestGlobalLockerModule.java
index 5b0acad..06bdd94 100644
--- a/util/src/test/java/com/ning/billing/util/globallocker/TestGlobalLockerModule.java
+++ b/util/src/test/java/com/ning/billing/util/globallocker/TestGlobalLockerModule.java
@@ -16,8 +16,7 @@
 
 package com.ning.billing.util.globallocker;
 
-import com.ning.billing.dbi.DBTestingHelper;
-import com.ning.billing.dbi.DBTestingHelper.DBEngine;
+import com.ning.billing.commons.embeddeddb.EmbeddedDB;
 import com.ning.billing.mock.glue.MockGlobalLockerModule;
 import com.ning.billing.util.glue.GlobalLockerModule;
 
@@ -25,15 +24,15 @@ import com.google.inject.AbstractModule;
 
 public class TestGlobalLockerModule extends AbstractModule {
 
-    private final DBTestingHelper helper;
+    private final EmbeddedDB helper;
 
-    public TestGlobalLockerModule(final DBTestingHelper helper) {
+    public TestGlobalLockerModule(final EmbeddedDB helper) {
         this.helper = helper;
     }
 
     @Override
     protected void configure() {
-        if (DBEngine.MYSQL.equals(helper.getDBEngine())) {
+        if (EmbeddedDB.DBEngine.MYSQL.equals(helper.getDBEngine())) {
             install(new GlobalLockerModule());
         } else {
             install(new MockGlobalLockerModule());
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 8682bc5..f6d695a 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
@@ -16,6 +16,7 @@
 
 package com.ning.billing.util.globallocker;
 
+import java.io.IOException;
 import java.util.UUID;
 
 import org.skife.jdbi.v2.Handle;
@@ -24,21 +25,23 @@ import org.skife.jdbi.v2.TransactionStatus;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import com.ning.billing.commons.locker.GlobalLock;
+import com.ning.billing.commons.locker.GlobalLocker;
+import com.ning.billing.commons.locker.LockFailedException;
+import com.ning.billing.commons.locker.mysql.MySqlGlobalLocker;
 import com.ning.billing.util.UtilTestSuiteWithEmbeddedDB;
-import com.ning.billing.util.globallocker.GlobalLocker.LockerType;
 
 public class TestMysqlGlobalLocker extends UtilTestSuiteWithEmbeddedDB {
 
-
     // Used as a manual test to validate the simple DAO by stepping through that locking is done and release correctly
     @Test(groups = "mysql")
-    public void testSimpleLocking() {
+    public void testSimpleLocking() throws IOException, LockFailedException {
         final String lockName = UUID.randomUUID().toString();
 
-        final GlobalLocker locker = new MySqlGlobalLocker(getDBI());
-        final GlobalLock lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName, 3);
+        final GlobalLocker locker = new MySqlGlobalLocker(dataSource);
+        final GlobalLock lock = locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS.toString(), lockName, 3);
 
-        getDBI().inTransaction(new TransactionCallback<Void>() {
+        dbi.inTransaction(new TransactionCallback<Void>() {
             @Override
             public Void inTransaction(final Handle conn, final TransactionStatus status)
                     throws Exception {
@@ -46,11 +49,11 @@ public class TestMysqlGlobalLocker extends UtilTestSuiteWithEmbeddedDB {
                 return null;
             }
         });
-        Assert.assertEquals(locker.isFree(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName), Boolean.FALSE);
+        Assert.assertEquals(locker.isFree(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS.toString(), lockName), false);
 
         boolean gotException = false;
         try {
-            locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName, 1);
+            locker.lockWithNumberOfTries(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS.toString(), lockName, 1);
         } catch (LockFailedException e) {
             gotException = true;
         }
@@ -58,6 +61,6 @@ public class TestMysqlGlobalLocker extends UtilTestSuiteWithEmbeddedDB {
 
         lock.release();
 
-        Assert.assertEquals(locker.isFree(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS, lockName), Boolean.TRUE);
+        Assert.assertEquals(locker.isFree(LockerType.ACCOUNT_FOR_INVOICE_PAYMENTS.toString(), lockName), true);
     }
 }
diff --git a/util/src/test/java/com/ning/billing/util/validation/TestValidationManager.java b/util/src/test/java/com/ning/billing/util/validation/TestValidationManager.java
index c7c8803..c639fbb 100644
--- a/util/src/test/java/com/ning/billing/util/validation/TestValidationManager.java
+++ b/util/src/test/java/com/ning/billing/util/validation/TestValidationManager.java
@@ -41,9 +41,9 @@ public class TestValidationManager extends UtilTestSuiteWithEmbeddedDB {
     @BeforeClass(groups = "slow")
     public void beforeClass() throws Exception {
         super.beforeClass();
-        final DatabaseSchemaDao dao = new DatabaseSchemaDao(getDBI());
+        final DatabaseSchemaDao dao = new DatabaseSchemaDao(dbi);
         vm = new ValidationManager(dao);
-        vm.loadSchemaInformation(helper.getDbName());
+        vm.loadSchemaInformation(helper.getDatabaseName());
     }