use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class OwnerProductResourceTest method testUpdateProductIdMismatch.
@Test(expected = BadRequestException.class)
public void testUpdateProductIdMismatch() {
Owner owner = this.createOwner("Update-Product-Owner");
ProductDTO pdto = this.buildTestProductDTO();
ProductDTO product = this.ownerProductResource.createProduct(owner.getKey(), pdto);
ProductDTO update = this.buildTestProductDTO();
update.setId("TaylorSwift");
ProductDTO result = this.ownerProductResource.updateProduct(owner.getKey(), product.getId(), update);
}
use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class OwnerProductResourceTest method buildTestProductDTO.
private ProductDTO buildTestProductDTO() {
ProductDTO dto = TestUtil.createProductDTO("test_product");
dto.setAttribute(Product.Attributes.VERSION, "1.0");
dto.setAttribute(Product.Attributes.VARIANT, "server");
dto.setAttribute(Product.Attributes.TYPE, "SVC");
dto.setAttribute(Product.Attributes.ARCHITECTURE, "ALL");
return dto;
}
use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class ProductResourceTest method buildTestProductDTO.
private ProductDTO buildTestProductDTO() {
ProductDTO dto = TestUtil.createProductDTO("test_product");
dto.setAttribute(Product.Attributes.VERSION, "1.0");
dto.setAttribute(Product.Attributes.VARIANT, "server");
dto.setAttribute(Product.Attributes.TYPE, "SVC");
dto.setAttribute(Product.Attributes.ARCHITECTURE, "ALL");
return dto;
}
use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class ProductResourceTest method testCreateProductResource.
@Test(expected = BadRequestException.class)
public void testCreateProductResource() {
Owner owner = this.createOwner("Example-Corporation");
ProductDTO dto = this.buildTestProductDTO();
assertNull(this.ownerProductCurator.getProductById(owner.getKey(), dto.getId()));
productResource.createProduct(dto);
}
use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class ProductResourceTest method testCreateProductWithContent.
@Test(expected = BadRequestException.class)
public void testCreateProductWithContent() {
Owner owner = this.createOwner("Example-Corporation");
ProductDTO pdto = this.buildTestProductDTO();
ContentDTO cdto = TestUtil.createContentDTO();
pdto.addContent(cdto, true);
assertNull(this.ownerProductCurator.getProductById(owner.getKey(), pdto.getId()));
ProductDTO result = productResource.createProduct(pdto);
Product entity = this.ownerProductCurator.getProductById(owner.getKey(), pdto.getId());
ProductDTO expected = this.modelTranslator.translate(entity, ProductDTO.class);
assertNotNull(entity);
assertEquals(expected, result);
assertNotNull(result.getProductContent());
assertEquals(1, result.getProductContent().size());
assertEquals(cdto, result.getProductContent().iterator().next().getContent());
}
Aggregations