Search in sources :

Example 6 with QEducationalContext

use of org.olat.modules.qpool.model.QEducationalContext in project OpenOLAT by OpenOLAT.

the class QEducationalContextDAOTest method testDelete_deletable.

@Test
public void testDelete_deletable() {
    String levelStr = "secondary-school-" + UUID.randomUUID().toString();
    QEducationalContext level = qEduContextDao.create(levelStr, true);
    dbInstance.commitAndCloseSession();
    // delete it
    boolean deleted = qEduContextDao.delete(level);
    dbInstance.commitAndCloseSession();
    Assert.assertTrue(deleted);
    // check that the type is really, really deleted
    QEducationalContext reloadedLevel = qEduContextDao.loadById(level.getKey());
    Assert.assertNull(reloadedLevel);
    List<QEducationalContext> allLevels = qEduContextDao.getEducationalContexts();
    Assert.assertFalse(allLevels.contains(level));
}
Also used : QEducationalContext(org.olat.modules.qpool.model.QEducationalContext) Test(org.junit.Test)

Example 7 with QEducationalContext

use of org.olat.modules.qpool.model.QEducationalContext in project OpenOLAT by OpenOLAT.

the class QEducationalContextDAOTest method testCreateAndGet_byLevel.

@Test
public void testCreateAndGet_byLevel() {
    String levelStr = "onlyLevel-" + UUID.randomUUID().toString();
    QEducationalContext level = qEduContextDao.create(levelStr, true);
    dbInstance.commit();
    // load it
    QEducationalContext reloadedLevel = qEduContextDao.loadByLevel(levelStr);
    // check the values
    Assert.assertNotNull(reloadedLevel);
    Assert.assertEquals(level.getKey(), reloadedLevel.getKey());
    Assert.assertNotNull(reloadedLevel.getCreationDate());
    Assert.assertEquals(levelStr, reloadedLevel.getLevel());
    Assert.assertTrue(reloadedLevel.isDeletable());
}
Also used : QEducationalContext(org.olat.modules.qpool.model.QEducationalContext) Test(org.junit.Test)

Example 8 with QEducationalContext

use of org.olat.modules.qpool.model.QEducationalContext in project OpenOLAT by OpenOLAT.

the class QEducationalContextDAOTest method testCreateAndGet.

@Test
public void testCreateAndGet() {
    String levelStr = "highLevel-" + UUID.randomUUID().toString();
    QEducationalContext level = qEduContextDao.create(levelStr, true);
    dbInstance.commit();
    // load it
    QEducationalContext reloadedLevel = qEduContextDao.loadById(level.getKey());
    // check the values
    Assert.assertNotNull(reloadedLevel);
    Assert.assertEquals(level.getKey(), reloadedLevel.getKey());
    Assert.assertNotNull(reloadedLevel.getCreationDate());
    Assert.assertEquals(levelStr, reloadedLevel.getLevel());
    Assert.assertTrue(reloadedLevel.isDeletable());
}
Also used : QEducationalContext(org.olat.modules.qpool.model.QEducationalContext) Test(org.junit.Test)

Example 9 with QEducationalContext

use of org.olat.modules.qpool.model.QEducationalContext in project OpenOLAT by OpenOLAT.

the class QEducationalContextDAOTest method testGetItemLevels.

@Test
public void testGetItemLevels() {
    String levelStr = "primary-school-" + UUID.randomUUID().toString();
    QEducationalContext level = qEduContextDao.create(levelStr, true);
    dbInstance.commit();
    // load it
    List<QEducationalContext> allLevels = qEduContextDao.getEducationalContexts();
    // check the values
    Assert.assertNotNull(allLevels);
    Assert.assertTrue(allLevels.contains(level));
}
Also used : QEducationalContext(org.olat.modules.qpool.model.QEducationalContext) Test(org.junit.Test)

Example 10 with QEducationalContext

use of org.olat.modules.qpool.model.QEducationalContext in project OpenOLAT by OpenOLAT.

the class QEducationalContextDAOTest method testDelete_notDeletable.

@Test
public void testDelete_notDeletable() {
    String levelStr = "uni-" + UUID.randomUUID().toString();
    QEducationalContext level = qEduContextDao.create(levelStr, false);
    dbInstance.commitAndCloseSession();
    // delete it
    boolean deleted = qEduContextDao.delete(level);
    dbInstance.commitAndCloseSession();
    Assert.assertFalse(deleted);
    // check that the type is really, really deleted
    QEducationalContext reloadedLevel = qEduContextDao.loadById(level.getKey());
    Assert.assertNotNull(reloadedLevel);
    List<QEducationalContext> allLevels = qEduContextDao.getEducationalContexts();
    Assert.assertTrue(allLevels.contains(level));
}
Also used : QEducationalContext(org.olat.modules.qpool.model.QEducationalContext) Test(org.junit.Test)

Aggregations

QEducationalContext (org.olat.modules.qpool.model.QEducationalContext)34 Test (org.junit.Test)18 QItemType (org.olat.modules.qpool.model.QItemType)8 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)8 File (java.io.File)4 BigDecimal (java.math.BigDecimal)4 URL (java.net.URL)4 QuestionItem (org.olat.modules.qpool.QuestionItem)4 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)4 Date (java.util.Date)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 Identity (org.olat.core.id.Identity)2 QTIMetadataConverter (org.olat.ims.qti.qpool.QTIMetadataConverter)2 QTI21QuestionType (org.olat.ims.qti21.model.QTI21QuestionType)2 QuestionItemAuditLogBuilder (org.olat.modules.qpool.QuestionItemAuditLogBuilder)2 QItemEdited (org.olat.modules.qpool.ui.events.QItemEdited)2 Taxonomy (org.olat.modules.taxonomy.Taxonomy)2