use of org.candlepin.policy.js.pool.PoolUpdate in project candlepin by candlepin.
the class PoolRulesStackDerivedTest method virtLimitFromLastVirtLimitEntWhenFirstIsRemoved.
@Test
public void virtLimitFromLastVirtLimitEntWhenFirstIsRemoved() {
stackedEnts.clear();
stackedEnts.add(createEntFromPool(pool1));
stackedEnts.add(createEntFromPool(pool2));
PoolUpdate update = poolRules.updatePoolFromStack(stackDerivedPool, null);
assertEquals((Long) 2L, stackDerivedPool.getQuantity());
stackedEnts.remove(0);
update = poolRules.updatePoolFromStack(stackDerivedPool, null);
assertTrue(update.changed());
assertTrue(update.getQuantityChanged());
assertEquals(new Long("-1"), stackDerivedPool.getQuantity());
}
use of org.candlepin.policy.js.pool.PoolUpdate in project candlepin by candlepin.
the class PoolRulesStackDerivedTest method mergedProvidedProducts.
@Test
public void mergedProvidedProducts() {
stackedEnts.add(createEntFromPool(pool1));
stackedEnts.add(createEntFromPool(pool3));
PoolUpdate update = poolRules.updatePoolFromStack(stackDerivedPool, null);
assertTrue(update.getProductsChanged());
assertEquals(3, stackDerivedPool.getProvidedProducts().size());
assertTrue(stackDerivedPool.getProvidedProducts().contains(provided1));
assertTrue(stackDerivedPool.getProvidedProducts().contains(provided2));
assertTrue(stackDerivedPool.getProvidedProducts().contains(provided3));
}
use of org.candlepin.policy.js.pool.PoolUpdate in project candlepin by candlepin.
the class PoolRulesStackDerivedTest method removeEarliestStartingEntitlement.
@Test
public void removeEarliestStartingEntitlement() {
stackedEnts.add(createEntFromPool(pool1));
stackedEnts.add(createEntFromPool(pool3));
poolRules.updatePoolFromStack(stackDerivedPool, null);
// Should change a variety of settings on the pool.
stackedEnts.remove(1);
PoolUpdate update = poolRules.updatePoolFromStack(stackDerivedPool, null);
assertTrue(update.changed());
assertTrue(update.getDatesChanged());
assertEquals(pool2.getStartDate(), stackDerivedPool.getStartDate());
assertEquals(pool3.getEndDate(), stackDerivedPool.getEndDate());
}
Aggregations