Package org.candlepin.model

Examples of org.candlepin.model.Pool


        Owner owner = mock(Owner.class);
        Product product = mock(Product.class);

        when(product.getId()).thenReturn("product id");

        Pool pool = new Pool();
        pool.setSourceSubscription(new SourceSubscription("subId", "master"));
        pool.setOwner(owner);
        Subscription subscription = new Subscription();
        subscription.setId("subId");
        subscription.setOwner(owner);

        List<Pool> pools = Util.newList();
View Full Code Here


        Product product2 = mock(Product.class);

        when(product.getId()).thenReturn("product id");
        when(product2.getId()).thenReturn("product id 2");

        Pool pool = new Pool();
        pool.setSourceSubscription(new SourceSubscription("subId", "master"));
        Subscription subscription = new Subscription();
        subscription.setId("subId");

        List<Pool> pools = Util.newList();
        pools.add(pool);
View Full Code Here

    }

    @Test
    public void bindByPoolString() throws EntitlementRefusedException {
        String poolid = "pool10";
        Pool pool = mock(Pool.class);
        Entitlement ent = mock(Entitlement.class);

        when(cc.findByUuid(eq("abcd1234"))).thenReturn(consumer);
        when(pm.find(eq(poolid))).thenReturn(pool);
        when(pm.entitleByPool(eq(consumer), eq(pool), eq(1))).thenReturn(ent);
View Full Code Here

    }

    @Test
    public void bindByPool() throws EntitlementRefusedException {
        String poolid = "pool10";
        Pool pool = mock(Pool.class);
        Entitlement ent = mock(Entitlement.class);

        when(pm.find(eq(poolid))).thenReturn(pool);
        when(pm.entitleByPool(eq(consumer), eq(pool), eq(1))).thenReturn(ent);
View Full Code Here

    }

    private void bindByPoolErrorTest(String msg) {
        try {
            String poolid = "pool10";
            Pool pool = mock(Pool.class);
            EntitlementRefusedException ere = new EntitlementRefusedException(
                fakeOutResult(msg));

            when(pool.getId()).thenReturn(poolid);
            when(pm.find(eq(poolid))).thenReturn(pool);
            when(pm.entitleByPool(eq(consumer), eq(pool), eq(1))).thenThrow(ere);
            entitler.bindByPool(poolid, consumer, 1);
        }
        catch (EntitlementRefusedException e) {
View Full Code Here

        targetProduct.getAttributes().clear();
        targetProduct.setAttribute("A1", "V1");
        targetProduct.setAttribute("A2", "V2");
        Subscription sourceSub = TestUtil.createSubscription(targetProduct);

        Pool targetPool = TestUtil.createPool(targetProduct);
        // createPool will simulate the copy automatically - reset them.
        targetPool.setProductAttributes(new HashSet<ProductPoolAttribute>());

        PoolHelper ph = new PoolHelper(pm, productCache, null);
        when(psa.getProductById(targetProduct.getId())).thenReturn(targetProduct);
        assertTrue("Update expected.",
            ph.copyProductAttributesOntoPool(sourceSub.getProduct().getId(), targetPool));
        assertEquals(2, targetPool.getProductAttributes().size());
        assertTrue(targetPool.hasProductAttribute("A1"));
        assertTrue(targetPool.hasProductAttribute("A2"));
    }
View Full Code Here

        job = injector.getInstance(ActiveEntitlementJob.class);
    }

    @Test
    public void testActiveEntitlementJob() throws JobExecutionException {
        Pool p = createPoolAndSub(owner, prod, 5L, Util.yesterday(), Util.tomorrow());
        Entitlement ent = this.createEntitlement(owner, consumer, p,
                createEntitlementCertificate("entkey", "ecert"));
        // Needs to be flipped
        ent.setUpdatedOnStart(false);
        entitlementCurator.create(ent);
View Full Code Here


    @Test
    public void testFindBestWithSingleProductSinglePoolReturnsProvidedPool() {
        Product product = new Product(productId, "A test product");
        Pool pool = TestUtil.createPool(owner, product);
        pool.setId("DEAD-BEEF");
        when(this.prodAdapter.getProductById(productId)).thenReturn(product);

        List<Pool> pools = new LinkedList<Pool>();
        pools.add(pool);
View Full Code Here

            productContent.add(new Content("fake" + i, "fake" + i,
                "fake" + i, "yum", "vendor", "", "", ""));
        }

        engProduct.setContent(productContent);
        Pool pool = TestUtil.createPool(owner, mktProduct);
        pool.setId("DEAD-BEEF");
        pool.addProvidedProduct(new ProvidedProduct(engProduct.getId(),
            engProduct.getName()));
        when(this.prodAdapter.getProductById(productId)).thenReturn(mktProduct);
        when(this.prodAdapter.getProductById(engProduct.getId())).thenReturn(engProduct);

        List<Pool> pools = new LinkedList<Pool>();
View Full Code Here

            productContent.add(new Content("fake" + i, "fake" + i,
                "fake" + i, "yum", "vendor", "", "", ""));
        }

        engProduct.setContent(productContent);
        Pool pool = TestUtil.createPool(owner, mktProduct);
        pool.setId("DEAD-BEEF");
        pool.addProvidedProduct(new ProvidedProduct(engProduct.getId(),
            engProduct.getName()));
        when(this.prodAdapter.getProductById(productId)).thenReturn(mktProduct);
        when(this.prodAdapter.getProductById(engProduct.getId())).thenReturn(engProduct);

        List<Pool> pools = new LinkedList<Pool>();
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.