use of org.olat.course.nodes.gta.model.TaskListImpl in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method createIfNotExists.
@Test
public void createIfNotExists() {
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
Assert.assertNotNull(node.getIdent());
TaskList tasks = gtaManager.createIfNotExists(re, node);
Assert.assertNotNull(tasks);
dbInstance.commit();
// reload and check
TaskList reloadedTasks = gtaManager.getTaskList(re, node);
Assert.assertNotNull(reloadedTasks);
Assert.assertEquals(tasks, reloadedTasks);
Assert.assertTrue(reloadedTasks instanceof TaskListImpl);
TaskListImpl tasksImpl = (TaskListImpl) reloadedTasks;
Assert.assertNotNull(tasksImpl.getCreationDate());
Assert.assertNotNull(tasksImpl.getLastModified());
Assert.assertEquals(re, tasksImpl.getEntry());
Assert.assertEquals(node.getIdent(), tasksImpl.getCourseNodeIdent());
dbInstance.commit();
// check that a second call doesn't create a new task list
TaskList secondTasks = gtaManager.createIfNotExists(re, node);
Assert.assertNotNull(secondTasks);
dbInstance.commit();
Assert.assertEquals(tasks, secondTasks);
}
use of org.olat.course.nodes.gta.model.TaskListImpl in project openolat by klemens.
the class GTAIdentityMarkDAOTest method createTaskList.
private TaskList createTaskList() {
TaskListImpl tasksImpl = new TaskListImpl();
Date creationDate = new Date();
tasksImpl.setCreationDate(creationDate);
tasksImpl.setLastModified(creationDate);
tasksImpl.setEntry(JunitTestHelper.createAndPersistRepositoryEntry());
tasksImpl.setCourseNodeIdent(UUID.randomUUID().toString());
dbInstance.getCurrentEntityManager().persist(tasksImpl);
return tasksImpl;
}
use of org.olat.course.nodes.gta.model.TaskListImpl in project openolat by klemens.
the class GTAManagerTest method createIfNotExists.
@Test
public void createIfNotExists() {
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
Assert.assertNotNull(node.getIdent());
TaskList tasks = gtaManager.createIfNotExists(re, node);
Assert.assertNotNull(tasks);
dbInstance.commit();
// reload and check
TaskList reloadedTasks = gtaManager.getTaskList(re, node);
Assert.assertNotNull(reloadedTasks);
Assert.assertEquals(tasks, reloadedTasks);
Assert.assertTrue(reloadedTasks instanceof TaskListImpl);
TaskListImpl tasksImpl = (TaskListImpl) reloadedTasks;
Assert.assertNotNull(tasksImpl.getCreationDate());
Assert.assertNotNull(tasksImpl.getLastModified());
Assert.assertEquals(re, tasksImpl.getEntry());
Assert.assertEquals(node.getIdent(), tasksImpl.getCourseNodeIdent());
dbInstance.commit();
// check that a second call doesn't create a new task list
TaskList secondTasks = gtaManager.createIfNotExists(re, node);
Assert.assertNotNull(secondTasks);
dbInstance.commit();
Assert.assertEquals(tasks, secondTasks);
}
use of org.olat.course.nodes.gta.model.TaskListImpl in project OpenOLAT by OpenOLAT.
the class GTAIdentityMarkDAOTest method createTaskList.
private TaskList createTaskList() {
TaskListImpl tasksImpl = new TaskListImpl();
Date creationDate = new Date();
tasksImpl.setCreationDate(creationDate);
tasksImpl.setLastModified(creationDate);
tasksImpl.setEntry(JunitTestHelper.createAndPersistRepositoryEntry());
tasksImpl.setCourseNodeIdent(UUID.randomUUID().toString());
dbInstance.getCurrentEntityManager().persist(tasksImpl);
return tasksImpl;
}
use of org.olat.course.nodes.gta.model.TaskListImpl in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method createIfNotExists.
@Override
public TaskList createIfNotExists(RepositoryEntry entry, GTACourseNode cNode) {
TaskList tasks = getTaskList(entry, cNode);
if (tasks == null) {
TaskListImpl tasksImpl = new TaskListImpl();
Date creationDate = new Date();
tasksImpl.setCreationDate(creationDate);
tasksImpl.setLastModified(creationDate);
tasksImpl.setEntry(entry);
tasksImpl.setCourseNodeIdent(cNode.getIdent());
dbInstance.getCurrentEntityManager().persist(tasksImpl);
tasks = tasksImpl;
}
return tasks;
}
Aggregations