Package org.candlepin.model

Examples of org.candlepin.model.OwnerInfo$ConsumptionTypeCounts


        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


        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(0, 1));
                }
            };

        assertEquals(expected, info.getEntitlementsConsumedByFamily());

    }
View Full Code Here

        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(0, 1));
                }
            };

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

        // Second physical machine with no is_guest fact set.
        Consumer physical2 = new Consumer("test-consumer2", "test-user", owner, type);
        consumerCurator.create(physical2);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);
        assertEquals((Integer) 2, info.getConsumerGuestCounts().get(OwnerInfo.GUEST));
        assertEquals((Integer) 2, info.getConsumerGuestCounts().get(OwnerInfo.PHYSICAL));


        // Create another owner to make sure we don't see another owners consumers:
        Owner anotherOwner = createOwner();
        ownerCurator.create(anotherOwner);
        info = ownerInfoCurator.lookupByOwner(anotherOwner);
        assertEquals((Integer) 0, info.getConsumerGuestCounts().get(OwnerInfo.GUEST));
        assertEquals((Integer) 0, info.getConsumerGuestCounts().get(OwnerInfo.PHYSICAL));
    }
View Full Code Here

    @Test
    public void testConsumerCountsByEntitlementStatus() {
        setupConsumerCountTest("test-user");

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);
        assertConsumerCountsByEntitlementStatus(info);
    }
View Full Code Here

        ueberConsumer.setEntitlementStatus(ComplianceStatus.GREEN);
        consumerCurator.create(ueberConsumer);

        // Even though we've added an ubercert consumer, the counts should remain
        // as expected.
        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);
        assertConsumerCountsByEntitlementStatus(info);
    }
View Full Code Here

        setupConsumerCountTest("test-user");
        setupConsumerCountTest(mySystemsUser.getUsername());

        // Should only get the counts for a single setup case above.
        // The test-user consumers should be ignored.
        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);
        assertConsumerCountsByEntitlementStatus(info);
    }
View Full Code Here

        consumerCurator.create(consumer);

        consumer = new Consumer("not-my-system", "another-user", owner, type);
        consumerCurator.create(consumer);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

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

        assertEquals(expectedConsumers, info.getConsumerCounts());
    }
View Full Code Here

        Entitlement otherEntitlement = createEntitlement(owner, consumer, pool1, otherCert);
        otherEntitlement.setQuantity(1);
        entitlementCurator.create(otherEntitlement);
        consumerCurator.merge(consumer);

        OwnerInfo info = ownerInfoCurator.lookupByOwner(owner);

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

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

        assertEquals(expectedConsumers, info.getConsumerCounts());
        assertEquals(expectedEntitlementsConsumed, info.getEntitlementsConsumedByType());
    }
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.