Search in sources :

Example 26 with OwnerDTO

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

the class ActivationKeyResourceTest method testUpdateTooLongRelease.

@Test(expected = BadRequestException.class)
public void testUpdateTooLongRelease() {
    ActivationKey key = new ActivationKey();
    OwnerDTO ownerDto = new OwnerDTO();
    key.setOwner(owner);
    key.setName("dd");
    key.setServiceLevel("level1");
    key.setReleaseVer(new Release("release1"));
    activationKeyCurator.create(key);
    ActivationKeyDTO update = new ActivationKeyDTO();
    update.setOwner(ownerDto);
    update.setName("dd");
    update.setServiceLevel("level1");
    update.setReleaseVersion(TestUtil.getStringOfSize(256));
    activationKeyResource.updateActivationKey(key.getId(), update);
}
Also used : ActivationKeyDTO(org.candlepin.dto.api.v1.ActivationKeyDTO) OwnerDTO(org.candlepin.dto.api.v1.OwnerDTO) ActivationKey(org.candlepin.model.activationkeys.ActivationKey) Release(org.candlepin.model.Release) Test(org.junit.Test)

Example 27 with OwnerDTO

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

the class ConsumerResourceIntegrationTest method personalNameOverride.

@Test
public void personalNameOverride() {
    ConsumerDTO personal = createConsumerDTO(personTypeDTO, ownerDTO);
    personal = consumerResource.create(personal, principal, null, null, null, true);
    // Not sure if this should be hard-coded to default
    assertEquals(USER_NAME, personal.getName());
}
Also used : ConsumerDTO(org.candlepin.dto.api.v1.ConsumerDTO) TestUtil.createConsumerDTO(org.candlepin.test.TestUtil.createConsumerDTO) Test(org.junit.Test)

Example 28 with OwnerDTO

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

the class ConsumerResourceIntegrationTest method onlyOnePersonalConsumer.

@Test(expected = BadRequestException.class)
public void onlyOnePersonalConsumer() {
    ConsumerDTO personal = createConsumerDTO(personTypeDTO, ownerDTO);
    consumerResource.create(personal, principal, null, null, null, true);
    personal = createConsumerDTO(personTypeDTO, ownerDTO);
    consumerResource.create(personal, principal, null, null, null, true);
}
Also used : ConsumerDTO(org.candlepin.dto.api.v1.ConsumerDTO) TestUtil.createConsumerDTO(org.candlepin.test.TestUtil.createConsumerDTO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)23 OwnerDTO (org.candlepin.dto.api.v1.OwnerDTO)16 Owner (org.candlepin.model.Owner)16 OwnerDTO (org.candlepin.dto.manifest.v1.OwnerDTO)9 ConsumerDTO (org.candlepin.dto.manifest.v1.ConsumerDTO)7 ConsumerTypeDTO (org.candlepin.dto.manifest.v1.ConsumerTypeDTO)6 UserPrincipal (org.candlepin.auth.UserPrincipal)5 ConsumerDTO (org.candlepin.dto.api.v1.ConsumerDTO)5 ConsumerType (org.candlepin.model.ConsumerType)5 ConsumerTypeDTO (org.candlepin.dto.api.v1.ConsumerTypeDTO)3 CertificateSerial (org.candlepin.model.CertificateSerial)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 ConsumerPrincipal (org.candlepin.auth.ConsumerPrincipal)2 SubResource (org.candlepin.auth.SubResource)2 NotFoundException (org.candlepin.common.exceptions.NotFoundException)2 CandlepinCommonTestConfig (org.candlepin.config.CandlepinCommonTestConfig)2