use of org.killbill.billing.junction.plumbing.billing.BlockingCalculator.DisabledDuration in project killbill by killbill.
the class TestBlockingCalculator method testEventsToRemoveClosedBetweenFollow.
// Closed with no previous event but in-between events and following
// -----[------Y-----]-------Z-------------
@Test(groups = "fast")
public void testEventsToRemoveClosedBetweenFollow() {
final DateTime now = clock.getUTCNow();
final List<DisabledDuration> disabledDuration = new ArrayList<BlockingCalculator.DisabledDuration>();
final SortedSet<BillingEvent> billingEvents = new TreeSet<BillingEvent>();
disabledDuration.add(new DisabledDuration(now, now.plusDays(2)));
final BillingEvent e2 = createRealEvent(now.plusDays(1), subscription1);
final BillingEvent e3 = createRealEvent(now.plusDays(3), subscription1);
billingEvents.add(e2);
billingEvents.add(e3);
final SortedSet<BillingEvent> results = blockingCalculator.eventsToRemove(disabledDuration, billingEvents, subscription1);
assertEquals(results.size(), 1);
assertEquals(results.first(), e2);
}
use of org.killbill.billing.junction.plumbing.billing.BlockingCalculator.DisabledDuration in project killbill by killbill.
the class TestBlockingCalculator method testEventsToRemoveClosedBetwn.
// Closed with no previous event but in-between events
// -----[------Y-----]---------------------
@Test(groups = "fast")
public void testEventsToRemoveClosedBetwn() {
final DateTime now = clock.getUTCNow();
final List<DisabledDuration> disabledDuration = new ArrayList<BlockingCalculator.DisabledDuration>();
final SortedSet<BillingEvent> billingEvents = new TreeSet<BillingEvent>();
disabledDuration.add(new DisabledDuration(now, now.plusDays(2)));
final BillingEvent e2 = createRealEvent(now.plusDays(1), subscription1);
billingEvents.add(e2);
final SortedSet<BillingEvent> results = blockingCalculator.eventsToRemove(disabledDuration, billingEvents, subscription1);
assertEquals(results.size(), 1);
assertEquals(results.first(), e2);
}
use of org.killbill.billing.junction.plumbing.billing.BlockingCalculator.DisabledDuration in project killbill by killbill.
the class TestBlockingCalculator method testEventsToRemoveOpenFollow.
// Open with no previous event (only following)
// -----[----X-----------------------------
@Test(groups = "fast")
public void testEventsToRemoveOpenFollow() {
final DateTime now = clock.getUTCNow();
final List<DisabledDuration> disabledDuration = new ArrayList<BlockingCalculator.DisabledDuration>();
final SortedSet<BillingEvent> billingEvents = new TreeSet<BillingEvent>();
disabledDuration.add(new DisabledDuration(now, null));
final BillingEvent e1 = createRealEvent(now.plusDays(1), subscription1);
billingEvents.add(e1);
final SortedSet<BillingEvent> results = blockingCalculator.eventsToRemove(disabledDuration, billingEvents, subscription1);
assertEquals(results.size(), 1);
assertEquals(results.first(), e1);
}
use of org.killbill.billing.junction.plumbing.billing.BlockingCalculator.DisabledDuration in project killbill by killbill.
the class TestBlockingCalculator method testEventsToRemoveClosedPrevBetw.
// Closed duration with a previous event and in-between event
// --X--[------Y-----]---------------------
@Test(groups = "fast")
public void testEventsToRemoveClosedPrevBetw() {
final DateTime now = clock.getUTCNow();
final List<DisabledDuration> disabledDuration = new ArrayList<BlockingCalculator.DisabledDuration>();
final SortedSet<BillingEvent> billingEvents = new TreeSet<BillingEvent>();
disabledDuration.add(new DisabledDuration(now, now.plusDays(2)));
final BillingEvent e1 = createRealEvent(now.minusDays(1), subscription1);
final BillingEvent e2 = createRealEvent(now.plusDays(1), subscription1);
billingEvents.add(e1);
billingEvents.add(e2);
final SortedSet<BillingEvent> results = blockingCalculator.eventsToRemove(disabledDuration, billingEvents, subscription1);
assertEquals(results.size(), 1);
assertEquals(results.first(), e2);
}
Aggregations