use of org.candlepin.model.Cdn in project candlepin by candlepin.
the class CdnImporter method store.
/**
* @param cdnSet Set of CDN's.
*/
public void store(Set<Cdn> cdnSet) {
log.debug("Creating/updating cdns");
for (Cdn cdn : cdnSet) {
Cdn existing = curator.lookupByLabel(cdn.getLabel());
if (existing == null) {
log.debug("Creating CDN: {}", cdn);
curator.create(cdn);
} else {
log.debug("Updating CDN: {}", cdn);
existing.setName(cdn.getName());
existing.setUrl(cdn.getUrl());
curator.merge(existing);
}
}
}
use of org.candlepin.model.Cdn in project candlepin by candlepin.
the class CdnImporter method createObject.
public Cdn createObject(ObjectMapper mapper, Reader reader) throws IOException {
Cdn cdn = mapper.readValue(reader, Cdn.class);
cdn.setId(null);
return cdn;
}
use of org.candlepin.model.Cdn in project candlepin by candlepin.
the class CdnManagerTest method updateCdn.
@Test
public void updateCdn() throws Exception {
Cdn cdn = createCdn("test_cdn");
assertEquals("Test CDN", cdn.getName());
cdn.setName("Updated CDN");
manager.updateCdn(cdn);
Cdn fetched = curator.lookupByLabel(cdn.getLabel());
assertNotNull(fetched);
assertEquals(cdn.getLabel(), fetched.getLabel());
assertEquals("Updated CDN", fetched.getName());
}
use of org.candlepin.model.Cdn 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.Cdn in project candlepin by candlepin.
the class CdnManagerTest method testCreateCdn.
@Test
public void testCreateCdn() throws Exception {
Cdn cdn = createCdn("test_cdn");
Cdn fetched = curator.lookupByLabel(cdn.getLabel());
assertNotNull(fetched);
assertEquals("test_cdn", fetched.getLabel());
}
Aggregations