use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeActivationDAOTest method shouldDeleteActivation.
@Test
public void shouldDeleteActivation() {
String name = "name";
LicenseType licenseType = licenseTypeDao.create(name);
licenseTypeDao.save(licenseType);
licenseTypeActivationDao.createAndPersist(LICENSE_HANDLER, licenseType);
dbInstance.commitAndCloseSession();
licenseTypeActivationDao.delete(LICENSE_HANDLER, licenseType);
dbInstance.commitAndCloseSession();
boolean isActive = licenseTypeActivationDao.isActive(LICENSE_HANDLER, licenseType);
assertThat(isActive).isFalse();
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeActivationDAOTest method shouldNotCreateActivationIfItIsAlreadyActive.
@Test
public void shouldNotCreateActivationIfItIsAlreadyActive() {
String name = "name";
LicenseType licenseType = licenseTypeDao.create(name);
licenseTypeDao.save(licenseType);
licenseTypeActivationDao.createAndPersist(LICENSE_HANDLER, licenseType);
dbInstance.commitAndCloseSession();
licenseTypeActivationDao.createAndPersist(LICENSE_HANDLER, licenseType);
dbInstance.commitAndCloseSession();
boolean isActive = licenseTypeActivationDao.isActive(LICENSE_HANDLER, licenseType);
assertThat(isActive).isTrue();
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeDAOTest method shouldLoadNoLicenseType.
@Test
public void shouldLoadNoLicenseType() {
LicenseType noLicenseType = licenseTypeDao.loadNoLicenseType();
assertThat(noLicenseType).isNotNull();
assertThat(noLicenseType.getName()).isEqualTo(LicenseTypeDAO.NO_LICENSE_NAME);
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeDAOTest method shouldLoadLicenseTypeByKey.
@Test
public void shouldLoadLicenseTypeByKey() {
LicenseType licenseType = licenseTypeDao.create(UUID.randomUUID().toString());
licenseType = licenseTypeDao.save(licenseType);
LicenseType otherLicenseType = licenseTypeDao.create(UUID.randomUUID().toString());
licenseTypeDao.save(otherLicenseType);
dbInstance.commitAndCloseSession();
LicenseType loadedLicenseType = licenseTypeDao.loadLicenseTypeByKey(licenseType.getKey());
assertThat(loadedLicenseType).isEqualTo(licenseType);
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeDAOTest method shouldCreateWithHighestSortOrder.
@Test
public void shouldCreateWithHighestSortOrder() {
LicenseType licenseType = licenseTypeDao.create("name");
int sortOrder = 22;
licenseType.setSortOrder(sortOrder);
licenseTypeDao.save(licenseType);
dbInstance.commitAndCloseSession();
LicenseType licenseType2 = licenseTypeDao.create("other");
LicenseType licenseType3 = licenseTypeDao.create("other2");
licenseType2 = licenseTypeDao.save(licenseType2);
licenseType3 = licenseTypeDao.save(licenseType3);
dbInstance.commitAndCloseSession();
assertThat(licenseType2.getSortOrder()).isEqualTo(sortOrder + 1);
assertThat(licenseType3.getSortOrder()).isEqualTo(sortOrder + 2);
}
Aggregations