use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method isTaskInProcess.
@Test
public void isTaskInProcess() {
// prepare
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-11");
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.individual.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
File taskFile = new File("solo.txt");
Assert.assertNotNull(tasks);
dbInstance.commit();
// select
AssignmentResponse response = gtaManager.selectTask(participant, tasks, node, taskFile);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(response);
Assert.assertNotNull(response.getTask());
// check
boolean inProcess = gtaManager.isTaskInProcess(re, node, taskFile.getName());
Assert.assertTrue(inProcess);
// check dummy file name which cannot be in process
boolean notInProcess = gtaManager.isTaskInProcess(re, node, "qwertz");
Assert.assertFalse(notInProcess);
}
use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method isTaskAssigned.
@Test
public void isTaskAssigned() {
// create an individual task
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-6");
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.individual.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
dbInstance.commit();
Assert.assertNotNull(tasks);
// select
File taskFile = new File("bg.txt");
AssignmentResponse response = gtaManager.selectTask(participant, tasks, node, taskFile);
Assert.assertNotNull(response);
Assert.assertEquals(Status.ok, response.getStatus());
// check is assigned
boolean assigned = gtaManager.isTaskAssigned(tasks, taskFile.getName());
Assert.assertTrue(assigned);
boolean notAssigned = gtaManager.isTaskAssigned(tasks, "noise.txt");
Assert.assertFalse(notAssigned);
}
use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method createTaskRevisionDate.
@Test
public void createTaskRevisionDate() {
// prepare
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-20");
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.individual.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
dbInstance.commit();
// create task
Task task = gtaManager.createAndPersistTask(null, tasks, TaskProcess.assignment, null, participant, node);
dbInstance.commitAndCloseSession();
// create the revision log
TaskRevisionDate taskRevision = gtaManager.createAndPersistTaskRevisionDate(task, 2, TaskProcess.correction);
Assert.assertNotNull(taskRevision);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(taskRevision.getKey());
Assert.assertNotNull(taskRevision.getDate());
Assert.assertEquals(task, taskRevision.getTask());
Assert.assertEquals(2, taskRevision.getRevisionLoop());
Assert.assertEquals(TaskProcess.correction, taskRevision.getTaskStatus());
}
use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method isTasksInProcess_yes.
@Test
public void isTasksInProcess_yes() {
// prepare
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-12");
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.individual.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
File taskFile = new File("solo.txt");
Assert.assertNotNull(tasks);
dbInstance.commit();
// select
AssignmentResponse response = gtaManager.selectTask(participant, tasks, node, taskFile);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(response);
Assert.assertNotNull(response.getTask());
// check
boolean inProcess = gtaManager.isTasksInProcess(re, node);
Assert.assertTrue(inProcess);
}
use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method selectTask_identity.
@Test
public void selectTask_identity() {
// prepare
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-1");
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.individual.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
File taskFile = new File("solo.txt");
Assert.assertNotNull(tasks);
dbInstance.commit();
// select
AssignmentResponse response = gtaManager.selectTask(participant, tasks, node, taskFile);
dbInstance.commitAndCloseSession();
// check
Assert.assertNotNull(response);
Assert.assertNotNull(response.getTask());
Assert.assertEquals(AssignmentResponse.Status.ok, response.getStatus());
Task task = response.getTask();
Assert.assertNotNull(task.getKey());
Assert.assertNull(task.getBusinessGroup());
Assert.assertNotNull(task.getCreationDate());
Assert.assertNotNull(task.getLastModified());
Assert.assertEquals(tasks, task.getTaskList());
Assert.assertEquals("solo.txt", task.getTaskName());
Assert.assertEquals(participant, task.getIdentity());
}
Aggregations