Search in sources :

Example 1 with ProductCertificateDTO

use of org.candlepin.dto.api.v1.ProductCertificateDTO in project candlepin by candlepin.

the class OwnerProductResourceTest method getProductCertificate.

@Test
public void getProductCertificate() {
    Owner owner = this.createOwner("Example-Corporation");
    Product entity = this.createProduct("123", "AwesomeOS Core", owner);
    // ensure we check SecurityHole
    securityInterceptor.enable();
    ProductCertificate cert = new ProductCertificate();
    cert.setCert("some text");
    cert.setKey("some key");
    cert.setProduct(entity);
    productCertificateCurator.create(cert);
    ProductCertificateDTO cert1 = ownerProductResource.getProductCertificate(owner.getKey(), entity.getId());
    ProductCertificateDTO expected = this.modelTranslator.translate(cert, ProductCertificateDTO.class);
    assertEquals(cert1, expected);
}
Also used : Owner(org.candlepin.model.Owner) ProductCertificate(org.candlepin.model.ProductCertificate) Product(org.candlepin.model.Product) ProductCertificateDTO(org.candlepin.dto.api.v1.ProductCertificateDTO) Test(org.junit.Test)

Example 2 with ProductCertificateDTO

use of org.candlepin.dto.api.v1.ProductCertificateDTO in project candlepin by candlepin.

the class ProductResourceTest method getProductCertificate.

@Test
public void getProductCertificate() {
    Owner owner = this.createOwner("Example-Corporation");
    Product entity = this.createProduct(owner);
    // ensure we check SecurityHole
    securityInterceptor.enable();
    ProductCertificate cert = new ProductCertificate();
    cert.setCert("some text");
    cert.setKey("some key");
    cert.setProduct(entity);
    productCertificateCurator.create(cert);
    ProductCertificateDTO cert1 = productResource.getProductCertificate(entity.getUuid());
    ProductCertificateDTO expected = this.modelTranslator.translate(cert, ProductCertificateDTO.class);
    assertEquals(cert1, expected);
}
Also used : Owner(org.candlepin.model.Owner) ProductCertificate(org.candlepin.model.ProductCertificate) Product(org.candlepin.model.Product) ProductCertificateDTO(org.candlepin.dto.api.v1.ProductCertificateDTO) Test(org.junit.Test)

Aggregations

ProductCertificateDTO (org.candlepin.dto.api.v1.ProductCertificateDTO)2 Owner (org.candlepin.model.Owner)2 Product (org.candlepin.model.Product)2 ProductCertificate (org.candlepin.model.ProductCertificate)2 Test (org.junit.Test)2