Package org.candlepin.model

Examples of org.candlepin.model.Content


    @Test
    public void testContentWithArches() {
        String  contentHash = String.valueOf(
            Math.abs(Long.valueOf("test-content-arches".hashCode())));

        Content content = new Content("test-content-arches", contentHash,
                            "test-content-arches-label", "yum", "test-vendor",
                             "test-content-url", "test-gpg-url", "");
        String arches = "x86_64, i386";
        content.setArches(arches);
        contentCurator.create(content);

        Content lookedUp = contentCurator.find(content.getId());
        assertEquals(lookedUp.getArches(), arches);
    }
View Full Code Here


        assertEquals(lookedUp.getArches(), arches);
    }

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

        // Same ID, but label changed:
        String newLabel = "test-content-label-new";
        String newName = "Test Content Updated";
        Content modifiedContent = new Content(newName, "100",
            newLabel, "yum", "test-vendor", "test-content-url",
            "test-gpg-url", "test-arch1");
        contentCurator.createOrUpdate(modifiedContent);

        content = contentCurator.find("100");
View Full Code Here

        product.setContent(Collections.singleton(content));
    }

    private Content createContent(String name, String id, String label,
        String type, String vendor, String url, String gpgUrl, String arches) {
        Content c = new Content(name, id, label, type, vendor, url, gpgUrl, arches);

        return c;
    }
View Full Code Here

        // Use this set for successful providing queries:
        Set<Entitlement> successResult = new HashSet<Entitlement>();
        successResult.add(new Entitlement()); // just need something in there

        Content normalContent = createContent(CONTENT_NAME, CONTENT_ID,
            CONTENT_LABEL, CONTENT_TYPE, CONTENT_VENDOR, CONTENT_URL,
            CONTENT_GPG_URL, ARCH_LABEL);
        // Change label to prevent an equals match:
        Content modContent = createContent(CONTENT_NAME, CONTENT_ID + "_2",
            "differentlabel", CONTENT_TYPE, CONTENT_VENDOR, CONTENT_URL,
            CONTENT_GPG_URL, ARCH_LABEL);
        modContent.setLabel("mod content");
        Set<String> modifiedProductIds = new HashSet<String>(
            Arrays.asList(new String[]{ "product1", "product2" }));
        modContent.setModifiedProductIds(modifiedProductIds);

        modProduct.addContent(normalContent);
        modProduct.addContent(modContent);

        // First check that if we have no entitlements providing the modified
View Full Code Here

        Product wrongArchProduct = new Product("12345", "a product",
            "variant", "version", "ALL", "SVC");

        // no x86_64, ie ARCH_LABEL
        String wrongArches = "s390x,s390,ppc64,ia64";
        Content wrongArchContent = createContent(CONTENT_NAME, CONTENT_ID, CONTENT_LABEL,
            CONTENT_TYPE, CONTENT_VENDOR, CONTENT_URL, CONTENT_GPG_URL, wrongArches);

        wrongArchProduct.setContent(Collections.singleton(wrongArchContent));
        products.clear();
        products.add(wrongArchProduct);
View Full Code Here

        Product wrongArchProduct = new Product("12345", "a product",
            "variant", "version", "ALL", "SVC");

        // no x86_64, ie ARCH_LABEL
        String wrongArches = "s390x,s390,ppc64,ia64";
        Content wrongArchContent = createContent(CONTENT_NAME, CONTENT_ID, CONTENT_LABEL,
            CONTENT_TYPE, CONTENT_VENDOR, CONTENT_URL, CONTENT_GPG_URL, wrongArches);

        wrongArchProduct.setContent(Collections.singleton(wrongArchContent));
        products.clear();
        products.add(wrongArchProduct);
View Full Code Here

        Set<Product> products = new HashSet<Product>();
        products.add(product);
        // set of content for an incompatible arch, which should
        // be in the cert, since this consumer has no arch fact therefore
        // should match everything
        Content wrongArchContent = new Content();
        String wrongArches = "s390";
        String noArchUrl = "/some/place/nice";
        wrongArchContent = createContent(CONTENT_NAME, CONTENT_ID, CONTENT_LABEL,
                CONTENT_TYPE, CONTENT_VENDOR, noArchUrl, CONTENT_GPG_URL, wrongArches);
        product.setContent(superContent);
View Full Code Here

        addContentTo(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(new Long(1000), c.getMetadataExpire());
    }
View Full Code Here

    public void testExistingProductContentAdded() throws Exception {
        Product oldProduct = TestUtil.createProduct("fake id", "fake name");
        Product newProduct = TestUtil.createProduct("fake id", "fake name");

        addContentTo(newProduct);
        Content c = newProduct.getProductContent().iterator().next().getContent();

        when(productCuratorMock.lookupById(oldProduct.getId())).thenReturn(oldProduct);

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

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

        Content content = new Content();

        newProduct.addContent(content);

        Set<Product> products = new HashSet<Product>();
        products.add(newProduct);
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.