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));
}
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());
}
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));
}
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());
}
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));
}
Aggregations