public DefaultBlockingState(final BlockingState input, final DateTime effectiveDate) { this(input.getBlockedId(), input.getType(), input.getStateName(), input.getService(), input.isBlockChange(), input.isBlockEntitlement(), input.isBlockBilling(), effectiveDate); }
@Override public String apply(final BlockingState input) { return input.getService(); } }));
@Override public boolean apply(final BlockingState input) { return input.getService().equals(service); } }));
@Override public boolean apply(final BlockingState input) { return input.getService().equals(service); } }));
@Override public boolean apply(@Nullable final BlockingState input) { return input.getService().equals(serviceName); } }));
svcBlockedMap.get(e.getService()).addBlockingState(e);
@Override public List<BlockingState> getBlockingState(final UUID blockableId, final BlockingStateType blockingStateType, final DateTime upToDate, final InternalTenantContext context) { final List<BlockingState> blockingStatesForId = blockingStates.get(blockableId); if (blockingStatesForId == null) { return new ArrayList<BlockingState>(); } final Map<String, BlockingState> tmp = new HashMap<String, BlockingState>(); for (BlockingState cur : blockingStatesForId) { final BlockingState curStateForService = tmp.get(cur.getService()); if (curStateForService == null || curStateForService.getEffectiveDate().compareTo(cur.getEffectiveDate()) < 0) { tmp.put(cur.getService(), cur); } } return new ArrayList<BlockingState>(tmp.values()); }
private void doCheckFutureBlockingStatesToCancel(final DefaultEntitlement addOnEntitlement, final DateTime effectiveCancellationDateTime, final Collection<BlockingState> blockingStatesForCancellation) { if (addOnEntitlement == null || effectiveCancellationDateTime == null) { Assert.assertEquals(blockingStatesForCancellation.size(), 0); } else { Assert.assertEquals(blockingStatesForCancellation.size(), 1); final BlockingState blockingState = blockingStatesForCancellation.iterator().next(); Assert.assertEquals(blockingState.getBlockedId(), addOnEntitlement.getId()); Assert.assertEquals(blockingState.getEffectiveDate(), effectiveCancellationDateTime); Assert.assertEquals(blockingState.getType(), BlockingStateType.SUBSCRIPTION); Assert.assertEquals(blockingState.getService(), KILLBILL_SERVICES.ENTITLEMENT_SERVICE.getServiceName()); Assert.assertEquals(blockingState.getStateName(), DefaultEntitlementApi.ENT_STATE_CANCELLED); } }
public DefaultBlockingState(final BlockingState input, final DateTime effectiveDate) { this(input.getBlockedId(), input.getType(), input.getStateName(), input.getService(), input.isBlockChange(), input.isBlockEntitlement(), input.isBlockBilling(), effectiveDate); }
private void checkBlockingStatesDAO(final DefaultEntitlement baseEntitlement, final DefaultEntitlement addOnEntitlement, final LocalDate effectiveBaseCancellationDate, final LocalDate effectiveAddOnCancellationDate, final boolean isBaseCancelled) { final List<BlockingState> blockingStatesForBaseEntitlement = blockingStatesForBlockedId(baseEntitlement.getId()); Assert.assertEquals(blockingStatesForBaseEntitlement.size(), isBaseCancelled ? 2 : 1); if (isBaseCancelled) { Assert.assertEquals(blockingStatesForBaseEntitlement.get(1).getBlockedId(), baseEntitlement.getId()); Assert.assertEquals(blockingStatesForBaseEntitlement.get(1).getEffectiveDate().toLocalDate(), effectiveBaseCancellationDate); Assert.assertEquals(blockingStatesForBaseEntitlement.get(1).getType(), BlockingStateType.SUBSCRIPTION); Assert.assertEquals(blockingStatesForBaseEntitlement.get(1).getService(), KILLBILL_SERVICES.ENTITLEMENT_SERVICE.getServiceName()); Assert.assertEquals(blockingStatesForBaseEntitlement.get(1).getStateName(), DefaultEntitlementApi.ENT_STATE_CANCELLED); } final List<BlockingState> blockingStatesForAddOn = blockingStatesForBlockedId(addOnEntitlement.getId()); Assert.assertEquals(blockingStatesForAddOn.size(), 2); Assert.assertEquals(blockingStatesForAddOn.get(1).getBlockedId(), addOnEntitlement.getId()); Assert.assertEquals(blockingStatesForAddOn.get(1).getEffectiveDate().toLocalDate(), effectiveAddOnCancellationDate); Assert.assertEquals(blockingStatesForAddOn.get(1).getType(), BlockingStateType.SUBSCRIPTION); Assert.assertEquals(blockingStatesForAddOn.get(1).getService(), KILLBILL_SERVICES.ENTITLEMENT_SERVICE.getServiceName()); Assert.assertEquals(blockingStatesForAddOn.get(1).getStateName(), DefaultEntitlementApi.ENT_STATE_CANCELLED); }
private void verifyBlockingStates(final Iterable<BlockingState> result, final List<BlockingState> expected) { int i = 0; final Iterator<BlockingState> iterator = result.iterator(); while (iterator.hasNext()) { final BlockingState cur = iterator.next(); final BlockingState expectedItem = expected.get(i); assertEquals(cur.isBlockBilling(), expectedItem.isBlockBilling()); assertEquals(cur.isBlockEntitlement(), expectedItem.isBlockEntitlement()); assertEquals(cur.isBlockChange(), expectedItem.isBlockChange()); assertEquals(cur.getService(), expectedItem.getService()); assertEquals(cur.getStateName(), expectedItem.getStateName()); assertEquals(cur.getBlockedId(), expectedItem.getBlockedId()); assertEquals(internalCallContext.toLocalDate(cur.getEffectiveDate()).compareTo(internalCallContext.toLocalDate(expectedItem.getEffectiveDate())), 0); i++; } assertEquals(i, expected.size()); }
private void doCheckActualBlockingStatesToCancel(final DefaultEntitlement addOnEntitlement, final DateTime effectiveCancellationDateTime, final boolean approximateDateCheck, final Collection<BlockingState> blockingStatesForCancellation) { if (effectiveCancellationDateTime == null) { Assert.assertEquals(blockingStatesForCancellation.size(), 0); } else { Assert.assertEquals(blockingStatesForCancellation.size(), 1); final BlockingState blockingState = blockingStatesForCancellation.iterator().next(); Assert.assertEquals(blockingState.getBlockedId(), addOnEntitlement.getId()); if (approximateDateCheck) { Assert.assertEquals(blockingState.getEffectiveDate().toLocalDate(), effectiveCancellationDateTime.toLocalDate()); Assert.assertEquals(blockingState.getEffectiveDate().getMinuteOfDay(), effectiveCancellationDateTime.getMinuteOfDay()); } else { Assert.assertEquals(blockingState.getEffectiveDate(), effectiveCancellationDateTime); } Assert.assertEquals(blockingState.getType(), BlockingStateType.SUBSCRIPTION); Assert.assertEquals(blockingState.getService(), KILLBILL_SERVICES.ENTITLEMENT_SERVICE.getServiceName()); Assert.assertEquals(blockingState.getStateName(), DefaultEntitlementApi.ENT_STATE_CANCELLED); } }
Assert.assertEquals(blockingStates1.get(0).getBlockedId(), blockableId); Assert.assertEquals(blockingStates1.get(0).getStateName(), state); Assert.assertEquals(blockingStates1.get(0).getService(), serviceA); Assert.assertEquals(blockingStates1.get(0).getEffectiveDate(), stateDateTime); Assert.assertEquals(blockingStates2.get(0).getBlockedId(), blockableId); Assert.assertEquals(blockingStates2.get(0).getStateName(), state); Assert.assertEquals(blockingStates2.get(0).getService(), serviceA); Assert.assertEquals(blockingStates2.get(0).getEffectiveDate(), stateDateTime); Assert.assertEquals(blockingStates3.get(0).getBlockedId(), blockableId); Assert.assertEquals(blockingStates3.get(0).getStateName(), state); Assert.assertEquals(blockingStates3.get(0).getService(), serviceA); Assert.assertEquals(blockingStates3.get(0).getEffectiveDate(), stateDateTime); Assert.assertEquals(blockingStates3.get(1).getBlockedId(), blockableId); Assert.assertEquals(blockingStates3.get(1).getStateName(), state); Assert.assertEquals(blockingStates3.get(1).getService(), serviceB); Assert.assertEquals(blockingStates3.get(1).getEffectiveDate(), stateDateTime); Assert.assertEquals(blockingStates4.get(0).getBlockedId(), blockableId); Assert.assertEquals(blockingStates4.get(0).getStateName(), state); Assert.assertEquals(blockingStates4.get(0).getService(), serviceA); Assert.assertEquals(blockingStates4.get(0).getEffectiveDate(), stateDateTime); Assert.assertEquals(blockingStates4.get(1).getBlockedId(), blockableId); Assert.assertEquals(blockingStates4.get(1).getStateName(), state); Assert.assertEquals(blockingStates4.get(1).getService(), serviceB); Assert.assertEquals(blockingStates4.get(1).getEffectiveDate(), stateDateTime); Assert.assertEquals(blockingStates5.get(0).getBlockedId(), blockableId);
public BlockingStateJson(final BlockingState input, final AccountAuditLogs accountAuditLogs) { this(input.getBlockedId(), input.getStateName(), input.getService(), input.isBlockChange(), input.isBlockEntitlement(), input.isBlockBilling(), input.getEffectiveDate(), input.getType(), toAuditLogJson(accountAuditLogs == null ? null : accountAuditLogs.getAuditLogsForBlockingState(input.getId()))); }
assertTrue(iterableForCreateState.iterator().hasNext()); final BlockingState createState = iterableForCreateState.iterator().next(); assertEquals(createState.getService(), KILLBILL_SERVICES.ENTITLEMENT_SERVICE.getServiceName()); assertListenerStatus();