use of org.candlepin.dto.manifest.v1.ContentDTO in project candlepin by candlepin.
the class ContentDTOTranslatorTest method initSourceObject.
@Override
protected ContentDTO initSourceObject() {
ContentDTO source = new ContentDTO();
source.setUuid("test_value");
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.setMetadataExpire(1234L);
source.setModifiedProductIds(Arrays.asList("1", "2", "3"));
source.setArches("test_value");
return source;
}
use of org.candlepin.dto.manifest.v1.ContentDTO in project candlepin by candlepin.
the class ProductDTOTranslatorTest method initSourceObject.
@Override
protected ProductDTO initSourceObject() {
ProductDTO source = new ProductDTO();
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);
for (int i = 0; i < 3; ++i) {
ContentDTO contentDTO = new ContentDTO();
contentDTO.setId("content-dto-" + i);
contentDTO.setUuid(contentDTO.getId() + "_uuid");
ProductContentDTO pcDTO = new ProductContentDTO(contentDTO, true);
source.addProductContent(pcDTO);
}
return source;
}
use of org.candlepin.dto.manifest.v1.ContentDTO in project candlepin by candlepin.
the class ProductDTOTranslatorTest method verifyOutput.
@Override
protected void verifyOutput(ProductDTO source, ProductData dto, boolean childrenGenerated) {
if (source != null) {
assertEquals(source.getUuid(), dto.getUuid());
assertEquals(source.getId(), dto.getId());
assertEquals(source.getName(), dto.getName());
assertEquals(source.getMultiplier(), dto.getMultiplier());
assertEquals(source.getAttributes(), dto.getAttributes());
assertEquals(source.getDependentProductIds(), dto.getDependentProductIds());
assertNotNull(dto.getProductContent());
if (childrenGenerated) {
for (ProductContentDTO pcdto : source.getProductContent()) {
for (ProductContentData pcdata : dto.getProductContent()) {
ContentDTO cdto = pcdto.getContent();
ContentData cdata = pcdata.getContent();
assertNotNull(cdata);
assertNotNull(cdata.getUuid());
if (cdata.getUuid().equals(cdto.getUuid())) {
assertEquals(pcdto.isEnabled(), pcdata.isEnabled());
// Pass the content off to the ContentTranslatorTest to verify it
this.contentDTOTranslatorTest.verifyOutput(cdto, cdata, true);
}
}
}
} else {
assertTrue(dto.getProductContent().isEmpty());
}
} else {
assertNull(dto);
}
}
use of org.candlepin.dto.manifest.v1.ContentDTO in project candlepin by candlepin.
the class TestUtil method createContentDTO.
public static ContentDTO createContentDTO(String id, String name) {
ContentDTO dto = new ContentDTO();
dto.setId(id);
dto.setName(name);
return dto;
}
use of org.candlepin.dto.manifest.v1.ContentDTO in project candlepin by candlepin.
the class ContentManagerTest method testCreateContentThatAlreadyExists.
@Test(expected = IllegalStateException.class)
public void testCreateContentThatAlreadyExists() {
Owner owner = this.createOwner("test-owner", "Test Owner");
ContentDTO dto = TestUtil.createContentDTO("c1", "content-1");
dto.setLabel("test-label");
dto.setType("test-test");
dto.setVendor("test-vendor");
Content output = this.contentManager.createContent(dto, owner);
// Verify the creation worked
assertNotNull(output);
assertEquals(output, this.ownerContentCurator.getContentById(owner, dto.getId()));
// This should fail, since it already exists
this.contentManager.createContent(dto, owner);
}
Aggregations