Search in sources :

Example 61 with TaskList

use of org.olat.course.nodes.gta.TaskList 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);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) GTACourseNode(org.olat.course.nodes.GTACourseNode) AssignmentResponse(org.olat.course.nodes.gta.AssignmentResponse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) File(java.io.File) Test(org.junit.Test)

Example 62 with TaskList

use of org.olat.course.nodes.gta.TaskList 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);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) GTACourseNode(org.olat.course.nodes.GTACourseNode) AssignmentResponse(org.olat.course.nodes.gta.AssignmentResponse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) File(java.io.File) Test(org.junit.Test)

Example 63 with TaskList

use of org.olat.course.nodes.gta.TaskList 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());
}
Also used : Task(org.olat.course.nodes.gta.Task) TaskList(org.olat.course.nodes.gta.TaskList) GTACourseNode(org.olat.course.nodes.GTACourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) Test(org.junit.Test)

Example 64 with TaskList

use of org.olat.course.nodes.gta.TaskList 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);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) GTACourseNode(org.olat.course.nodes.GTACourseNode) AssignmentResponse(org.olat.course.nodes.gta.AssignmentResponse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) File(java.io.File) Test(org.junit.Test)

Example 65 with TaskList

use of org.olat.course.nodes.gta.TaskList 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());
}
Also used : Task(org.olat.course.nodes.gta.Task) TaskList(org.olat.course.nodes.gta.TaskList) GTACourseNode(org.olat.course.nodes.GTACourseNode) AssignmentResponse(org.olat.course.nodes.gta.AssignmentResponse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) File(java.io.File) Test(org.junit.Test)

Aggregations

TaskList (org.olat.course.nodes.gta.TaskList)102 Identity (org.olat.core.id.Identity)68 Test (org.junit.Test)64 RepositoryEntry (org.olat.repository.RepositoryEntry)60 GTACourseNode (org.olat.course.nodes.GTACourseNode)48 File (java.io.File)36 Task (org.olat.course.nodes.gta.Task)36 AssignmentResponse (org.olat.course.nodes.gta.AssignmentResponse)32 BusinessGroup (org.olat.group.BusinessGroup)20 ArrayList (java.util.ArrayList)16 Date (java.util.Date)12 List (java.util.List)12 TaskRevisionDate (org.olat.course.nodes.gta.TaskRevisionDate)12 TaskProcess (org.olat.course.nodes.gta.TaskProcess)10 ReminderRuleImpl (org.olat.modules.reminder.model.ReminderRuleImpl)10 IdentityMark (org.olat.course.nodes.gta.IdentityMark)8 ModuleConfiguration (org.olat.modules.ModuleConfiguration)8 Calendar (java.util.Calendar)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 GTAManager (org.olat.course.nodes.gta.GTAManager)6