use of org.candlepin.model.Content in project candlepin by candlepin.
the class ProductDataTranslatorTest method initSourceObject.
@Override
protected ProductData initSourceObject() {
ProductData source = new ProductData();
Map<String, String> attributes = new HashMap<>();
attributes.put("attrib_1", "attrib_value_1");
attributes.put("attrib_2", "attrib_value_2");
attributes.put("attrib_3", "attrib_value_3");
Collection<String> depProdIds = new LinkedList<>();
depProdIds.add("dep_prod_1");
depProdIds.add("dep_prod_2");
depProdIds.add("dep_prod_3");
source.setUuid("test_uuid");
source.setId("test_id");
source.setName("test_name");
source.setMultiplier(10L);
source.setAttributes(attributes);
source.setDependentProductIds(depProdIds);
source.setLocked(true);
for (int i = 0; i < 3; ++i) {
Content content = TestUtil.createContent("content-" + i);
content.setUuid(content.getId() + "_uuid");
source.addContent(content, true);
}
return source;
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class EnvironmentTranslatorTest method verifyOutput.
@Override
protected void verifyOutput(Environment source, EnvironmentDTO dto, boolean childrenGenerated) {
if (source != null) {
assertEquals(source.getId(), dto.getId());
assertEquals(source.getName(), dto.getName());
assertEquals(source.getDescription(), dto.getDescription());
if (childrenGenerated) {
this.ownerTranslatorTest.verifyOutput(source.getOwner(), dto.getOwner(), childrenGenerated);
assertNotNull(dto.getEnvironmentContent());
for (EnvironmentContent ec : source.getEnvironmentContent()) {
for (EnvironmentContentDTO ecdto : dto.getEnvironmentContent()) {
Content content = ec.getContent();
ContentDTO cdto = ecdto.getContent();
assertNotNull(cdto);
assertNotNull(cdto.getUuid());
if (cdto.getUuid().equals(content.getUuid())) {
assertEquals(ec.getEnabled(), ecdto.isEnabled());
// Pass the content off to the ContentTranslatorTest to verify it
this.contentTranslatorTest.verifyOutput(content, cdto, childrenGenerated);
}
}
}
} else {
assertNull(dto.getEnvironmentContent());
assertNull(dto.getOwner());
}
} else {
assertNull(dto);
}
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class ContentTranslatorTest method initSourceObject.
@Override
protected Content initSourceObject() {
Content source = new Content();
source.setUuid("test_value");
source.setMetadataExpire(3L);
source.setId("test_value");
source.setType("test_value");
source.setLabel("test_value");
source.setName("test_value");
source.setVendor("test_value");
source.setContentUrl("test_value");
source.setRequiredTags("test_value");
source.setReleaseVersion("test_value");
source.setGpgUrl("test_value");
source.setModifiedProductIds(Arrays.asList("1", "2", "3"));
source.setArches("test_value");
return source;
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class X509V3ExtensionUtilTest method testPrefixLogic.
@Test
public void testPrefixLogic() {
Owner owner = new Owner("Test Corporation");
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));
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class PoolManagerTest method buildContent.
private Content buildContent(Owner owner) {
Content content = new Content();
int rand = TestUtil.randomInt();
HashSet<String> modifiedProductIds = new HashSet<>(Arrays.asList("mpid-a-" + rand, "mpid-d-" + rand, "mpid-c-" + rand));
content.setId("cid" + rand);
content.setContentUrl("https://www.content_url.com/" + rand);
content.setGpgUrl("https://www.gpg_url.com/" + rand);
content.setLabel("content_label-" + rand);
content.setName("content-" + rand);
content.setReleaseVersion("content_releasever-" + rand);
content.setRequiredTags("content_tags-" + rand);
content.setType("content_type-" + rand);
content.setVendor("content_vendor-" + rand);
content.setArches("content_arches-" + rand);
content.setModifiedProductIds(modifiedProductIds);
// Since CPM sets all inbound products and content as "locked," we do this to ensure we
// don't always trigger a change because the lock state looks different from our mocks.
content.setLocked(true);
return content;
}
Aggregations