use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class MetaInfoFactoryTest method shouldLoadExistingLicenseType.
@Test
public void shouldLoadExistingLicenseType() {
String typeName = "name";
LicenseType licenseType = licenseService.createLicenseType(typeName);
licenseType = licenseService.saveLicenseType(licenseType);
dbInstance.commitAndCloseSession();
String licensor = "licensor";
String name = licenseType.getName();
File file = new File("");
MetaInfo meta = new MetaInfoFileImpl(file);
meta.setLicenseTypeName(name);
meta.setLicensor(licensor);
License license = metaInfoFactory.getLicense(meta);
assertThat(license.getLicensor()).isEqualTo(licensor);
LicenseType loadedLicenseType = license.getLicenseType();
assertThat(loadedLicenseType).isEqualTo(licenseType);
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeActivationDAOTest method shouldCreateActivation.
@Test
public void shouldCreateActivation() {
String name = "name";
LicenseType licenseType = licenseTypeDao.create(name);
licenseTypeDao.save(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 shouldCreateLicenseType.
@Test
public void shouldCreateLicenseType() {
String name = "name";
LicenseType licenseType = licenseTypeDao.create(name);
assertThat(licenseType).isNotNull();
assertThat(licenseType.getName()).isEqualTo(name);
assertThat(licenseType.isPredefined()).isFalse();
assertThat(licenseType.getSortOrder()).isNotNull();
assertThat(licenseType.getCreationDate()).isNotNull();
assertThat(licenseType.getLastModified()).isNotNull();
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeDAOTest method shouldPersistLicenseType.
@Test
public void shouldPersistLicenseType() {
String name = "name";
String text = "url";
String cssClass = "cssClass";
int sortOrder = 88;
LicenseType licenseType = licenseTypeDao.create(name);
licenseType.setText(text);
licenseType.setCssClass(cssClass);
licenseType.setSortOrder(sortOrder);
// create
licenseType = licenseTypeDao.save(licenseType);
dbInstance.commitAndCloseSession();
assertThat(licenseType).isNotNull();
assertThat(licenseType.getName()).isEqualTo(name);
assertThat(licenseType.isPredefined()).isFalse();
assertThat(licenseType.getText()).isEqualTo(text);
assertThat(licenseType.getCssClass()).isEqualTo(cssClass);
assertThat(licenseType.getSortOrder()).isEqualTo(sortOrder);
assertThat(licenseType.getCreationDate()).isNotNull();
assertThat(licenseType.getLastModified()).isNotNull();
// update
licenseType = licenseTypeDao.save(licenseType);
dbInstance.commitAndCloseSession();
assertThat(licenseType).isNotNull();
assertThat(licenseType.getName()).isEqualTo(name);
assertThat(licenseType.isPredefined()).isFalse();
assertThat(licenseType.getText()).isEqualTo(text);
assertThat(licenseType.getCssClass()).isEqualTo(cssClass);
assertThat(licenseType.getSortOrder()).isEqualTo(sortOrder);
assertThat(licenseType.getCreationDate()).isNotNull();
assertThat(licenseType.getLastModified()).isNotNull();
assertThat(licenseType.getLastModified()).isNotEqualTo(licenseType.getCreationDate());
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseTypeDAOTest method shouldLoadAllLicensesTypes.
@Test
public void shouldLoadAllLicensesTypes() {
LicenseType licenseType1 = licenseTypeDao.create(UUID.randomUUID().toString());
licenseType1 = licenseTypeDao.save(licenseType1);
LicenseType licenseType2 = licenseTypeDao.create(UUID.randomUUID().toString());
licenseType2 = licenseTypeDao.save(licenseType2);
LicenseType licenseType3 = licenseTypeDao.create(UUID.randomUUID().toString());
licenseType3 = licenseTypeDao.save(licenseType3);
dbInstance.commitAndCloseSession();
List<LicenseType> licenseType = licenseTypeDao.loadLicenseTypes();
assertThat(licenseType).contains(licenseType1, licenseType2, licenseType3);
}
Aggregations