Search in sources :

Example 11 with ActivationKeyCurator

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);
}
Also used : ProductCachedSerializationModule(org.candlepin.jackson.ProductCachedSerializationModule) ActivationKeyCurator(org.candlepin.model.activationkeys.ActivationKeyCurator) ActivationKeyPool(org.candlepin.model.activationkeys.ActivationKeyPool) Pool(org.candlepin.model.Pool) ActivationKey(org.candlepin.model.activationkeys.ActivationKey) PoolManager(org.candlepin.controller.PoolManager) Test(org.junit.Test)

Example 12 with ActivationKeyCurator

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);
}
Also used : ProductCachedSerializationModule(org.candlepin.jackson.ProductCachedSerializationModule) ActivationKeyCurator(org.candlepin.model.activationkeys.ActivationKeyCurator) ActivationKeyPool(org.candlepin.model.activationkeys.ActivationKeyPool) Pool(org.candlepin.model.Pool) ActivationKey(org.candlepin.model.activationkeys.ActivationKey) PoolManager(org.candlepin.controller.PoolManager) Test(org.junit.Test)

Aggregations

ActivationKey (org.candlepin.model.activationkeys.ActivationKey)12 ActivationKeyCurator (org.candlepin.model.activationkeys.ActivationKeyCurator)12 Test (org.junit.Test)12 PoolManager (org.candlepin.controller.PoolManager)10 ProductCachedSerializationModule (org.candlepin.jackson.ProductCachedSerializationModule)10 Pool (org.candlepin.model.Pool)10 ActivationKeyPool (org.candlepin.model.activationkeys.ActivationKeyPool)10 Owner (org.candlepin.model.Owner)2 HashSet (java.util.HashSet)1 NoAuthPrincipal (org.candlepin.auth.NoAuthPrincipal)1 ActivationKeyDTO (org.candlepin.dto.api.v1.ActivationKeyDTO)1 ConsumerDTO (org.candlepin.dto.api.v1.ConsumerDTO)1 ConsumerTypeDTO (org.candlepin.dto.api.v1.ConsumerTypeDTO)1 Consumer (org.candlepin.model.Consumer)1 ConsumerContentOverrideCurator (org.candlepin.model.ConsumerContentOverrideCurator)1 ConsumerType (org.candlepin.model.ConsumerType)1 OwnerCurator (org.candlepin.model.OwnerCurator)1 ProductCurator (org.candlepin.model.ProductCurator)1