use of org.olat.course.nodes.cl.model.AssessmentData in project openolat by klemens.
the class CheckboxManagerTest method loadAssessmentDatas_inGroup.
@Test
public void loadAssessmentDatas_inGroup() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("check-19");
BusinessGroup group = businessGroupDao.createAndPersist(null, "gcheck", "gcheck-desc", 0, 10, true, true, false, false, false);
businessGroupRelationDao.addRole(id, group, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
String checkboxId = UUID.randomUUID().toString();
String resSubPath = UUID.randomUUID().toString();
DBCheckbox checkbox = checkboxManager.createDBCheckbox(checkboxId, entry.getOlatResource(), resSubPath);
DBCheck check = checkboxManager.createCheck(checkbox, id, null, Boolean.TRUE);
dbInstance.commitAndCloseSession();
List<BusinessGroup> groups = Collections.singletonList(group);
List<AssessmentData> loadedChecks = checkboxManager.getAssessmentDatas(entry.getOlatResource(), resSubPath, null, groups);
Assert.assertNotNull(loadedChecks);
Assert.assertEquals(1, loadedChecks.size());
AssessmentData data = loadedChecks.get(0);
Assert.assertNotNull(data);
Assert.assertNotNull(data.getChecks());
Assert.assertEquals(1, data.getChecks().size());
Assert.assertEquals(check, data.getChecks().get(0));
Assert.assertEquals(id, data.getIdentity());
}
use of org.olat.course.nodes.cl.model.AssessmentData in project openolat by klemens.
the class CheckboxManagerTest method loadAssessmentDatas_inGroupAndCourse.
@Test
public void loadAssessmentDatas_inGroupAndCourse() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity groupParticipant = JunitTestHelper.createAndPersistIdentityAsRndUser("check-20");
BusinessGroup group = businessGroupDao.createAndPersist(null, "gcheck", "gcheck-desc", 0, 10, true, true, false, false, false);
businessGroupRelationDao.addRole(groupParticipant, group, GroupRoles.participant.name());
Identity courseParticipant = JunitTestHelper.createAndPersistIdentityAsRndUser("check-21");
repositoryEntryRelationDao.addRole(courseParticipant, entry, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
// add some noise
Identity courseOwner = JunitTestHelper.createAndPersistIdentityAsRndUser("check-22");
repositoryEntryRelationDao.addRole(courseOwner, entry, GroupRoles.owner.name());
Identity groupWaiting = JunitTestHelper.createAndPersistIdentityAsRndUser("check-23");
businessGroupRelationDao.addRole(groupWaiting, group, GroupRoles.waiting.name());
dbInstance.commitAndCloseSession();
String checkboxId = UUID.randomUUID().toString();
String resSubPath = UUID.randomUUID().toString();
DBCheckbox checkbox = checkboxManager.createDBCheckbox(checkboxId, entry.getOlatResource(), resSubPath);
DBCheck checkGroup = checkboxManager.createCheck(checkbox, groupParticipant, null, Boolean.TRUE);
DBCheck checkCourse = checkboxManager.createCheck(checkbox, courseParticipant, null, Boolean.TRUE);
DBCheck checkNotVisible1 = checkboxManager.createCheck(checkbox, groupWaiting, null, Boolean.FALSE);
DBCheck checkNotVisible2 = checkboxManager.createCheck(checkbox, courseOwner, null, Boolean.FALSE);
dbInstance.commitAndCloseSession();
List<BusinessGroup> groups = Collections.singletonList(group);
List<AssessmentData> loadedChecks = checkboxManager.getAssessmentDatas(entry.getOlatResource(), resSubPath, entry, groups);
Assert.assertNotNull(loadedChecks);
Assert.assertEquals(2, loadedChecks.size());
List<DBCheck> collectedChecks = new ArrayList<>();
for (AssessmentData loadedCheck : loadedChecks) {
for (DBCheck loaded : loadedCheck.getChecks()) {
collectedChecks.add(loaded);
}
}
Assert.assertEquals(2, collectedChecks.size());
Assert.assertTrue(collectedChecks.contains(checkGroup));
Assert.assertTrue(collectedChecks.contains(checkCourse));
Assert.assertFalse(collectedChecks.contains(checkNotVisible1));
Assert.assertFalse(collectedChecks.contains(checkNotVisible2));
}
use of org.olat.course.nodes.cl.model.AssessmentData in project OpenOLAT by OpenOLAT.
the class CheckboxManagerTest method loadAssessmentDatas_inGroupAndCourse.
@Test
public void loadAssessmentDatas_inGroupAndCourse() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity groupParticipant = JunitTestHelper.createAndPersistIdentityAsRndUser("check-20");
BusinessGroup group = businessGroupDao.createAndPersist(null, "gcheck", "gcheck-desc", 0, 10, true, true, false, false, false);
businessGroupRelationDao.addRole(groupParticipant, group, GroupRoles.participant.name());
Identity courseParticipant = JunitTestHelper.createAndPersistIdentityAsRndUser("check-21");
repositoryEntryRelationDao.addRole(courseParticipant, entry, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
// add some noise
Identity courseOwner = JunitTestHelper.createAndPersistIdentityAsRndUser("check-22");
repositoryEntryRelationDao.addRole(courseOwner, entry, GroupRoles.owner.name());
Identity groupWaiting = JunitTestHelper.createAndPersistIdentityAsRndUser("check-23");
businessGroupRelationDao.addRole(groupWaiting, group, GroupRoles.waiting.name());
dbInstance.commitAndCloseSession();
String checkboxId = UUID.randomUUID().toString();
String resSubPath = UUID.randomUUID().toString();
DBCheckbox checkbox = checkboxManager.createDBCheckbox(checkboxId, entry.getOlatResource(), resSubPath);
DBCheck checkGroup = checkboxManager.createCheck(checkbox, groupParticipant, null, Boolean.TRUE);
DBCheck checkCourse = checkboxManager.createCheck(checkbox, courseParticipant, null, Boolean.TRUE);
DBCheck checkNotVisible1 = checkboxManager.createCheck(checkbox, groupWaiting, null, Boolean.FALSE);
DBCheck checkNotVisible2 = checkboxManager.createCheck(checkbox, courseOwner, null, Boolean.FALSE);
dbInstance.commitAndCloseSession();
List<BusinessGroup> groups = Collections.singletonList(group);
List<AssessmentData> loadedChecks = checkboxManager.getAssessmentDatas(entry.getOlatResource(), resSubPath, entry, groups);
Assert.assertNotNull(loadedChecks);
Assert.assertEquals(2, loadedChecks.size());
List<DBCheck> collectedChecks = new ArrayList<>();
for (AssessmentData loadedCheck : loadedChecks) {
for (DBCheck loaded : loadedCheck.getChecks()) {
collectedChecks.add(loaded);
}
}
Assert.assertEquals(2, collectedChecks.size());
Assert.assertTrue(collectedChecks.contains(checkGroup));
Assert.assertTrue(collectedChecks.contains(checkCourse));
Assert.assertFalse(collectedChecks.contains(checkNotVisible1));
Assert.assertFalse(collectedChecks.contains(checkNotVisible2));
}
use of org.olat.course.nodes.cl.model.AssessmentData in project OpenOLAT by OpenOLAT.
the class CheckboxManagerTest method loadAssessmentDatas_inGroup.
@Test
public void loadAssessmentDatas_inGroup() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("check-19");
BusinessGroup group = businessGroupDao.createAndPersist(null, "gcheck", "gcheck-desc", 0, 10, true, true, false, false, false);
businessGroupRelationDao.addRole(id, group, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
String checkboxId = UUID.randomUUID().toString();
String resSubPath = UUID.randomUUID().toString();
DBCheckbox checkbox = checkboxManager.createDBCheckbox(checkboxId, entry.getOlatResource(), resSubPath);
DBCheck check = checkboxManager.createCheck(checkbox, id, null, Boolean.TRUE);
dbInstance.commitAndCloseSession();
List<BusinessGroup> groups = Collections.singletonList(group);
List<AssessmentData> loadedChecks = checkboxManager.getAssessmentDatas(entry.getOlatResource(), resSubPath, null, groups);
Assert.assertNotNull(loadedChecks);
Assert.assertEquals(1, loadedChecks.size());
AssessmentData data = loadedChecks.get(0);
Assert.assertNotNull(data);
Assert.assertNotNull(data.getChecks());
Assert.assertEquals(1, data.getChecks().size());
Assert.assertEquals(check, data.getChecks().get(0));
Assert.assertEquals(id, data.getIdentity());
}
use of org.olat.course.nodes.cl.model.AssessmentData in project OpenOLAT by OpenOLAT.
the class CheckboxManagerTest method loadAssessmentDatas_inCourse.
@Test
public void loadAssessmentDatas_inCourse() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("check-18");
repositoryEntryRelationDao.addRole(id, entry, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
String checkboxId = UUID.randomUUID().toString();
String resSubPath = UUID.randomUUID().toString();
DBCheckbox checkbox = checkboxManager.createDBCheckbox(checkboxId, entry.getOlatResource(), resSubPath);
DBCheck check = checkboxManager.createCheck(checkbox, id, null, Boolean.TRUE);
dbInstance.commitAndCloseSession();
// load and check the check
List<AssessmentData> loadedChecks = checkboxManager.getAssessmentDatas(entry.getOlatResource(), resSubPath, entry, null);
Assert.assertNotNull(loadedChecks);
Assert.assertEquals(1, loadedChecks.size());
AssessmentData data = loadedChecks.get(0);
Assert.assertNotNull(data);
Assert.assertNotNull(data.getChecks());
Assert.assertEquals(1, data.getChecks().size());
Assert.assertEquals(check, data.getChecks().get(0));
Assert.assertEquals(id, data.getIdentity());
}
Aggregations