use of org.killbill.billing.subscription.engine.dao.MockSubscriptionDaoMemory in project killbill by killbill.
the class TestUserApiError method setChargedThroughDate.
private void setChargedThroughDate(UUID subscriptionId, DateTime chargedThruDate, InternalCallContext context) throws SubscriptionBaseApiException {
try {
final SubscriptionCatalog catalog = subscriptionCatalogApi.getFullCatalog(context);
final DefaultSubscriptionBase subscription = (DefaultSubscriptionBase) dao.getSubscriptionFromId(subscriptionId, catalog, context);
final SubscriptionBuilder builder = new SubscriptionBuilder(subscription).setChargedThroughDate(chargedThruDate);
((MockSubscriptionDaoMemory) dao).updateChargedThroughDate(new DefaultSubscriptionBase(builder), context);
} catch (final CatalogApiException e) {
throw new SubscriptionBaseApiException(e);
}
}
use of org.killbill.billing.subscription.engine.dao.MockSubscriptionDaoMemory in project killbill by killbill.
the class SubscriptionTestSuiteNoDB method beforeMethod.
@BeforeMethod(groups = "fast")
public void beforeMethod() throws Exception {
if (hasFailed()) {
return;
}
// CLEANUP ALL DB TABLES OR IN MEMORY STRUCTURES
((MockSubscriptionDaoMemory) dao).reset();
subscriptionTestInitializer.startTestFramework(testListener, clock, busService, subscriptionBaseService);
this.catalog = DefaultSubscriptionCatalogApi.wrapCatalog(subscriptionTestInitializer.initCatalog(catalogService, internalCallContext), clock);
this.accountData = subscriptionTestInitializer.initAccountData(clock);
final Account account = GuicyKillbillTestSuiteNoDB.createMockAccount(accountData, accountUserApi, accountInternalApi, immutableAccountInternalApi, mockNonEntityDao, clock, internalCallContextFactory, callContext, internalCallContext);
final UUID accountId = account.getId();
mockNonEntityDao.addAccountRecordIdMapping(accountId, internalCallContext);
mockNonEntityDao.addTenantRecordIdMapping(accountId, internalCallContext);
mockNonEntityDao.addAccountIdMapping(internalCallContext.getAccountRecordId(), accountId);
final ImmutableAccountData immutableAccountData = Mockito.mock(ImmutableAccountData.class);
Mockito.when(immutableAccountInternalApi.getImmutableAccountDataByRecordId(Mockito.<Long>eq(internalCallContext.getAccountRecordId()), Mockito.<InternalTenantContext>any())).thenReturn(immutableAccountData);
this.bundle = subscriptionTestInitializer.initBundle(accountId, subscriptionInternalApi, clock, internalCallContext);
mockNonEntityDao.addTenantRecordIdMapping(bundle.getId(), internalCallContext);
mockNonEntityDao.addAccountRecordIdMapping(bundle.getId(), internalCallContext);
}
Aggregations