use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_have_negative.
@Test
public void hasCompetenceByTaxonomy_have_negative() {
// create a level and competence with a type teach
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
TaxonomyLevelType type = createTypeLevelCompetence(id, null, TaxonomyCompetenceTypes.have);
// set read for teach competence
type.setDocumentsLibraryTeachCompetenceReadEnabled(true);
type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
dbInstance.commitAndCloseSession();
boolean hasCompetence = documentPoolManager.hasValidCompetence(id);
Assert.assertFalse(hasCompetence);
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_target.
@Test
public void hasCompetenceByTaxonomy_target() {
// create a level and competence with a type teach
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
TaxonomyLevelType type = createTypeLevelCompetence(id, null, TaxonomyCompetenceTypes.target);
// set read for teach competence
type.setDocumentsLibraryTargetCompetenceReadEnabled(true);
type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
dbInstance.commitAndCloseSession();
boolean hasCompetence = documentPoolManager.hasValidCompetence(id);
Assert.assertTrue(hasCompetence);
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_manage.
@Test
public void hasCompetenceByTaxonomy_manage() {
// create a level and competence with a type teach
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
TaxonomyLevelType type = createTypeLevelCompetence(id, null, TaxonomyCompetenceTypes.manage);
// set read for teach competence
type.setDocumentsLibraryManageCompetenceEnabled(true);
type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
dbInstance.commitAndCloseSession();
boolean hasCompetence = documentPoolManager.hasValidCompetence(id);
Assert.assertTrue(hasCompetence);
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_teach_negative.
@Test
public void hasCompetenceByTaxonomy_teach_negative() {
// create a level and competence with a type teach
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
TaxonomyLevelType type = createTypeLevelCompetence(id, null, TaxonomyCompetenceTypes.teach);
// set read for teach competence
type.setDocumentsLibraryManageCompetenceEnabled(true);
type.setDocumentsLibraryHaveCompetenceReadEnabled(true);
type.setDocumentsLibraryTargetCompetenceReadEnabled(true);
type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
dbInstance.commitAndCloseSession();
boolean hasCompetence = documentPoolManager.hasValidCompetence(id);
Assert.assertFalse(hasCompetence);
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TaxonomyLevelDAOTest method createAndLoadTaxonomyLevel_withType.
@Test
public void createAndLoadTaxonomyLevel_withType() {
Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-103", "Typed taxonomy", null, null);
TaxonomyLevelType type = taxonomyLevelTypeDao.createTaxonomyLevelType("Type-t", "A type", "Typed", "TYP-T", taxonomy);
TaxonomyLevel level = taxonomyLevelDao.createTaxonomyLevel("ID-Level-0", "A taxonomy level", "A basic level", null, null, null, type, taxonomy);
dbInstance.commitAndCloseSession();
TaxonomyLevel reloadedLevel = taxonomyLevelDao.loadByKey(level.getKey());
dbInstance.commitAndCloseSession();
Assert.assertNotNull(reloadedLevel);
Assert.assertNotNull(reloadedLevel.getKey());
Assert.assertEquals(level, reloadedLevel);
Assert.assertEquals(taxonomy, reloadedLevel.getTaxonomy());
Assert.assertEquals(type, reloadedLevel.getType());
}
Aggregations