Examples of addPool()


Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

    @Test
    public void testNullQuantityEmptyPool() {
        ActivationKey key = new ActivationKey();
        Pool existing = genPool();
        existing.setConsumed(existing.getQuantity());
        key.addPool(genVirtOnlyPool(), null);

        Pool pool = genPhysOnlyPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

     * should be treated as virt only.
     */
    @Test
    public void testPhysicalOnlyOnKeyWithOneInstanceBased() {
        ActivationKey key = new ActivationKey();
        key.addPool(genInstanceBased(), new Long(1));

        Pool pool = genPhysOnlyPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

     * amount for physical or virtual systems.
     */
    @Test
    public void testPhysicalOnlyOnKeyWithNullInstanceBased() {
        ActivationKey key = new ActivationKey();
        key.addPool(genInstanceBased(), null);

        Pool pool = genPhysOnlyPool();
        // Should be a valid combination
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

     * of an instance based subscription (for physical) should cause a failure.
     */
    @Test
    public void testAlreadyHasPhysAddingVirtQuantityInstanceBased() {
        ActivationKey key = new ActivationKey();
        key.addPool(genPhysOnlyPool(), new Long(1));

        Pool pool = genInstanceBased();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

     * should not cause a failure if there are no physical pools.
     */
    @Test
    public void testAllowsAddingVirtQuantityInstanceBased() {
        ActivationKey key = new ActivationKey();
        key.addPool(genPool(), new Long(1));

        Pool pool = genInstanceBased();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertTrue(result.getErrors().isEmpty());
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

     */
    @Test
    public void testActivationKeyRulesinSufficientQuantity() {
        ActivationKey key = new ActivationKey();
        Pool pool = genPhysOnlyPool();
        key.addPool(pool, 1L);

        Pool instanceBased = this.genInstanceBased();
        instanceBased.setQuantity(1L);
        instanceBased.setConsumed(0L);

View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

        ActivationKey key = createActivationKey(owner);
        Product prod = TestUtil.createProduct();
        productCurator.create(prod);
        Pool pool = createPoolAndSub(owner, prod, 12L,
            new Date(), new Date(System.currentTimeMillis() + (365 * 24 * 60 * 60 * 1000)));
        key.addPool(pool, 5L);
        activationKeyCurator.create(key);
        activationKeyCurator.refresh(key);
        assertNotNull(poolCurator.getActivationKeysForPool(pool));
        assertNotNull(key.getPools());
        assertTrue("The count of pools should be 1", key.getPools().size() == 1);
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

        ActivationKey key = createActivationKey(owner);
        Product prod = TestUtil.createProduct();
        productCurator.create(prod);
        Pool pool = createPoolAndSub(owner, prod, 12L,
            new Date(), new Date(System.currentTimeMillis() + (365 * 24 * 60 * 60 * 1000)));
        key.addPool(pool, null);
        activationKeyCurator.create(key);
        activationKeyCurator.refresh(key);
        assertNotNull(poolCurator.getActivationKeysForPool(pool));
        assertNotNull(key.getPools());
        assertTrue("The count of pools should be 1", key.getPools().size() == 1);
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

        ActivationKey key = activationKeyCurator.verifyAndLookupKey(activationKeyId);
        Pool pool = findPool(poolId);

        // Throws a BadRequestException if adding pool to key is a bad idea
        activationKeyRules.validatePoolForActKey(key, pool, quantity);
        key.addPool(pool, quantity);
        activationKeyCurator.update(key);
        return key;
    }

    /**
 
View Full Code Here

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()

        Pool p1 = genPool();
        p1.setAttribute("requires_host", "host1");
        Pool p2 = genPool();
        p2.setAttribute("requires_host", "host2");

        ak.addPool(p2, 1L);
        when(akc.verifyAndLookupKey(eq("testKey"))).thenReturn(ak);
        when(poolManager.find(eq("testPool1"))).thenReturn(p1);

        ActivationKeyResource akr = new ActivationKeyResource(
            akc, i18n, poolManager, serviceLevelValidator, activationKeyRules, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.