use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class OwnerProductResourceTest method testCreateProductResource.
@Test
public void testCreateProductResource() {
Owner owner = this.createOwner("Example-Corporation");
ProductDTO pdto = this.buildTestProductDTO();
assertNull(this.ownerProductCurator.getProductById(owner.getKey(), pdto.getId()));
ProductDTO result = this.ownerProductResource.createProduct(owner.getKey(), pdto);
Product entity = this.ownerProductCurator.getProductById(owner, pdto.getId());
ProductDTO expected = this.modelTranslator.translate(entity, ProductDTO.class);
assertNotNull(result);
assertNotNull(entity);
assertEquals(expected, result);
}
use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class OwnerProductResourceTest method getProduct.
@Test
public void getProduct() {
Owner owner = this.createOwner("Example-Corporation");
Product entity = this.createProduct("test_product", "test_product", owner);
securityInterceptor.enable();
ProductDTO result = this.ownerProductResource.getProduct(owner.getKey(), entity.getId());
ProductDTO expected = this.modelTranslator.translate(entity, ProductDTO.class);
assertNotNull(result);
assertEquals(expected, result);
}
use of org.candlepin.dto.api.v1.ProductDTO in project candlepin by candlepin.
the class ProductResourceTest method getProduct.
@Test
public void getProduct() {
Owner owner = this.createOwner("Example-Corporation");
Product entity = this.createProduct("test_product", "test_product", owner);
ProductDTO expected = this.modelTranslator.translate(entity, ProductDTO.class);
if (entity.isLocked()) {
throw new RuntimeException("entity is locked...?");
}
securityInterceptor.enable();
ProductDTO result = productResource.getProduct(entity.getUuid());
assertNotNull(result);
assertEquals(result, expected);
}
Aggregations