Examples of PoolRules


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

        consumer = new Consumer("test consumer", "test user", owner,
            new ConsumerType(ConsumerTypeEnum.SYSTEM));

        attrHelper = new AttributeHelper();

        poolRules = new PoolRules(poolManagerMock, productCache, config,
            entCurMock);
    }
View Full Code Here

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

        when(rulesCuratorMock.getRules()).thenReturn(rules);

        when(configMock.getInt(eq(ConfigProperties.PRODUCT_CACHE_MAX))).thenReturn(100);
        productCache = new ProductCache(configMock, productAdapterMock);

        poolRules = new PoolRules(poolManagerMock, productCache, configMock, entCurMock);
    }
View Full Code Here

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

            });
    }

    @Test
    public void createPoolsForExistingSubscriptionsNoneExist() {
        PoolRules pRules = new PoolRules(manager, productCache,
            mockConfig, entitlementCurator);
        List<Subscription> subscriptions = Util.newList();
        List<Pool> pools = Util.newList();
        Product prod = TestUtil.createProduct();
        Set<Product> products = new HashSet<Product>();
        products.add(prod);
        prod.setAttribute("virt_limit", "4");
        productCache.addProducts(products);
        Subscription s = TestUtil.createSubscription(getOwner(), prod);
        subscriptions.add(s);
        when(mockSubAdapter.getSubscriptions(any(Owner.class))).thenReturn(
            subscriptions);
        when(mockConfig.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);

        List<Pool> existingPools = new LinkedList<Pool>();
        List<Pool> newPools = pRules.createPools(s, existingPools);

        assertEquals(newPools.size(), 2);
        assert (newPools.get(0).getSourceSubscription().getSubscriptionSubKey()
            .equals("derived") || newPools.get(0).getSourceSubscription()
            .getSubscriptionSubKey().equals("derived"));
View Full Code Here

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

            .getSubscriptionSubKey().equals("master"));
    }

    @Test
    public void createPoolsForExistingSubscriptionsMasterExist() {
        PoolRules pRules = new PoolRules(manager, productCache,
            mockConfig, entitlementCurator);
        List<Subscription> subscriptions = Util.newList();
        List<Pool> pools = Util.newList();
        Product prod = TestUtil.createProduct();
        Set<Product> products = new HashSet<Product>();
        products.add(prod);
        productCache.addProducts(products);
        prod.setAttribute("virt_limit", "4");
        Subscription s = TestUtil.createSubscription(getOwner(), prod);
        subscriptions.add(s);
        when(mockSubAdapter.getSubscriptions(any(Owner.class))).thenReturn(
            subscriptions);
        when(mockConfig.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);

        List<Pool> existingPools = new LinkedList<Pool>();
        Pool p = TestUtil.createPool(s.getProduct());
        p.setSourceSubscription(new SourceSubscription(s.getId(), "master"));
        existingPools.add(p);
        List<Pool> newPools = pRules.createPools(s, existingPools);
        assertEquals(newPools.size(), 1);
        assertEquals(newPools.get(0).getSourceSubscription().getSubscriptionSubKey(), "derived");
    }
View Full Code Here

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

        assertEquals(newPools.get(0).getSourceSubscription().getSubscriptionSubKey(), "derived");
    }

    @Test
    public void createPoolsForExistingSubscriptionsBonusExist() {
        PoolRules pRules = new PoolRules(manager, productCache,
            mockConfig, entitlementCurator);
        List<Subscription> subscriptions = Util.newList();
        List<Pool> pools = Util.newList();
        Product prod = TestUtil.createProduct();
        Set<Product> products = new HashSet<Product>();
        products.add(prod);
        productCache.addProducts(products);
        prod.setAttribute("virt_limit", "4");
        Subscription s = TestUtil.createSubscription(getOwner(), prod);
        subscriptions.add(s);
        when(mockSubAdapter.getSubscriptions(any(Owner.class))).thenReturn(
            subscriptions);
        when(mockConfig.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);

        List<Pool> existingPools = new LinkedList<Pool>();
        Pool p = TestUtil.createPool(s.getProduct());
        p.setSourceSubscription(new SourceSubscription(s.getId(), "derived"));
        existingPools.add(p);
        pRules.createPools(s, existingPools);
        List<Pool> newPools = pRules.createPools(s, existingPools);
        assertEquals(newPools.size(), 1);
        assertEquals(newPools.get(0).getSourceSubscription().getSubscriptionSubKey(), "master");
    }
View Full Code Here

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

        when(rulesCuratorMock.getRules()).thenReturn(rules);

        when(configMock.getInt(eq(ConfigProperties.PRODUCT_CACHE_MAX))).thenReturn(100);
        productCache = new ProductCache(configMock, productAdapterMock);

        poolRules = new PoolRules(poolManagerMock, productCache, configMock, entCurMock);
        principal = TestUtil.createOwnerPrincipal();
        owner = principal.getOwners().get(0);
    }
View Full Code Here

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

        when(rulesCuratorMock.getRules()).thenReturn(rules);

        when(configMock.getInt(eq(ConfigProperties.PRODUCT_CACHE_MAX))).thenReturn(100);
        productCache = new ProductCache(configMock, productAdapterMock);

        poolRules = new PoolRules(poolManagerMock, productCache, configMock, entCurMock);
        principal = TestUtil.createOwnerPrincipal();
        owner = principal.getOwners().get(0);

        consumer = new Consumer("consumer", "registeredbybob", owner,
            new ConsumerType(ConsumerTypeEnum.SYSTEM));
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.