@Test(groups = "slow", description = "Verify add-ons blocking states are added for IMM billing / EOT entitlement cancellations") public void testCancellationBillingIMMEntitlementEOT() throws Exception { // Cancel the base plan testListener.pushExpectedEvents(NextEvent.CANCEL, NextEvent.CANCEL); final DefaultEntitlement cancelledBaseEntitlement = (DefaultEntitlement) baseEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.END_OF_TERM, BillingActionPolicy.IMMEDIATE, ImmutableList.<PluginProperty>of(), callContext); assertListenerStatus(); // Verify the blocking states API sees the EOT cancellation (add-on blocking state not on disk) checkBlockingStatesDAO(cancelledBaseEntitlement, addOnEntitlement, baseEffectiveCancellationOrChangeDate, true); }
@Test(groups = "slow", description = "Verify add-ons blocking states are not impacted for add-on IMM cancellations") public void testCancellationBaseEOTAddOnIMM() throws Exception { // Cancel the base plan final DefaultEntitlement cancelledBaseEntitlement = (DefaultEntitlement) baseEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.END_OF_TERM, BillingActionPolicy.END_OF_TERM, ImmutableList.<PluginProperty>of(), callContext); // No blocking event (EOT) assertListenerStatus(); // Cancel the add-on testListener.pushExpectedEvents(NextEvent.CANCEL, NextEvent.BLOCK); final DefaultEntitlement cancelledAddOnEntitlement = (DefaultEntitlement) addOnEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.IMMEDIATE, ImmutableList.<PluginProperty>of(), callContext); assertListenerStatus(); // Verify the blocking states API doesn't mix the dates (all blocking states are on disk) checkBlockingStatesDAO(cancelledBaseEntitlement, cancelledAddOnEntitlement, baseEffectiveCancellationOrChangeDate, clock.getUTCToday(), true); }
bpEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.IMMEDIATE, ImmutableList.<PluginProperty>of(), callContext); assertListenerStatus();
bpEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.IMMEDIATE, ImmutableList.<PluginProperty>of(), callContext); assertListenerStatus();
bpEntitlement1.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.END_OF_TERM, ImmutableList.<PluginProperty>of(), callContext); assertListenerStatus();
final Entitlement cancelledEntitlement = baseEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.START_OF_TERM, null, callContext); assertListenerStatus();
final Entitlement cancelledEntitlement = baseEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.START_OF_TERM, null, callContext); assertListenerStatus();
@Test(groups = "slow", description = "Verify add-ons blocking states are added for EOT cancellations") public void testCancellationEOT() throws Exception { // Cancel the base plan final DefaultEntitlement cancelledBaseEntitlement = (DefaultEntitlement) baseEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.END_OF_TERM, BillingActionPolicy.END_OF_TERM, ImmutableList.<PluginProperty>of(), callContext); // No blocking event (EOT) assertListenerStatus(); // Verify we compute the right blocking states for the "read" path... checkFutureBlockingStatesToCancel(addOnEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, addOnEntitlement, baseEffectiveEOTCancellationOrChangeDateTime); // and for the "write" path (which will be exercised when the future notification kicks in). checkActualBlockingStatesToCancel(cancelledBaseEntitlement, addOnEntitlement, baseEffectiveEOTCancellationOrChangeDateTime, false); // Verify also the blocking states DAO adds events not on disk checkBlockingStatesDAO(baseEntitlement, addOnEntitlement, baseEffectiveCancellationOrChangeDate, true); // Verify the notification kicks in testListener.pushExpectedEvents(NextEvent.CANCEL, NextEvent.BLOCK, NextEvent.CANCEL, NextEvent.BLOCK); clock.addDays(30); assertListenerStatus(); // Refresh the state final DefaultEntitlement cancelledAddOnEntitlement = (DefaultEntitlement) entitlementApi.getEntitlementForId(addOnEntitlement.getId(), callContext); // Verify we compute the right blocking states for the "read" path... checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledAddOnEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, null); // ...and for the "write" path (which has been exercised when the notification kicked in). checkActualBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, baseEffectiveEOTCancellationOrChangeDateTime, false); // Verify also the blocking states API doesn't add too many events (now on disk) checkBlockingStatesDAO(cancelledBaseEntitlement, cancelledAddOnEntitlement, baseEffectiveCancellationOrChangeDate, true); }
@Test(groups = "slow", description = "Verify add-ons blocking states are not impacted by IMM cancellations") public void testCancellationIMM() throws Exception { // Approximate check, as the blocking state check (checkBlockingStatesDAO) could be a bit off final DateTime cancellationDateTime = clock.getUTCNow(); final LocalDate cancellationDate = clock.getUTCToday(); // Cancel the base plan testListener.pushExpectedEvents(NextEvent.CANCEL, NextEvent.BLOCK, NextEvent.CANCEL, NextEvent.BLOCK); final DefaultEntitlement cancelledBaseEntitlement = (DefaultEntitlement) baseEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.IMMEDIATE, ImmutableList.<PluginProperty>of(), callContext); assertListenerStatus(); // Refresh the add-on state final DefaultEntitlement cancelledAddOnEntitlement = (DefaultEntitlement) entitlementApi.getEntitlementForId(addOnEntitlement.getId(), callContext); // Verify we compute the right blocking states for the "read" path... checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledAddOnEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, null); // ...and for the "write" path (which has been exercised in the cancel call above). checkActualBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDateTime, true); // Verify also the blocking states DAO doesn't add too many events (all on disk) checkBlockingStatesDAO(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDate, true); clock.addDays(30); // No new event assertListenerStatus(); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledAddOnEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, null); checkActualBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDateTime, true); checkBlockingStatesDAO(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDate, true); }
@Test(groups = "slow", description = "Verify add-ons blocking states are not impacted by EOT billing cancellations") public void testCancellationIMMBillingEOT() throws Exception { // Approximate check, as the blocking state check (checkBlockingStatesDAO) could be a bit off final DateTime cancellationDateTime = clock.getUTCNow(); final LocalDate cancellationDate = clock.getUTCToday(); // Cancel the base plan testListener.pushExpectedEvents(NextEvent.BLOCK, NextEvent.BLOCK); final DefaultEntitlement cancelledBaseEntitlement = (DefaultEntitlement) baseEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.END_OF_TERM, ImmutableList.<PluginProperty>of(), callContext); assertListenerStatus(); // Refresh the add-on state final DefaultEntitlement cancelledAddOnEntitlement = (DefaultEntitlement) entitlementApi.getEntitlementForId(addOnEntitlement.getId(), callContext); // Verify we compute the right blocking states for the "read" path... checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledAddOnEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, null); // ...and for the "write" path (which has been exercised in the cancel call above). checkActualBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDateTime, true); // Verify also the blocking states DAO doesn't add too many events (all on disk) checkBlockingStatesDAO(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDate, true); testListener.pushExpectedEvents(NextEvent.CANCEL, NextEvent.CANCEL); clock.addDays(30); assertListenerStatus(); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledAddOnEntitlement, null, null); checkFutureBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, null); checkActualBlockingStatesToCancel(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDateTime, true); checkBlockingStatesDAO(cancelledBaseEntitlement, cancelledAddOnEntitlement, cancellationDate, true); }