Package org.candlepin.model

Examples of org.candlepin.model.Product


    public void purgeCache(Collection<String> cachedKeys) {
    }

    @Override
    public void removeContent(String productId, String contentId) {
        Product product = prodCurator.find(productId);
        Content content = contentCurator.find(contentId);
        prodCurator.removeProductContent(product, content);
    }
View Full Code Here


        assertFalse(np.equals(np1));
    }

    @Test
    public void testPrefixLogic() {
        Product p = new Product("JarJar", "Binks");
        Content c = new Content();
        c.setContentUrl("/some/path");
        ProductContent pc = new ProductContent(p, c, true);

        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is", pc));
View Full Code Here

    @Test
    public void productWithBrandName() {
        String engProdId = "1000";
        String brandedName = "Branded Eng Product";
        Product p = new Product(engProdId, "Eng Product 1000");
        p.setAttribute("brand_type", "OS");
        Set<Product> prods = new HashSet<Product>(Arrays.asList(p));
        Pool pool = TestUtil.createPool(new Product("mkt", "MKT SKU"));
        pool.getBranding().add(new Branding(engProdId, "OS", brandedName));
        Consumer consumer = new Consumer();
        Entitlement e = new Entitlement(pool, consumer, 10);

        List<org.candlepin.json.model.Product> certProds = util.createProducts(prods, "",
View Full Code Here

    @Test
    public void productWithMultipleBrandNames() {
        String engProdId = "1000";
        String brandedName = "Branded Eng Product";
        Product p = new Product(engProdId, "Eng Product 1000");
        p.setAttribute("brand_type", "OS");
        Set<Product> prods = new HashSet<Product>(Arrays.asList(p));
        Pool pool = TestUtil.createPool(new Product("mkt", "MKT SKU"));
        pool.getBranding().add(new Branding(engProdId, "OS", brandedName));
        pool.getBranding().add(new Branding(engProdId, "OS", "another brand name"));
        pool.getBranding().add(new Branding(engProdId, "OS", "number 3"));
        Set<String> possibleBrandNames = new HashSet<String>();
        for (Branding b : pool.getBranding()) {
View Full Code Here

        verify(poolManager, times(1)).refreshPoolsWithRegeneration(eq(owner), eq(false));
    }

    @Test
    public void testProductOnlyExaminedOnce() {
        Product product = mock(Product.class);

        refresher.add(product);
        refresher.add(product);
        refresher.run();
View Full Code Here

    }

    @Test
    public void testPoolOnlyExaminedOnceProductAndOwner() {
        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();
View Full Code Here

            any(Subscription.class), eq(false));
    }

    @Test
    public void testPoolOnlyExaminedOnceTwoProducts() {
        Product product = mock(Product.class);
        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");
View Full Code Here

    }

    @Test
    public void getProductFromAdapterIfNotInCache() {
        Product p = new Product("a_product", "a_product");
        when(mockProductAdapter.getProductById(p.getId())).thenReturn(p);
        assertFalse(cache.contains(p.getId()));
        Product fetched = cache.getProductById(p.getId());
        assertEquals(p.getId(), fetched.getId());
        assertTrue(cache.contains(p.getId()));

        verify(mockProductAdapter, times(1)).getProductById(eq(p.getId()));
    }
View Full Code Here

        verify(mockProductAdapter, times(1)).getProductById(eq(p.getId()));
    }

    @Test
    public void doNotGetProductFromAdapterIfInCache() {
        Product p = new Product("a_product", "a_product");
        when(mockProductAdapter.getProductById(p.getId())).thenReturn(p);
        assertFalse(cache.contains(p.getId()));
        // Look up the product so it is fetched from the adapter
        cache.getProductById(p.getId());
        assertTrue(cache.contains(p.getId()));

        // Look the product up again so that we can verify that
        // a second adapter call was not made.
        Product fetched = cache.getProductById(p.getId());
        assertEquals(p.getId(), fetched.getId());

        // The adapter should be hit only once.
        verify(mockProductAdapter, times(1)).getProductById(eq(p.getId()));
    }
View Full Code Here

    }

    @Test
    public void ensureFirstProductRemovedWhenMaxReached() {

        Product initial = addProductToCache("initial_product");
        for (int i = 0; i < 99; i++) {
            addProductToCache("Product" + i);
        }

        assertEquals(100, cache.size());
        assertTrue(cache.contains(initial.getId()));

        // Add one more to roll the cache over its max.
        Product overflow = addProductToCache("overflow");

        // Cache size should remain at MAX.
        assertEquals(100, cache.size());
        // First product added should no longer be there.
        assertFalse(cache.contains(initial.getId()));
        // New product should exist.
        assertTrue(cache.contains(overflow.getId()));
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.Product

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.