Package org.candlepin.model

Examples of org.candlepin.model.Content


    }

    @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));
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is/", pc));
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is///", pc));
        c.setContentUrl("some/path");
        assertEquals("/some/path", util.createFullContentPath(null, pc));
        assertEquals("/some/path", util.createFullContentPath("", pc));
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is/", pc));
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is", pc));
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is///", pc));
        c.setContentUrl("///////some/path");
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is/", pc));
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is", pc));
        assertEquals("/this/is/some/path", util.createFullContentPath("/this/is///", pc));
        assertEquals("/some/path", util.createFullContentPath(null, pc));
        assertEquals("/some/path", util.createFullContentPath("", pc));
        c.setContentUrl("http://some/path");
        assertEquals("http://some/path", util.createFullContentPath("/this/is", pc));
        c.setContentUrl("https://some/path");
        assertEquals("https://some/path", util.createFullContentPath("/this/is", pc));
        c.setContentUrl("ftp://some/path");
        assertEquals("ftp://some/path", util.createFullContentPath("/this/is", pc));
        c.setContentUrl("file://some/path");
        assertEquals("file://some/path", util.createFullContentPath("/this/is", pc));
    }
View Full Code Here


    /* FIXME: Add Arches here */

    @Before
    public void setUp() {
        updates = new Content(
            "Test Content 1", "100",
            "test-content-label-1", "yum-1", "test-vendor-1",
            "test-content-url-1", "test-gpg-url-1", "test-arch1,test-arch2");
        updates.setRequiredTags("required-tags");
        updates.setReleaseVer("releaseVer");
View Full Code Here

        updates.setModifiedProductIds(new HashSet<String>() { { add("productIdOne"); } });
    }

    @Test
    public void shouldUpdateContentWithNewValues() {
        Content toBeUpdated = new Content(
            "Test Content", updates.getId(),
            "test-content-label", "yum", "test-vendor",
            "test-content-url", "test-gpg-url", "test-arch1");
        contentCurator.create(toBeUpdated);

        toBeUpdated = contentCurator.createOrUpdate(updates);

        assertEquals(toBeUpdated.getName(), updates.getName());
        assertEquals(toBeUpdated.getLabel(), updates.getLabel());
        assertEquals(toBeUpdated.getType(), updates.getType());
        assertEquals(toBeUpdated.getVendor(), updates.getVendor());
        assertEquals(toBeUpdated.getContentUrl(), updates.getContentUrl());
        assertEquals(toBeUpdated.getRequiredTags(), updates.getRequiredTags());
        assertEquals(toBeUpdated.getReleaseVer(), updates.getReleaseVer());
        assertEquals(toBeUpdated.getMetadataExpire(), updates.getMetadataExpire());
        assertEquals(toBeUpdated.getModifiedProductIds(), updates.getModifiedProductIds());
        assertEquals(toBeUpdated.getArches(), updates.getArches());
    }
View Full Code Here

    }

    @Test
    public void testRemoveProductContent() {
        Product p = createTestProduct();
        Content content = new Content("test-content", "test-content",
            "test-content", "yum", "us", "here", "here", "test-arch");
        p.addContent(content);
        contentCurator.create(content);
        productCurator.create(p);
View Full Code Here

    }

    @Test
    public void testGetProductIdFromContentId() {
        Product p = createTestProduct();
        Content content = new Content("best-content", "best-content",
            "best-content", "yum", "us", "here", "here", "test-arch");
        p.addContent(content);
        contentCurator.create(content);
        productCurator.create(p);

        List<String> contentIds = new LinkedList<String>();
        contentIds.add(content.getId());
        List<String> productIds = productCurator.getProductIdsWithContent(contentIds);
        assertEquals(1, productIds.size());
        assertEquals(p.getId(), productIds.get(0));
    }
View Full Code Here

    }

    @Test
    public void testSaveOrUpdateProductNoDuplicateProdContent() {
        Product p = createTestProduct();
        Content content = new Content("best-content", "best-content",
            "best-content", "yum", "us", "here", "here", "test-arch");
        p.addContent(content);
        contentCurator.create(content);
        productCurator.createOrUpdate(p);

        p = createTestProduct();
        // The content isn't quite the same.  We just care about matching
        // product ids with content ids
        content = new Content("best-content", "best-content",
            "best-content", "yum", "us", "here", "differnet", "test-arch");
        p.addContent(content);
        productCurator.createOrUpdate(p);

        Product result = productCurator.find(p.getId());
View Full Code Here

        e = new Environment("env1", "Env 1", owner);
        envCurator.create(e);

        p = TestUtil.createProduct();
        c = new Content("testcontent", "contentId1", "testcontent", "yum",
            "red hat", "http://example.com", "http://example.com/gpg.key",
            "test-arch");
        contentCurator.create(c);
        p.addContent(c);
        productCurator.create(p);
View Full Code Here

        throws EntitlementRefusedException {
        Product modifier = new Product("modifier", "modifier");

        Set<String> modified = new HashSet<String>();
        modified.add(PRODUCT_VIRT_HOST);
        Content content = new Content("modifier-content", "modifier-content",
            "modifer-content", "yum", "us", "here", "here", "");
        content.setModifiedProductIds(modified);
        modifier.addContent(content);

        contentCurator.create(content);
        productAdapter.createProduct(modifier);
View Full Code Here

    }

    @Test
    public void removeContent() {
        Product p = mock(Product.class);
        Content c = mock(Content.class);
        when(pc.find(eq(someid))).thenReturn(p);
        when(cc.find(eq("cid"))).thenReturn(c);

        dpsa.removeContent(someid, "cid");
View Full Code Here

    @Test
    public void testContent() {
        String  contentHash = String.valueOf(
            Math.abs(Long.valueOf("test-content".hashCode())));
        Content content = new Content("test-content", contentHash,
                            "test-content-label", "yum", "test-vendor",
                             "test-content-url", "test-gpg-url",
                             "test-arch1,test-arch2");
        HashSet<String> modifiedProductIds = new HashSet<String>();
        modifiedProductIds.add("ProductA");
        modifiedProductIds.add("ProductB");

        content.setModifiedProductIds(modifiedProductIds);
        Long metadataExpire = new Long(60 * 60 * 24);
        content.setMetadataExpire(metadataExpire);

        contentCurator.create(content);

        Content lookedUp = contentCurator.find(content.getId());
        assertEquals(content.getContentUrl(), lookedUp.getContentUrl());
        assertThat(lookedUp.getModifiedProductIds(), hasItem("ProductB"));
        assertEquals(metadataExpire, lookedUp.getMetadataExpire());
    }
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.