Package org.candlepin.model

Examples of org.candlepin.model.Consumer


    @Test
    public void enricherDoesntSetArchVersion() {
        //test that the enricher does not set the arch and version
        //when they are supplied with values
        Consumer c = mockConsumer(PRODUCT_1);

        Calendar cal = Calendar.getInstance();
        Date now = cal.getTime();
        DateRange range2 = rangeRelativeToDate(now, -1, 4);
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);
        ComplianceStatus status = compliance.getStatus(c, now);
        status.addNonCompliantProduct(PRODUCT_1);
        ConsumerInstalledProduct cip = new ConsumerInstalledProduct();
        cip.setArch("x86_64");
        cip.setVersion("4.5");
        c.addInstalledProduct(cip);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
        Product p = new Product(PRODUCT_1, "Awesome Product");
        p.setAttribute("version", "candlepin version");
        p.setAttribute("arch", "candlepin arch");
View Full Code Here


    }

    @Test
    public void preEntitlementNoRamCapableBindError() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("memory.memtotal", "2000000");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        c.setCapabilities(caps);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        prod.setAttribute("ram", "2");
        Pool p = TestUtil.createPool(prod);
View Full Code Here

        assertEquals("x86_64", cip.getArch());
    }

    @Test
    public void validRangeIgnoresFutureWithOverlap() {
        Consumer c = mockConsumer(PRODUCT_1);

        Calendar cal = Calendar.getInstance();
        Date now = cal.getTime();
        DateRange future = rangeRelativeToDate(now, 12, 24);
        DateRange current = rangeRelativeToDate(now, 0, 13);

        // Add current entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, current, PRODUCT_1));
        // Add future entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, future, PRODUCT_1));
        // Add future entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, future, PRODUCT_1));

        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);

        ComplianceStatus status = compliance.getStatus(c, now);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
View Full Code Here

    }

    @Test
    public void preEntitlementNoRamCapableListWarn() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("memory.memtotal", "2000000");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        c.setCapabilities(caps);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        prod.setAttribute("ram", "2");
        Pool p = TestUtil.createPool(prod);
View Full Code Here

        assertEquals(future.getEndDate(), validRange.getEndDate());
    }

    @Test
    public void validRangeIgnoresFutureBackToBack() {
        Consumer c = mockConsumer(PRODUCT_1);

        Calendar cal = Calendar.getInstance();
        Date now = cal.getTime();
        DateRange future = rangeRelativeToDate(now, 12, 24);
        DateRange current = rangeRelativeToDate(now, 0, 12);

        // Add current entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, current, PRODUCT_1));
        // Add future entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, future, PRODUCT_1));
        // Add future entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, future, PRODUCT_1));

        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);

        ComplianceStatus status = compliance.getStatus(c, now);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
View Full Code Here

    }

    @Test
    public void preEntitlementSuccessRamCapable() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("memory.memtotal", "2000000");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        ConsumerCapability cc = new ConsumerCapability(c, "ram");
        caps.add(cc);
        c.setCapabilities(caps);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        prod.setAttribute("ram", "2");
        Pool p = TestUtil.createPool(prod);
View Full Code Here

        assertEquals(future.getEndDate(), validRange.getEndDate());
    }

    @Test
    public void validRangeWithMultipleEntsWithOverlap() {
        Consumer c = mockConsumer(PRODUCT_1);

        Calendar cal = Calendar.getInstance();
        Date now = cal.getTime();
        DateRange range1 = rangeRelativeToDate(now, -4, 4);
        DateRange range2 = rangeRelativeToDate(now, 1, 8);

        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range1, PRODUCT_1));

        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);

        ComplianceStatus status = compliance.getStatus(c, now);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
View Full Code Here

        assertEquals(range2.getEndDate(), validRange.getEndDate());
    }

    @Test
    public void validRangeWithMultipleWhereOneConsumesTheOthersSpan() {
        Consumer c = mockConsumer(PRODUCT_1);

        Calendar cal = Calendar.getInstance();
        Date now = cal.getTime();
        DateRange range1 = rangeRelativeToDate(now, -4, 4);
        DateRange range2 = rangeRelativeToDate(now, 0, 2);

        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range1, PRODUCT_1));

        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);

        ComplianceStatus status = compliance.getStatus(c, now);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
View Full Code Here

    }

    @Test
    public void preEntitlementNoInstanceCapableBindError() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        c.setCapabilities(caps);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        prod.setAttribute("instance_multiplier", "2");
        Pool p = TestUtil.createPool(prod);
View Full Code Here

        assertEquals(range1.getEndDate(), validRange.getEndDate());
    }

    @Test
    public void validRangeWithMultipleWhereFutureEntitlementOverlaps() {
        Consumer c = mockConsumer(PRODUCT_1);

        Calendar cal = Calendar.getInstance();
        Date now = cal.getTime();
        DateRange range1 = rangeRelativeToDate(now, -4, 2);
        DateRange range2 = rangeRelativeToDate(now, 2, 4);

        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range1, PRODUCT_1));

        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);

        ComplianceStatus status = compliance.getStatus(c, now);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
View Full Code Here

TOP

Related Classes of org.candlepin.model.Consumer

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.