Skip to content

Commit

Permalink
Adding a mock generating module for Invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Westhead committed May 4, 2012
1 parent 57ebef8 commit 34f2899
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 1 deletion.
27 changes: 27 additions & 0 deletions api/src/main/java/com/ning/billing/glue/InvoiceModule.java
Original file line number Original file line Diff line number Diff line change
@@ -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();

}
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.ning.billing.config.InvoiceConfig; import com.ning.billing.config.InvoiceConfig;
import com.ning.billing.glue.InvoiceModule;
import com.ning.billing.invoice.InvoiceListener; import com.ning.billing.invoice.InvoiceListener;
import com.ning.billing.invoice.api.DefaultInvoiceService; import com.ning.billing.invoice.api.DefaultInvoiceService;
import com.ning.billing.invoice.api.InvoiceMigrationApi; import com.ning.billing.invoice.api.InvoiceMigrationApi;
Expand All @@ -43,15 +44,23 @@
import com.ning.billing.invoice.template.formatters.DefaultInvoiceFormatterFactory; import com.ning.billing.invoice.template.formatters.DefaultInvoiceFormatterFactory;
import com.ning.billing.util.template.translation.TranslatorConfig; import com.ning.billing.util.template.translation.TranslatorConfig;


public class DefaultInvoiceModule extends AbstractModule { public class DefaultInvoiceModule extends AbstractModule implements InvoiceModule {
protected void installInvoiceDao() { protected void installInvoiceDao() {
bind(InvoiceDao.class).to(DefaultInvoiceDao.class).asEagerSingleton(); bind(InvoiceDao.class).to(DefaultInvoiceDao.class).asEagerSingleton();
} }


/* (non-Javadoc)
* @see com.ning.billing.invoice.glue.InvoiceModule#installInvoiceUserApi()
*/
@Override
public void installInvoiceUserApi() { public void installInvoiceUserApi() {
bind(InvoiceUserApi.class).to(DefaultInvoiceUserApi.class).asEagerSingleton(); bind(InvoiceUserApi.class).to(DefaultInvoiceUserApi.class).asEagerSingleton();
} }


/* (non-Javadoc)
* @see com.ning.billing.invoice.glue.InvoiceModule#installInvoicePaymentApi()
*/
@Override
public void installInvoicePaymentApi() { public void installInvoicePaymentApi() {
bind(InvoicePaymentApi.class).to(DefaultInvoicePaymentApi.class).asEagerSingleton(); bind(InvoicePaymentApi.class).to(DefaultInvoicePaymentApi.class).asEagerSingleton();
} }
Expand All @@ -65,6 +74,10 @@ protected void installInvoiceService() {
bind(InvoiceService.class).to(DefaultInvoiceService.class).asEagerSingleton(); bind(InvoiceService.class).to(DefaultInvoiceService.class).asEagerSingleton();
} }


/* (non-Javadoc)
* @see com.ning.billing.invoice.glue.InvoiceModule#installInvoiceMigrationApi()
*/
@Override
public void installInvoiceMigrationApi() { public void installInvoiceMigrationApi() {
bind(InvoiceMigrationApi.class).to(DefaultInvoiceMigrationApi.class).asEagerSingleton(); bind(InvoiceMigrationApi.class).to(DefaultInvoiceMigrationApi.class).asEagerSingleton();
} }
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -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();
}

}

0 comments on commit 34f2899

Please sign in to comment.