Search in sources :

Example 1 with IdentityMark

use of org.olat.course.nodes.gta.IdentityMark in project OpenOLAT by OpenOLAT.

the class GTAIdentityMarkDAOTest method shouldDeleteMarkOfAMarker.

@Test
public void shouldDeleteMarkOfAMarker() {
    TaskList taskList = createTaskList();
    TaskList otherTaskList = createTaskList();
    Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
    Identity otherMarker = JunitTestHelper.createAndPersistIdentityAsAuthor("otherCoach");
    Identity participant1 = JunitTestHelper.createAndPersistIdentityAsUser("participant1");
    Identity participant2 = JunitTestHelper.createAndPersistIdentityAsUser("participant2");
    Identity participant3 = JunitTestHelper.createAndPersistIdentityAsUser("participant3");
    IdentityMark mark1 = sut.createAndPersisitMark(taskList, marker, participant1);
    sut.createAndPersisitMark(taskList, marker, participant2);
    sut.createAndPersisitMark(otherTaskList, marker, participant3);
    sut.createAndPersisitMark(taskList, otherMarker, participant3);
    IdentityMark mark3 = sut.createAndPersisitMark(taskList, marker, participant3);
    dbInstance.commitAndCloseSession();
    sut.deleteMark(taskList, marker, participant2);
    dbInstance.commitAndCloseSession();
    List<IdentityMark> marks = sut.loadMarks(taskList, marker);
    assertThat(marks).hasSize(2);
    assertThat(marks).containsExactly(mark1, mark3);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) Identity(org.olat.core.id.Identity) IdentityMark(org.olat.course.nodes.gta.IdentityMark) Test(org.junit.Test)

Example 2 with IdentityMark

use of org.olat.course.nodes.gta.IdentityMark in project OpenOLAT by OpenOLAT.

the class GTAIdentityMarkDAOTest method shouldLoadAllMarksOfAMarker.

@Test
public void shouldLoadAllMarksOfAMarker() {
    TaskList taskList = createTaskList();
    TaskList otherTaskList = createTaskList();
    Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
    Identity otherMarker = JunitTestHelper.createAndPersistIdentityAsAuthor("otherCoach");
    Identity participant1 = JunitTestHelper.createAndPersistIdentityAsUser("participant1");
    Identity participant2 = JunitTestHelper.createAndPersistIdentityAsUser("participant2");
    Identity participant3 = JunitTestHelper.createAndPersistIdentityAsUser("participant3");
    IdentityMark mark1 = sut.createAndPersisitMark(taskList, marker, participant1);
    IdentityMark mark2 = sut.createAndPersisitMark(taskList, marker, participant2);
    sut.createAndPersisitMark(otherTaskList, marker, participant3);
    sut.createAndPersisitMark(taskList, otherMarker, participant3);
    IdentityMark mark3 = sut.createAndPersisitMark(taskList, marker, participant3);
    dbInstance.commitAndCloseSession();
    List<IdentityMark> marks = sut.loadMarks(taskList, marker);
    assertThat(marks).hasSize(3);
    assertThat(marks).containsExactly(mark1, mark2, mark3);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) Identity(org.olat.core.id.Identity) IdentityMark(org.olat.course.nodes.gta.IdentityMark) Test(org.junit.Test)

Example 3 with IdentityMark

use of org.olat.course.nodes.gta.IdentityMark in project OpenOLAT by OpenOLAT.

the class GTAIdentityMarkDAOTest method shouldDeleteMarkOfATaskList.

