Package org.candlepin.policy.js.pool

Examples of org.candlepin.policy.js.pool.PoolHelper


    @Test
    public void hostedParentConsumerPostCreatesNoPool() {
        Pool pool = setupVirtLimitPool();
        Entitlement e = new Entitlement(pool, consumer, 1);

        PoolHelper postHelper = mock(PoolHelper.class);
        when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
        enforcer.postEntitlement(consumer, postHelper, e);

        verify(postHelper, never()).createHostRestrictedPool(pool.getProductId(),
            pool, pool.getAttributeValue("virt_limit"));
View Full Code Here


        assertEquals(new Long(100), virtBonusPool.getQuantity());
        assertEquals("true", virtBonusPool.getAttributeValue("virt_only"));
        assertEquals("10", virtBonusPool.getProductAttribute("virt_limit").getValue());

        Entitlement e = new Entitlement(physicalPool, consumer, 1);
        PoolHelper postHelper = new PoolHelper(poolManagerMock, productCache, e);
        List<Pool> poolList = new ArrayList<Pool>();
        poolList.add(virtBonusPool);
        when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId())))
            .thenReturn(poolList);
View Full Code Here

        assertEquals(new Long(10), physicalPool.getQuantity());
        assertEquals(0, physicalPool.getAttributes().size());

        Entitlement e = new Entitlement(physicalPool, consumer, 1);
        PoolHelper postHelper = new PoolHelper(poolManagerMock, productCache, e);

        enforcer.postEntitlement(consumer, postHelper, e);
        verify(poolManagerMock).createPool(any(Pool.class));
    }
View Full Code Here

        assertEquals("true", virtBonusPool.getAttributeValue("virt_only"));
        assertEquals("unlimited", virtBonusPool.getProductAttribute("virt_limit")
            .getValue());

        Entitlement e = new Entitlement(physicalPool, consumer, 1);
        PoolHelper postHelper = new PoolHelper(poolManagerMock, productCache, e);
        List<Pool> poolList = new ArrayList<Pool>();
        poolList.add(virtBonusPool);
        when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId())))
            .thenReturn(poolList);
View Full Code Here

        assertEquals("true", virtBonusPool.getAttributeValue("virt_only"));
        assertEquals("unlimited", virtBonusPool.getProductAttribute("virt_limit")
            .getValue());

        Entitlement e = new Entitlement(physicalPool, consumer, 1);
        PoolHelper postHelper = new PoolHelper(poolManagerMock, productCache, e);

        enforcer.postEntitlement(consumer, postHelper, e);
        verify(poolManagerMock, never()).createPool(any(Pool.class));
        verify(poolManagerMock, never()).updatePoolQuantity(any(Pool.class), anyInt());
View Full Code Here

            .getValue());

        Entitlement e = new Entitlement(physicalPool, consumer, 10);
        physicalPool.setConsumed(10L);
        physicalPool.setExported(10L);
        PoolHelper postHelper = new PoolHelper(poolManagerMock, productCache, e);
        List<Pool> poolList = new ArrayList<Pool>();
        poolList.add(virtBonusPool);
        when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId())))
            .thenReturn(poolList);
View Full Code Here

        virtBonusPool.setAttribute("virt_only", "true");
        virtBonusPool.setAttribute("virt_limit", "10");
        virtBonusPool.setAttribute("pool_derived", "true");

        Entitlement e = new Entitlement(virtBonusPool, consumer, 1);
        PoolHelper postHelper = new PoolHelper(poolManagerMock, productCache, e);
        List<Pool> poolList = new ArrayList<Pool>();
        poolList.add(virtBonusPool);
        when(poolManagerMock.lookupBySubscriptionId(eq(virtBonusPool.getSubscriptionId())))
            .thenReturn(poolList);
View Full Code Here

public class ManifestEntitlementRulesTest extends EntitlementRulesTestFixture {

    @Test
    public void postEntitlement() {
        Consumer c = mock(Consumer.class);
        PoolHelper ph = mock(PoolHelper.class);
        Entitlement e = mock(Entitlement.class);
        ConsumerType type = mock(ConsumerType.class);
        Pool pool = mock(Pool.class);
        Product product = mock(Product.class);
View Full Code Here

    @Test
    public void virtLimitSubPool() {
        Pool pool = setupVirtLimitPool();
        Entitlement e = new Entitlement(pool, consumer, 5);

        PoolHelper postHelper = mock(PoolHelper.class);
        when(postHelper.getFlattenedAttributes(eq(pool))).thenReturn(
            attrHelper.getFlattenedAttributes(pool));
        when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
        enforcer.postEntitlement(consumer, postHelper, e);

        // Pool quantity should be virt_limit:
View Full Code Here

    public void unlimitedVirtLimitSubPool() {
        Pool pool = setupVirtLimitPool();
        pool.setAttribute("virt_limit", "unlimited");
        Entitlement e = new Entitlement(pool, consumer, 5);

        PoolHelper postHelper = mock(PoolHelper.class);
        when(postHelper.getFlattenedAttributes(eq(pool))).thenReturn(
            attrHelper.getFlattenedAttributes(pool));
        when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
        enforcer.postEntitlement(consumer, postHelper, e);

        // Pool quantity should be virt_limit * entitlement quantity:
View Full Code Here

TOP

Related Classes of org.candlepin.policy.js.pool.PoolHelper

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.