Package org.candlepin.model

Examples of org.candlepin.model.Pool


    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");

        ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.LIST_POOLS);
        assertNotNull(results);
        assertEquals(1, results.getErrors().size());
        ValidationError error = results.getErrors().get(0);
View Full Code Here


    public void preEntitlementShouldNotAllowOverConsumptionOfEntitlements() {
        Consumer c = TestUtil.createConsumer();
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setQuantity(5L);

        ValidationResult results = enforcer.preEntitlement(c, p, 10);
        assertNotNull(results);
        assertEquals(1, results.getErrors().size());
        ValidationError error = results.getErrors().get(0);
View Full Code Here

        Consumer c = TestUtil.createConsumer();
        c.setCapabilities(new HashSet<ConsumerCapability>());
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setDerivedProductId("sub-prod-id");

        ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.BIND);
        assertNotNull(results);
        assertEquals(1, results.getErrors().size());
        assertTrue(results.getWarnings().isEmpty());
View Full Code Here

        Consumer c = TestUtil.createConsumer();
        c.setCapabilities(new HashSet<ConsumerCapability>());
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setDerivedProductId("sub-prod-id");

        ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.LIST_POOLS);
        assertNotNull(results);
        assertEquals(1, results.getWarnings().size());
        assertTrue(results.getErrors().isEmpty());
View Full Code Here

        Consumer c = TestUtil.createConsumer();
        c.setCapabilities(new HashSet<ConsumerCapability>());
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setDerivedProductId("sub-prod-id");

        ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.BEST_POOLS);
        assertNotNull(results);
        assertEquals(1, results.getErrors().size());
        assertTrue(results.getWarnings().isEmpty());
View Full Code Here

        capabilities.add(new ConsumerCapability(c, "derived_product"));
        c.setCapabilities(capabilities);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setDerivedProductId("sub-prod-id");

        ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.BIND);
        assertNotNull(results);
        assertTrue("Expected no warnings or errors.", results.isSuccessful());
    }
View Full Code Here

        capabilities.add(new ConsumerCapability(c, "derived_product"));
        c.setCapabilities(capabilities);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
        p.setDerivedProductId("sub-prod-id");

        ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.BEST_POOLS);
        assertNotNull(results);
        assertTrue("Expected no warnings or errors.", results.isSuccessful());
    }
View Full Code Here

        Set<ProvidedProduct> provided = new HashSet<ProvidedProduct>();
        for (String pid : providedProductIds) {
            provided.add(new ProvidedProduct(pid, pid));
        }
        Pool p = new Pool(owner, productId, productId, provided,
            new Long(1000), range.getStartDate(), range.getEndDate(), "1000", "1000",
            "1000");
        Entitlement e = new Entitlement(p, consumer, 1);

        Random gen = new Random();
View Full Code Here

    private Entitlement mockStackedEntitlement(Consumer consumer, DateRange range,
        String stackId, String productId, int quantity, String ... providedProductIds) {

        Entitlement e = mockEntitlement(consumer, productId, range, providedProductIds);
        e.setQuantity(quantity);
        Pool p = e.getPool();

        // Setup the attributes for stacking:
        p.addProductAttribute(new ProductPoolAttribute("stacking_id", stackId, productId));
        p.addProductAttribute(new ProductPoolAttribute("sockets", "2", productId));

        return e;
    }
View Full Code Here

        String productId, String name) {
        Entitlement e = mockEntitlement(consumer, productId, name);
        Random gen = new Random();
        int id = gen.nextInt(Integer.MAX_VALUE);
        e.setId(String.valueOf(id));
        Pool p = e.getPool();
        // Setup the attributes for stacking:
        p.addProductAttribute(new ProductPoolAttribute("stacking_id", stackId, productId));
        return e;
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.Pool

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.