use of org.candlepin.model.Content in project candlepin by candlepin.
the class TestUtil method createContent.
public static Content createContent(ContentDTO dto) {
Content content = null;
if (dto != null) {
content = createContent(dto.getId(), dto.getName());
content.setUuid(dto.getUuid());
content.setType(dto.getType());
content.setLabel(dto.getLabel());
content.setVendor(dto.getVendor());
content.setContentUrl(dto.getContentUrl());
content.setRequiredTags(dto.getRequiredTags());
content.setReleaseVersion(dto.getReleaseVersion());
content.setGpgUrl(dto.getGpgUrl());
content.setMetadataExpire(dto.getMetadataExpiration());
content.setModifiedProductIds(dto.getModifiedProductIds());
content.setArches(dto.getArches());
content.setLocked(dto.isLocked());
}
return content;
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class TestUtil method createProduct.
public static Product createProduct(ProductDTO dto) {
Product product = null;
if (dto != null) {
product = new Product(dto.getId(), dto.getName());
product.setUuid(dto.getUuid());
product.setMultiplier(dto.getMultiplier());
product.setAttributes(dto.getAttributes());
if (dto.getProductContent() != null) {
for (ProductContentDTO pcd : dto.getProductContent()) {
if (pcd != null) {
Content content = createContent((ContentDTO) pcd.getContent());
if (content != null) {
product.addContent(content, pcd.isEnabled() != null ? pcd.isEnabled() : true);
}
}
}
}
product.setDependentProductIds(dto.getDependentProductIds());
product.setLocked(dto.isLocked() != null ? dto.isLocked() : false);
}
return product;
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class TestUtil method createContent.
public static Content createContent(String id, String name) {
Content content = new Content(id, name, "test-type", "test-label", "test-vendor");
content.setContentUrl("https://test.url.com");
content.setGpgUrl("https://gpg.test.url.com");
content.setArches("x86");
return content;
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class TestUtil method createProduct.
public static Product createProduct(ProductData pdata) {
Product product = null;
if (pdata != null) {
product = new Product(pdata.getId(), pdata.getName());
product.setUuid(pdata.getUuid());
product.setMultiplier(pdata.getMultiplier());
product.setAttributes(pdata.getAttributes());
if (pdata.getProductContent() != null) {
for (ProductContentData pcd : pdata.getProductContent()) {
if (pcd != null) {
Content content = createContent((ContentData) pcd.getContent());
if (content != null) {
product.addContent(content, pcd.isEnabled() != null ? pcd.isEnabled() : true);
}
}
}
}
product.setDependentProductIds(pdata.getDependentProductIds());
product.setLocked(pdata.isLocked() != null ? pdata.isLocked() : false);
}
return product;
}
use of org.candlepin.model.Content in project candlepin by candlepin.
the class EntitlementCertificateGeneratorTest method generateEntitlements.
/**
* Generates some entitlements and the necessary objects for testing entitlement regeneration
*
* @return
* A list of entitlements
*/
private List<Entitlement> generateEntitlements() {
Owner owner = TestUtil.createOwner("test-owner", "Test Owner");
Content c1 = TestUtil.createContent("c1");
Content c2 = TestUtil.createContent("c2");
Content c3 = TestUtil.createContent("c3");
Product prod1 = TestUtil.createProduct();
Product prod2 = TestUtil.createProduct();
Product prod3 = TestUtil.createProduct();
Product pprod1 = TestUtil.createProduct();
Product pprod2 = TestUtil.createProduct();
Product pprod3 = TestUtil.createProduct();
prod1.addContent(c1, true);
pprod2.addContent(c2, true);
prod3.addContent(c3, true);
Pool pool1 = createPool(owner, prod1, Collections.singleton(pprod1), 1);
Pool pool2 = createPool(owner, prod2, Collections.singleton(pprod2), 1);
Pool pool3 = createPool(owner, prod3, Collections.singleton(pprod3), 1);
Consumer consumer = TestUtil.createConsumer(owner);
Entitlement ent1 = TestUtil.createEntitlement(owner, consumer, pool1, null);
Entitlement ent2 = TestUtil.createEntitlement(owner, consumer, pool2, null);
Entitlement ent3 = TestUtil.createEntitlement(owner, consumer, pool3, null);
ent1.setId("ent1");
ent2.setId("ent2");
ent3.setId("ent3");
return Arrays.asList(ent1, ent2, ent3);
}
Aggregations