Search in sources :

Example 56 with TaxonomyLevelType

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);
}
Also used : TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 57 with TaxonomyLevelType

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);
}
Also used : TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 58 with TaxonomyLevelType

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);
}
Also used : TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 59 with TaxonomyLevelType

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);
}
Also used : TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 60 with TaxonomyLevelType

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());
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) Test(org.junit.Test)

Aggregations

TaxonomyLevelType (org.olat.modules.taxonomy.TaxonomyLevelType)92 Test (org.junit.Test)40 Taxonomy (org.olat.modules.taxonomy.Taxonomy)32 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)32 ArrayList (java.util.ArrayList)26 Identity (org.olat.core.id.Identity)20 TaxonomyLevelTypeToType (org.olat.modules.taxonomy.TaxonomyLevelTypeToType)16 URI (java.net.URI)14 HttpResponse (org.apache.http.HttpResponse)14 TaxonomyLevelTypeRefImpl (org.olat.modules.taxonomy.model.TaxonomyLevelTypeRefImpl)14 Path (javax.ws.rs.Path)12 List (java.util.List)10 Produces (javax.ws.rs.Produces)10 Collectors (java.util.stream.Collectors)8 TaxonomyLevelRefImpl (org.olat.modules.taxonomy.model.TaxonomyLevelRefImpl)7 HashMap (java.util.HashMap)6 Map (java.util.Map)6 PUT (javax.ws.rs.PUT)6 HttpGet (org.apache.http.client.methods.HttpGet)6 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)6