Package org.candlepin.model

Examples of org.candlepin.model.Consumer


        assertEquals("pool.not.available.to.manifest.consumers", error.getResourceKey());
    }

    @Test
    public void preEntitlementShouldNotAllowConsumptionFromRequiresHostPools() {
        Consumer c = TestUtil.createConsumer();
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setAttribute("virt_only", "true");
        p.setAttribute("requires_host", "true");
View Full Code Here


    }

    // Stacking becomes involved here.
    @Test
    public void validRangeNotNullWhenOnlyPartialEntitlement() {
        Consumer c = mockConsumer(PRODUCT_1);

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

        c.addEntitlement(mockStackedEntitlement(c, range, STACK_ID_1, PRODUCT_1, 1,
            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("pool.not.available.to.manifest.consumers", error.getResourceKey());
    }

    @Test
    public void preEntitlementShouldNotAllowListOfRequiresHostPools() {
        Consumer c = TestUtil.createConsumer();
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setAttribute("virt_only", "true");
        p.setAttribute("requires_host", "true");
View Full Code Here

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

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

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

        c.addEntitlement(mockStackedEntitlement(c, range1, STACK_ID_1, PRODUCT_1, 1,
            PRODUCT_1));
        c.addEntitlement(mockStackedEntitlement(c, range2, STACK_ID_1, PRODUCT_1, 1,
            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

        Product p = new Product(engProdId, "Eng Product 1000");
        p.setAttribute("brand_type", "OS");
        Set<Product> prods = new HashSet<Product>(Arrays.asList(p));
        Pool pool = TestUtil.createPool(new Product("mkt", "MKT SKU"));
        pool.getBranding().add(new Branding(engProdId, "OS", brandedName));
        Consumer consumer = new Consumer();
        Entitlement e = new Entitlement(pool, consumer, 10);

        List<org.candlepin.json.model.Product> certProds = util.createProducts(prods, "",
            new HashMap<String, EnvironmentContent>()new Consumer(), e);

        assertEquals(1, certProds.size());
        assertEquals(brandedName, certProds.get(0).getBrandName());
        assertEquals("OS", certProds.get(0).getBrandType());
    }
View Full Code Here

        pool.getBranding().add(new Branding(engProdId, "OS", "number 3"));
        Set<String> possibleBrandNames = new HashSet<String>();
        for (Branding b : pool.getBranding()) {
            possibleBrandNames.add(b.getName());
        }
        Consumer consumer = new Consumer();
        Entitlement e = new Entitlement(pool, consumer, 10);

        List<org.candlepin.json.model.Product> certProds = util.createProducts(prods, "",
            new HashMap<String, EnvironmentContent>()new Consumer(), e);

        assertEquals(1, certProds.size());
        // Should get the first name we encountered
        // but they're in a set so we can't test order
        String resultBrandName = certProds.get(0).getBrandName();
View Full Code Here

        context = new HashMap<String, Object>();
    }

    @Test
    public void filterConsumerIdCert() {
        Consumer c = new Consumer();
        c.setType(new ConsumerType(ConsumerType.ConsumerTypeEnum.SYSTEM));
        IdentityCertificate cert = new IdentityCertificate();
        cert.setCert("FILTERMEPLEASE");
        cert.setKey("KEY");
        c.setIdCert(cert);

        context.put("consumer", c);
        String output = objMapper.toJsonString(context);
        assertFalse(output.contains("FILTERMEPLEASE"));
    }
View Full Code Here

    }

    @Test
    public void filterEntitlementConsumer() {
        Entitlement e = new Entitlement();
        Consumer c = new Consumer();
        IdentityCertificate cert = new IdentityCertificate();
        cert.setCert("FILTERMEPLEASE");
        cert.setKey("KEY");
        c.setIdCert(cert);
        e.setConsumer(c);

        context.put("entitlement", e);
        String output = objMapper.toJsonString(context);
        assertFalse(output.contains("consumer"));
View Full Code Here

    }

    @Test(expected = BadRequestException.class)
    public void nullPool() {
        String poolid = "foo";
        Consumer c = null; // keeps me from casting null
        when(pm.find(eq(poolid))).thenReturn(null);
        entitler.bindByPool(poolid, c, 10);
    }
View Full Code Here

        owner = new Owner("test-owner", "Test Owner");
        owner = ownerCurator.create(owner);
        ct = new ConsumerType(ConsumerTypeEnum.SYSTEM);
        ct = consumerTypeCurator.create(ct);

        consumer = new Consumer("a consumer", "username", owner, ct);
        consumer.addInstalledProduct(new ConsumerInstalledProduct(prod.getId(), prod.getName()));
        consumerCurator.create(consumer);

        job = injector.getInstance(ActiveEntitlementJob.class);
    }
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.