Package org.candlepin.model

Examples of org.candlepin.model.Entitlement


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

        Entitlement ent = mockEntitlement(c, PRODUCT_1, range1, PRODUCT_1);
        ent.getPool().setProductAttribute("sockets", "2", PRODUCT_1);
        c.addEntitlement(ent);

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

        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
View Full Code Here


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

        DateRange hypervisorRange = rangeRelativeToDate(now, -2, 2);

        Entitlement ent = mockStackedEntitlement(c, range, STACK_ID_1, PRODUCT_1, 10, PRODUCT_1);
        ent.getPool().setProductAttribute("guest_limit", "2", PRODUCT_1);
        c.addEntitlement(ent);
        Entitlement hpvsrEnt = mockStackedEntitlement(c, hypervisorRange,
            "other_stack_id", "other", 10, "prod2");
        hpvsrEnt.getPool().setProductAttribute("guest_limit", "-1", "prod2");
        c.addEntitlement(hpvsrEnt);

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

            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();
        int id = gen.nextInt(Integer.MAX_VALUE);
        e.setId(String.valueOf(id));

        return e;
    }
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));
View Full Code Here

        List<Pool> pools = new LinkedList<Pool>();
        //pools.add(pool1);
        pools.add(pool2);

        Entitlement entitlement = TestUtil.createEntitlement();
        entitlement.setPool(pool1);
        entitlement.setQuantity(2);

        compliance.addPartialStack("1", entitlement);

        List<PoolQuantity> result = autobindRules.selectBestPools(consumer,
            new String[]{ productId2, productId3 },
View Full Code Here

        return result;
    }

    private Entitlement mockBaseStackedEntitlement(Consumer consumer, String stackId,
        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

    public void instanceAutobindForPhysical8SocketCompletePartialStack() {
        List<Pool> pools = createInstanceBasedPool();
        setupConsumer("8", false);

        // Create a pre-existing entitlement which only covers half of the sockets:
        Entitlement mockEnt = mockEntitlement(pools.get(0), 4);
        consumer.addEntitlement(mockEnt);
        compliance.addPartiallyCompliantProduct(productId, mockEnt);
        compliance.addPartialStack("1", mockEnt);

        List<PoolQuantity> bestPools = autobindRules.selectBestPools(consumer,
View Full Code Here

    private Entitlement mockEntitlement(Consumer consumer, String productId, String name) {
        Pool p = new Pool(owner, productId, name, null,
            new Long(1000), TestUtil.createDate(2000, 1, 1),
            TestUtil.createDate(2050, 1, 1), "1000", "1000", "1000");
        Entitlement e = new Entitlement(p, consumer, 1);
        return e;
    }
View Full Code Here

        assertEquals(new Integer(4), q.getQuantity());
    }

     // Simple utility to simulate a pre-existing entitlement for a pool.
    private Entitlement mockEntitlement(Pool p, int quantity) {
        Entitlement e = TestUtil.createEntitlement(owner, consumer, p, null);
        e.setQuantity(quantity);
        return e;
    }
View Full Code Here

        Pool serverPool = TestUtil.createPool(owner, server, 10);
        Pool hyperPool = TestUtil.createPool(owner, hypervisor, 10);
        serverPool.setId("POOL-ID1");
        hyperPool.setId("Pool-ID2");

        Entitlement entitlement = TestUtil.createEntitlement();
        entitlement.setPool(hyperPool);
        entitlement.setQuantity(4); // compliant

        // The hypervisor must be installed and entitled on the system for autobind
        // to pick up the unlimited guest_limit
        compliance.addCompliantProduct(hypervisor.getId(), entitlement);
View Full Code Here

TOP

Related Classes of org.candlepin.model.Entitlement

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.