@Test
public void shouldDeleteMarkOfATaskList() {
    TaskList taskList = createTaskList();
    TaskList otherTaskList = createTaskList();
    Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
    Identity otherMarker = JunitTestHelper.createAndPersistIdentityAsAuthor("otherCoach");
    Identity participant1 = JunitTestHelper.createAndPersistIdentityAsUser("participant1");
    Identity participant2 = JunitTestHelper.createAndPersistIdentityAsUser("participant2");
    Identity participant3 = JunitTestHelper.createAndPersistIdentityAsUser("participant3");
    sut.createAndPersisitMark(taskList, marker, participant1);
    sut.createAndPersisitMark(taskList, marker, participant2);
    sut.createAndPersisitMark(otherTaskList, marker, participant3);
    sut.createAndPersisitMark(taskList, otherMarker, participant3);
    sut.createAndPersisitMark(taskList, marker, participant3);
    dbInstance.commitAndCloseSession();
    int numberDeleted = sut.deleteMark(taskList);
    dbInstance.commitAndCloseSession();
    assertThat(numberDeleted).isSameAs(4);
    List<IdentityMark> marksOfDeletedTaskList = sut.loadMarks(taskList, marker);
    assertThat(marksOfDeletedTaskList).hasSize(0);
    List<IdentityMark> marksOfExistinTaskList = sut.loadMarks(otherTaskList, marker);
    assertThat(marksOfExistinTaskList).hasSize(1);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) Identity(org.olat.core.id.Identity) IdentityMark(org.olat.course.nodes.gta.IdentityMark) Test(org.junit.Test)

Example 4 with IdentityMark

use of org.olat.course.nodes.gta.IdentityMark in project OpenOLAT by OpenOLAT.

the class GTAIdentityMarkDAOTest method shouldCreateAndPersistMark.

@Test
public void shouldCreateAndPersistMark() {
    TaskList taskList = createTaskList();
    Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
    Identity participant = JunitTestHelper.createAndPersistIdentityAsUser("participant");
    dbInstance.commitAndCloseSession();
    sut.createAndPersisitMark(taskList, marker, participant);
    dbInstance.commitAndCloseSession();
    IdentityMark reloadedMark = sut.loadMarks(taskList, marker).get(0);
    assertThat(reloadedMark).isNotNull();
    assertThat(reloadedMark.getCreationDate()).isNotNull();
    assertThat(reloadedMark.getLastModified()).isNotNull();
    assertThat(reloadedMark.getTaskList()).isEqualTo(taskList);
    assertThat(reloadedMark.getMarker()).isEqualTo(marker);
    assertThat(reloadedMark.getParticipant()).isEqualTo(participant);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) Identity(org.olat.core.id.Identity) IdentityMark(org.olat.course.nodes.gta.IdentityMark) Test(org.junit.Test)

Example 5 with IdentityMark

use of org.olat.course.nodes.gta.IdentityMark in project openolat by klemens.

the class GTAIdentityMarkDAOTest method shouldCreateAndPersistMark.

@Test
public void shouldCreateAndPersistMark() {
    TaskList taskList = createTaskList();
    Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
    Identity participant = JunitTestHelper.createAndPersistIdentityAsUser("participant");
    dbInstance.commitAndCloseSession();
    sut.createAndPersisitMark(taskList, marker, participant);
    dbInstance.commitAndCloseSession();
    IdentityMark reloadedMark = sut.loadMarks(taskList, marker).get(0);
    assertThat(reloadedMark).isNotNull();
    assertThat(reloadedMark.getCreationDate()).isNotNull();
    assertThat(reloadedMark.getLastModified()).isNotNull();
    assertThat(reloadedMark.getTaskList()).isEqualTo(taskList);
    assertThat(reloadedMark.getMarker()).isEqualTo(marker);
    assertThat(reloadedMark.getParticipant()).isEqualTo(participant);
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) Identity(org.olat.core.id.Identity) IdentityMark(org.olat.course.nodes.gta.IdentityMark) Test(org.junit.Test)

Aggregations

IdentityMark (org.olat.course.nodes.gta.IdentityMark)10 Test (org.junit.Test)8 Identity (org.olat.core.id.Identity)8 TaskList (org.olat.course.nodes.gta.TaskList)8 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 IdentityRef (org.olat.basesecurity.IdentityRef)2 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 TaskLight (org.olat.course.nodes.gta.TaskLight)2 DueDate (org.olat.course.nodes.gta.model.DueDate)2 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 UserPropertiesRow (org.olat.user.UserPropertiesRow)2