Search in sources :

Example 41 with ProductDTO

use of org.candlepin.dto.manifest.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);
}
Also used : Owner(org.candlepin.model.Owner) Product(org.candlepin.model.Product) ProductDTO(org.candlepin.dto.api.v1.ProductDTO) Test(org.junit.Test)

Example 42 with ProductDTO

use of org.candlepin.dto.manifest.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);
}
Also used : Owner(org.candlepin.model.Owner) Product(org.candlepin.model.Product) ProductDTO(org.candlepin.dto.api.v1.ProductDTO) Test(org.junit.Test)

Aggregations

ProductDTO (org.candlepin.dto.api.v1.ProductDTO)29 Product (org.candlepin.model.Product)27 Test (org.junit.Test)27 Owner (org.candlepin.model.Owner)25 ProductDTO (org.candlepin.dto.manifest.v1.ProductDTO)12 Content (org.candlepin.model.Content)10 ProductContent (org.candlepin.model.ProductContent)9 ContentDTO (org.candlepin.dto.api.v1.ContentDTO)7 Parameters (junitparams.Parameters)6 ContentDTO (org.candlepin.dto.manifest.v1.ContentDTO)6 Transactional (com.google.inject.persist.Transactional)5 Reader (java.io.Reader)5 StringReader (java.io.StringReader)4 HashSet (java.util.HashSet)4 LinkedList (java.util.LinkedList)4 Subscription (org.candlepin.model.dto.Subscription)4 Consumes (javax.ws.rs.Consumes)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 ForbiddenException (org.candlepin.common.exceptions.ForbiddenException)3