Package org.candlepin.model

Examples of org.candlepin.model.Consumer


    }

    @Test
    public void preEntitlementIgnoresSocketAttributeChecking() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("cpu.socket(s)", "12");
        c.getType().setManifest(true);

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


        owner = new Owner("test");
    }

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

        Calendar cal = Calendar.getInstance();
        Date now = cal.getTime();

        DateRange entRange = rangeRelativeToDate(now, -6, 6);
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, entRange, 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 preEntitlementNoCoreCapableBindError() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("cpu.core(s)_per_socket", "2");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        c.setCapabilities(caps);
        c.getType().setManifest(true);

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

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

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

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

        // Add current entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        // Add expired entitlement
        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 preEntitlementNoCoreCapableListWarn() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("cpu.core(s)_per_socket", "2");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        c.setCapabilities(caps);
        c.getType().setManifest(true);

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

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

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

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

        // Add current entitlement
        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        // Add future entitlement
        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

     * @throws Exception
     */
    @Test
    public void correctUserName() throws Exception {
        Owner owner = new Owner("test owner");
        Consumer consumer = new Consumer("machine_name", "test user", owner,
                new ConsumerType(ConsumerTypeEnum.SYSTEM));
        ConsumerPrincipal expected = new ConsumerPrincipal(consumer);

        String dn = "CN=453-44423-235";

View Full Code Here

     */
    @Test
    public void noUuidOnCert() throws Exception {
        mockCert("OU=something");
        when(this.consumerCurator.findByUuid(anyString())).thenReturn(
                new Consumer("machine_name", "test user", null, null));
        assertNull(this.auth.getPrincipal(request));
    }
View Full Code Here

    }

    @Test
    public void preEntitlementSuccessCoreCapable() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("cpu.core(s)_per_socket", "2");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        ConsumerCapability cc = new ConsumerCapability(c, "cores");
        caps.add(cc);
        c.setCapabilities(caps);
        c.getType().setManifest(true);

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

    @Test
    public void enricherSetsArchVersion() {
        //test that the enricher sets the arch and version
        //when they are supplied as null
        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();
        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

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.