Search in sources :

Example 21 with ConsumerTypeDTO

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

the class ConsumerTypeResourceTest method testUpdateTypeUpdatesNothing.

@Test
public void testUpdateTypeUpdatesNothing() {
    String label = this.testType.getLabel();
    boolean manifest = this.testType.isManifest();
    ConsumerTypeDTO dto = new ConsumerTypeDTO();
    dto.setId(this.testType.getId());
    // Update the type with our DTO
    ConsumerTypeDTO output = this.consumerTypeResource.update(dto);
    assertNotNull(output);
    assertEquals(label, output.getLabel());
    assertEquals(manifest, output.isManifest());
    // Flush & clear DB state
    this.consumerTypeCurator.flush();
    this.consumerTypeCurator.clear();
    // Ensure the update changed nothing in the DB
    ConsumerType existing = this.consumerTypeCurator.find(this.testType.getId());
    assertNotNull(existing);
    assertEquals(label, existing.getLabel());
    assertEquals(manifest, existing.isManifest());
}
Also used : ConsumerType(org.candlepin.model.ConsumerType) ConsumerTypeDTO(org.candlepin.dto.api.v1.ConsumerTypeDTO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)20 ConsumerTypeDTO (org.candlepin.dto.api.v1.ConsumerTypeDTO)14 ConsumerType (org.candlepin.model.ConsumerType)13 Owner (org.candlepin.model.Owner)11 ConsumerDTO (org.candlepin.dto.api.v1.ConsumerDTO)7 ConsumerTypeDTO (org.candlepin.dto.manifest.v1.ConsumerTypeDTO)7 ConsumerDTO (org.candlepin.dto.manifest.v1.ConsumerDTO)6 OwnerDTO (org.candlepin.dto.manifest.v1.OwnerDTO)6 UserPrincipal (org.candlepin.auth.UserPrincipal)5 CertificateSerial (org.candlepin.model.CertificateSerial)3 Consumer (org.candlepin.model.Consumer)3 IdentityCertificate (org.candlepin.model.IdentityCertificate)3 UpstreamConsumer (org.candlepin.model.UpstreamConsumer)3 File (java.io.File)2 Date (java.util.Date)2 Access (org.candlepin.auth.Access)2 NoAuthPrincipal (org.candlepin.auth.NoAuthPrincipal)2 SubResource (org.candlepin.auth.SubResource)2 CandlepinCommonTestConfig (org.candlepin.config.CandlepinCommonTestConfig)2 OwnerDTO (org.candlepin.dto.api.v1.OwnerDTO)2