killbill-aplcache
Changes
beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestBillingAlignment.java 1(+0 -1)
beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java 1(+0 -1)
beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithOverdueEnforcementOffTag.java 1(+0 -1)
beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithSubscriptionCancellation.java 1(+0 -1)
beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java 1(+0 -1)
beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java 1(+0 -1)
catalog/src/test/resources/SpyCarBasic.xml 175(+175 -0)
invoice/src/test/java/com/ning/billing/invoice/notification/TestNextBillingDateNotifier.java 3(+1 -2)
payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginModule.java 9(+7 -2)
payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java 4(+2 -2)
util/src/main/resources/ehcache.xml 1(+1 -0)
Details
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/BeatrixTestSuiteWithEmbeddedDB.java b/beatrix/src/test/java/com/ning/billing/beatrix/BeatrixTestSuiteWithEmbeddedDB.java
index 0fb5713..f6cd068 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/BeatrixTestSuiteWithEmbeddedDB.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/BeatrixTestSuiteWithEmbeddedDB.java
@@ -16,7 +16,7 @@
package com.ning.billing.beatrix;
-import com.ning.billing.KillbillTestSuiteWithEmbeddedDB;
+import com.ning.billing.GuicyKillbillTestSuiteWithEmbeddedDB;
-public abstract class BeatrixTestSuiteWithEmbeddedDB extends KillbillTestSuiteWithEmbeddedDB {
+public abstract class BeatrixTestSuiteWithEmbeddedDB extends GuicyKillbillTestSuiteWithEmbeddedDB {
}
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/BeatrixIntegrationModule.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/BeatrixIntegrationModule.java
index 076e883..35acacf 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/BeatrixIntegrationModule.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/BeatrixIntegrationModule.java
@@ -20,10 +20,7 @@ import java.io.IOException;
import java.net.URL;
import java.util.Set;
-import org.skife.config.ConfigurationObjectFactory;
-import org.skife.jdbi.v2.IDBI;
-
-import com.ning.billing.KillbillTestSuiteWithEmbeddedDB;
+import com.ning.billing.GuicyKillbillTestWithEmbeddedDBModule;
import com.ning.billing.account.api.AccountService;
import com.ning.billing.account.glue.DefaultAccountModule;
import com.ning.billing.analytics.setup.AnalyticsModule;
@@ -42,9 +39,6 @@ import com.ning.billing.beatrix.util.PaymentChecker;
import com.ning.billing.beatrix.util.RefundChecker;
import com.ning.billing.catalog.api.CatalogService;
import com.ning.billing.catalog.glue.CatalogModule;
-import com.ning.billing.dbi.DBIProvider;
-import com.ning.billing.dbi.DBTestingHelper;
-import com.ning.billing.dbi.DbiConfig;
import com.ning.billing.entitlement.api.EntitlementService;
import com.ning.billing.entitlement.glue.DefaultEntitlementModule;
import com.ning.billing.invoice.api.InvoiceService;
@@ -59,18 +53,16 @@ import com.ning.billing.payment.glue.PaymentModule;
import com.ning.billing.payment.provider.MockPaymentProviderPluginModule;
import com.ning.billing.tenant.glue.TenantModule;
import com.ning.billing.usage.glue.UsageModule;
-import com.ning.billing.util.clock.Clock;
-import com.ning.billing.util.clock.ClockMock;
import com.ning.billing.util.config.PaymentConfig;
import com.ning.billing.util.email.EmailModule;
import com.ning.billing.util.email.templates.TemplateModule;
-import com.ning.billing.util.globallocker.TestGlobalLockerModule;
import com.ning.billing.util.glue.AuditModule;
import com.ning.billing.util.glue.BusModule;
import com.ning.billing.util.glue.CacheModule;
import com.ning.billing.util.glue.CallContextModule;
import com.ning.billing.util.glue.CustomFieldModule;
import com.ning.billing.util.glue.ExportModule;
+import com.ning.billing.util.glue.GlobalLockerModule;
import com.ning.billing.util.glue.NonEntityDaoModule;
import com.ning.billing.util.glue.NotificationQueueModule;
import com.ning.billing.util.glue.TagStoreModule;
@@ -92,25 +84,14 @@ public class BeatrixIntegrationModule extends AbstractModule {
loadSystemPropertiesFromClasspath("/resource.properties");
- bind(Clock.class).to(ClockMock.class).asEagerSingleton();
- bind(ClockMock.class).asEagerSingleton();
bind(Lifecycle.class).to(SubsetDefaultLifecycle.class).asEagerSingleton();
- final DBTestingHelper helper = KillbillTestSuiteWithEmbeddedDB.getDBTestingHelper();
- final IDBI dbi;
- if (helper.isUsingLocalInstance()) {
- final DbiConfig config = new ConfigurationObjectFactory(System.getProperties()).build(DbiConfig.class);
- final DBIProvider provider = new DBIProvider(config);
- dbi = provider.get();
- } else {
- dbi = helper.getDBI();
- }
- bind(IDBI.class).toInstance(dbi);
+ install(new GuicyKillbillTestWithEmbeddedDBModule());
+ install(new GlobalLockerModule());
install(new CacheModule());
install(new EmailModule());
install(new CallContextModule());
- install(new TestGlobalLockerModule(helper));
install(new BusModule());
install(new NotificationQueueModule());
install(new TagStoreModule());
@@ -151,7 +132,7 @@ public class BeatrixIntegrationModule extends AbstractModule {
@Override
protected void installPaymentProviderPlugins(final PaymentConfig config) {
- install(new MockPaymentProviderPluginModule(PLUGIN_NAME));
+ install(new MockPaymentProviderPluginModule(PLUGIN_NAME, TestIntegrationBase.getClock()));
}
}
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestOSGIIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestOSGIIntegration.java
index 98fced0..2be1879 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestOSGIIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/osgi/TestOSGIIntegration.java
@@ -21,7 +21,6 @@ import org.testng.annotations.Test;
import com.ning.billing.beatrix.integration.BeatrixIntegrationModule;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestOSGIIntegration extends TestOSGIBase {
@Test(groups = "slow")
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestBillingAlignment.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestBillingAlignment.java
index 9177afc..c4984c9 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestBillingAlignment.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestBillingAlignment.java
@@ -33,7 +33,6 @@ import com.ning.billing.entitlement.api.user.Subscription;
import com.ning.billing.entitlement.api.user.SubscriptionBundle;
import com.ning.billing.invoice.api.InvoiceItemType;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestBillingAlignment extends TestIntegrationBase {
// TODO test fails as it should not create a proration when the chnage to annual occurs. Instaed we should restart from the data of the chnage
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
index 74d8e53..b66e107 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueIntegration.java
@@ -45,7 +45,6 @@ import static org.testng.Assert.assertTrue;
@Test(groups = "slow")
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestOverdueIntegration extends TestOverdueBase {
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithOverdueEnforcementOffTag.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithOverdueEnforcementOffTag.java
index c3bc728..687a476 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithOverdueEnforcementOffTag.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithOverdueEnforcementOffTag.java
@@ -37,7 +37,6 @@ import com.ning.billing.util.tag.ControlTagType;
import static junit.framework.Assert.assertTrue;
@Test(groups = "slow")
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestOverdueWithOverdueEnforcementOffTag extends TestOverdueBase {
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithSubscriptionCancellation.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithSubscriptionCancellation.java
index f8a92d2..2a67e46 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithSubscriptionCancellation.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/overdue/TestOverdueWithSubscriptionCancellation.java
@@ -34,7 +34,6 @@ import com.ning.billing.invoice.api.InvoiceItemType;
import com.ning.billing.util.svcapi.junction.DefaultBlockingState;
@Test(groups = "slow")
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestOverdueWithSubscriptionCancellation extends TestOverdueBase {
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java
index 302b6a8..9caa951 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestAnalytics.java
@@ -65,7 +65,6 @@ import com.ning.billing.util.tag.TagDefinition;
import static org.testng.Assert.assertTrue;
-@Guice(modules = BeatrixIntegrationModule.class)
public class TestAnalytics extends TestIntegrationBase {
private Account account;
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java
index 174b45a..bc58705 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestBundleTransfer.java
@@ -43,7 +43,6 @@ import com.ning.billing.invoice.api.InvoiceItemType;
import com.google.common.collect.ImmutableList;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestBundleTransfer extends TestIntegrationBase {
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestEntitlement.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestEntitlement.java
index ea566b0..a9f1a58 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestEntitlement.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestEntitlement.java
@@ -42,7 +42,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestEntitlement extends TestIntegrationBase {
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java
index 6287aef..b7817af 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegration.java
@@ -48,7 +48,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestIntegration extends TestIntegrationBase {
@Test(groups = "slow")
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java
index 265a751..6de9d54 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationBase.java
@@ -88,7 +88,10 @@ import com.ning.billing.util.svcsapi.bus.BusService;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
+import com.google.inject.Guice;
import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Stage;
import com.google.inject.name.Named;
import static org.testng.Assert.assertNotNull;
@@ -112,11 +115,6 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
protected static final long DELAY = 5000;
- @Inject
- protected IDBI dbi;
-
- @Inject
- protected ClockMock clock;
@Inject
protected Lifecycle lifecycle;
@@ -223,9 +221,13 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
@BeforeClass(groups = "slow")
public void setup() throws Exception {
+ final Injector g = Guice.createInjector(Stage.PRODUCTION, new BeatrixIntegrationModule());
+ g.injectMembers(this);
busHandler = new TestApiListener(this);
+
}
+
@BeforeMethod(groups = "slow")
public void setupTest() throws Exception {
log.warn("\n");
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
index 66502cb..d79e09c 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoInvoiceOffTag.java
@@ -48,7 +48,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestIntegrationWithAutoInvoiceOffTag extends TestIntegrationBase {
@Inject
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java
index d88502f..07c48e4 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestIntegrationWithAutoPayOff.java
@@ -49,7 +49,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestIntegrationWithAutoPayOff extends TestIntegrationBase {
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPaymentRefund.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPaymentRefund.java
index d77e519..f2ead6a 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPaymentRefund.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPaymentRefund.java
@@ -49,7 +49,6 @@ import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestPaymentRefund extends TestIntegrationBase {
// Setup for all tests below
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPublicBus.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPublicBus.java
index 5160880..37800f0 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPublicBus.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestPublicBus.java
@@ -37,7 +37,6 @@ import com.ning.billing.entitlement.api.user.SubscriptionData;
import com.google.common.eventbus.Subscribe;
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestPublicBus extends TestIntegrationBase {
private PublicListener publicListener;
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java
index 7e8c3f9..170f015 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/integration/TestRepairIntegration.java
@@ -49,8 +49,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-@Test(groups = "slow")
-@Guice(modules = {BeatrixIntegrationModule.class})
public class TestRepairIntegration extends TestIntegrationBase {
diff --git a/catalog/src/main/java/com/ning/billing/catalog/CreateCatalogSchema.java b/catalog/src/main/java/com/ning/billing/catalog/CreateCatalogSchema.java
new file mode 100644
index 0000000..1ccaf64
--- /dev/null
+++ b/catalog/src/main/java/com/ning/billing/catalog/CreateCatalogSchema.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2010-2011 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.catalog;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+
+import com.ning.billing.util.config.catalog.XMLSchemaGenerator;
+
+public class CreateCatalogSchema {
+
+ /**
+ * @param args
+ */
+ public static void main(final String[] args) throws Exception {
+ if (args.length != 1) {
+ System.err.println("Usage: <filepath>");
+ System.exit(0);
+ }
+
+ final File f = new File(args[0]);
+ final Writer w = new FileWriter(f);
+ w.write(XMLSchemaGenerator.xmlSchemaAsString(StandaloneCatalog.class));
+ w.close();
+
+ }
+
+}
diff --git a/catalog/src/main/java/com/ning/billing/catalog/LoadCatalog.java b/catalog/src/main/java/com/ning/billing/catalog/LoadCatalog.java
new file mode 100644
index 0000000..6cabe57
--- /dev/null
+++ b/catalog/src/main/java/com/ning/billing/catalog/LoadCatalog.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2010-2011 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.catalog;
+
+import java.io.File;
+
+import com.ning.billing.util.config.catalog.XMLLoader;
+
+public class LoadCatalog {
+ public static void main(final String[] args) throws Exception {
+ if (args.length != 1) {
+ System.err.println("Usage: <catalog filepath>");
+ System.exit(0);
+ }
+ File file = new File(args[0]);
+ if(!file.exists()) {
+ System.err.println("Error: '" + args[0] + "' does not exist");
+ }
+ StandaloneCatalog catalog = XMLLoader.getObjectFromUri(file.toURI(), StandaloneCatalog.class);
+ if (catalog != null) {
+ System.out.println("Success: Catalog loads!");
+ }
+ }
+
+}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java b/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java
index dd50f9d..a9d1b03 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2013 Ning, Inc.
+ * Copyright 2010-2011 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
@@ -19,19 +19,18 @@ package com.ning.billing.catalog.io;
import org.testng.Assert;
import org.testng.annotations.Test;
+import com.google.common.io.Resources;
import com.ning.billing.catalog.CatalogTestSuiteNoDB;
import com.ning.billing.catalog.StandaloneCatalog;
import com.ning.billing.util.config.catalog.XMLLoader;
-import com.google.common.io.Resources;
-
public class TestXMLReader extends CatalogTestSuiteNoDB {
-
@Test(groups = "fast")
public void testCatalogLoad() {
try {
XMLLoader.getObjectFromString(Resources.getResource("WeaponsHire.xml").toExternalForm(), StandaloneCatalog.class);
XMLLoader.getObjectFromString(Resources.getResource("WeaponsHireSmall.xml").toExternalForm(), StandaloneCatalog.class);
+ XMLLoader.getObjectFromString(Resources.getResource("SpyCarBasic.xml").toExternalForm(), StandaloneCatalog.class);
} catch (Exception e) {
Assert.fail(e.toString());
}
catalog/src/test/resources/SpyCarBasic.xml 175(+175 -0)
diff --git a/catalog/src/test/resources/SpyCarBasic.xml b/catalog/src/test/resources/SpyCarBasic.xml
new file mode 100644
index 0000000..7db7465
--- /dev/null
+++ b/catalog/src/test/resources/SpyCarBasic.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ ~ 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.
+ -->
+
+<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="CatalogSchema.xsd ">
+
+ <effectiveDate>2013-02-08T00:00:00+00:00</effectiveDate>
+ <catalogName>SpyCarBasic</catalogName>
+
+ <currencies>
+ <currency>USD</currency>
+ <currency>GBP</currency>
+ </currencies>
+
+ <products>
+ <product name="Standard">
+ <category>BASE</category>
+ </product>
+ <product name="Sports">
+ <category>BASE</category>
+ </product>
+ <product name="Super">
+ <category>BASE</category>
+ </product>
+ </products>
+
+ <rules>
+ <changePolicy>
+ <changePolicyCase>
+ <policy>IMMEDIATE</policy>
+ </changePolicyCase>
+ </changePolicy>
+ <changeAlignment>
+ <changeAlignmentCase>
+ <alignment>START_OF_BUNDLE</alignment>
+ </changeAlignmentCase>
+ </changeAlignment>
+ <cancelPolicy>
+ <cancelPolicyCase>
+ <policy>IMMEDIATE</policy>
+ </cancelPolicyCase>
+ </cancelPolicy>
+ <createAlignment>
+ <createAlignmentCase>
+ <alignment>START_OF_BUNDLE</alignment>
+ </createAlignmentCase>
+ </createAlignment>
+ <billingAlignment>
+ <billingAlignmentCase>
+ <alignment>ACCOUNT</alignment>
+ </billingAlignmentCase>
+ </billingAlignment>
+ <priceList>
+ <priceListCase>
+ <toPriceList>DEFAULT</toPriceList>
+ </priceListCase>
+ </priceList>
+ </rules>
+
+ <plans>
+ <plan name="standard-monthly">
+ <product>Standard</product>
+ <initialPhases>
+ <phase type="TRIAL">
+ <duration>
+ <unit>DAYS</unit>
+ <number>30</number>
+ </duration>
+ <billingPeriod>NO_BILLING_PERIOD</billingPeriod>
+ <fixedPrice> <!-- empty price implies $0 -->
+ </fixedPrice>
+ </phase>
+ </initialPhases>
+ <finalPhase type="EVERGREEN">
+ <duration>
+ <unit>UNLIMITED</unit>
+ </duration>
+ <billingPeriod>MONTHLY</billingPeriod>
+ <recurringPrice>
+ <price>
+ <currency>GBP</currency>
+ <value>75.00</value>
+ </price>
+ <price>
+ <currency>USD</currency>
+ <value>100.00</value>
+ </price>
+ </recurringPrice>
+ </finalPhase>
+ </plan>
+ <plan name="sports-monthly">
+ <product>Sports</product>
+ <initialPhases>
+ <phase type="TRIAL">
+ <duration>
+ <unit>DAYS</unit>
+ <number>30</number>
+ </duration>
+ <billingPeriod>NO_BILLING_PERIOD</billingPeriod>
+ <fixedPrice> <!-- empty price implies $0 -->
+ </fixedPrice>
+ </phase>
+ </initialPhases>
+ <finalPhase type="EVERGREEN">
+ <duration>
+ <unit>UNLIMITED</unit>
+ </duration>
+ <billingPeriod>MONTHLY</billingPeriod>
+ <recurringPrice>
+ <price>
+ <currency>GBP</currency>
+ <value>375.00</value>
+ </price>
+ <price>
+ <currency>USD</currency>
+ <value>500.00</value>
+ </price>
+ </recurringPrice>
+ </finalPhase>
+ </plan>
+ <plan name="super-monthly">
+ <product>Super</product>
+ <initialPhases>
+ <phase type="TRIAL">
+ <duration>
+ <unit>DAYS</unit>
+ <number>30</number>
+ </duration>
+ <billingPeriod>NO_BILLING_PERIOD</billingPeriod>
+ <fixedPrice> <!-- empty price implies $0 -->
+ </fixedPrice>
+ </phase>
+ </initialPhases>
+ <finalPhase type="EVERGREEN">
+ <duration>
+ <unit>UNLIMITED</unit>
+ </duration>
+ <billingPeriod>MONTHLY</billingPeriod>
+ <recurringPrice>
+ <price>
+ <currency>GBP</currency>
+ <value>750.00</value>
+ </price>
+ <price>
+ <currency>USD</currency>
+ <value>1000.00</value>
+ </price>
+ </recurringPrice>
+ </finalPhase>
+ </plan>
+ </plans>
+ <priceLists>
+ <defaultPriceList name="DEFAULT">
+ <plans>
+ <plan>standard-monthly</plan>
+ <plan>sports-monthly</plan>
+ <plan>super-monthly</plan>
+ </plans>
+ </defaultPriceList>
+ </priceLists>
+</catalog>
diff --git a/invoice/src/test/java/com/ning/billing/invoice/notification/TestNextBillingDateNotifier.java b/invoice/src/test/java/com/ning/billing/invoice/notification/TestNextBillingDateNotifier.java
index 3005d80..e9d1358 100644
--- a/invoice/src/test/java/com/ning/billing/invoice/notification/TestNextBillingDateNotifier.java
+++ b/invoice/src/test/java/com/ning/billing/invoice/notification/TestNextBillingDateNotifier.java
@@ -40,8 +40,7 @@ public class TestNextBillingDateNotifier extends InvoiceTestSuiteWithEmbeddedDB
final UUID accountId = UUID.randomUUID();
final Subscription subscription = invoiceUtil.createSubscription();
final UUID subscriptionId = subscription.getId();
- final DateTime now = new DateTime();
- final DateTime readyTime = now.plusMillis(2000);
+ final DateTime now = clock.getUTCNow();
final NotificationQueue nextBillingQueue = notificationQueueService.getNotificationQueue(DefaultInvoiceService.INVOICE_SERVICE_NAME, DefaultNextBillingDateNotifier.NEXT_BILLING_DATE_NOTIFIER_QUEUE);
diff --git a/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModule.java b/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModule.java
index 1e36213..915607b 100644
--- a/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModule.java
+++ b/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModule.java
@@ -29,6 +29,7 @@ import com.ning.billing.mock.glue.MockNotificationQueueModule;
import com.ning.billing.payment.TestPaymentHelper;
import com.ning.billing.payment.provider.MockPaymentProviderPluginModule;
import com.ning.billing.util.callcontext.InternalTenantContext;
+import com.ning.billing.util.clock.Clock;
import com.ning.billing.util.config.PaymentConfig;
import com.ning.billing.util.email.EmailModule;
import com.ning.billing.util.email.templates.TemplateModule;
@@ -48,9 +49,15 @@ import static org.testng.Assert.assertNotNull;
public class TestPaymentModule extends PaymentModule {
+ private final Clock clock;
+
+ public TestPaymentModule(final Clock clock) {
+ this.clock = clock;
+ }
+
@Override
protected void installPaymentProviderPlugins(final PaymentConfig config) {
- install(new MockPaymentProviderPluginModule(TestPaymentHelper.PLUGIN_TEST_NAME));
+ install(new MockPaymentProviderPluginModule(TestPaymentHelper.PLUGIN_TEST_NAME, clock));
}
private void installExternalApis() {
diff --git a/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleNoDB.java b/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleNoDB.java
index 9b69860..6ae07e0 100644
--- a/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleNoDB.java
+++ b/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleNoDB.java
@@ -20,9 +20,14 @@ import com.ning.billing.GuicyKillbillTestNoDBModule;
import com.ning.billing.mock.glue.MockNonEntityDaoModule;
import com.ning.billing.payment.dao.MockPaymentDao;
import com.ning.billing.payment.dao.PaymentDao;
+import com.ning.billing.util.clock.Clock;
public class TestPaymentModuleNoDB extends TestPaymentModule {
+ public TestPaymentModuleNoDB(final Clock clock) {
+ super(clock);
+ }
+
@Override
protected void installPaymentDao() {
bind(PaymentDao.class).to(MockPaymentDao.class).asEagerSingleton();
diff --git a/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleWithEmbeddedDB.java b/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleWithEmbeddedDB.java
index 43cc11d..a8d8109 100644
--- a/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleWithEmbeddedDB.java
+++ b/payment/src/test/java/com/ning/billing/payment/glue/TestPaymentModuleWithEmbeddedDB.java
@@ -17,10 +17,15 @@
package com.ning.billing.payment.glue;
import com.ning.billing.GuicyKillbillTestWithEmbeddedDBModule;
+import com.ning.billing.util.clock.Clock;
import com.ning.billing.util.glue.NonEntityDaoModule;
public class TestPaymentModuleWithEmbeddedDB extends TestPaymentModule {
+ public TestPaymentModuleWithEmbeddedDB(final Clock clock) {
+ super(clock);
+ }
+
@Override
protected void configure() {
install(new GuicyKillbillTestWithEmbeddedDBModule());
diff --git a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java
index f61d8bb..672ee07 100644
--- a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java
+++ b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java
@@ -76,7 +76,7 @@ public abstract class PaymentTestSuiteNoDB extends GuicyKillbillTestSuiteNoDB {
loadSystemPropertiesFromClasspath("/resource.properties");
- final Injector injector = Guice.createInjector(new TestPaymentModuleNoDB());
+ final Injector injector = Guice.createInjector(new TestPaymentModuleNoDB(getClock()));
injector.injectMembers(this);
}
diff --git a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java
index 64a9802..81bddf7 100644
--- a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java
+++ b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java
@@ -77,7 +77,7 @@ public abstract class PaymentTestSuiteWithEmbeddedDB extends GuicyKillbillTestSu
loadSystemPropertiesFromClasspath("/resource.properties");
- final Injector injector = Guice.createInjector(new TestPaymentModuleWithEmbeddedDB());
+ final Injector injector = Guice.createInjector(new TestPaymentModuleWithEmbeddedDB(getClock()));
injector.injectMembers(this);
}
diff --git a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginModule.java b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginModule.java
index a4f60be..91be5c2 100644
--- a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginModule.java
+++ b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginModule.java
@@ -16,21 +16,26 @@
package com.ning.billing.payment.provider;
+import com.ning.billing.util.clock.Clock;
+
import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
public class MockPaymentProviderPluginModule extends AbstractModule {
+
private final String instanceName;
+ private final Clock clock;
- public MockPaymentProviderPluginModule(final String instanceName) {
+ public MockPaymentProviderPluginModule(final String instanceName, final Clock clock) {
this.instanceName = instanceName;
+ this.clock = clock;
}
@Override
protected void configure() {
bind(MockPaymentProviderPlugin.class)
.annotatedWith(Names.named(instanceName))
- .toProvider(new MockPaymentProviderPluginProvider(instanceName))
+ .toProvider(new MockPaymentProviderPluginProvider(instanceName, clock))
.asEagerSingleton();
}
}
diff --git a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java
index 8cf86e5..3fb098d 100644
--- a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java
+++ b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java
@@ -28,11 +28,11 @@ public class MockPaymentProviderPluginProvider implements Provider<MockPaymentPr
private OSGIServiceRegistration<PaymentPluginApi> registry;
private final String instanceName;
- @Inject
private Clock clock;
- public MockPaymentProviderPluginProvider(final String instanceName) {
+ public MockPaymentProviderPluginProvider(final String instanceName, Clock clock) {
this.instanceName = instanceName;
+ this.clock = clock;
}
@Inject
diff --git a/server/src/main/resources/ehcache.xml b/server/src/main/resources/ehcache.xml
index 61f663b..ce3e135 100644
--- a/server/src/main/resources/ehcache.xml
+++ b/server/src/main/resources/ehcache.xml
@@ -26,6 +26,7 @@
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false"
+ statistics="true"
/>
<cache name="record-id"
diff --git a/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java b/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
index 94cb566..58673c6 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
@@ -36,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
+import com.ning.billing.GuicyKillbillTestSuiteWithEmbeddedDB;
import com.ning.billing.catalog.api.BillingPeriod;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.catalog.api.PriceListSet;
@@ -83,12 +84,11 @@ import static com.ning.billing.jaxrs.resources.JaxrsResource.SUBSCRIPTIONS;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
-public abstract class KillbillClient extends ServerTestSuiteWithEmbeddedDB {
+public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedDB {
protected static final String PLUGIN_NAME = "noop";
- // STEPH
- protected static final int DEFAULT_HTTP_TIMEOUT_SEC = 6000; // 5;
+ protected static final int DEFAULT_HTTP_TIMEOUT_SEC = 5;
protected static final Map<String, String> DEFAULT_EMPTY_QUERY = new HashMap<String, String>();
@@ -102,7 +102,6 @@ public abstract class KillbillClient extends ServerTestSuiteWithEmbeddedDB {
protected CoreConfig config;
protected AsyncHttpClient httpClient;
protected ObjectMapper mapper;
- protected ClockMock clock;
// Context information to be passed around
protected static final String createdBy = "Toto";
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 d80766a..97ac7be 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
@@ -29,21 +29,18 @@ import javax.servlet.http.HttpServlet;
import org.eclipse.jetty.servlet.FilterHolder;
import org.joda.time.LocalDate;
import org.skife.config.ConfigurationObjectFactory;
-import org.skife.jdbi.v2.IDBI;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
-import com.ning.billing.KillbillTestSuiteWithEmbeddedDB;
+import com.ning.billing.GuicyKillbillTestWithEmbeddedDBModule;
import com.ning.billing.account.glue.DefaultAccountModule;
import com.ning.billing.analytics.setup.AnalyticsModule;
import com.ning.billing.api.TestApiListener;
import com.ning.billing.beatrix.glue.BeatrixModule;
import com.ning.billing.catalog.glue.CatalogModule;
-import com.ning.billing.dbi.DBIProvider;
import com.ning.billing.dbi.DBTestingHelper;
-import com.ning.billing.dbi.DbiConfig;
import com.ning.billing.dbi.MysqlTestingHelper;
import com.ning.billing.entitlement.glue.DefaultEntitlementModule;
import com.ning.billing.invoice.api.InvoiceNotifier;
@@ -59,8 +56,6 @@ import com.ning.billing.server.listeners.KillbillGuiceListener;
import com.ning.billing.server.modules.KillbillServerModule;
import com.ning.billing.tenant.glue.TenantModule;
import com.ning.billing.usage.glue.UsageModule;
-import com.ning.billing.util.clock.Clock;
-import com.ning.billing.util.clock.ClockMock;
import com.ning.billing.util.config.PaymentConfig;
import com.ning.billing.util.email.EmailModule;
import com.ning.billing.util.email.templates.TemplateModule;
@@ -98,8 +93,6 @@ public class TestJaxrsBase extends KillbillClient {
protected static TestKillbillGuiceListener listener;
- private final DBTestingHelper helper = KillbillTestSuiteWithEmbeddedDB.getDBTestingHelper();
-
private HttpServer server;
protected TestApiListener busHandler;
@@ -115,23 +108,19 @@ public class TestJaxrsBase extends KillbillClient {
public static class TestKillbillGuiceListener extends KillbillGuiceListener {
- private final DBTestingHelper helper;
- private final Clock clock;
+ private final TestKillbillServerModule module;
+
- public TestKillbillGuiceListener(final DBTestingHelper helper, final Clock clock) {
+ public TestKillbillGuiceListener(final DBTestingHelper helper) {
super();
- this.helper = helper;
- this.clock = clock;
+ this.module = new TestKillbillServerModule(helper);
}
@Override
protected Module getModule() {
- return new TestKillbillServerModule(helper, clock);
+ return module;
}
- public Clock getClock() {
- return clock;
- }
}
public static class InvoiceModuleWithMockSender extends DefaultInvoiceModule {
@@ -145,24 +134,27 @@ public class TestJaxrsBase extends KillbillClient {
public static class TestKillbillServerModule extends KillbillServerModule {
private final DBTestingHelper helper;
- private final Clock clock;
- public TestKillbillServerModule(final DBTestingHelper helper, final Clock clock) {
+ public TestKillbillServerModule(final DBTestingHelper helper) {
super();
this.helper = helper;
- this.clock = clock;
}
@Override
protected void installClock() {
- bind(Clock.class).toInstance(clock);
+ // Already done By Top test class
+ }
+
+ @Override
+ protected void configureDao() {
+ // Already done By Top test class
}
private static final class PaymentMockModule extends PaymentModule {
@Override
protected void installPaymentProviderPlugins(final PaymentConfig config) {
- install(new MockPaymentProviderPluginModule(PLUGIN_NAME));
+ install(new MockPaymentProviderPluginModule(PLUGIN_NAME, getClock()));
}
}
@@ -175,6 +167,10 @@ public class TestJaxrsBase extends KillbillClient {
super.installKillbillModules();
Modules.override(new com.ning.billing.payment.setup.PaymentModule()).with(new PaymentMockModule());
*/
+
+ install(new GuicyKillbillTestWithEmbeddedDBModule());
+
+
install(new EmailModule());
install(new CacheModule());
install(new NonEntityDaoModule());
@@ -201,18 +197,6 @@ public class TestJaxrsBase extends KillbillClient {
install(new UsageModule());
installClock();
}
-
- @Override
- protected void configureDao() {
- if (helper.isUsingLocalInstance()) {
- bind(IDBI.class).toProvider(DBIProvider.class).asEagerSingleton();
- final DbiConfig config = new ConfigurationObjectFactory(System.getProperties()).build(DbiConfig.class);
- bind(DbiConfig.class).toInstance(config);
- } else {
- final IDBI dbi = helper.getDBI();
- bind(IDBI.class).toInstance(dbi);
- }
- }
}
@BeforeMethod(groups = "slow")
@@ -225,6 +209,10 @@ public class TestJaxrsBase extends KillbillClient {
@BeforeClass(groups = "slow")
public void setupClass() throws IOException {
loadConfig();
+
+
+ listener.getInstantiatedInjector().injectMembers(this);
+
httpClient = new AsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeoutInMs(DEFAULT_HTTP_TIMEOUT_SEC * 1000).build());
mapper = new ObjectMapper();
mapper.registerModule(new JodaModule());
@@ -233,7 +221,6 @@ public class TestJaxrsBase extends KillbillClient {
//mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy());
busHandler = new TestApiListener(null);
- this.clock = (ClockMock) listener.getClock();
}
protected void loadConfig() {
@@ -242,7 +229,7 @@ public class TestJaxrsBase extends KillbillClient {
}
// For shiro (outside of Guice control)
- System.setProperty("com.ning.jetty.jdbi.url", helper.getJdbcConnectionString());
+ 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);
}
@@ -252,8 +239,7 @@ public class TestJaxrsBase extends KillbillClient {
loadSystemPropertiesFromClasspath("/killbill.properties");
loadConfig();
- this.clock = new ClockMock();
- listener = new TestKillbillGuiceListener(helper, clock);
+ listener = new TestKillbillGuiceListener(getDBTestingHelper());
server = new HttpServer();
server.configure(config, getListeners(), getFilters());
diff --git a/server/src/test/java/com/ning/billing/server/security/TestTenantFilter.java b/server/src/test/java/com/ning/billing/server/security/TestTenantFilter.java
index bfe9273..d4a0dbf 100644
--- a/server/src/test/java/com/ning/billing/server/security/TestTenantFilter.java
+++ b/server/src/test/java/com/ning/billing/server/security/TestTenantFilter.java
@@ -39,7 +39,7 @@ import com.ning.http.client.Realm.AuthScheme;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-public class TestTenantFilter extends TestJaxrsBase {
+public class TestTenantFilter extends TestJaxrsBase {
@Override
protected void loadConfig() {
util/src/main/resources/ehcache.xml 1(+1 -0)
diff --git a/util/src/main/resources/ehcache.xml b/util/src/main/resources/ehcache.xml
index ac86fe3..684c3c8 100644
--- a/util/src/main/resources/ehcache.xml
+++ b/util/src/main/resources/ehcache.xml
@@ -26,6 +26,7 @@
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false"
+ statistics="true"
/>
<cache name="record-id"
diff --git a/util/src/test/java/com/ning/billing/GuicyKillbillTestModule.java b/util/src/test/java/com/ning/billing/GuicyKillbillTestModule.java
index 9ab7a27..1b69a96 100644
--- a/util/src/test/java/com/ning/billing/GuicyKillbillTestModule.java
+++ b/util/src/test/java/com/ning/billing/GuicyKillbillTestModule.java
@@ -34,20 +34,20 @@ public class GuicyKillbillTestModule extends AbstractModule {
// CreatedFontTracker references that will later be injected through Guices.
// That we we have only one clock and all internalContext/callContext are consistent
//
- private final ClockMock clock = new ClockMock();
private final InternalCallContext internalCallContext = new InternalCallContext(InternalCallContextFactory.INTERNAL_TENANT_RECORD_ID, 1687L, UUID.randomUUID(),
UUID.randomUUID().toString(), CallOrigin.TEST,
UserType.TEST, "Testing", "This is a test",
- clock.getUTCNow(), clock.getUTCNow());
+ GuicyKillbillTestSuite.getClock().getUTCNow(), GuicyKillbillTestSuite.getClock().getUTCNow());
private final CallContext callContext = internalCallContext.toCallContext();
+
@Override
protected void configure() {
- bind(Clock.class).toInstance(clock);
- bind(ClockMock.class).toInstance(clock);
+ bind(ClockMock.class).toInstance(GuicyKillbillTestSuite.getClock());
+ bind(Clock.class).to(ClockMock.class);
bind(InternalCallContext.class).toInstance(internalCallContext);
bind(CallContext.class).toInstance(callContext);
}
diff --git a/util/src/test/java/com/ning/billing/GuicyKillbillTestSuite.java b/util/src/test/java/com/ning/billing/GuicyKillbillTestSuite.java
index d299670..86ab3ce 100644
--- a/util/src/test/java/com/ning/billing/GuicyKillbillTestSuite.java
+++ b/util/src/test/java/com/ning/billing/GuicyKillbillTestSuite.java
@@ -39,14 +39,20 @@ public class GuicyKillbillTestSuite {
private boolean hasFailed = false;
@Inject
- protected ClockMock clock;
-
- @Inject
protected InternalCallContext internalCallContext;
@Inject
protected CallContext callContext;
+ @Inject
+ protected ClockMock clock;
+
+
+ private final static ClockMock theStaticClock = new ClockMock();
+
+ public static ClockMock getClock() {
+ return theStaticClock;
+ }
@BeforeMethod(alwaysRun = true)
public void startTestSuite(final Method method) throws Exception {
diff --git a/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java b/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java
index c568530..7f44985 100644
--- a/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java
+++ b/util/src/test/java/com/ning/billing/GuicyKillbillTestWithEmbeddedDBModule.java
@@ -17,9 +17,6 @@
package com.ning.billing;
-import javax.inject.Provider;
-
-import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.IDBI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;