assertEquals(newPools.get(0).getSourceSubscription().getSubscriptionSubKey(), "derived");
}
@Test
public void createPoolsForExistingSubscriptionsBonusExist() {
PoolRules pRules = new PoolRules(manager, productCache,
mockConfig, entitlementCurator);
List<Subscription> subscriptions = Util.newList();
List<Pool> pools = Util.newList();
Product prod = TestUtil.createProduct();
Set<Product> products = new HashSet<Product>();
products.add(prod);
productCache.addProducts(products);
prod.setAttribute("virt_limit", "4");
Subscription s = TestUtil.createSubscription(getOwner(), prod);
subscriptions.add(s);
when(mockSubAdapter.getSubscriptions(any(Owner.class))).thenReturn(
subscriptions);
when(mockConfig.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
List<Pool> existingPools = new LinkedList<Pool>();
Pool p = TestUtil.createPool(s.getProduct());
p.setSourceSubscription(new SourceSubscription(s.getId(), "derived"));
existingPools.add(p);
pRules.createPools(s, existingPools);
List<Pool> newPools = pRules.createPools(s, existingPools);
assertEquals(newPools.size(), 1);
assertEquals(newPools.get(0).getSourceSubscription().getSubscriptionSubKey(), "master");
}