@Test(groups = "slow") public void testAddonCreateWithBundleAlign() throws CatalogApiException, SubscriptionBaseApiException { final String aoProduct = "Telescopic-Scope"; final BillingPeriod aoTerm = BillingPeriod.MONTHLY; final String aoPriceList = PriceListSet.DEFAULT_PRICELIST_NAME; // This is just to double check our test catalog gives us what we want before we start the test final PlanSpecifier planSpecifier = new PlanSpecifier(aoProduct, ProductCategory.ADD_ON, aoTerm, aoPriceList); final PlanAlignmentCreate alignement = catalog.planCreateAlignment(planSpecifier, clock.getUTCNow()); assertEquals(alignement, PlanAlignmentCreate.START_OF_BUNDLE); testAddonCreateInternal(aoProduct, aoTerm, aoPriceList, alignement); assertListenerStatus(); }
@Test(groups = "slow") public void testCreateCancelAddon() throws SubscriptionBaseApiException { final String baseProduct = "Shotgun"; final BillingPeriod baseTerm = BillingPeriod.ANNUAL; final String basePriceList = PriceListSet.DEFAULT_PRICELIST_NAME; DefaultSubscriptionBase baseSubscription = testUtil.createSubscription(bundle, baseProduct, baseTerm, basePriceList); final String aoProduct = "Telescopic-Scope"; final BillingPeriod aoTerm = BillingPeriod.MONTHLY; final String aoPriceList = PriceListSet.DEFAULT_PRICELIST_NAME; DefaultSubscriptionBase aoSubscription = testUtil.createSubscription(bundle, aoProduct, aoTerm, aoPriceList); assertEquals(aoSubscription.getState(), EntitlementState.ACTIVE); testListener.pushExpectedEvent(NextEvent.CANCEL); final DateTime now = clock.getUTCNow(); aoSubscription.cancel(callContext); assertListenerStatus(); aoSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(aoSubscription.getId(), internalCallContext); assertEquals(aoSubscription.getState(), EntitlementState.CANCELLED); assertListenerStatus(); }
assertListenerStatus(); testListener.pushExpectedEvent(NextEvent.CANCEL); baseSubscription.changePlan(newBaseProduct, newBaseTerm, newBasePriceList, callContext); assertListenerStatus(); assertEquals(aoSubscription.getState(), EntitlementState.CANCELLED); assertListenerStatus();
@Test(groups = "slow") public void testAddonCreateWithSubscriptionAlign() throws SubscriptionBaseApiException, CatalogApiException { final String aoProduct = "Laser-Scope"; final BillingPeriod aoTerm = BillingPeriod.MONTHLY; final String aoPriceList = PriceListSet.DEFAULT_PRICELIST_NAME; // This is just to double check our test catalog gives us what we want before we start the test final PlanSpecifier planSpecifier = new PlanSpecifier(aoProduct, ProductCategory.ADD_ON, aoTerm, aoPriceList); final PlanAlignmentCreate alignement = catalog.planCreateAlignment(planSpecifier, clock.getUTCNow()); assertEquals(alignement, PlanAlignmentCreate.START_OF_SUBSCRIPTION); testAddonCreateInternal(aoProduct, aoTerm, aoPriceList, alignement); assertListenerStatus(); }
assertListenerStatus(); it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusMonths(1)); clock.addDeltaFromReality(it.toDurationMillis()); assertListenerStatus(); assertEquals(aoSubscription.getState(), EntitlementState.CANCELLED); assertListenerStatus();
testListener.pushExpectedEvent(NextEvent.PHASE); clock.addDeltaFromReality(it.toDurationMillis()); assertListenerStatus(); assertListenerStatus(); assertTrue(aoSubscription.getFutureEndDate().compareTo(newBPChargedThroughDate) == 0); assertListenerStatus();
assertListenerStatus(); baseSubscription = (DefaultSubscriptionBase) subscriptionInternalApi.getSubscriptionFromId(baseSubscription.getId(), internalCallContext); baseSubscription.uncancel(callContext); assertListenerStatus(); assertEquals(aoSubscription.getState(), EntitlementState.ACTIVE); assertTrue(aoSubscription.isSubscriptionFutureCancelled()); assertListenerStatus();
assertListenerStatus(); assertListenerStatus(); assertEquals(aoSubscription.getState(), EntitlementState.CANCELLED); assertListenerStatus();