Details
diff --git a/api/src/main/java/com/ning/billing/glue/InvoiceModule.java b/api/src/main/java/com/ning/billing/glue/InvoiceModule.java
new file mode 100644
index 0000000..5b98407
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/glue/InvoiceModule.java
@@ -0,0 +1,27 @@
+/*
+ * 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.glue;
+
+public interface InvoiceModule {
+
+ public abstract void installInvoiceUserApi();
+
+ public abstract void installInvoicePaymentApi();
+
+ public abstract void installInvoiceMigrationApi();
+
+}
\ No newline at end of file
diff --git a/invoice/src/main/java/com/ning/billing/invoice/glue/DefaultInvoiceModule.java b/invoice/src/main/java/com/ning/billing/invoice/glue/DefaultInvoiceModule.java
index 472ad60..5a2b883 100644
--- a/invoice/src/main/java/com/ning/billing/invoice/glue/DefaultInvoiceModule.java
+++ b/invoice/src/main/java/com/ning/billing/invoice/glue/DefaultInvoiceModule.java
@@ -20,6 +20,7 @@ import org.skife.config.ConfigurationObjectFactory;
import com.google.inject.AbstractModule;
import com.ning.billing.config.InvoiceConfig;
+import com.ning.billing.glue.InvoiceModule;
import com.ning.billing.invoice.InvoiceListener;
import com.ning.billing.invoice.api.DefaultInvoiceService;
import com.ning.billing.invoice.api.InvoiceMigrationApi;
@@ -43,15 +44,23 @@ import com.ning.billing.invoice.notification.NullInvoiceNotifier;
import com.ning.billing.invoice.template.formatters.DefaultInvoiceFormatterFactory;
import com.ning.billing.util.template.translation.TranslatorConfig;
-public class DefaultInvoiceModule extends AbstractModule {
+public class DefaultInvoiceModule extends AbstractModule implements InvoiceModule {
protected void installInvoiceDao() {
bind(InvoiceDao.class).to(DefaultInvoiceDao.class).asEagerSingleton();
}
+ /* (non-Javadoc)
+ * @see com.ning.billing.invoice.glue.InvoiceModule#installInvoiceUserApi()
+ */
+ @Override
public void installInvoiceUserApi() {
bind(InvoiceUserApi.class).to(DefaultInvoiceUserApi.class).asEagerSingleton();
}
+ /* (non-Javadoc)
+ * @see com.ning.billing.invoice.glue.InvoiceModule#installInvoicePaymentApi()
+ */
+ @Override
public void installInvoicePaymentApi() {
bind(InvoicePaymentApi.class).to(DefaultInvoicePaymentApi.class).asEagerSingleton();
}
@@ -65,6 +74,10 @@ public class DefaultInvoiceModule extends AbstractModule {
bind(InvoiceService.class).to(DefaultInvoiceService.class).asEagerSingleton();
}
+ /* (non-Javadoc)
+ * @see com.ning.billing.invoice.glue.InvoiceModule#installInvoiceMigrationApi()
+ */
+ @Override
public void installInvoiceMigrationApi() {
bind(InvoiceMigrationApi.class).to(DefaultInvoiceMigrationApi.class).asEagerSingleton();
}
diff --git a/util/src/test/java/com/ning/billing/mock/glue/MockInvoiceModule.java b/util/src/test/java/com/ning/billing/mock/glue/MockInvoiceModule.java
new file mode 100644
index 0000000..d621df9
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/mock/glue/MockInvoiceModule.java
@@ -0,0 +1,50 @@
+/*
+ * 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.mock.glue;
+
+import com.google.inject.AbstractModule;
+import com.ning.billing.glue.InvoiceModule;
+import com.ning.billing.invoice.api.InvoiceMigrationApi;
+import com.ning.billing.invoice.api.InvoicePaymentApi;
+import com.ning.billing.invoice.api.InvoiceUserApi;
+import com.ning.billing.mock.BrainDeadProxyFactory;
+
+public class MockInvoiceModule extends AbstractModule implements InvoiceModule {
+
+ @Override
+ public void installInvoiceUserApi() {
+ bind(InvoiceUserApi.class).toInstance(BrainDeadProxyFactory.createBrainDeadProxyFor(InvoiceUserApi.class));
+ }
+
+ @Override
+ public void installInvoicePaymentApi() {
+ bind(InvoicePaymentApi.class).toInstance(BrainDeadProxyFactory.createBrainDeadProxyFor(InvoicePaymentApi.class));
+ }
+
+ @Override
+ public void installInvoiceMigrationApi() {
+ bind(InvoiceMigrationApi.class).toInstance(BrainDeadProxyFactory.createBrainDeadProxyFor(InvoiceMigrationApi.class));
+ }
+
+ @Override
+ protected void configure() {
+ installInvoiceUserApi();
+ installInvoicePaymentApi();
+ installInvoiceMigrationApi();
+ }
+
+}