Package org.candlepin.model

Examples of org.candlepin.model.Content


    @Test
    public void testGetChangedProductsContentRemoved() {
        Product newProduct = TestUtil.createProduct("fake id", "fake name");
        Product oldProduct = TestUtil.createProduct("fake id", "fake name");

        Content content = new Content();

        oldProduct.addContent(content);

        Set<Product> products = new HashSet<Product>();
        products.add(newProduct);
View Full Code Here


    @Test
    public void testGetChangedProductsContentSwapped() {
        Product newProduct = TestUtil.createProduct("fake id", "fake name");
        Product oldProduct = TestUtil.createProduct("fake id", "fake name");

        Content content = new Content("foobar", null, null, null, null, null, null, null);
        Content content2 = new Content("baz", null, null, null, null, null, null, null);

        oldProduct.addContent(content);
        newProduct.addContent(content2);

        Set<Product> products = new HashSet<Product>();
View Full Code Here

    @Test
    public void testGetChangedProductsContentEnabledToggled() {
        Product newProduct = TestUtil.createProduct("fake id", "fake name");
        Product oldProduct = TestUtil.createProduct("fake id", "fake name");

        Content content = new Content("foobar", null, null, null, null, null, null, null);

        oldProduct.addContent(content);
        newProduct.addEnabledContent(content);

        Set<Product> products = new HashSet<Product>();
View Full Code Here

        addNoVendorContentTo(product);

        String json = getJsonForProduct(product);
        Reader reader = new StringReader(json);
        Product created = importer.createObject(mapper, reader);
        Content c = created.getProductContent().iterator().next().getContent();
        Set<Product> storeThese = new HashSet<Product>();
        storeThese.add(created);
        importer.store(storeThese);

        verify(contentCuratorMock).createOrUpdate(c);

        assertEquals("unknown", c.getVendor());
    }
View Full Code Here

        assertEquals("unknown", c.getVendor());
    }

    // Returns the Content object added
    private void addContentTo(Product p) {
        Content c = new Content("name", "100130", "label", "type",
            "vendor", "url", "gpgurl", "arch");
        c.setMetadataExpire(1000L);
        p.getProductContent().add(new ProductContent(p, c, true));
    }
View Full Code Here

        p.getProductContent().add(new ProductContent(p, c, true));
    }

    // Returns the Content object added without vendor
    private void addNoVendorContentTo(Product p) {
        Content c = new Content("name", "100130", "label", "type",
            "", "url", "gpgurl", "arch");
        c.setMetadataExpire(1000L);
        p.getProductContent().add(new ProductContent(p, c, true));
    }
View Full Code Here

    @Test
    public void testCreateProductWithContent() {
        Product toSubmit = createProduct();
        String  contentHash = String.valueOf(
            Math.abs(Long.valueOf("test-content".hashCode())));
        Content testContent = new Content("test-content", contentHash,
                            "test-content-label", "yum", "test-vendor",
                             "test-content-url", "test-gpg-url", "test-arch");

        HashSet<Content> contentSet = new HashSet<Content>();
        testContent = contentCurator.create(testContent);
View Full Code Here

     */
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{content_id}")
    public Content getContent(@PathParam("content_id") String contentId) {
        Content content = contentCurator.find(contentId);

        if (content == null) {
            throw new BadRequestException(
                i18n.tr("Content with id {0} could not be found.", contentId));
        }
View Full Code Here

        if (content.getId() == null || content.getId().trim().length() == 0) {
            content.setId(idGenerator.generateId());
            return contentCurator.create(content);
        }

        Content lookedUp  = contentCurator.find(content.getId());
        if (lookedUp != null) {
            return lookedUp;
        }

        return contentCurator.create(content);
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    @Path("/batch")
    public List<Content> createBatchContent(List<Content> contents) {
        List<Content> result = new ArrayList<Content>();
        for (Content content : contents) {
            Content lookedUp = contentCurator.find(content.getId());
            if (lookedUp != null) {
                content.setId(lookedUp.getId());
                result.add(contentCurator.merge(content));
            }
            else {
                result.add(contentCurator.create(content));
            }
View Full Code Here

TOP

Related Classes of org.candlepin.model.Content

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.