diff --git a/src/main/java/org/olat/course/assessment/AssessmentManager.java b/src/main/java/org/olat/course/assessment/AssessmentManager.java index 7e6a66238d62f75d6e7efb9a8edd60377689b4cf..526acdf55f855b35a22fb96b03a3dd7a2bc0f05c 100644 --- a/src/main/java/org/olat/course/assessment/AssessmentManager.java +++ b/src/main/java/org/olat/course/assessment/AssessmentManager.java @@ -112,10 +112,9 @@ public interface AssessmentManager { * @param userCourseEnvironment * @param fullyAssessed * @param status - * @param by */ public void updateFullyAssessed(CourseNode courseNode, UserCourseEnvironment userCourseEnvironment, - Boolean fullyAssessed, AssessmentEntryStatus status, Role by); + Boolean fullyAssessed, AssessmentEntryStatus status); /** * Save an assessment comment for this node for a user. If there is already a comment property available, diff --git a/src/main/java/org/olat/course/assessment/CourseAssessmentService.java b/src/main/java/org/olat/course/assessment/CourseAssessmentService.java index 040c074c7a0f892e5cd697f0684f6eb2f348812f..3e6d3d6eeeaa1c85ba39222c0ba47ffbac2b3e58 100644 --- a/src/main/java/org/olat/course/assessment/CourseAssessmentService.java +++ b/src/main/java/org/olat/course/assessment/CourseAssessmentService.java @@ -130,7 +130,7 @@ public interface CourseAssessmentService { Double completion, AssessmentEntryStatus status, Role by); public void updateFullyAssessed(CourseNode courseNode, UserCourseEnvironment userCourseEnvironment, - Boolean fullyAssessed, AssessmentEntryStatus status, Role by); + Boolean fullyAssessed, AssessmentEntryStatus status); /** * @param courseNode diff --git a/src/main/java/org/olat/course/assessment/manager/CourseAssessmentManagerImpl.java b/src/main/java/org/olat/course/assessment/manager/CourseAssessmentManagerImpl.java index 460504dd49c0e651ca820e2784e587a3dd6fd26b..bd205fc4e9788a4a46a4238878776ba2befa1bb5 100644 --- a/src/main/java/org/olat/course/assessment/manager/CourseAssessmentManagerImpl.java +++ b/src/main/java/org/olat/course/assessment/manager/CourseAssessmentManagerImpl.java @@ -440,7 +440,7 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { assessmentService.updateAssessmentEntry(nodeAssessment); DBFactory.getInstance().commit(); - nodeAccessService.onStatusUpdated(courseNode, userCourseEnvironment, status, by); + nodeAccessService.onStatusUpdated(courseNode, userCourseEnvironment, status); DBFactory.getInstance().commit(); ScoreAccounting scoreAccounting = userCourseEnvironment.getScoreAccounting(); @@ -450,7 +450,7 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { @Override public void updateFullyAssessed(CourseNode courseNode, UserCourseEnvironment userCourseEnvironment, Boolean fullyAssessed, - AssessmentEntryStatus status, Role by) { + AssessmentEntryStatus status) { Identity assessedIdentity = userCourseEnvironment.getIdentityEnvironment().getIdentity(); ICourse course = CourseFactory.loadCourse(cgm.getCourseEntry()); Boolean entryRoot = isEntryRoot(course, courseNode); @@ -460,11 +460,6 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { return; } - if (by == Role.coach) { - nodeAssessment.setLastCoachModified(new Date()); - } else if (by == Role.user) { - nodeAssessment.setLastUserModified(new Date()); - } nodeAssessment.setAssessmentStatus(status); nodeAssessment.setFullyAssessed(fullyAssessed); @@ -533,9 +528,9 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { assessmentEntry = assessmentService.updateAssessmentEntry(assessmentEntry); DBFactory.getInstance().commit(); - nodeAccessService.onScoreUpdated(courseNode, userCourseEnv, score, assessmentEntry.getUserVisibility(), by); - nodeAccessService.onPassedUpdated(courseNode, userCourseEnv, passed, assessmentEntry.getUserVisibility(), by); - nodeAccessService.onStatusUpdated(courseNode, userCourseEnv, assessmentEntry.getAssessmentStatus(), by); + nodeAccessService.onScoreUpdated(courseNode, userCourseEnv, score, assessmentEntry.getUserVisibility()); + nodeAccessService.onPassedUpdated(courseNode, userCourseEnv, passed, assessmentEntry.getUserVisibility()); + nodeAccessService.onStatusUpdated(courseNode, userCourseEnv, assessmentEntry.getAssessmentStatus()); DBFactory.getInstance().commit(); //reevalute the tree @@ -608,7 +603,7 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { assessmentEntry = assessmentService.updateAssessmentEntry(assessmentEntry); DBFactory.getInstance().commit(); - nodeAccessService.onPassedUpdated(rootNode, userCourseEnvironment, passed, Boolean.TRUE, Role.coach); + nodeAccessService.onPassedUpdated(rootNode, userCourseEnvironment, passed, Boolean.TRUE); DBFactory.getInstance().commit(); ScoreAccounting scoreAccounting = userCourseEnvironment.getScoreAccounting(); @@ -646,7 +641,7 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { DBFactory.getInstance().commit(); Boolean passed = assessmentEntry.getPassed(); - nodeAccessService.onPassedUpdated(rootNode, userCourseEnvironment, passed, Boolean.TRUE, Role.coach); + nodeAccessService.onPassedUpdated(rootNode, userCourseEnvironment, passed, Boolean.TRUE); DBFactory.getInstance().commit(); ScoreAccounting scoreAccounting = userCourseEnvironment.getScoreAccounting(); diff --git a/src/main/java/org/olat/course/assessment/manager/CourseAssessmentServiceImpl.java b/src/main/java/org/olat/course/assessment/manager/CourseAssessmentServiceImpl.java index 7515312791db198e170df2e3f835b25d6957a5d4..757c85e150cd5268b8686faf9d4e28a983424c75 100644 --- a/src/main/java/org/olat/course/assessment/manager/CourseAssessmentServiceImpl.java +++ b/src/main/java/org/olat/course/assessment/manager/CourseAssessmentServiceImpl.java @@ -196,11 +196,11 @@ public class CourseAssessmentServiceImpl implements CourseAssessmentService, Nod @Override public void updateFullyAssessed(CourseNode courseNode, UserCourseEnvironment userCourseEnvironment, - Boolean fullyAssessed, AssessmentEntryStatus status, Role by) { + Boolean fullyAssessed, AssessmentEntryStatus status) { if (!userCourseEnvironment.isParticipant()) return; AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager(); - am.updateFullyAssessed(courseNode, userCourseEnvironment, fullyAssessed, status, by); + am.updateFullyAssessed(courseNode, userCourseEnvironment, fullyAssessed, status); } @Override diff --git a/src/main/java/org/olat/course/condition/ConditionNodeAccessProvider.java b/src/main/java/org/olat/course/condition/ConditionNodeAccessProvider.java index f3c46dcbc60fe0eec9e0ec6a21879b13470e2d2f..82fbfbe78f030a0b36220faa1f5c4a255ec2a326 100644 --- a/src/main/java/org/olat/course/condition/ConditionNodeAccessProvider.java +++ b/src/main/java/org/olat/course/condition/ConditionNodeAccessProvider.java @@ -35,7 +35,6 @@ import org.olat.course.run.CoursePaginationController; import org.olat.course.run.userview.CourseTreeModelBuilder; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.tree.CourseEditorTreeModel; -import org.olat.modules.assessment.Role; import org.olat.modules.assessment.model.AssessmentEntryStatus; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Service; @@ -135,17 +134,17 @@ public class ConditionNodeAccessProvider implements NodeAccessProvider { @Override public void onScoreUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Float score, - Boolean userVisibility, Role by) { + Boolean userVisibility) { // nothing to do } @Override - public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Boolean userVisibility, Role by) { + public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Boolean userVisibility) { // nothing to do } @Override public void onStatusUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, - AssessmentEntryStatus status, Role by) { + AssessmentEntryStatus status) { // nothing to do } diff --git a/src/main/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProvider.java b/src/main/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProvider.java index f7c7fa8672b2f3f51b8780929a6fd7085b90fca3..55253f6011c06f8fe8e9ffa15672e243e7a8d423 100644 --- a/src/main/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProvider.java +++ b/src/main/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProvider.java @@ -39,7 +39,6 @@ import org.olat.course.run.CoursePaginationController; import org.olat.course.run.userview.CourseTreeModelBuilder; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.tree.CourseEditorTreeModel; -import org.olat.modules.assessment.Role; import org.olat.modules.assessment.model.AssessmentEntryStatus; import org.olat.repository.RepositoryEntry; import org.springframework.beans.factory.annotation.Autowired; @@ -135,7 +134,7 @@ public class LearningPathNodeAccessProvider implements NodeAccessProvider { AssessmentEntryStatus status = getStatus(courseNode, userCourseEnv, result.isDone(), result.isFullyAssessed()); courseAssessmentService.updateFullyAssessed(courseNode, userCourseEnv, - Boolean.valueOf(result.isFullyAssessed()), status, Role.user); + Boolean.valueOf(result.isFullyAssessed()), status); return true; } return false; @@ -152,38 +151,37 @@ public class LearningPathNodeAccessProvider implements NodeAccessProvider { @Override public void onAssessmentConfirmed(CourseNode courseNode, UserCourseEnvironment userCourseEnv, boolean confirmed) { FullyAssessedResult result = getConfigs(courseNode).isFullyAssessedOnConfirmation(confirmed); - updateFullyAssessed(courseNode, userCourseEnv, Role.user, result); + updateFullyAssessed(courseNode, userCourseEnv, result); } @Override public void onScoreUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Float score, - Boolean userVisibility, Role by) { + Boolean userVisibility) { FullyAssessedResult result = getConfigs(courseNode).isFullyAssessedOnScore(score, userVisibility); - updateFullyAssessed(courseNode, userCourseEnv, by, result); + updateFullyAssessed(courseNode, userCourseEnv, result); } @Override public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, - Boolean userVisibility, Role by) { + Boolean userVisibility) { FullyAssessedResult result = getConfigs(courseNode).isFullyAssessedOnPassed(passed, userVisibility); - updateFullyAssessed(courseNode, userCourseEnv, by, result); + updateFullyAssessed(courseNode, userCourseEnv, result); } @Override public void onStatusUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, - AssessmentEntryStatus status, Role by) { + AssessmentEntryStatus status) { FullyAssessedResult result = getConfigs(courseNode).isFullyAssessedOnStatus(status); - updateFullyAssessed(courseNode, userCourseEnv, by, result); + updateFullyAssessed(courseNode, userCourseEnv, result); } - void updateFullyAssessed(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Role by, - FullyAssessedResult result) { + void updateFullyAssessed(CourseNode courseNode, UserCourseEnvironment userCourseEnv, FullyAssessedResult result) { boolean participant = userCourseEnv.isParticipant(); if (participant && result.isEnabled()) { AssessmentEntryStatus status = getStatus(courseNode, userCourseEnv, result.isDone(), result.isFullyAssessed()); courseAssessmentService.updateFullyAssessed(courseNode, userCourseEnv, - Boolean.valueOf(result.isFullyAssessed()), status, by); + Boolean.valueOf(result.isFullyAssessed()), status); } } diff --git a/src/main/java/org/olat/course/nodeaccess/NodeAccessProvider.java b/src/main/java/org/olat/course/nodeaccess/NodeAccessProvider.java index 2005e63454a622c6deabf279222aed8159f15661..2787ff100cf7e2140fd8d8ad84f1c10f0e65ca12 100644 --- a/src/main/java/org/olat/course/nodeaccess/NodeAccessProvider.java +++ b/src/main/java/org/olat/course/nodeaccess/NodeAccessProvider.java @@ -28,7 +28,6 @@ import org.olat.course.run.CoursePaginationController; import org.olat.course.run.userview.CourseTreeModelBuilder; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.tree.CourseEditorTreeModel; -import org.olat.modules.assessment.Role; import org.olat.modules.assessment.model.AssessmentEntryStatus; /** @@ -63,12 +62,12 @@ public interface NodeAccessProvider extends NodeAccessProviderIdentifier { public void onAssessmentConfirmed(CourseNode courseNode, UserCourseEnvironment userCourseEnv, boolean confirmed); public void onScoreUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Float score, - Boolean userVisibility, Role by); + Boolean userVisibility); - public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Boolean userVisibility, Role by); + public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Boolean userVisibility); public void onStatusUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, - AssessmentEntryStatus status, Role by); + AssessmentEntryStatus status); public void onCoursePublished(ICourse course); diff --git a/src/main/java/org/olat/course/nodeaccess/NodeAccessService.java b/src/main/java/org/olat/course/nodeaccess/NodeAccessService.java index 50f27cd077ed33cc4de56728946ee2ddcb079863..0eddafa3f4837ed87c1e0d1ece6e9decc61c6e2b 100644 --- a/src/main/java/org/olat/course/nodeaccess/NodeAccessService.java +++ b/src/main/java/org/olat/course/nodeaccess/NodeAccessService.java @@ -31,7 +31,6 @@ import org.olat.course.run.CoursePaginationController; import org.olat.course.run.userview.CourseTreeModelBuilder; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.tree.CourseEditorTreeModel; -import org.olat.modules.assessment.Role; import org.olat.modules.assessment.model.AssessmentEntryStatus; /** @@ -126,10 +125,9 @@ public interface NodeAccessService { * @param userCourseEnv * @param score * @param userVisibility - * @param by */ public void onScoreUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Float score, - Boolean userVisibility, Role by); + Boolean userVisibility); /** * Hook after the update of the passed value of an assessment changed. @@ -138,10 +136,9 @@ public interface NodeAccessService { * @param userCourseEnv * @param passed * @param userVisibility - * @param by */ public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, - Boolean userVisibility, Role by); + Boolean userVisibility); /** * Hook after the assessment status is updated. @@ -149,10 +146,9 @@ public interface NodeAccessService { * @param courseNode * @param userCourseEnv * @param status - * @param by */ public void onStatusUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, - AssessmentEntryStatus status, Role by); + AssessmentEntryStatus status); /** * Hook after a course was published. diff --git a/src/main/java/org/olat/course/nodeaccess/manager/NodeAccessServiceImpl.java b/src/main/java/org/olat/course/nodeaccess/manager/NodeAccessServiceImpl.java index 55f679578f18f785e453e12feef5379ca187c903..91a91648ea8caba09bf1733e2bfa7457c4c24119 100644 --- a/src/main/java/org/olat/course/nodeaccess/manager/NodeAccessServiceImpl.java +++ b/src/main/java/org/olat/course/nodeaccess/manager/NodeAccessServiceImpl.java @@ -38,7 +38,6 @@ import org.olat.course.run.navigation.NodeVisitedListener; import org.olat.course.run.userview.CourseTreeModelBuilder; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.tree.CourseEditorTreeModel; -import org.olat.modules.assessment.Role; import org.olat.modules.assessment.model.AssessmentEntryStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -138,23 +137,23 @@ public class NodeAccessServiceImpl implements NodeAccessService, NodeVisitedList @Override public void onScoreUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Float score, - Boolean userVisibility, Role by) { + Boolean userVisibility) { NodeAccessType type = NodeAccessType.of(userCourseEnv); - getNodeAccessProvider(type).onScoreUpdated(courseNode, userCourseEnv, score, userVisibility, by); + getNodeAccessProvider(type).onScoreUpdated(courseNode, userCourseEnv, score, userVisibility); } @Override public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, - Boolean userVisibility, Role by) { + Boolean userVisibility) { NodeAccessType type = NodeAccessType.of(userCourseEnv); - getNodeAccessProvider(type).onPassedUpdated(courseNode, userCourseEnv, passed, userVisibility, by); + getNodeAccessProvider(type).onPassedUpdated(courseNode, userCourseEnv, passed, userVisibility); } @Override public void onStatusUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, - AssessmentEntryStatus status, Role by) { + AssessmentEntryStatus status) { NodeAccessType type = NodeAccessType.of(userCourseEnv); - getNodeAccessProvider(type).onStatusUpdated(courseNode, userCourseEnv, status, by); + getNodeAccessProvider(type).onStatusUpdated(courseNode, userCourseEnv, status); } @Override diff --git a/src/main/java/org/olat/course/run/preview/PreviewAssessmentManager.java b/src/main/java/org/olat/course/run/preview/PreviewAssessmentManager.java index bf693687f1304dd4f5390fc912f16478f2fa1cd5..c8b835bf9509d1ad9159aa4821d1dbc51a988c3e 100644 --- a/src/main/java/org/olat/course/run/preview/PreviewAssessmentManager.java +++ b/src/main/java/org/olat/course/run/preview/PreviewAssessmentManager.java @@ -161,7 +161,7 @@ final class PreviewAssessmentManager implements AssessmentManager { @Override public void updateFullyAssessed(CourseNode courseNode, UserCourseEnvironment userCourseEnvironment, Boolean fullyAssessed, - AssessmentEntryStatus status, Role by) { + AssessmentEntryStatus status) { // } diff --git a/src/main/java/org/olat/restapi/support/vo/CourseVO.java b/src/main/java/org/olat/restapi/support/vo/CourseVO.java index ed0050883a98980f1979401d43a4c657878c73a9..6211c17bb30b5726c5071fedde6f089cb91d0953 100644 --- a/src/main/java/org/olat/restapi/support/vo/CourseVO.java +++ b/src/main/java/org/olat/restapi/support/vo/CourseVO.java @@ -239,4 +239,21 @@ public class CourseVO { public void setLifecycle(RepositoryEntryLifecycleVO lifecycle) { this.lifecycle = lifecycle; } + + @Override + public int hashCode() { + return key == null ? 24348 : key.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if(obj == this) { + return true; + } + if(obj instanceof CourseVO) { + CourseVO course = (CourseVO)obj; + return key != null && key.equals(course.getKey()); + } + return super.equals(obj); + } } \ No newline at end of file diff --git a/src/test/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProviderTest.java b/src/test/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProviderTest.java index 21472eeb8becb6c2bdcf1f0a4654388dbefccd53..08e52210cb1799d3e3b413d213a4590f1b0516f1 100644 --- a/src/test/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProviderTest.java +++ b/src/test/java/org/olat/course/learningpath/manager/LearningPathNodeAccessProviderTest.java @@ -39,7 +39,6 @@ import org.olat.course.learningpath.LearningPathNodeHandler; import org.olat.course.nodes.CourseNode; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.modules.assessment.AssessmentEntry; -import org.olat.modules.assessment.Role; import org.olat.modules.assessment.model.AssessmentEntryImpl; import org.olat.modules.assessment.model.AssessmentEntryStatus; @@ -92,7 +91,7 @@ public class LearningPathNodeAccessProviderTest { sut.onNodeVisited(courseNodeMock, participantCourseEnv); verify(courseAssessmentService).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.done, Role.user); + AssessmentEntryStatus.done); } @Test @@ -106,7 +105,7 @@ public class LearningPathNodeAccessProviderTest { sut.onNodeVisited(courseNodeMock, participantCourseEnv); verify(courseAssessmentService, never()).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.done, Role.user); + AssessmentEntryStatus.done); } @Test @@ -120,7 +119,7 @@ public class LearningPathNodeAccessProviderTest { sut.onNodeVisited(courseNodeMock, coachCourseEnv); verify(courseAssessmentService, never()).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.done, Role.user); + AssessmentEntryStatus.done); } @Test @@ -166,49 +165,49 @@ public class LearningPathNodeAccessProviderTest { public void shouldNotSetFullyAssessedIfNotEnabled() { FullyAssessedResult result = fullyAssessed(false, true, true); - sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, Role.auto, result); + sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, result); verify(courseAssessmentService, never()).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.done, Role.auto); + AssessmentEntryStatus.done); } @Test public void shouldNotSetFullyAssessedIfNotParticipant() { FullyAssessedResult result = fullyAssessed(false, true, true); - sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, Role.auto, result); + sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, result); verify(courseAssessmentService, never()).updateFullyAssessed(courseNodeMock, coachCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.done, Role.auto); + AssessmentEntryStatus.done); } @Test public void shouldSetFullyAssessedToTrue() { FullyAssessedResult result = fullyAssessed(true, true, true); - sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, Role.auto, result); + sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, result); verify(courseAssessmentService).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.done, Role.auto); + AssessmentEntryStatus.done); } @Test public void shouldSetFullyAssessedToFalse() { FullyAssessedResult result = fullyAssessed(true, false, true); - sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, Role.auto, result); + sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, result); verify(courseAssessmentService).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.FALSE, - AssessmentEntryStatus.notStarted, Role.auto); + AssessmentEntryStatus.notStarted); } @Test public void shouldSetStatusDone() { FullyAssessedResult result = fullyAssessed(true, true, true); - sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, Role.auto, result); + sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, result); verify(courseAssessmentService).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.done, Role.auto); + AssessmentEntryStatus.done); } @Test @@ -219,10 +218,10 @@ public class LearningPathNodeAccessProviderTest { .thenReturn(assessmentEntry); FullyAssessedResult result = fullyAssessed(true, true, false); - sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, Role.auto, result); + sut.updateFullyAssessed(courseNodeMock, participantCourseEnv, result); verify(courseAssessmentService).updateFullyAssessed(courseNodeMock, participantCourseEnv, Boolean.TRUE, - AssessmentEntryStatus.inReview, Role.auto); + AssessmentEntryStatus.inReview); } @Test @@ -234,21 +233,21 @@ public class LearningPathNodeAccessProviderTest { @Test public void shouldInvokeScoreConfig() { - sut.onScoreUpdated(courseNodeMock, coachCourseEnv, null, null, null); + sut.onScoreUpdated(courseNodeMock, coachCourseEnv, null, null); verify(configMock).isFullyAssessedOnScore(any(), any()); } @Test public void shouldInvokePassedConfig() { - sut.onPassedUpdated(courseNodeMock, coachCourseEnv, null, null, null); + sut.onPassedUpdated(courseNodeMock, coachCourseEnv, null, null); verify(configMock).isFullyAssessedOnPassed(any(), any()); } @Test public void onStatusUpdated() { - sut.onStatusUpdated(courseNodeMock, coachCourseEnv, null, null); + sut.onStatusUpdated(courseNodeMock, coachCourseEnv, null); verify(configMock).isFullyAssessedOnStatus(any()); } diff --git a/src/test/java/org/olat/selenium/AssessmentTest.java b/src/test/java/org/olat/selenium/AssessmentTest.java index d9d33af5214b739ef7df93ed7b9d8c4887efbf80..00cc76f29fd042f4a9f0331629d72df363f60743 100644 --- a/src/test/java/org/olat/selenium/AssessmentTest.java +++ b/src/test/java/org/olat/selenium/AssessmentTest.java @@ -803,6 +803,8 @@ public class AssessmentTest extends Deployments { QTI21Page.getQTI21Page(reiBrowser) .passE4() .assertOnCourseAssessmentTestScore(4); + + OOGraphene.waitingALittleLonger(); //open the efficiency statements UserToolsPage reiUserTools = new UserToolsPage(reiBrowser); diff --git a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java index fd51110be0d7039a93653a30c09f8ce99bd33e92..e8b71783addeaaa2adf329dfacdbc31967025254 100644 --- a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java +++ b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java @@ -19,6 +19,7 @@ */ package org.olat.selenium.page.course; +import java.time.Duration; import java.util.List; import org.junit.Assert; @@ -189,7 +190,7 @@ public class AssessmentToolPage { */ public AssessmentToolPage assertProgress(UserVO user, int progress) { By progressBy = By.xpath("//div[contains(@class,'o_table_wrapper')]/table//tr[td/a[contains(.,'" + user.getFirstName() + "')]]/td/div[@class='progress'][div[@title='" + progress + "%']]"); - OOGraphene.waitElement(progressBy, 15, 1, browser); + OOGraphene.waitElement(progressBy, Duration.ofSeconds(15), Duration.ofSeconds(1), browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java index b8142d2e2a02f7641511f4ccaa7c1b92471df9a2..7ee44dc37a9490d68030e4bdd05e62c8fdae206d 100644 --- a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java +++ b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java @@ -58,7 +58,6 @@ public class OOGraphene { private static final Logger log = Tracing.createLoggerFor(OOGraphene.class); - private static final Duration poolingDuration = Duration.ofMillis(100);//ms private static final Duration waitTinyDuration = Duration.ofSeconds(50);//seconds private static final long driverTimeout = 60;//seconds private static final long movePause = 400;//milliseconds @@ -122,16 +121,17 @@ public class OOGraphene { public static void waitCallout(WebDriver browser) { By calloutBy = By.cssSelector("div.popover-content div.o_callout_content"); - waitElement(calloutBy, 5, browser); + waitElement(calloutBy, browser); } public static void waitBusy(WebDriver browser) { - waitBusy(browser, timeout.getSeconds()); + waitBusy(browser, timeout); } - public static void waitBusy(WebDriver browser, long timeoutInSeconds) { + public static void waitBusy(WebDriver browser, Duration timeoutDuration) { new WebDriverWait(browser, driverTimeout) - .withTimeout(Duration.ofSeconds(timeoutInSeconds)).pollingEvery(poolingDuration) + .withTimeout(timeoutDuration) + .pollingEvery(polling) .until(new BusyPredicate()); } @@ -141,12 +141,13 @@ public class OOGraphene { * @param browser */ public static void waitElement(By element, WebDriver browser) { - waitElement(element, timeout.getSeconds(), browser); + waitElement(element, timeout, polling, browser); } public static void waitElementClickable(By element, WebDriver browser) { new WebDriverWait(browser, driverTimeout) - .withTimeout(timeout).pollingEvery(polling) + .withTimeout(timeout) + .pollingEvery(polling) .until(ExpectedConditions.elementToBeClickable(element)); } @@ -158,7 +159,7 @@ public class OOGraphene { * @param browser The web driver */ public static void waitElement(By element, long timeoutInSeconds, WebDriver browser) { - waitElement(element, timeoutInSeconds, polling.getSeconds(), browser); + waitElement(element, Duration.ofSeconds(timeoutInSeconds), polling, browser); } /** @@ -170,7 +171,7 @@ public class OOGraphene { * @param browser The web driver */ public static void waitElementSlowly(By element, long timeoutInSeconds, WebDriver browser) { - waitElement(element, timeoutInSeconds, poolingSlower.getSeconds(), browser); + waitElement(element, Duration.ofSeconds(timeoutInSeconds), poolingSlower, browser); } /** @@ -180,9 +181,9 @@ public class OOGraphene { * @param timeoutInSeconds The timeout in seconds * @param browser The web driver */ - public static void waitElement(By element, long timeoutInSeconds, long pollingInSeconds, WebDriver browser) { + public static void waitElement(By element, Duration timeoutDuration, Duration pollingDuration, WebDriver browser) { new WebDriverWait(browser, driverTimeout) - .withTimeout(Duration.ofSeconds(timeoutInSeconds)).pollingEvery(Duration.ofSeconds(pollingInSeconds)) + .withTimeout(timeoutDuration).pollingEvery(pollingDuration) .until(ExpectedConditions.visibilityOfElementLocated(element)); } @@ -208,7 +209,7 @@ public class OOGraphene { */ public static void waitElementDisappears(By element, int timeoutInSeconds, WebDriver browser) { new WebDriverWait(browser, driverTimeout) - .withTimeout(Duration.ofSeconds(timeoutInSeconds)).pollingEvery(poolingDuration) + .withTimeout(Duration.ofSeconds(timeoutInSeconds)).pollingEvery(polling) .until(ExpectedConditions.invisibilityOfElementLocated(element)); } @@ -354,7 +355,7 @@ public class OOGraphene { public static final void waitTinymce(WebDriver browser) { new WebDriverWait(browser, driverTimeout).withTimeout(waitTinyDuration) - .pollingEvery(poolingDuration) + .pollingEvery(polling) .until(new TinyMCELoadedPredicate()); } @@ -377,7 +378,7 @@ public class OOGraphene { String tinyId = tinyIdEl.getAttribute("id").replace("_diw", ""); new WebDriverWait(browser, driverTimeout).withTimeout(waitTinyDuration) - .pollingEvery(poolingDuration) + .pollingEvery(polling) .until(new TinyMCELoadedByIdPredicate(tinyId)); ((JavascriptExecutor)browser).executeScript("top.tinymce.editors['" + tinyId + "'].setContent('" + content + "')"); } @@ -396,7 +397,7 @@ public class OOGraphene { String tinyId = tinyIdEl.getAttribute("id").replace("_diw", ""); new WebDriverWait(browser, driverTimeout).withTimeout(waitTinyDuration) - .pollingEvery(poolingDuration) + .pollingEvery(polling) .until(new TinyMCELoadedByIdPredicate(tinyId)); ((JavascriptExecutor)browser).executeScript("top.tinymce.editors['" + tinyId + "'].insertContent('" + content + "')"); } @@ -529,7 +530,7 @@ public class OOGraphene { */ public static final void waitingTransition(WebDriver browser) { new WebDriverWait(browser, driverTimeout) - .pollingEvery(poolingDuration) + .pollingEvery(polling) .until(new TransitionPredicate()); waitingALittleBit(); } @@ -577,7 +578,7 @@ public class OOGraphene { public static final void waitBusyAndScrollTop(WebDriver browser) { try { new WebDriverWait(browser, driverTimeout) - .pollingEvery(poolingDuration) + .pollingEvery(polling) .withTimeout(timeout) .until(new BusyScrollToPredicate()); } catch (Exception e) { @@ -634,7 +635,7 @@ public class OOGraphene { public static final void waitAndCloseBlueMessageWindow(WebDriver browser) { try { new WebDriverWait(browser, driverTimeout) - .withTimeout(timeout).pollingEvery(poolingDuration) + .withTimeout(timeout).pollingEvery(polling) .until(ExpectedConditions.visibilityOfElementLocated(closeBlueBoxButtonBy)); } catch (Exception e) { //e.printStackTrace(); @@ -669,7 +670,7 @@ public class OOGraphene { private static final void clickCloseButton(WebDriver browser, WebElement closeButton) { closeButton.click(); new WebDriverWait(browser, driverTimeout) - .withTimeout(Duration.ofMillis(1000)).pollingEvery(poolingDuration) + .withTimeout(Duration.ofMillis(1000)).pollingEvery(polling) .until(new CloseAlertInfoPredicate()); } @@ -719,7 +720,7 @@ public class OOGraphene { public static final void waitNavBarTransition(WebDriver browser) { try { - new WebDriverWait(browser, driverTimeout).pollingEvery(poolingDuration) + new WebDriverWait(browser, driverTimeout).pollingEvery(polling) .until(new NavBarTransitionPredicate()); waitingALittleBit(); } catch (Exception e) { diff --git a/src/test/java/org/olat/selenium/page/repository/FeedPage.java b/src/test/java/org/olat/selenium/page/repository/FeedPage.java index 64241b646a579906b330dc5c24dcb9b3b3a3f05a..514e637f152cf5503ed2f0582ebc18fff9a5b06a 100644 --- a/src/test/java/org/olat/selenium/page/repository/FeedPage.java +++ b/src/test/java/org/olat/selenium/page/repository/FeedPage.java @@ -19,6 +19,7 @@ */ package org.olat.selenium.page.repository; +import java.time.Duration; import java.util.List; import org.junit.Assert; @@ -117,7 +118,7 @@ public class FeedPage { //save the settings By saveButton = By.xpath("//div[contains(@class,'modal-body')]//form//button[contains(@class,'btn-primary')]"); browser.findElement(saveButton).click(); - OOGraphene.waitBusy(browser, 20); + OOGraphene.waitBusy(browser, Duration.ofSeconds(20)); return this; } diff --git a/src/test/java/org/olat/selenium/page/user/EfficiencyStatementPage.java b/src/test/java/org/olat/selenium/page/user/EfficiencyStatementPage.java index 00bdd54de7847fa1ac47cf38066b9f1492445677..920e029d98c7f51c49bab4e2a25300e44e4e9a63 100644 --- a/src/test/java/org/olat/selenium/page/user/EfficiencyStatementPage.java +++ b/src/test/java/org/olat/selenium/page/user/EfficiencyStatementPage.java @@ -73,7 +73,7 @@ public class EfficiencyStatementPage { if(courseTitle.length() > 25) { courseTitle = courseTitle.substring(0, 25); } - By courseCertificateBy = By.xpath("//div[contains(@class,'o_sel_certificates_table')]//table//tr[td[contains(text(),'" + courseTitle + "')]]/td//a/i[contains(@class,'o_filetype_pdf')]"); + By courseCertificateBy = By.xpath("//div[contains(@class,'o_sel_certificates_table')]//table//tr[td[contains(text(),'" + courseTitle + "')]]/td/a/i[contains(@class,'o_filetype_pdf')]"); OOGraphene.waitElementSlowly(courseCertificateBy, 30, browser); return this; } diff --git a/src/test/java/org/olat/test/rest/RepositoryRestClient.java b/src/test/java/org/olat/test/rest/RepositoryRestClient.java index 62283f1a2610d49bb76f5a92bcfbf65939f1d42e..ead8b148c713ac347c7df48c256a3a50ab1baec8 100644 --- a/src/test/java/org/olat/test/rest/RepositoryRestClient.java +++ b/src/test/java/org/olat/test/rest/RepositoryRestClient.java @@ -109,6 +109,7 @@ public class RepositoryRestClient { assertNotNull(vo); assertNotNull(vo.getDisplayname()); assertNotNull(vo.getKey()); + conn.shutdown(); return vo; } @@ -139,6 +140,7 @@ public class RepositoryRestClient { assertNotNull(vo); assertNotNull(vo.getRepoEntryKey()); assertNotNull(vo.getKey()); + conn.shutdown(); return vo; } }