Search in sources :

Example 56 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project openolat by klemens.

the class TaxonomyLevelDAOTest method getLevelsByDisplayName.

@Test
public void getLevelsByDisplayName() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-104", "Named taxonomy", null, null);
    String displayName = UUID.randomUUID().toString();
    TaxonomyLevel level = taxonomyLevelDao.createTaxonomyLevel("L-1", displayName, "A basic level", null, null, null, null, taxonomy);
    dbInstance.commitAndCloseSession();
    List<TaxonomyLevel> levels = taxonomyLevelDao.getLevelsByDisplayName(taxonomy, displayName);
    Assert.assertNotNull(levels);
    Assert.assertEquals(1, levels.size());
    Assert.assertEquals(level, levels.get(0));
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) Test(org.junit.Test)

Example 57 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project openolat by klemens.

the class TaxonomyLevelDAOTest method createTaxonomyCompetence_2Level.

@Test
public void createTaxonomyCompetence_2Level() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-99", "Leveled taxonomy", null, null);
    TaxonomyLevel rootLevel = taxonomyLevelDao.createTaxonomyLevel("ID-Level-1", "My root level", "A basic level", null, null, null, null, taxonomy);
    dbInstance.commit();
    TaxonomyLevel secondLevel = taxonomyLevelDao.createTaxonomyLevel("ID-Level-2", "My second level", "A basic level", null, null, rootLevel, null, taxonomy);
    dbInstance.commit();
    TaxonomyLevel reloadedSecondLevel = taxonomyLevelDao.loadByKey(secondLevel.getKey());
    Assert.assertNotNull(reloadedSecondLevel);
    Assert.assertNotNull(reloadedSecondLevel.getKey());
    Assert.assertNotNull(reloadedSecondLevel.getCreationDate());
    Assert.assertEquals(taxonomy, reloadedSecondLevel.getTaxonomy());
    Assert.assertEquals(rootLevel, reloadedSecondLevel.getParent());
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) Test(org.junit.Test)

Example 58 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project openolat by klemens.

the class TaxonomyLevelDAOTest method getParentLine.

@Test
public void getParentLine() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-103", "Deeply leveled taxonomy", null, null);
    TaxonomyLevel level_1 = taxonomyLevelDao.createTaxonomyLevel("L-1", "A level", "A basic level", null, null, null, null, taxonomy);
    TaxonomyLevel level_2 = taxonomyLevelDao.createTaxonomyLevel("L-2", "A level", "A basic level", null, null, level_1, null, taxonomy);
    TaxonomyLevel level_3 = taxonomyLevelDao.createTaxonomyLevel("L-3", "A level", "A basic level", null, null, level_2, null, taxonomy);
    TaxonomyLevel level_4 = taxonomyLevelDao.createTaxonomyLevel("L-4", "A level", "A basic level", null, null, level_3, null, taxonomy);
    TaxonomyLevel level_5 = taxonomyLevelDao.createTaxonomyLevel("L-5", "A level", "A basic level", null, null, level_4, null, taxonomy);
    dbInstance.commit();
    List<TaxonomyLevel> levels = taxonomyLevelDao.getParentLine(level_5, taxonomy);
    Assert.assertNotNull(levels);
    Assert.assertEquals(5, levels.size());
    Assert.assertEquals(level_1, levels.get(0));
    Assert.assertEquals(level_2, levels.get(1));
    Assert.assertEquals(level_3, levels.get(2));
    Assert.assertEquals(level_4, levels.get(3));
    Assert.assertEquals(level_5, levels.get(4));
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) Test(org.junit.Test)

Example 59 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project openolat by klemens.

the class TaxonomyLevelDAOTest method createAndLoadTaxonomyLevel.

@Test
public void createAndLoadTaxonomyLevel() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-100", "Leveled taxonomy", null, null);
    TaxonomyLevel level = taxonomyLevelDao.createTaxonomyLevel("ID-Level-0", "A taxonomy level", "A basic level", null, null, null, null, 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());
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) Test(org.junit.Test)

Example 60 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project openolat by klemens.

the class TaxonomyLevelDAOTest method getTaxonomyLevels_all.

@Test
public void getTaxonomyLevels_all() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-103", "Leveled taxonomy", null, null);
    TaxonomyLevel level = taxonomyLevelDao.createTaxonomyLevel("ID-Level-4", "A level", "A basic level", null, null, null, null, taxonomy);
    dbInstance.commit();
    List<TaxonomyLevel> levels = taxonomyLevelDao.getLevels(null);
    Assert.assertNotNull(levels);
    Assert.assertTrue(levels.contains(level));
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) Test(org.junit.Test)

Aggregations

Taxonomy (org.olat.modules.taxonomy.Taxonomy)194 Test (org.junit.Test)132 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)122 Identity (org.olat.core.id.Identity)56 URI (java.net.URI)36 HttpResponse (org.apache.http.HttpResponse)36 TaxonomyCompetence (org.olat.modules.taxonomy.TaxonomyCompetence)36 TaxonomyLevelType (org.olat.modules.taxonomy.TaxonomyLevelType)34 Date (java.util.Date)22 HttpGet (org.apache.http.client.methods.HttpGet)16 ArrayList (java.util.ArrayList)14 TaxonomyService (org.olat.modules.taxonomy.TaxonomyService)14 TaxonomyRefImpl (org.olat.modules.taxonomy.model.TaxonomyRefImpl)14 HttpPut (org.apache.http.client.methods.HttpPut)12 HashMap (java.util.HashMap)10 List (java.util.List)10 VFSContainer (org.olat.core.util.vfs.VFSContainer)10 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)10 TaxonomyLevelTypeToType (org.olat.modules.taxonomy.TaxonomyLevelTypeToType)10 TaxonomyLevelRefImpl (org.olat.modules.taxonomy.model.TaxonomyLevelRefImpl)10