use of org.candlepin.model.CertificateSerial in project candlepin by candlepin.
the class CertificateSerialTranslatorTest method initSourceObject.
@Override
protected CertificateSerial initSourceObject() {
CertificateSerial source = new CertificateSerial();
// ID is automatically generated for this object
// ID is also used as the serial here
source.setExpiration(new Date());
source.setCollected(true);
source.setRevoked(true);
return source;
}
use of org.candlepin.model.CertificateSerial in project candlepin by candlepin.
the class CdnManagerTest method cdnCertSerialIsRevokedOnCdnDeletion.
@Test
public void cdnCertSerialIsRevokedOnCdnDeletion() throws Exception {
Cdn cdn = createCdn("test_cdn");
CertificateSerial serial = cdn.getCertificate().getSerial();
assertNotNull(serial);
assertFalse(serial.isRevoked());
manager.deleteCdn(cdn);
CertificateSerial fetched = certSerialCurator.find(serial.getId());
assertNotNull(fetched);
assertTrue(fetched.isRevoked());
}
use of org.candlepin.model.CertificateSerial in project candlepin by candlepin.
the class PoolManagerFunctionalTest method testRevocationRevokesEntitlementCertSerial.
@Test
public void testRevocationRevokesEntitlementCertSerial() throws Exception {
AutobindData data = AutobindData.create(parentSystem, o).on(new Date()).forProducts(new String[] { monitoring.getId() });
Entitlement e = poolManager.entitleByProducts(data).get(0);
CertificateSerial serial = e.getCertificates().iterator().next().getSerial();
poolManager.revokeEntitlement(e);
List<Entitlement> entitlements = entitlementCurator.listByConsumer(parentSystem);
assertTrue(entitlements.isEmpty());
CertificateSerial revoked = certSerialCurator.find(serial.getId());
assertTrue("Entitlement cert serial should have been marked as revoked once deleted!", revoked.isRevoked());
}
use of org.candlepin.model.CertificateSerial in project candlepin by candlepin.
the class ConsumerResourceTest method createEntitlementCertificate.
protected EntitlementCertificate createEntitlementCertificate(String key, String cert) {
EntitlementCertificate toReturn = new EntitlementCertificate();
CertificateSerial certSerial = new CertificateSerial(1L, new Date());
toReturn.setKeyAsBytes(key.getBytes());
toReturn.setCertAsBytes(cert.getBytes());
toReturn.setSerial(certSerial);
return toReturn;
}
use of org.candlepin.model.CertificateSerial in project candlepin by candlepin.
the class CertificateSerialResourceTest method getSerial.
@Test
public void getSerial() {
CertificateSerialCurator csc = mock(CertificateSerialCurator.class);
CertificateSerialResource csr = new CertificateSerialResource(csc, this.modelTranslator);
CertificateSerial cs = new CertificateSerial(10L);
when(csc.find(cs.getId())).thenReturn(cs);
CertificateSerialDTO output = csr.getCertificateSerial(10L);
assertNotNull(output);
CertificateSerialDTO dto = this.modelTranslator.translate(cs, CertificateSerialDTO.class);
assertEquals(dto, output);
}
Aggregations