Package org.candlepin.model

Examples of org.candlepin.model.OwnerInfo$ConsumptionTypeCounts


    @Test
    public void testConsumerTypeCountByPoolPutsDefaultsIntoSystem() {
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>() {
            {
                put("system", 1);
                put("domain", 0);
                put("uebercert", 0);
            }
        };

        assertEquals(expectedPoolCount, info.getConsumerTypeCountByPool());
    }
View Full Code Here


    public void testOwnerPoolEnabledCountPoolOnly() {
        ConsumerType type = consumerTypeCurator.lookupByLabel("domain");
        pool1.setAttribute("enabled_consumer_types", type.getLabel());
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>() {
            {
                put("domain", 1);
            }
        };

        assertEquals(expectedPoolCount, info.getEnabledConsumerTypeCountByPool());
    }
View Full Code Here

        ConsumerType type = consumerTypeCurator.lookupByLabel("system");
        pool1.setProductAttribute("enabled_consumer_types", type.getLabel(),
            pool1.getProductId());
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>() {
            {
                put("system", 1);
            }
        };

        assertEquals(expectedPoolCount, info.getEnabledConsumerTypeCountByPool());
    }
View Full Code Here

        pool1.setAttribute("enabled_consumer_types", type.getLabel());
        pool1.setProductAttribute("enabled_consumer_types", type2.getLabel(),
            pool1.getProductId());
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>() {
            {
                put("domain", 1);
            }
        };

        assertEquals(expectedPoolCount, info.getEnabledConsumerTypeCountByPool());
    }
View Full Code Here

        ConsumerType type = consumerTypeCurator.lookupByLabel("system");
        pool1.setAttribute("enabled_consumer_types", type.getLabel());
        pool1.setStartDate(Util.tomorrow());
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>();

        assertEquals(expectedPoolCount, info.getEnabledConsumerTypeCountByPool());
    }
View Full Code Here

        ConsumerType type = consumerTypeCurator.lookupByLabel("system");
        pool1.setAttribute("enabled_consumer_types", type.getLabel());
        pool1.setEndDate(Util.yesterday());
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>();

        assertEquals(expectedPoolCount, info.getEnabledConsumerTypeCountByPool());
    }
View Full Code Here

        ConsumerType type2 = consumerTypeCurator.lookupByLabel("system");
        pool1.setAttribute("enabled_consumer_types", type1.getLabel() +
                           "," + type2.getLabel());
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>() {
            {
                put("domain", 1);
                put("system", 1);
            }
        };

        assertEquals(expectedPoolCount, info.getEnabledConsumerTypeCountByPool());
    }
View Full Code Here

    @Test
    public void testOwnerPoolEnabledZeroCount() {
        pool1.setAttribute("enabled_consumer_types", "non-type");
        owner.addEntitlementPool(pool1);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, Integer> expectedPoolCount = new HashMap<String, Integer>();

        assertEquals(expectedPoolCount, info.getEnabledConsumerTypeCountByPool());
    }
View Full Code Here

        Entitlement entitlement = createEntitlement(owner, consumer, pool1, cert);
        entitlement.setQuantity(1);
        entitlementCurator.create(entitlement);
        pool1.getEntitlements().add(entitlement);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, OwnerInfo.ConsumptionTypeCounts> expected =
            new HashMap<String, OwnerInfo.ConsumptionTypeCounts>() {
                {
                    put("none", new OwnerInfo.ConsumptionTypeCounts(1, 0));
                }
            };

        assertEquals(expected, info.getEntitlementsConsumedByFamily());
    }
View Full Code Here

        Entitlement entitlement = createEntitlement(owner, consumer, pool1, cert);
        entitlement.setQuantity(1);
        entitlementCurator.create(entitlement);
        pool1.getEntitlements().add(entitlement);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

        Map<String, OwnerInfo.ConsumptionTypeCounts> expected =
            new HashMap<String, OwnerInfo.ConsumptionTypeCounts>() {
                {
                    put("test family", new OwnerInfo.ConsumptionTypeCounts(1, 0));
                }
            };

        assertEquals(expected, info.getEntitlementsConsumedByFamily());
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.OwnerInfo$ConsumptionTypeCounts

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.