use of org.candlepin.model.activationkeys.ActivationKeyCurator in project candlepin by candlepin.
the class ActivationKeyResourceTest method testActivationKeyWithUnlimitedPool.
@Test
public void testActivationKeyWithUnlimitedPool() {
ActivationKey ak = genActivationKey();
ActivationKeyCurator akc = mock(ActivationKeyCurator.class);
Pool p = genPool();
p.getProduct().setAttribute(Pool.Attributes.MULTI_ENTITLEMENT, "yes");
p.setQuantity(-1L);
PoolManager poolManager = mock(PoolManager.class);
when(akc.verifyAndLookupKey(eq("testKey"))).thenReturn(ak);
when(poolManager.find(eq("testPool"))).thenReturn(p);
ActivationKeyResource akr = new ActivationKeyResource(akc, i18n, poolManager, serviceLevelValidator, activationKeyRules, null, new ProductCachedSerializationModule(productCurator), this.modelTranslator);
akr.addPoolToKey("testKey", "testPool", 15L);
}
use of org.candlepin.model.activationkeys.ActivationKeyCurator in project candlepin by candlepin.
the class ActivationKeyResourceTest method testActivationKeyWithNullQuantity.
@Test
public void testActivationKeyWithNullQuantity() {
ActivationKey ak = genActivationKey();
ActivationKeyCurator akc = mock(ActivationKeyCurator.class);
Pool p = genPool();
PoolManager poolManager = mock(PoolManager.class);
when(akc.verifyAndLookupKey(eq("testKey"))).thenReturn(ak);
when(poolManager.find(eq("testPool"))).thenReturn(p);
ActivationKeyResource akr = new ActivationKeyResource(akc, i18n, poolManager, serviceLevelValidator, activationKeyRules, null, new ProductCachedSerializationModule(productCurator), this.modelTranslator);
akr.addPoolToKey("testKey", "testPool", null);
}
Aggregations