use of org.olat.portfolio.model.artefacts.EPStructureElementArtefact in project openolat by klemens.
the class EPArtefactManagerTest method testCreateStructureElementArtefact.
@Test
public void testCreateStructureElementArtefact() {
AbstractArtefact artefact = epFrontendManager.createAndPersistArtefact(ident1, "ep-structure-element");
if (artefact != null) {
// handler is disabled or another error occurred while
// trying to create the artefact
assertNotNull(artefact);
assertTrue(artefact instanceof EPStructureElementArtefact);
EPStructureElementArtefact elementArtefact = (EPStructureElementArtefact) artefact;
PortfolioStructure el = epFrontendManager.createAndPersistPortfolioStructureElement(null, "structure-el-for-artefact", "structure-element-for-artefact");
elementArtefact.setStructureElement((EPStructureElement) el);
dbInstance.commitAndCloseSession();
assertNotNull(artefact.getKey());
// reload the artefact
AbstractArtefact persistedArtefact = epFrontendManager.loadArtefactByKey(artefact.getKey());
assertNotNull(persistedArtefact);
assertTrue(persistedArtefact instanceof EPStructureElementArtefact);
EPStructureElementArtefact persistedElementArtefact = (EPStructureElementArtefact) persistedArtefact;
assertNotNull(persistedElementArtefact.getStructureElement());
assertEquals(el.getKey(), persistedElementArtefact.getStructureElement().getKey());
}
}
use of org.olat.portfolio.model.artefacts.EPStructureElementArtefact in project OpenOLAT by OpenOLAT.
the class EPArtefactManagerTest method testCreateStructureElementArtefact.
@Test
public void testCreateStructureElementArtefact() {
AbstractArtefact artefact = epFrontendManager.createAndPersistArtefact(ident1, "ep-structure-element");
if (artefact != null) {
// handler is disabled or another error occurred while
// trying to create the artefact
assertNotNull(artefact);
assertTrue(artefact instanceof EPStructureElementArtefact);
EPStructureElementArtefact elementArtefact = (EPStructureElementArtefact) artefact;
PortfolioStructure el = epFrontendManager.createAndPersistPortfolioStructureElement(null, "structure-el-for-artefact", "structure-element-for-artefact");
elementArtefact.setStructureElement((EPStructureElement) el);
dbInstance.commitAndCloseSession();
assertNotNull(artefact.getKey());
// reload the artefact
AbstractArtefact persistedArtefact = epFrontendManager.loadArtefactByKey(artefact.getKey());
assertNotNull(persistedArtefact);
assertTrue(persistedArtefact instanceof EPStructureElementArtefact);
EPStructureElementArtefact persistedElementArtefact = (EPStructureElementArtefact) persistedArtefact;
assertNotNull(persistedElementArtefact.getStructureElement());
assertEquals(el.getKey(), persistedElementArtefact.getStructureElement().getKey());
}
}
Aggregations