use of org.candlepin.dto.api.v1.ActivationKeyDTO in project candlepin by candlepin.
the class OwnerResourceTest method testActivationKeyTooLongRelease.
@Test(expected = BadRequestException.class)
public void testActivationKeyTooLongRelease() {
OwnerCurator oc = mock(OwnerCurator.class);
ProductCurator pc = mock(ProductCurator.class);
Owner o = new Owner();
o.setKey("owner-key");
OwnerResource ownerres = new OwnerResource(oc, pc, null, null, i18n, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, this.modelTranslator);
when(oc.lookupByKey(anyString())).thenReturn(o);
ActivationKeyDTO key = new ActivationKeyDTO();
key.setReleaseVersion(TestUtil.getStringOfSize(256));
key = ownerres.createActivationKey(owner.getKey(), key);
}
use of org.candlepin.dto.api.v1.ActivationKeyDTO in project candlepin by candlepin.
the class OwnerResourceTest method testActivationKeyCreateRead.
@Test
public void testActivationKeyCreateRead() {
ActivationKeyDTO key = new ActivationKeyDTO();
key.setName("dd");
key.setReleaseVersion("release1");
key = ownerResource.createActivationKey(owner.getKey(), key);
assertNotNull(key.getId());
assertEquals(key.getOwner().getId(), owner.getId());
assertEquals(key.getReleaseVersion(), "release1");
CandlepinQuery<ActivationKeyDTO> result = ownerResource.ownerActivationKeys(owner.getKey(), null);
assertNotNull(result);
List<ActivationKeyDTO> keys = result.list();
assertEquals(1, keys.size());
}
use of org.candlepin.dto.api.v1.ActivationKeyDTO 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);
}
Aggregations