Package org.candlepin.model

Examples of org.candlepin.model.ProvidedProduct


        return rhel;
    }

    public static ProvidedProduct createProvidedProduct(String id, String name) {
        ProvidedProduct p = new ProvidedProduct(id, name);
        return p;
    }
View Full Code Here


                    attr.getValue(), sub.getProduct().getId()));
            }
        }

        for (Product prod : sub.getProvidedProducts()) {
            p.addProvidedProduct(new ProvidedProduct(prod.getId(), prod.getName()));
        }

        for (Branding b : sub.getBranding()) {
            p.getBranding().add(new Branding(b.getProductId(), b.getType(), b.getName()));
        }
View Full Code Here

    @Test
    public void exportProducts() throws Exception {
        config.setProperty(ConfigProperties.SYNC_WORK_DIR, "/tmp/");
        Consumer consumer = mock(Consumer.class);
        Entitlement ent = mock(Entitlement.class);
        ProvidedProduct pp = mock(ProvidedProduct.class);
        DerivedProvidedProduct spp = mock(DerivedProvidedProduct.class);
        Pool pool = mock(Pool.class);
        Rules mrules = mock(Rules.class);
        Principal principal = mock(Principal.class);
        IdentityCertificate idcert = new IdentityCertificate();

        Set<ProvidedProduct> ppset = new HashSet<ProvidedProduct>();
        ppset.add(pp);

        Set<DerivedProvidedProduct> sppSet = new HashSet<DerivedProvidedProduct>();
        sppSet.add(spp);

        Set<Entitlement> entitlements = new HashSet<Entitlement>();
        entitlements.add(ent);

        Product prod = new Product("12345", "RHEL Product");
        prod.setMultiplier(1L);
        prod.setCreated(new Date());
        prod.setUpdated(new Date());
        prod.setHref("http://localhost");
        prod.setAttributes(Collections.EMPTY_SET);

        Product prod1 = new Product("MKT-prod", "RHEL Product");
        prod1.setMultiplier(1L);
        prod1.setCreated(new Date());
        prod1.setUpdated(new Date());
        prod1.setHref("http://localhost");
        prod1.setAttributes(Collections.EMPTY_SET);

        Product subProduct = new Product("MKT-sub-prod", "Sub Product");
        subProduct.setMultiplier(1L);
        subProduct.setCreated(new Date());
        subProduct.setUpdated(new Date());
        subProduct.setHref("http://localhost");
        subProduct.setAttributes(Collections.EMPTY_SET);

        Product subProvidedProduct = new Product("332211", "Sub Product");
        subProvidedProduct.setMultiplier(1L);
        subProvidedProduct.setCreated(new Date());
        subProvidedProduct.setUpdated(new Date());
        subProvidedProduct.setHref("http://localhost");
        subProvidedProduct.setAttributes(Collections.EMPTY_SET);

        ProductCertificate pcert = new ProductCertificate();
        pcert.setKey("euh0876puhapodifbvj094");
        pcert.setCert("hpj-08ha-w4gpoknpon*)&^%#");
        pcert.setCreated(new Date());
        pcert.setUpdated(new Date());

        when(pp.getProductId()).thenReturn("12345");
        when(pool.getProvidedProducts()).thenReturn(ppset);
        when(pool.getProductId()).thenReturn("MKT-prod");

        when(pool.getDerivedProvidedProducts()).thenReturn(sppSet);
        when(pool.getDerivedProductId()).thenReturn(subProduct.getId());
View Full Code Here

    private Entitlement mockEntitlement(Consumer consumer, String productId,
        DateRange range, String ... providedProductIds) {

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

        ownerCurator.create(owner2);
    }

    private void associateProductToOwner(Owner o, Product p, Product provided) {
        Set<ProvidedProduct> providedProducts = new HashSet<ProvidedProduct>();
        ProvidedProduct providedProduct = new ProvidedProduct(
            provided.getId(), "Test Provided Product");
        providedProducts.add(providedProduct);

        Pool pool = TestUtil.createPool(o, p, providedProducts, 5);
        providedProduct.setPool(pool);
        poolCurator.create(pool);

        Consumer c = createConsumer(o);
        EntitlementCertificate cert = createEntitlementCertificate("key", "certificate");
        Entitlement ent = createEntitlement(o, c, pool, cert);
View Full Code Here

        Product provided = TestUtil.createProduct();
        productCurator.create(product);
        productCurator.create(provided);

        Set<ProvidedProduct> providedProducts = new HashSet<ProvidedProduct>();
        ProvidedProduct providedProduct = new ProvidedProduct(
            provided.getId(), "Test Provided Product");
        providedProducts.add(providedProduct);

        // Create pool with end date in the past.
        Pool pool = new Pool(owner, product.getId(), product.getName(),
            providedProducts, Long.valueOf(5), TestUtil.createDate(2009,
                11, 30), TestUtil.createDate(2010, 11, 30), "SUB234598S",
            "ACC123", "ORD222");

        providedProduct.setPool(pool);
        poolCurator.create(pool);

        Consumer consumer = createConsumer(owner);
        consumerCurator.create(consumer);
View Full Code Here

        productCurator.create(prod2);
        owner = new Owner("testowner");
        ownerCurator.create(owner);

        Set<ProvidedProduct> providedProducts = new HashSet<ProvidedProduct>();
        ProvidedProduct providedProduct = new ProvidedProduct(
            prod2.getId(), prod2.getName());
        providedProducts.add(providedProduct);

        pool = TestUtil.createPool(owner, prod1, providedProducts, 1000);
        subscription = TestUtil.createSubscription(owner, prod1);
        subAdapter.createSubscription(subscription);
        pool.setSourceSubscription(
            new SourceSubscription(subscription.getId(), "master"));
        providedProduct.setPool(pool);
        poolCurator.create(pool);
        owner = pool.getOwner();

        consumer = TestUtil.createConsumer(owner);
View Full Code Here

    public void testCreateWithDerivedProvidedProducts() {
        Product derivedProd = TestUtil.createProduct();
        productCurator.create(derivedProd);

        Pool p = TestUtil.createPool(owner, prod1, new HashSet<ProvidedProduct>(), 1000);
        p.addProvidedProduct(new ProvidedProduct(prod2.getId(), prod2.getName()));
        Set<DerivedProvidedProduct> derivedProducts = new HashSet<DerivedProvidedProduct>();
        derivedProducts.add(new DerivedProvidedProduct(derivedProd.getId(),
            derivedProd.getName(), p));

        p.setDerivedProvidedProducts(derivedProducts);
View Full Code Here

        Product childProduct = TestUtil.createProduct("2", "product-2");
        productCurator.create(childProduct);
        productCurator.create(parentProduct);

        Set<ProvidedProduct> providedProducts = new HashSet<ProvidedProduct>();
        ProvidedProduct providedProduct = new ProvidedProduct(childProduct.getId(),
            childProduct.getName());
        providedProducts.add(providedProduct);

        Pool pool = TestUtil.createPool(owner, parentProduct, providedProducts, 5);
        providedProduct.setPool(pool);
        poolCurator.create(pool);


        List<Pool> results = poolCurator.listAvailableEntitlementPools(null, owner,
            childProduct.getId(), null, false);
View Full Code Here

        productCurator.create(childProduct2);
        productCurator.create(childProduct3);
        productCurator.create(parentProduct);

        Set<ProvidedProduct> providedProducts = new HashSet<ProvidedProduct>();
        ProvidedProduct providedProduct = new ProvidedProduct("child1",
            "child1", pool);
        providedProducts.add(providedProduct);

        Pool pool = TestUtil.createPool(owner, parentProduct, providedProducts, 5);
        poolCurator.create(pool);
        pool = poolCurator.find(pool.getId());
        assertEquals(1, pool.getProvidedProducts().size());

        // Clear the set and create a new one:
        pool.getProvidedProducts().clear();
        pool.addProvidedProduct(new ProvidedProduct("child2",
            "child2", pool));
        pool.addProvidedProduct(new ProvidedProduct("child3",
            "child3", pool));
        poolCurator.merge(pool);

        pool = poolCurator.find(pool.getId());
        assertEquals(2, pool.getProvidedProducts().size());
View Full Code Here

TOP

Related Classes of org.candlepin.model.ProvidedProduct

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.