Package org.candlepin.model

Examples of org.candlepin.model.SourceSubscription


        Pool derivedPool = new Pool(owner, product.getId(), product.getName(),
            new HashSet<ProvidedProduct>(), 1L, TestUtil.createDate(2011, 3, 2),
            TestUtil.createDate(2055, 3, 2),
            "", "", "");
        derivedPool.setSourceEntitlement(sourceEnt);
        derivedPool.setSourceSubscription(new SourceSubscription(subid, "derived"));
        poolCurator.create(derivedPool);

        assertEquals(0, poolCurator.lookupOversubscribedBySubscriptionId(
            subid, sourceEnt).size());
View Full Code Here


        Entitlement e = new Entitlement(sourcePool, consumer, 1);
        entitlementCurator.create(e);

        Pool pool2 = TestUtil.createPool(owner, product);
        pool2.setSourceEntitlement(e);
        pool2.setSourceSubscription(new SourceSubscription(
            sourcePool.getSubscriptionId(), "derived"));
        poolCurator.create(pool2);

        assertTrue(poolCurator.lookupBySubscriptionId(sub.getId()).size() == 2);
        poolManager.deletePool(sourcePool);
View Full Code Here

        assertTrue(result.isEmpty());
    }

    private Pool createPool(Owner o, String subId) {
        Pool pool = TestUtil.createPool(o, product);
        pool.setSourceSubscription(new SourceSubscription(subId, "master"));
        return poolCurator.create(pool);
    }
View Full Code Here

    protected Pool createPool(Owner owner, Product product,
        int quantity, Date startDate, Date endDate) {
        Pool p = TestUtil.createPool(owner, product, quantity);
        p.setId("testpool" + TestUtil.randomInt());
        p.setSourceSubscription(
            new SourceSubscription("testsub" + TestUtil.randomInt(), "master"));
        p.setStartDate(startDate);
        p.setEndDate(endDate);
        for (ProductAttribute pa : product.getAttributes()) {
            p.addProductAttribute(new ProductPoolAttribute(pa.getName(),
                pa.getValue(), product.getId()));
View Full Code Here

            for (Branding b : sub.getBranding()) {
                newPool.getBranding().add(new Branding(b.getProductId(), b.getType(),
                    b.getName()));
            }

            newPool.setSourceSubscription(new SourceSubscription(sub.getId(), "master"));
            ProductAttribute virtAtt = sub.getProduct().getAttribute("virt_only");

            // note: the product attributes are getting copied above, but the following will
            // make virt_only a pool attribute. That makes the pool explicitly virt_only to
            // subscription manager and any other downstream comsumer.
            if (virtAtt != null && virtAtt.getValue() != null &&
                !virtAtt.getValue().equals("")) {
                newPool.addAttribute(new org.candlepin.model.PoolAttribute("virt_only",
                    virtAtt.getValue()));
            }

            pools.add(newPool);
        }

        boolean hostLimited = attributes.containsKey("host_limited") &&
            attributes.get("host_limited").equals("true");
        // Check if we need to create a virt-only pool for this subscription:
        if (attributes.containsKey("virt_limit") && !config.getBoolean(ConfigProperties.STANDALONE) &&
            !hostLimited && !hasBonusPool(existingPools)) {
            HashMap<String, String> virtAttributes = new HashMap<String, String>();
            virtAttributes.put("virt_only", "true");
            virtAttributes.put("pool_derived", "true");
            virtAttributes.put("physical_only", "false");
            // Make sure the virt pool does not have a virt_limit,
            // otherwise this will recurse infinitely
            virtAttributes.put("virt_limit", "0");

            String virtQuantity = getVirtQuantity(attributes.get("virt_limit"), quantity);
            if (virtQuantity != null) {
                Pool derivedPool = helper.createPool(sub, sub.getProduct().getId(),
                                                    virtQuantity, virtAttributes);
                // Using derived here because only one derived pool
                // is created for this subscription
                derivedPool.setSourceSubscription(
                    new SourceSubscription(sub.getId(), "derived"));
                pools.add(derivedPool);
            }
        }
        return pools;
    }
View Full Code Here

        }
        else {
            // attribute per 795431, useful for rolling up pool info in headpin
            consumerSpecificPool.setAttribute("source_pool_id", pool.getId());
            consumerSpecificPool.setSourceSubscription(
                new SourceSubscription(pool.getSubscriptionId(),
                    sourceEntitlement.getId()));
        }

        poolManager.createPool(consumerSpecificPool);
        return consumerSpecificPool;
View Full Code Here

            String quantity, Map<String, String> newPoolAttributes) {

        Pool pool = createPool(productId, sub.getOwner(), quantity, sub.getStartDate(),
            sub.getEndDate(), sub.getContractNumber(), sub.getAccountNumber(),
            sub.getOrderNumber(), new HashSet<ProvidedProduct>());
        pool.setSourceSubscription(new SourceSubscription(sub.getId(), "master"));

        copyProvidedProducts(sub, pool);

        // Add in the new attributes
        for (Entry<String, String> entry : newPoolAttributes.entrySet()) {
View Full Code Here

TOP

Related Classes of org.candlepin.model.SourceSubscription

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.