use of org.olat.modules.qpool.model.QLicense in project openolat by klemens.
the class QLicenseDAOTest method testCreate.
@Test
public void testCreate() {
String licenseKey = "mit-license-" + UUID.randomUUID().toString();
QLicense license = qpoolLicenseDao.create(licenseKey, null, true);
dbInstance.commit();
// check
Assert.assertNotNull(license);
Assert.assertNotNull(license.getKey());
Assert.assertNotNull(license.getCreationDate());
Assert.assertEquals(licenseKey, license.getLicenseKey());
Assert.assertTrue(license.isDeletable());
}
use of org.olat.modules.qpool.model.QLicense in project openolat by klemens.
the class QLicenseDAO method createDefaultLicenses.
protected void createDefaultLicenses() {
List<QLicense> licenses = getLicenses();
Set<String> licenseKeys = new HashSet<String>();
for (QLicense license : licenses) {
licenseKeys.add(license.getLicenseKey());
}
for (String defaultLicenseKey : defaultLicenses) {
if (!licenseKeys.contains(defaultLicenseKey)) {
create(defaultLicenseKey, null, false);
}
}
dbInstance.commitAndCloseSession();
}
use of org.olat.modules.qpool.model.QLicense in project OpenOLAT by OpenOLAT.
the class QLicenseDAOTest method testCreate.
@Test
public void testCreate() {
String licenseKey = "mit-license-" + UUID.randomUUID().toString();
QLicense license = qpoolLicenseDao.create(licenseKey, null, true);
dbInstance.commit();
// check
Assert.assertNotNull(license);
Assert.assertNotNull(license.getKey());
Assert.assertNotNull(license.getCreationDate());
Assert.assertEquals(licenseKey, license.getLicenseKey());
Assert.assertTrue(license.isDeletable());
}
use of org.olat.modules.qpool.model.QLicense in project OpenOLAT by OpenOLAT.
the class QLicenseDAOTest method testCreateAndGet_byLicenseKey.
@Test
public void testCreateAndGet_byLicenseKey() {
String licenseKey = "apache-license-" + UUID.randomUUID().toString();
QLicense license = qpoolLicenseDao.create(licenseKey, null, true);
dbInstance.commit();
// load it
QLicense reloadedLicense = qpoolLicenseDao.loadByLicenseKey(licenseKey);
// check the values
Assert.assertNotNull(reloadedLicense);
Assert.assertEquals(license.getKey(), reloadedLicense.getKey());
Assert.assertNotNull(reloadedLicense.getCreationDate());
Assert.assertEquals(licenseKey, reloadedLicense.getLicenseKey());
Assert.assertTrue(reloadedLicense.isDeletable());
}
use of org.olat.modules.qpool.model.QLicense in project OpenOLAT by OpenOLAT.
the class OLATUpgrade_12_4_0 method saveLicense.
private void saveLicense(QuestionItemImpl item) {
QLicense qlicense = item.getLicense();
String name = mapLicenseTypeName(qlicense.getLicenseKey());
LicenseType licenseType = licenseService.loadLicenseTypeByName(name);
ResourceLicense license = licenseService.loadOrCreateLicense(item);
license.setLicenseType(licenseType);
license.setFreetext(qlicense.getLicenseText());
license.setLicensor(item.getCreator());
licenseService.update(license);
}
Aggregations