Package org.candlepin.policy.js.quantity

Examples of org.candlepin.policy.js.quantity.SuggestedQuantity


        consumer = createConsumer(owner1);
    }

    @Test
    public void testCalculatedAttributesPresent() {
        SuggestedQuantity suggested = new SuggestedQuantity();
        suggested.setSuggested(1L);
        suggested.setIncrement(1L);
        when(quantityRules.getSuggestedQuantity(any(Pool.class),
            any(Consumer.class), any(Date.class))).
            thenReturn(suggested);

        PoolComplianceType pt = new PoolComplianceType();
View Full Code Here


        productCurator.create(product2);

        Pool pool2 = createPoolAndSub(owner1, product2, 500L,
            TestUtil.createDate(2000, 1, 1), TestUtil.createDate(3000, 1, 1));

        SuggestedQuantity suggested = new SuggestedQuantity();
        suggested.setSuggested(1L);
        suggested.setIncrement(12L);
        when(quantityRules.getSuggestedQuantity(any(Pool.class),
            any(Consumer.class), any(Date.class))).
            thenReturn(suggested);

        when(poolTypeRules.getPoolType(any(Pool.class))).
View Full Code Here

        Date now = new Date();
        // If the pool is being attached in the future, calculate
        // suggested quantity on the start date
        Date onDate = now.before(pool.getStartDate()) ?
            pool.getStartDate() : now;
        SuggestedQuantity suggested = quantityRules.getSuggestedQuantity(pool,
            consumer, onDate);
        int quantity = Math.max(suggested.getIncrement().intValue(),
            suggested.getSuggested().intValue());
        //It's possible that increment is greater than the number available
        //but whatever we do here, the bind will fail
        return quantity;
    }
View Full Code Here

        if (c == null) {
            return attrMap;
        }

        SuggestedQuantity suggested = quantityRules.getSuggestedQuantity(p, c, date);

        attrMap.put("suggested_quantity",
            String.valueOf(suggested.getSuggested()));
        attrMap.put("quantity_increment",
            String.valueOf(suggested.getIncrement()));

        return attrMap;
    }
View Full Code Here

TOP

Related Classes of org.candlepin.policy.js.quantity.SuggestedQuantity

Copyright © 2018 www.massapicom. 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.