use of org.killbill.billing.entitlement.dao.MockBlockingStateDao in project killbill by killbill.
the class TestBillingApi method beforeMethod.
@BeforeMethod(groups = "fast")
public void beforeMethod() throws Exception {
super.beforeMethod();
final SubscriptionBaseBundle bundle = Mockito.mock(SubscriptionBaseBundle.class);
Mockito.when(bundle.getId()).thenReturn(bunId);
final List<SubscriptionBaseBundle> bundles = ImmutableList.<SubscriptionBaseBundle>of(bundle);
effectiveSubscriptionTransitions = new LinkedList<EffectiveSubscriptionInternalEvent>();
final DateTime subscriptionStartDate = clock.getUTCNow().minusDays(3);
subscription = new MockSubscription(subId, bunId, null, subscriptionStartDate, subscriptionStartDate);
final List<SubscriptionBase> subscriptions = ImmutableList.<SubscriptionBase>of(subscription);
Mockito.when(subscriptionInternalApi.getBundlesForAccount(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(bundles);
Mockito.when(subscriptionInternalApi.getSubscriptionsForBundle(Mockito.<UUID>any(), Mockito.<DryRunArguments>any(), Mockito.<InternalTenantContext>any())).thenReturn(subscriptions);
Mockito.when(subscriptionInternalApi.getSubscriptionFromId(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(subscription);
Mockito.when(subscriptionInternalApi.getBundleFromId(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(bundle);
Mockito.when(subscriptionInternalApi.getBaseSubscription(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(subscription);
Mockito.when(subscriptionInternalApi.getBillingTransitions(Mockito.<SubscriptionBase>any(), Mockito.<InternalTenantContext>any())).thenReturn(effectiveSubscriptionTransitions);
Mockito.when(subscriptionInternalApi.getAllTransitions(Mockito.<SubscriptionBase>any(), Mockito.<InternalTenantContext>any())).thenReturn(effectiveSubscriptionTransitions);
catalog = ((MockCatalog) catalogService.getCurrentCatalog(true, true, internalCallContext));
// TODO The MockCatalog module returns two different things for full vs current catalog
Mockito.when(catalogService.getFullCatalog(true, true, internalCallContext)).thenReturn(catalog);
// Set a default alignment
catalog.setBillingAlignment(BillingAlignment.ACCOUNT);
// Cleanup mock daos
((MockBlockingStateDao) blockingStateDao).clear();
((MockTagDao) tagDao).clear();
}
use of org.killbill.billing.entitlement.dao.MockBlockingStateDao in project killbill by killbill.
the class TestBlockingChecker method beforeMethod.
@BeforeMethod(groups = "fast")
public void beforeMethod() throws Exception {
super.beforeMethod();
final UUID accountId = UUID.randomUUID();
account = Mockito.mock(Account.class);
Mockito.when(account.getId()).thenReturn(accountId);
bundle = Mockito.mock(SubscriptionBaseBundle.class);
Mockito.when(bundle.getAccountId()).thenReturn(accountId);
final UUID bundleId = UUID.randomUUID();
Mockito.when(bundle.getId()).thenReturn(bundleId);
Mockito.when(bundle.getExternalKey()).thenReturn("key");
subscription = Mockito.mock(SubscriptionBase.class);
Mockito.when(subscription.getId()).thenReturn(UUID.randomUUID());
Mockito.when(subscription.getBundleId()).thenReturn(bundleId);
try {
Mockito.when(subscriptionInternalApi.getBundleFromId(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(bundle);
} catch (SubscriptionBaseApiException e) {
Assert.fail(e.toString());
}
// Cleanup mock daos
((MockBlockingStateDao) blockingStateDao).clear();
}
Aggregations