Search in sources :

Example 86 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.

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();
}
Also used : LicenseType(org.olat.core.commons.services.license.LicenseType) Test(org.junit.Test)

Example 87 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.

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();
}
Also used : LicenseType(org.olat.core.commons.services.license.LicenseType) Test(org.junit.Test)

Example 88 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.

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();
}
Also used : LicenseType(org.olat.core.commons.services.license.LicenseType) Test(org.junit.Test)

Example 89 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.

the class LicenseTypeDAOTest method shouldLoadLicenseTypeByName.

@Test
public void shouldLoadLicenseTypeByName() {
    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.loadLicenseTypeByName(licenseType.getName());
    assertThat(loadedLicenseType).isEqualTo(licenseType);
}
Also used : LicenseType(org.olat.core.commons.services.license.LicenseType) Test(org.junit.Test)

Example 90 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.

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();
}
Also used : LicenseType(org.olat.core.commons.services.license.LicenseType) Test(org.junit.Test)

Aggregations

LicenseType (org.olat.core.commons.services.license.LicenseType)106 Test (org.junit.Test)40 ResourceLicense (org.olat.core.commons.services.license.ResourceLicense)28 LicenseService (org.olat.core.commons.services.license.LicenseService)14 License (org.olat.core.commons.services.license.License)12 OLATResourceable (org.olat.core.id.OLATResourceable)12 File (java.io.File)6 ArrayList (java.util.ArrayList)4 LicenseHandler (org.olat.core.commons.services.license.LicenseHandler)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 QLicense (org.olat.modules.qpool.model.QLicense)4 Date (java.util.Date)2 Random (java.util.Random)2 IdentityShort (org.olat.basesecurity.IdentityShort)2 LicenseImpl (org.olat.core.commons.services.license.model.LicenseImpl)2 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 Translator (org.olat.core.gui.translator.Translator)2 MultiUserEvent (org.olat.core.util.event.MultiUserEvent)2 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)2