├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── pull_request_template.md └── workflows │ └── run-tests.yml ├── .gitignore ├── Dockerfile ├── LICENSE.txt ├── Procfile ├── README.md ├── app.json ├── docker-compose.yml ├── docs ├── README.txt ├── code-folder-structure.png ├── dp_logo.png ├── dp_logo.pxm ├── dp_logo_grey.png ├── dp_small_logo.png ├── dp_small_logo_dark.png ├── how_dp_works.png └── resources │ ├── config.yml │ ├── homepage.md │ └── wiki │ ├── assignment-creation.md │ ├── code-folder-structure.md │ ├── concepts.md │ ├── summary.md │ └── test-tips.md ├── pom.xml ├── src ├── main │ ├── kotlin │ │ ├── edu │ │ │ └── uoc │ │ │ │ ├── elc │ │ │ │ └── lti │ │ │ │ │ └── tool │ │ │ │ │ └── Tool.kt │ │ │ │ └── lti │ │ │ │ ├── claims │ │ │ │ └── ClaimsEnum.kt │ │ │ │ └── jwt │ │ │ │ └── AlgorithmFactory.kt │ │ └── org │ │ │ └── dropProject │ │ │ ├── AsyncConfig.kt │ │ │ ├── AsyncConfigurer.kt │ │ │ ├── AsyncTestConfig.kt │ │ │ ├── CancellableTaskScheduler.kt │ │ │ ├── Constants.kt │ │ │ ├── ControllerRequestsLoggingFilterConfig.kt │ │ │ ├── DropProjectApplication.kt │ │ │ ├── I18NConfig.kt │ │ │ ├── OAuth2WebSecurityConfig.kt │ │ │ ├── PendingTasksConfig.kt │ │ │ ├── SimpleLoginWebSecurityConfig.kt │ │ │ ├── SwaggerConfig.kt │ │ │ ├── ThymeleafConfig.kt │ │ │ ├── controllers │ │ │ ├── AdminController.kt │ │ │ ├── AppErrorController.kt │ │ │ ├── ApplicationContextListener.kt │ │ │ ├── AssignmentController.kt │ │ │ ├── GlobalControllerAdvice.kt │ │ │ ├── GlobalExceptionHandler.kt │ │ │ ├── InvalidProjectGroupException.kt │ │ │ ├── InvalidProjectStructureException.kt │ │ │ ├── LoginController.kt │ │ │ ├── ReportController.kt │ │ │ ├── ResourceNotFoundException.kt │ │ │ ├── StudentAPIController.kt │ │ │ ├── TeacherAPIController.kt │ │ │ └── UploadController.kt │ │ │ ├── dao │ │ │ ├── Assignee.kt │ │ │ ├── Assignment.kt │ │ │ ├── AssignmentACL.kt │ │ │ ├── AssignmentReport.kt │ │ │ ├── AssignmentTag.kt │ │ │ ├── AssignmentTags.kt │ │ │ ├── AssignmentTestMethod.kt │ │ │ ├── Author.kt │ │ │ ├── BuildReport.kt │ │ │ ├── GitSubmission.kt │ │ │ ├── JUnitReport.kt │ │ │ ├── JacocoReport.kt │ │ │ ├── PersonalToken.kt │ │ │ ├── ProjectGroup.kt │ │ │ ├── ProjectGroupRestrictions.kt │ │ │ ├── Submission.kt │ │ │ ├── SubmissionGitInfo.kt │ │ │ └── SubmissionReport.kt │ │ │ ├── data │ │ │ ├── AssignmentInfoResponse.kt │ │ │ ├── AssignmentLatestSubmissionsResponse.kt │ │ │ ├── AssignmentStatistics.kt │ │ │ ├── AuthorDetails.kt │ │ │ ├── BuildReport.kt │ │ │ ├── GitSubmissionExport.kt │ │ │ ├── GroupedProjectGroups.kt │ │ │ ├── JSONViews.kt │ │ │ ├── JUnitSummary.kt │ │ │ ├── MavenResult.kt │ │ │ ├── StudentHistory.kt │ │ │ ├── SubmissionExport.kt │ │ │ ├── SubmissionInfo.kt │ │ │ └── SubmissionResult.kt │ │ │ ├── extensions │ │ │ ├── ClassPathResourceExtension.kt │ │ │ ├── DateExtension.kt │ │ │ ├── FileExtension.kt │ │ │ ├── PrincipalExtension.kt │ │ │ └── StringExtension.kt │ │ │ ├── filters │ │ │ └── ControllerRequestsLoggingFilter.kt │ │ │ ├── forms │ │ │ ├── AdminDashboardForm.kt │ │ │ ├── AssignmentForm.kt │ │ │ └── UploadForm.kt │ │ │ ├── lti │ │ │ ├── LTIAuthenticationUserDetailsService.kt │ │ │ ├── LTIConfig.kt │ │ │ ├── LTIWebSecurityConfig.kt │ │ │ ├── RegistrationServiceImpl.kt │ │ │ └── WellKnownKeysController.kt │ │ │ ├── repository │ │ │ ├── AssigneeRepository.kt │ │ │ ├── AssignmentACLRepository.kt │ │ │ ├── AssignmentReportRepository.kt │ │ │ ├── AssignmentRepository.kt │ │ │ ├── AssignmentTagRepository.kt │ │ │ ├── AssignmentTagsRepository.kt │ │ │ ├── AssignmentTestMethodRepository.kt │ │ │ ├── AuthorRepository.kt │ │ │ ├── BuildReportRepository.kt │ │ │ ├── GitSubmissionRepository.kt │ │ │ ├── JUnitReportRepository.kt │ │ │ ├── JacocoReportRepository.kt │ │ │ ├── PersonalTokenRepository.kt │ │ │ ├── ProjectGroupRepository.kt │ │ │ ├── ProjectGroupRestrictionsRepository.kt │ │ │ ├── SubmissionGitInfoRepository.kt │ │ │ ├── SubmissionReportRepository.kt │ │ │ └── SubmissionRepository.kt │ │ │ ├── security │ │ │ ├── DropProjectSecurityConfig.kt │ │ │ ├── PersonalToken.kt │ │ │ ├── PersonalTokenAuthenticationFilter.kt │ │ │ └── PersonalTokenAuthenticationManager.kt │ │ │ ├── services │ │ │ ├── AssignmentService.kt │ │ │ ├── AssignmentTeacherFiles.kt │ │ │ ├── AssignmentValidator.kt │ │ │ ├── BuildReportBuilder.kt │ │ │ ├── BuildWorker.kt │ │ │ ├── GitClient.kt │ │ │ ├── GitSubmissionService.kt │ │ │ ├── JPlagService.kt │ │ │ ├── JacocoResultsParser.kt │ │ │ ├── JunitResultsParser.kt │ │ │ ├── MarkdownRenderer.kt │ │ │ ├── MavenInvoker.kt │ │ │ ├── MyAsyncUncaughtExceptionHandler.kt │ │ │ ├── ProjectGroupService.kt │ │ │ ├── ReportService.kt │ │ │ ├── ScheduledTasks.kt │ │ │ ├── StudentService.kt │ │ │ ├── SubmissionService.kt │ │ │ └── ZipService.kt │ │ │ └── storage │ │ │ ├── FileSystemStorageService.kt │ │ │ ├── StorageException.kt │ │ │ └── StorageService.kt │ └── resources │ │ ├── META-INF │ │ └── build-info.properties │ │ ├── drop-project-lti.properties │ │ ├── drop-project-mysql.properties │ │ ├── drop-project-oauth2.properties │ │ ├── drop-project.properties │ │ ├── initialData │ │ ├── javaSubmission2ErrorsJUnitXml.txt │ │ ├── javaSubmission2ErrorsMavenOutput.txt │ │ ├── javaSubmission4ErrorsJUnitXml.txt │ │ ├── javaSubmission4ErrorsMavenOutput.txt │ │ ├── javaSubmissionErrorJUnitXml.txt │ │ ├── javaSubmissionErrorMavenOutput.txt │ │ ├── javaSubmissionOkJUnitXml.txt │ │ └── javaSubmissionOkMavenOutput.txt │ │ ├── logback-spring.xml │ │ ├── messages.properties │ │ ├── messages_en_US.properties │ │ ├── messages_pt_PT.properties │ │ ├── static │ │ ├── access-denied.html │ │ ├── css │ │ │ ├── bootstrap-tagsinput.css │ │ │ ├── dropproject.css │ │ │ ├── dropzone.css │ │ │ └── typeaheadjs.css │ │ ├── favicon.ico │ │ ├── img │ │ │ ├── dp_small_logo.png │ │ │ ├── error.png │ │ │ ├── github-clone-ssh.png │ │ │ ├── github-deploy-keys-2.png │ │ │ ├── github-deploy-keys.png │ │ │ ├── iconfinder_cat_sleep_185528.png │ │ │ ├── if-information_2867914.png │ │ │ ├── if_sign-check_299110-half.png │ │ │ ├── if_sign-check_299110.png │ │ │ ├── if_sign-error_299045.png │ │ │ ├── if_sign-question-mark.png │ │ │ ├── info.png │ │ │ ├── setting_environment_variables.png │ │ │ ├── several-users.png │ │ │ ├── single-user.png │ │ │ ├── trophy_16.png │ │ │ ├── trophy_24.png │ │ │ ├── trophy_32.png │ │ │ ├── trophy_64.png │ │ │ └── warn.png │ │ └── js │ │ │ ├── bootstrap-tagsinput.js │ │ │ ├── bootstrap-tagsinput.min.js │ │ │ ├── bootstrap-tagsinput.min.js.map │ │ │ ├── copyToClipboard.js │ │ │ ├── dropproject.js │ │ │ ├── dropzone.js │ │ │ └── typeahead.bundle.js │ │ ├── templates │ │ ├── admin-dashboard.html │ │ ├── admin-pending-submissions.html │ │ ├── admin-tags.html │ │ ├── assignment-detail.html │ │ ├── assignment-form.html │ │ ├── assignments-list.html │ │ ├── build-report.html │ │ ├── exception.html │ │ ├── export-status.html │ │ ├── layout │ │ │ └── layout.html │ │ ├── leaderboard.html │ │ ├── login.html │ │ ├── personal-tokens-list.html │ │ ├── report.html │ │ ├── setup-git.html │ │ ├── signalled-submissions.html │ │ ├── student-git-form.html │ │ ├── student-history-form.html │ │ ├── student-history.html │ │ ├── student-setup-git.html │ │ ├── student-upload-form.html │ │ ├── submissions.html │ │ ├── teacher-assignments-list.html │ │ ├── teacher-import-assignment.html │ │ ├── teacher-submissions-plagiarism.html │ │ └── test-matrix.html │ │ ├── templatesXML │ │ └── download-all-pom.xml │ │ └── users.csv ├── orchid │ └── resources │ │ ├── config.yml │ │ └── wiki │ │ ├── assignment-creation.md │ │ ├── code-folder-structure.md │ │ ├── concepts.md │ │ ├── summary.md │ │ └── test-tips.md └── test │ ├── kotlin │ └── org │ │ └── dropProject │ │ ├── TestsHelper.kt │ │ ├── controllers │ │ ├── APIControllerTests.kt │ │ ├── AdminControllerTests.kt │ │ ├── AssignmentControllerTests.kt │ │ ├── GitSubmissionControllerTests.kt │ │ ├── ReportControllerTests.kt │ │ ├── StudentAPIControllerTests.kt │ │ ├── TeacherAPIControllerTests.kt │ │ ├── UploadControllerTests.kt │ │ └── UploadKotlinControllerTests.kt │ │ ├── dao │ │ ├── TestAuthor.kt │ │ ├── TestProjectGroup.kt │ │ └── TestSubmissionStatus.kt │ │ ├── data │ │ ├── TestBuildReport.kt │ │ ├── TestMavenResult.kt │ │ └── TestProjectGroup.kt │ │ └── services │ │ ├── TestAssignmentService.kt │ │ ├── TestAssignmentValidator.kt │ │ ├── TestGitClient.kt │ │ ├── TestJunitResultsParser.kt │ │ ├── TestProjectGroupService.kt │ │ ├── TestSubmissionService.kt │ │ └── TestZipService.kt │ ├── resources │ ├── drop-project-test.properties │ └── logback-test.xml │ ├── sampleAUTHORS_TXT │ ├── with_extra_empty_line.txt │ ├── with_spaces.txt │ └── without_id.txt │ ├── sampleAssignments │ ├── sampleJavaProject │ │ ├── .gitignore │ │ ├── README.md │ │ ├── checkstyle.xml │ │ ├── instructions.html │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── samples │ │ │ │ └── sampleJavaAssignment │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── samples │ │ │ └── sampleJavaAssignment │ │ │ └── TestTeacherProject.java │ ├── testJavaComplexProj │ │ ├── README.md │ │ ├── checkstyle.xml │ │ ├── instructions.html │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── pt │ │ │ │ └── ulusofona │ │ │ │ └── deisi │ │ │ │ └── aedProj2020 │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── pt │ │ │ └── ulusofona │ │ │ └── deisi │ │ │ └── aedProj2020 │ │ │ ├── TestTeacherHiddenPart1.java │ │ │ ├── TestTeacherHiddenPart2.java │ │ │ ├── TestTeacherWithLargeFiles.java │ │ │ ├── TestTeacherWithSimpleFiles.java │ │ │ └── UtilsTeacher.java │ ├── testJavaProj │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ ├── public │ │ │ └── test.txt │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── sampleAssignments │ │ │ │ └── testProj │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestTeacherHiddenProject.java │ │ │ └── TestTeacherProject.java │ ├── testJavaProj2 │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ └── src │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestProject1.java │ │ │ └── TestProject2.java │ ├── testJavaProjJUnit5 │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── sampleAssignments │ │ │ │ └── testProj │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestTeacherHiddenProject.java │ │ │ └── TestTeacherProject.java │ ├── testJavaProjWithCoverage │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── sampleAssignments │ │ │ │ └── testProj │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestTeacherHiddenProject.java │ │ │ └── TestTeacherProject.java │ ├── testJavaProjWithIgnoredTests │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── sampleAssignments │ │ │ │ └── testProj │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestTeacherHiddenProject.java │ │ │ └── TestTeacherProject.java │ ├── testJavaProjWithUserIdNOK │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── sampleAssignments │ │ │ │ └── testProj │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestTeacherHiddenProject.java │ │ │ └── TestTeacherProject.java │ ├── testJavaProjWithUserIdOK │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── sampleAssignments │ │ │ │ └── testProj │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestTeacherHiddenProject.java │ │ │ └── TestTeacherProject.java │ ├── testJavaProjWithWrongCheckstyleVersion │ │ ├── checkstyle.xml │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── dropProject │ │ │ │ └── sampleAssignments │ │ │ │ └── testProj │ │ │ │ └── Main.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── dropProject │ │ │ └── sampleAssignments │ │ │ └── testProj │ │ │ ├── TestTeacherHiddenProject.java │ │ │ └── TestTeacherProject.java │ ├── testKotlinProj │ │ ├── detekt-config.yml │ │ ├── instructions.html │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── kotlin │ │ │ │ └── Main.kt │ │ │ └── test │ │ │ └── kotlin │ │ │ └── TestProject.kt │ └── testKotlinProj2 │ │ ├── detekt-config.yml │ │ ├── instructions.html │ │ ├── instructions.md │ │ ├── pom.xml │ │ ├── public │ │ └── file.txt │ │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── org │ │ │ └── dropproject │ │ │ └── samples │ │ │ └── samplekotlinassignment │ │ │ └── Main.kt │ │ └── test │ │ └── kotlin │ │ └── org │ │ └── dropproject │ │ └── samples │ │ └── samplekotlinassignment │ │ └── TestTeacherProject.kt │ ├── sampleExports │ ├── export-assignment-and-git-submissions.dp │ ├── export-assignment-and-submissions.dp │ └── export-only-assignment.dp │ ├── sampleJacocoReports │ └── jacoco-testProj.csv │ ├── sampleJunitXmlReports │ ├── testErrors1.xml │ ├── testErrors2.xml │ ├── testNoErrors.xml │ └── testSkipped.xml │ ├── sampleMavenOutputs │ ├── checkstyleErrors1.txt │ ├── checkstylePluginFails.txt │ ├── compilerError1.txt │ ├── compilerError2.txt │ ├── exit.txt │ ├── fatalError1.txt │ ├── fatalError2.txt │ ├── junitErrors1.txt │ ├── kotlinCompilerError1.txt │ ├── kotlinCompilerError2.txt │ ├── kotlinDetektErrors-1.0.0.RC9.2.txt │ ├── kotlinDetektErrors-1.1.1.txt │ ├── kotlinDetektErrors-1.11.0.txt │ ├── kotlinDetektErrors2-1.11.0.txt │ ├── kotlinJunitErrors1.txt │ ├── kotlinOK1.txt │ ├── ok1.txt │ ├── outOfMemoryError.txt │ ├── pluginError.txt │ └── testsDidntRun.txt │ └── sampleProjects │ ├── projectCheckstyleErrors │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectCompilationErrors │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectHackingAttempt │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectInvalidStructure1 │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── invalidPackage │ │ └── sampleAssignments │ │ └── testProj │ │ └── Sample.java │ ├── projectInvalidStructure2 │ ├── AUTHORS.txt │ ├── README.md │ │ └── README.md │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectJUnitErrors │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectJava17 │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectKotlinCompilationError │ ├── AUTHORS.txt │ └── src │ │ └── Main.kt │ ├── projectKotlinNoPackageOK │ ├── AUTHORS.txt │ └── src │ │ └── Main.kt │ ├── projectKotlinOK │ ├── AUTHORS.txt │ ├── README.md │ └── src │ │ └── org │ │ └── dropproject │ │ └── samples │ │ └── samplekotlinassignment │ │ └── Main.kt │ ├── projectKotlinOK2 │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── samples │ │ └── samplekotlinassignment │ │ └── Main.kt │ ├── projectKotlinWithStyleErrors │ ├── AUTHORS.txt │ └── src │ │ └── Main.kt │ ├── projectOK │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectOKIndividual │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectOtherEncoding │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectOutOfMemory │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectSampleJavaAssignmentNOK │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── samples │ │ └── sampleJavaAssignment │ │ └── Main.java │ ├── projectUnexpectedCharacter │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectWith1StudentTest │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ ├── Main.java │ │ └── TestStudent.java │ ├── projectWith2StudentTests │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ ├── Main.java │ │ └── TestStudent.java │ ├── projectWith2StudentTestsUsingBeforeClass │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ ├── Main.java │ │ └── TestStudent.java │ ├── projectWithBOM │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectWithLargeOutput │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectWithREADME │ ├── AUTHORS.txt │ ├── README.txt │ ├── cross_red_icon.png │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ └── Main.java │ ├── projectWithStudentTestNotValid │ ├── AUTHORS.txt │ └── src │ │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ ├── Main.java │ │ └── StudentTest.java │ └── projectWithTestInputFiles │ ├── AUTHORS.txt │ ├── src │ └── org │ │ └── dropProject │ │ └── sampleAssignments │ │ └── testProj │ │ ├── Main.java │ │ └── TestStudent.java │ └── test-files │ └── test.txt └── system.properties /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots or screen recording** 24 | If applicable, add screenshots or screen recording to help explain your problem. 25 | 26 | **Configuration:** 27 | - OS: [e.g. Windows, MacOS, iOS, Android, ...] 28 | - Browser [e.g. chrome, safari, plugin] 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Please check if the PR fulfills these requirements: 2 | 3 | * [ ] Tests for the changes have been added/updated (if possible) 4 | * [ ] Documentation has been updated/added if relevant 5 | * [ ] Screenshots are attached to Github PR if visual/UI changes were made 6 | 7 | ### What is the current behavior? 8 | 9 | 10 | ### What is the new behavior? 11 | 12 | ### Other information? 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v3 11 | - name: Set up JDK 17 12 | uses: actions/setup-java@v3 13 | with: 14 | distribution: 'zulu' 15 | java-version: '17' 16 | # uncomment this when github actions don't find maven 17 | - name: Check maven version 18 | run: mvn --version 19 | - name: Cache Maven packages 20 | uses: actions/cache@v3 21 | with: 22 | path: ~/.m2 23 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} 24 | restore-keys: ${{ runner.os }}-m2 25 | - name: Build with Maven 26 | env: 27 | DP_M2_HOME: /usr/share/apache-maven-3.9.9 28 | DP_MVN_REPO: ~/.m2 29 | run: mvn --batch-mode --update-snapshots verify 30 | - name: Upload coverage to codecov 31 | uses: codecov/codecov-action@v1.2.1 32 | with: 33 | file: ./target/site/jacoco/jacoco.xml 34 | flags: unittests 35 | 36 | # - name: Upload war file to github releases 37 | # uses: AButler/upload-release-assets@v2.0 38 | # with: 39 | # files: 'target/drop-project.war' 40 | # repo-token: ${{ secrets.GITHUB_TOKEN }} 41 | # release-tag: 0.9.3 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | target 4 | upload 5 | mavenized-projects-test 6 | mavenized-projects 7 | *.zip 8 | /src/main/resources/config 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | #FROM tomcat:9-jdk17-openjdk-slim 2 | FROM openjdk:17-jdk-slim 3 | 4 | EXPOSE 8080 5 | 6 | WORKDIR /usr/src/app 7 | 8 | # install maven 9 | RUN apt-get update && apt-get install -y maven 10 | 11 | # setup environment variables 12 | ENV DP_M2_HOME=/usr/share/maven 13 | ENV DP_MVN_REPO=/usr/src/app/mvn_repository 14 | 15 | # COPY target/drop-project.war /usr/local/tomcat/webapps/ROOT.war 16 | COPY target/drop-project.jar /usr/src/app 17 | 18 | #CMD ["catalina.sh", "run"] 19 | CMD ["java", "-jar", "drop-project.jar"] -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war 2 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Drop Project - Continuous Auto-Grader", 3 | "description": "A web application where students drop their projects to check for correctness and quality.", 4 | "repository": "https://github.com/drop-project-edu/drop-project", 5 | "keywords": ["auto-grader", "maven", "java", "kotlin", "education"], 6 | 7 | "buildpacks": [ 8 | { 9 | "url": "https://github.com/palves-ulht/heroku-buildpack-java-maven" 10 | } 11 | ], 12 | 13 | "env": { 14 | "DP_M2_HOME": { 15 | "description": "Maven home", 16 | "value": ".maven" 17 | }, 18 | "DP_MVN_REPO": { 19 | "description": "Maven repository", 20 | "value": ".mvn_repository" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | 3 | services: 4 | db: 5 | image: mysql:8.0.35 6 | command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci 7 | environment: 8 | MYSQL_ROOT_PASSWORD: s3cret 9 | MYSQL_DATABASE: dp 10 | MYSQL_USER: dp 11 | MYSQL_PASSWORD: dp 12 | volumes: 13 | - ./db:/var/lib/mysql 14 | 15 | drop-project: 16 | image: pedroalv3s/drop-project:v0.9.8 17 | restart: "on-failure" 18 | environment: 19 | SPRING_PROFILES_ACTIVE: mysql 20 | SPRING_CONFIG_ADDITIONAL-LOCATION: /usr/src/app/conf/ 21 | DP_CONFIG_LOCATION: /usr/src/app/conf/ 22 | DB_URL: jdbc:mysql://db:3306/dp?connectTimeout=0&socketTimeout=0&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC 23 | DB_USERNAME: dp 24 | DB_PASSWORD: dp 25 | SERVER_SERVLET_CONTEXT_PATH: /dp-test 26 | volumes: 27 | - ./conf:/usr/src/app/conf 28 | - ./submissions:/usr/src/app/submissions 29 | - ./assignments:/usr/src/app/assignments 30 | - ./mavenized-projects:/usr/src/app/mavenized-projects 31 | ports: 32 | - "8080:8080" 33 | links: 34 | - db 35 | 36 | phpmyadmin: 37 | image: phpmyadmin/phpmyadmin:latest 38 | restart: always 39 | depends_on: 40 | - db 41 | environment: 42 | PMA_HOST: db 43 | MYSQL_ROOT_PASSWORD: s3cret 44 | ports: 45 | - "8096:80" -------------------------------------------------------------------------------- /docs/README.txt: -------------------------------------------------------------------------------- 1 | To generate the orchid integrated documentation website, perform: 2 | 3 | mvn orchid:build 4 | 5 | 6 | The generated files will be stored in: 7 | 8 | target/docs/orchid/ 9 | -------------------------------------------------------------------------------- /docs/code-folder-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/docs/code-folder-structure.png -------------------------------------------------------------------------------- /docs/dp_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/docs/dp_logo.png -------------------------------------------------------------------------------- /docs/dp_logo.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/docs/dp_logo.pxm -------------------------------------------------------------------------------- /docs/dp_logo_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/docs/dp_logo_grey.png -------------------------------------------------------------------------------- /docs/dp_small_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/docs/dp_small_logo.png -------------------------------------------------------------------------------- /docs/dp_small_logo_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/docs/dp_small_logo_dark.png -------------------------------------------------------------------------------- /docs/how_dp_works.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/docs/how_dp_works.png -------------------------------------------------------------------------------- /docs/resources/config.yml: -------------------------------------------------------------------------------- 1 | site: 2 | baseUrl: 'https://drop-project-edu.github.io/drop-project/' 3 | about: 4 | siteName: Drop Project 5 | siteDescription: 6 | 7 | Editorial: 8 | primaryColor: '#DE9149' 9 | social: 10 | github: 'drop-project-edu/drop-project' 11 | menu: 12 | - type: 'separator' 13 | title: 'Wiki' 14 | - type: 'wiki' 15 | - type: 'separator' 16 | title: 'API Docs' 17 | - type: 'kotlindocPackages' 18 | - type: 'kotlindocClasses' 19 | - type: 'sourcedocPages' 20 | moduleType: 'kotlindoc' 21 | node: 'classes' 22 | asSubmenu: true 23 | submenuTitle: 'Classes' 24 | - type: 'sourcedocPages' 25 | moduleType: 'kotlindoc' 26 | node: 'packages' 27 | asSubmenu: true 28 | submenuTitle: 'Packages' 29 | 30 | kotlindoc: 31 | sourceDirs: './../../src/main/kotlin' 32 | pages: 33 | menu: 34 | - type: "kotlindocClassLinks" 35 | includeItems: true 36 | 37 | 38 | services: 39 | publications: 40 | stages: 41 | ghPages: 42 | - type: 'githubPages' 43 | username: 'brunompc' 44 | repo: 'drop-project' 45 | -------------------------------------------------------------------------------- /docs/resources/homepage.md: -------------------------------------------------------------------------------- 1 | --- 2 | components: 3 | - type: 'pageContent' 4 | - type: 'readme' 5 | --- 6 | -------------------------------------------------------------------------------- /docs/resources/wiki/assignment-creation.md: -------------------------------------------------------------------------------- 1 | This tutorial explains how a teacher can create a new Assignment in Drop Project. 2 | 3 | The first step is to create a git repository with the correct structure. The easiest way to do this is to clone one of the the following repositories: 4 | 5 | https://github.com/drop-project-edu/sampleJavaAssignment 6 | 7 | https://github.com/drop-project-edu/sampleKotlinAssignment 8 | 9 | ## Structure 10 | 11 | The structure of the repository must be the following: 12 | 13 | + assignment 14 | |--- pom.xml (includes the checkstyle and junit plugins) 15 | |--- checkstyle.xml (the rules to validate the code style, e.g., variables must start with lowercase) 16 | |--- instructions.html (optional, the assignment instructions) 17 | |--- src 18 | |------ main 19 | |--------- ... (here goes the reference implementation, in maven structure) 20 | |------ test 21 | |--------- ... (JUnit tests that will validate students' submissions) 22 | 23 | ## Assignment creation 24 | 25 | After the creation of the repository, the following steps should be followed in the Drop Project web-application: 26 | 27 | 1. Login with your teacher account 28 | 2. From the top menu, open the `Manage Assignments` page 29 | 3. Press the `Create Assignment` blue button that appears in the bottom of the page 30 | 4. Fill in the form - below each field there is a short description of its purpose 31 | 32 | ## Tests 33 | 34 | Public tests should be defined in a file whose name should be prefixed with the `TestTeacher`. For example, the tests 35 | for a class `Person` should be defined in a file called `TestTeacherPerson`. 36 | 37 | Private (or Hidden) tests should be defined in a file whose name should be prefixed with `TestTeacherHidden`. For example, `TestTeacherHiddenPerson`. 38 | 39 | It is possible to have multiple test public and private (hidden) test classes. 40 | 41 | For some ideas on how to design your tests, check our [test tips](test-tips.md) page. 42 | -------------------------------------------------------------------------------- /docs/resources/wiki/code-folder-structure.md: -------------------------------------------------------------------------------- 1 | Drop Project's code itself follows the Maven folder structure. 2 | 3 | The following figure represents DP's folder/directory structure. Below the figure, a description of 4 | the contents of each sub-folder is given. 5 | 6 | . src 7 | +-- main 8 | +-- kotlin 9 | +---- org.dropProject 10 | +------ controllers 11 | +------ dao 12 | +------ data 13 | +------ extensions 14 | +------ filters 15 | +------ repositories 16 | +------ security 17 | +------ services 18 | +-- test 19 | +---- kotlin 20 | +---- org.dropProject 21 | +------ controllers 22 | +------ dao 23 | +------ data 24 | +------ ... 25 | +------ other test folders 26 | 27 | #### src/main/kotlin/drop-project/controllers 28 | Contains code related with handling HTTP requests. 29 | 30 | #### src/main/kotlin/drop-project/dao 31 | Contains the Data Access Object classes. This is where you will find the Assignment and Submission classes. 32 | 33 | #### src/main/kotlin/drop-project/data 34 | Contains auxiliary classes used in session. 35 | 36 | #### src/main/kotlin/drop-project/extensions 37 | Code that extends certain classes of the Java API (e.g. Date). 38 | 39 | #### src/main/kotlin/drop-project/filters 40 | Classes that intercept and pre-process HTTP requests. 41 | 42 | #### src/main/kotlin/drop-project/repositories 43 | Code that defines functions/interfaces to find persisted objects. 44 | 45 | #### src/main/kotlin/drop-project/security 46 | Contains access control definitions. 47 | 48 | #### src/main/kotlin/drop-project/services 49 | Business logic code. 50 | 51 | #### src/test/kotlin/drop-project/controllers 52 | Contains tests for controllers. 53 | 54 | #### src/test/kotlin/drop-project/dao 55 | Contains tests for Data Access Object classes. 56 | 57 | #### src/test/kotlin/drop-project/data 58 | Contains tests for the auxiliary classes . 59 | 60 | #### src/test/kotlin/drop-project/... 61 | Tests for other packages. 62 | -------------------------------------------------------------------------------- /docs/resources/wiki/summary.md: -------------------------------------------------------------------------------- 1 | - [Concepts](concepts.md) 2 | - [Assignment Creation Tutorial](assignment-creation.md) 3 | - [Source code structure](code-folder-structure.md) 4 | - [Test creation tips](test-tips.md) -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/AsyncConfigurer.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2022 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject 21 | 22 | 23 | interface AsyncConfigurer { 24 | 25 | fun getTimeout(): Int 26 | fun setTimeout(timeout: Int) 27 | 28 | fun getThreadPoolSize(): Int 29 | fun setThreadPoolSize(numThreads: Int) 30 | } 31 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/CancellableTaskScheduler.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject 21 | 22 | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler 23 | import java.util.* 24 | import java.util.concurrent.Callable 25 | import java.util.concurrent.Future 26 | import kotlin.concurrent.schedule 27 | 28 | /** 29 | * Tasks created through this scheduler are cancelled after a certain time 30 | */ 31 | class CancellableTaskScheduler(var timeout: Long) : ThreadPoolTaskScheduler() { 32 | 33 | override fun submit(task: Runnable): Future<*> { 34 | val future = super.submit(task) 35 | 36 | Timer("Timeout", false).schedule(timeout) { future.cancel(true) } 37 | 38 | return future 39 | } 40 | 41 | // on the latest spring version, this seems to be the method that is called 42 | override fun submit(task: Callable): Future { 43 | val future = super.submit(task) 44 | 45 | Timer("Timeout", false).schedule(timeout) { 46 | future.cancel(true) 47 | } 48 | 49 | return future 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/Constants.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject 21 | 22 | object Constants { 23 | const val TEST_NAME_PREFIX = "Test" 24 | const val TEACHER_TEST_NAME_PREFIX = "TestTeacher" 25 | const val TEACHER_HIDDEN_TEST_NAME_PREFIX = "TestTeacherHidden" 26 | 27 | const val DEFAULT_MAX_MEMORY_MB = 512 // max memory (in Mb) that is given to each submission to run their tests 28 | 29 | const val COOLOFF_FOR_STRUCTURE_OR_COMPILATION = 2 // minutes 30 | 31 | const val TOO_MUCH_OUTPUT_THRESHOLD = 2500 // more than 2500 println's is too much 32 | 33 | const val CACHE_ARCHIVED_ASSIGNMENTS_KEY = "archivedAssignmentsCache" 34 | 35 | const val SIMILARITY_THRESHOLD = 0.5 // minimum similarity to consider as plagiarism (0.0 .. 1.0) 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/ControllerRequestsLoggingFilterConfig.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject 21 | 22 | import org.springframework.context.annotation.Bean 23 | import org.springframework.context.annotation.Configuration 24 | import org.dropProject.filters.ControllerRequestsLoggingFilter 25 | 26 | 27 | @Configuration 28 | class ControllerRequestsLoggingFilterConfig { 29 | 30 | // ********** IMPORTANT ********** 31 | // don't forget to include the following line in drop-project.properties: 32 | // logging.level.org.springframework.web.filter.ControllerRequestsLoggingFilter=INFO 33 | 34 | @Bean 35 | fun logFilter(): ControllerRequestsLoggingFilter { 36 | val filter = ControllerRequestsLoggingFilter() 37 | return filter 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/PendingTasksConfig.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject 21 | 22 | import org.springframework.context.annotation.Bean 23 | import org.springframework.context.annotation.Configuration 24 | import org.springframework.context.annotation.Scope 25 | import java.lang.Exception 26 | 27 | /** 28 | * Used to signal errors on pending tasks 29 | */ 30 | data class PendingTaskError(val exception: Throwable) 31 | 32 | /** 33 | * Manages tasks that are executed asynchronously such as assignments export 34 | */ 35 | class PendingTasks { 36 | 37 | // key is the id of the task, value can be anything but if it is an error, will be PendingTaskError 38 | val pendingTasks = HashMap() 39 | 40 | fun get(taskId: String) : Any? { 41 | return pendingTasks[taskId] 42 | } 43 | 44 | fun put(taskId: String, data: Any) { 45 | pendingTasks[taskId] = data 46 | } 47 | } 48 | 49 | @Configuration 50 | class PendingTasksConfig { 51 | 52 | @Bean 53 | @Scope("singleton") 54 | fun pendingTasks(): PendingTasks { 55 | return PendingTasks() 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/controllers/InvalidProjectGroupException.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.controllers 21 | 22 | /** 23 | * Represents an Exception that is raised when the group that submitted a project doesn't comply with the restrictions of the assignment. 24 | */ 25 | class InvalidProjectGroupException(message: String?, cause: Throwable? = null) : RuntimeException(message, cause) 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/controllers/InvalidProjectStructureException.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.controllers 21 | 22 | /** 23 | * Represents an Exception that is raised when the submitted project's file and folder structure does not comply 24 | * with the expected/mandatory project structure. 25 | */ 26 | class InvalidProjectStructureException(message: String?, cause: Throwable? = null) : RuntimeException(message, cause) 27 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/controllers/ResourceNotFoundException.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.controllers 21 | 22 | import org.springframework.http.HttpStatus 23 | import org.springframework.web.bind.annotation.ResponseStatus 24 | 25 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 26 | class ResourceNotFoundException : RuntimeException() { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/Assignee.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.* 23 | 24 | /** 25 | * Represents an Assignee of an [Assignment]. Some assignments are private in the sense that they can only be accessed 26 | * by students that were given a certain permission. This "role" of Assignee represents that permission. 27 | * 28 | * @property id is primary-key like generated value 29 | * @property assignmentId is a String, identifying the Assignment 30 | * @property authorUserId is a String, corresponding to the author's user id (e.g. student number) 31 | */ 32 | @Entity 33 | @Table(uniqueConstraints=[UniqueConstraint(columnNames = ["assignmentId", "authorUserId"])]) 34 | data class Assignee( 35 | @Id @GeneratedValue 36 | val id: Long = 0, 37 | 38 | val assignmentId: String, 39 | val authorUserId: String 40 | ) 41 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/AssignmentACL.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.Column 23 | import javax.persistence.Entity 24 | import javax.persistence.GeneratedValue 25 | import javax.persistence.Id 26 | 27 | /** 28 | * Represents the association between an [Assignment] and a user that can access it. 29 | * 30 | * @property id is a primary-key like generated value 31 | * @assignmentId is a String, identifying the Assignment 32 | * @userId is a String, identifying the user 33 | */ 34 | @Entity 35 | data class AssignmentACL( 36 | @Id 37 | @GeneratedValue 38 | val id: Long = 0, 39 | 40 | @Column(length = 50) 41 | val assignmentId: String, 42 | val userId: String 43 | ) 44 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/AssignmentTag.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.* 23 | 24 | /** 25 | * Represents a "tag" used to categorize [Assignment]s. It is mostly used for filtering purposes. It might take any 26 | * value (e.g. the name of the course, the year, the type of evaluation, etc.). 27 | * 28 | * @property id is a primary-key like generated value. 29 | * @property name is a String, representing the name of the tag. 30 | * @property selected is a Boolean, indicating if this tag has been selected in a current filter. 31 | */ 32 | @Entity 33 | data class AssignmentTag( 34 | @Id 35 | @GeneratedValue 36 | val id: Long = 0, 37 | 38 | @Column(unique = true) 39 | val name: String, // tag name 40 | 41 | @Transient 42 | var selected: Boolean = false // used for the filter in the assignments' list 43 | ) 44 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/AssignmentTags.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import java.io.Serializable 23 | import javax.persistence.* 24 | 25 | @Embeddable 26 | data class AssignmentTagsCompositeKey( 27 | val assignmentId: String, 28 | val tagId: Long): Serializable 29 | 30 | /** 31 | * Represents an associate table between assignments and assignmentTags. Due to problems with spring "magic", i've decided to implement 32 | * this relation by hand 33 | * 34 | * @property assignmentId . 35 | * @property tagId . 36 | */ 37 | @Entity 38 | @IdClass(AssignmentTagsCompositeKey::class) 39 | data class AssignmentTags( 40 | @Id @Column(length = 50) val assignmentId: String, 41 | @Id val tagId: Long 42 | ) 43 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/AssignmentTestMethod.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2020 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.* 23 | 24 | /** 25 | * Represents an [Assignment]'s JUnit test method/function. 26 | * 27 | * @property id is a primary-key like generated value 28 | * @property assignmentId is a String, identifying the assignment 29 | * @property testClass is a String with the name of the test class 30 | * @property testMethod is a String with the name of the method 31 | */ 32 | @Entity 33 | data class AssignmentTestMethod( 34 | @Id 35 | @GeneratedValue 36 | val id: Long = 0, 37 | 38 | @ManyToOne 39 | @JoinColumn(name = "assignment_id", nullable = false) 40 | val assignment: Assignment, 41 | 42 | val testClass: String, 43 | val testMethod: String 44 | ) 45 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/BuildReport.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.* 23 | 24 | /** 25 | * Represents an [Assignment]'s "Build Report". 26 | * 27 | * @property id is a primary-key like generated value 28 | * @property buildReport is a String, containing the textual information that resulted from building an [Assignment] 29 | */ 30 | @Entity 31 | data class BuildReport( 32 | @Id @GeneratedValue 33 | val id: Long = 0, 34 | 35 | @Column(columnDefinition = "LONGTEXT", nullable = false) 36 | val buildReport: String 37 | ) 38 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/JUnitReport.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.* 23 | 24 | /** 25 | * Represents a persisted JUnitReport. 26 | * 27 | * @property id is a Long with a primary-key like generated id 28 | * @property submissionId is a Long, identifying the [Submission] that the report is based on 29 | * @property fileName is a String with the name of the JUnit report file 30 | * @property xmlReport is a String with the XML version of the report 31 | */ 32 | @Entity 33 | @Table(uniqueConstraints=[UniqueConstraint(columnNames = ["submissionId", "fileName"])], indexes = [Index(columnList = "submissionId")]) 34 | data class JUnitReport( 35 | @Id @GeneratedValue 36 | val id: Long = 0, 37 | 38 | val submissionId: Long, // submission.id 39 | 40 | val fileName: String, 41 | 42 | @Column(columnDefinition = "LONGTEXT") // TODO This is not working, it still creates with type TEXT... 43 | val xmlReport: String 44 | ) 45 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/JacocoReport.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.* 23 | 24 | /** 25 | * Represents a persisted Jacoco report. The Jacoco report contains the result of calculating the code 26 | * coverage of a [Submission]. 27 | * 28 | * @property id is a Long with a primary-key like generated id 29 | * @property submissionId is Long is a Long, identifying the [Submission] that the report is based on 30 | * @property fileName is a String with the name of the JUnit report file 31 | * @property csvReport is a String with the CSV version of the report 32 | */ 33 | @Entity 34 | @Table(uniqueConstraints=[UniqueConstraint(columnNames = ["submissionId", "fileName"])], indexes = [Index(columnList = "submissionId")]) 35 | data class JacocoReport( 36 | @Id @GeneratedValue 37 | val id: Long = 0, 38 | 39 | val submissionId: Long, // submission.id 40 | 41 | val fileName: String, 42 | 43 | @Column(columnDefinition = "LONGTEXT") // TODO This is not working, it still creates with type TEXT... 44 | val csvReport: String 45 | ) 46 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/ProjectGroupRestrictions.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2024 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.Column 23 | import javax.persistence.Entity 24 | import javax.persistence.GeneratedValue 25 | import javax.persistence.Id 26 | import javax.persistence.PrePersist 27 | import javax.persistence.PreUpdate 28 | 29 | @Entity 30 | data class ProjectGroupRestrictions( 31 | @Id @GeneratedValue 32 | val id: Long = 0, 33 | 34 | var minGroupSize: Int = 1, 35 | var maxGroupSize: Int? = null, 36 | 37 | @Column(length = 1000) 38 | var exceptions: String? = null // comma separated list of users that are exempt from the restrictions 39 | ) { 40 | 41 | @PrePersist 42 | @PreUpdate 43 | fun prePersist() { 44 | exceptions = exceptions?.replace(" ", "")?.replace("\n", "")?.replace("\r", "") 45 | } 46 | 47 | fun exceptionsAsList(): List { 48 | if (exceptions.isNullOrBlank()) { 49 | return emptyList() 50 | } 51 | return exceptions!!.split(",").sorted() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/dao/SubmissionGitInfo.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import javax.persistence.* 23 | 24 | /** 25 | * Represents specific git information for submissions. This is different from the class [GitSubmission] 26 | * because [GitSubmission] represents a single connection to a git repository that used by several submissions. 27 | * 28 | * This class represents specific information for each submission. 29 | * 30 | * @property id is a primary-key like generated value 31 | * @property submissionId is an id of a [Submission] (FK) 32 | * @property gitCommitHash is the git hash associated with the commit that corresponds to this submission 33 | */ 34 | @Entity 35 | class SubmissionGitInfo( 36 | @Id @GeneratedValue val id: Long = 0, 37 | @Column(unique = true) val submissionId: Long, // FK for Submission 38 | val gitCommitHash: String) 39 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/AssignmentInfoResponse.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2023 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import com.fasterxml.jackson.annotation.JsonView 23 | import org.dropProject.dao.Assignment 24 | 25 | data class AssignmentInfoResponse ( 26 | @JsonView(JSONViews.StudentAPI::class) 27 | var assignment: Assignment?=null, 28 | @JsonView(JSONViews.StudentAPI::class) 29 | var errorCode: Int?=null 30 | ) 31 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/AssignmentLatestSubmissionsResponse.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2024 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import com.fasterxml.jackson.annotation.JsonView 23 | import org.dropProject.dao.ProjectGroup 24 | import org.dropProject.dao.Submission 25 | 26 | data class AssignmentLatestSubmissionsResponse( 27 | @JsonView(JSONViews.TeacherAPI::class) 28 | val projectGroup: ProjectGroup, 29 | @JsonView(JSONViews.TeacherAPI::class) 30 | val lastSubmission: Submission, 31 | @JsonView(JSONViews.TeacherAPI::class) 32 | val numSubmissions: Int 33 | ) 34 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/AuthorDetails.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | /** 23 | * Represents one of the authors of a [Submission]. 24 | * Note that the author might not be the submitter (e.g. if a group has 2 elements, both will be authors, but only one 25 | * of them will be the submitter). 26 | * 27 | * @property name is a String 28 | * @property number is a String 29 | * @property submitter is a Boolean which will be true if the author object was the one performing the submission 30 | */ 31 | data class AuthorDetails(val name: String, val number: String, val submitter: Boolean = false) { 32 | override fun toString(): String { 33 | return "${number}-${name}" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/GitSubmissionExport.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import com.fasterxml.jackson.annotation.JsonFormat 23 | import com.fasterxml.jackson.annotation.JsonIgnore 24 | import java.util.* 25 | import javax.persistence.Column 26 | import kotlin.collections.ArrayList 27 | 28 | 29 | /** 30 | * Represents all the data pertaining a git submission, including all the submissions associated with this repo 31 | */ 32 | data class GitSubmissionExport( 33 | val assignmentId: String, 34 | var submitterUserId: String, 35 | 36 | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") 37 | val createDate: Date = Date(), 38 | 39 | var connected: Boolean = false, 40 | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") 41 | var lastCommitDate: Date? = null, 42 | 43 | val gitRepositoryUrl: String, 44 | var gitRepositoryPubKey: String? = null, 45 | var gitRepositoryPrivKey: String? = null, 46 | 47 | val authors: List 48 | ) 49 | { 50 | 51 | data class Author(val userId: String, val name: String) 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/JSONViews.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | /** 23 | * This is used by the JSON Serializer to include only certain attributes. 24 | * For example, we don't want to expose the private repository key of an assignment 25 | */ 26 | class JSONViews { 27 | open class StudentAPI 28 | class TeacherAPI: StudentAPI() 29 | } 30 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/MavenResult.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import org.dropProject.Constants 23 | 24 | /** 25 | * Represents the Output of a Maven build process. 26 | * 27 | * @property resultCode is an Int 28 | * @property outputLines is a List of String 29 | * @property expiredByTimeout is a Boolean 30 | */ 31 | data class MavenResult(val resultCode : Int, 32 | val outputLines: List, 33 | var expiredByTimeout : Boolean = false) { 34 | fun tooMuchOutput() = outputLines 35 | .filter { !it.startsWith("\tat ") } // count lines that are not associated with stacktraces 36 | .size >= Constants.TOO_MUCH_OUTPUT_THRESHOLD 37 | } 38 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/SubmissionInfo.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import com.fasterxml.jackson.annotation.JsonView 23 | import org.dropProject.dao.ProjectGroup 24 | import org.dropProject.dao.Submission 25 | 26 | /** 27 | * Represents the [Submission]s that a [ProjectGroup] did for a certain [Assignment]. 28 | * 29 | * @property projectGroup is a ProjectGroup 30 | * @property lastSubmission is the last (most recent) [Submission] performed by the ProjectGroup 31 | * @property allSubmissions is a List of [Submission]s 32 | */ 33 | data class SubmissionInfo( 34 | @JsonView(JSONViews.TeacherAPI::class) 35 | val projectGroup: ProjectGroup, 36 | @JsonView(JSONViews.TeacherAPI::class) 37 | val lastSubmission: Submission, 38 | @JsonView(JSONViews.TeacherAPI::class) 39 | val allSubmissions: List) { 40 | } 41 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/data/SubmissionResult.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import com.fasterxml.jackson.annotation.JsonInclude 23 | 24 | /** 25 | * Represents the response after a submission. It will be converted to JSON 26 | */ 27 | @JsonInclude(JsonInclude.Include.NON_NULL) // exclude nulls fields from serialization 28 | class SubmissionResult(val submissionId: Long? = null, val error: String? = null) { 29 | 30 | init { 31 | if (submissionId == null && error == null) { 32 | throw Exception("You must set at least one of [submissionId, error]") 33 | } 34 | 35 | if (submissionId != null && error != null) { 36 | throw Exception("You can't set both [submissionId, error]") 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/extensions/ClassPathResourceExtension.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2022 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.extensions 21 | 22 | import org.springframework.core.io.ClassPathResource 23 | import org.springframework.util.FileCopyUtils 24 | 25 | fun ClassPathResource.getContent(): String { 26 | return FileCopyUtils.copyToString(this.inputStream.bufferedReader()); 27 | } 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/extensions/DateExtension.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.extensions 21 | 22 | import java.text.SimpleDateFormat 23 | import java.util.* 24 | 25 | /** 26 | * This file contains extensions to the default [Date] class. 27 | */ 28 | 29 | fun Date.formatJustDate(): String { 30 | val sdf= SimpleDateFormat("yyyyMMdd", Locale.getDefault()) 31 | return sdf.format(this) 32 | } 33 | 34 | fun Date.formatDefault(): String { 35 | val sdf= SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()) 36 | return sdf.format(this) 37 | } 38 | 39 | fun Date.format(format: String): String { 40 | val sdf= SimpleDateFormat(format, Locale.getDefault()) 41 | return sdf.format(this) 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/extensions/FileExtension.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.extensions 21 | 22 | import java.io.File 23 | import java.io.IOException 24 | 25 | /** 26 | * This file contains extensions to the default [File] class. 27 | */ 28 | 29 | // taken from https://stackoverflow.com/a/34730781 30 | fun File.existsCaseSensitive(): Boolean { 31 | try { 32 | return exists() && canonicalFile.name == name 33 | } catch (e: IOException) { 34 | return false 35 | } 36 | 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/extensions/PrincipalExtension.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2020 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.extensions 21 | 22 | import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken 23 | import java.security.Principal 24 | 25 | /** 26 | * This file contains extensions to the default [Principal] class. 27 | */ 28 | 29 | fun Principal.realName(): String { 30 | if (this is OAuth2AuthenticationToken) { 31 | return this.principal.attributes["login"].toString() // this only works for github 32 | } 33 | return this.name 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/extensions/StringExtension.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.extensions 21 | 22 | import org.springframework.web.util.HtmlUtils 23 | 24 | /** 25 | * This file contains extensions to the default String class. 26 | */ 27 | 28 | // remove weird characters such as \uFFeF 29 | fun String.sanitize(): String { 30 | 31 | var sanitized = "" 32 | for (c in this) { 33 | if (c.isLetterOrDigit() || c == '_' || c == '-') { 34 | sanitized += c 35 | } 36 | } 37 | 38 | return sanitized 39 | } 40 | 41 | fun String.toEscapedHtml(): String { 42 | return HtmlUtils.htmlEscape(this) 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/filters/ControllerRequestsLoggingFilter.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.filters 21 | 22 | import org.springframework.web.filter.AbstractRequestLoggingFilter 23 | import javax.servlet.http.HttpServletRequest 24 | 25 | class ControllerRequestsLoggingFilter : AbstractRequestLoggingFilter() { 26 | 27 | init { 28 | isIncludeClientInfo = true 29 | setAfterMessagePrefix("[REQ] ") 30 | } 31 | 32 | override fun shouldLog(request: HttpServletRequest): Boolean { 33 | return logger.isInfoEnabled && 34 | !request.requestURI.orEmpty().endsWith(".css") && 35 | !request.requestURI.orEmpty().endsWith(".js") && 36 | !request.requestURI.orEmpty().endsWith(".ico") && 37 | !request.requestURI.orEmpty().endsWith(".png"); 38 | } 39 | 40 | override fun beforeRequest(request: HttpServletRequest, message: String) { 41 | // do nothing 42 | } 43 | 44 | override fun afterRequest(request: HttpServletRequest, message: String) { 45 | logger.info(message) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/forms/AdminDashboardForm.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.forms 21 | 22 | /** 23 | * Represents the contents of a form used to perform Administrative tasks over [Submission]s (for example, interrupt 24 | * pending submissions). 25 | */ 26 | data class AdminDashboardForm( 27 | val showMavenOutput: Boolean, 28 | val asyncTimeout: Int, 29 | val threadPoolSize: Int 30 | ) 31 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/forms/UploadForm.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.forms 21 | 22 | 23 | data class UploadForm(var assignmentId: String? = null) 24 | 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/lti/WellKnownKeysController.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2022 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.lti 21 | 22 | import edu.uoc.elc.lti.tool.Key 23 | import edu.uoc.elc.spring.lti.jkws.JwksKey 24 | import edu.uoc.elc.spring.lti.jkws.JwksKeyFactory 25 | import edu.uoc.elc.spring.lti.tool.registration.RegistrationService 26 | import org.springframework.beans.factory.annotation.Qualifier 27 | import org.springframework.context.annotation.Profile 28 | import org.springframework.web.bind.annotation.GetMapping 29 | import org.springframework.web.bind.annotation.RestController 30 | 31 | @Profile("lti") 32 | @RestController 33 | class WellKnownKeysController(@Qualifier("dpRegistrationService") 34 | val registrationService: RegistrationService) { 35 | 36 | @GetMapping("/.well-known/jwks.json") 37 | fun getKeys(): List { 38 | val keys = registrationService.allKeys 39 | val keyFactory = JwksKeyFactory() 40 | return keys.map { key: Key? -> keyFactory.from(key) } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AssigneeRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.Assignee 25 | 26 | /** 27 | * Provides functions to query [Assignee]s that have been persisted in the database. 28 | */ 29 | interface AssigneeRepository : JpaRepository { 30 | 31 | fun existsByAssignmentId(assignmentId: String): Boolean 32 | fun existsByAssignmentIdAndAuthorUserId(assignmentId: String, authorUserId: String): Boolean 33 | fun findByAssignmentIdOrderByAuthorUserId(assignmentId: String): List 34 | fun findByAuthorUserId(authorUserId: String): List 35 | fun findByAssignmentId(assignmentId: String): List 36 | 37 | @Transactional 38 | fun deleteByAssignmentId(assignmentId: String): List 39 | 40 | @Transactional 41 | fun deleteByAuthorUserId(authorUserId: String): List 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AssignmentACLRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.Assignee 25 | import org.dropProject.dao.AssignmentACL 26 | 27 | /** 28 | * Provides functions to query [AssignmentACL]s that have been persisted in the database. 29 | */ 30 | interface AssignmentACLRepository : JpaRepository { 31 | 32 | fun existsByAssignmentIdAndUserId(assignmentId: String, userId: String): Boolean 33 | fun findByAssignmentId(assignmentId: String): List 34 | fun findByUserId(userId: String): List 35 | 36 | @Transactional 37 | fun deleteByAssignmentId(assignmentId: String): List 38 | } 39 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AssignmentReportRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.Assignee 25 | import org.dropProject.dao.AssignmentReport 26 | 27 | /** 28 | * Provides functions to query [AssignmentReport]s that have been persisted in the database. 29 | */ 30 | interface AssignmentReportRepository : JpaRepository { 31 | 32 | fun findByAssignmentId(assignmentId: String): List 33 | 34 | @Transactional 35 | fun deleteByAssignmentId(assignmentId: String): List 36 | } 37 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AssignmentRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.dropProject.dao.* 23 | import org.springframework.data.jpa.repository.JpaRepository 24 | import org.springframework.data.jpa.repository.EntityGraph 25 | 26 | /** 27 | * Provides functions to query [Assignment]s that have been persisted in the database. 28 | */ 29 | interface AssignmentRepository : JpaRepository { 30 | fun findByOwnerUserId(ownerUserId: String): List 31 | fun findByGitRepositoryFolder(gitRepositoryFolder: String): Assignment? 32 | fun findAllByActiveIsAndVisibility(active: Boolean, visibility: AssignmentVisibility): List 33 | fun findAllByVisibility(visibility: AssignmentVisibility): List 34 | fun findAllByNumSubmissions(numSubmissions: Int): List 35 | } 36 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AssignmentTagRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.Assignee 25 | import org.dropProject.dao.AssignmentACL 26 | import org.dropProject.dao.AssignmentTag 27 | 28 | /** 29 | * Provides functions to query [AssignmentTag]s that have been persisted in the database. 30 | */ 31 | interface AssignmentTagRepository : JpaRepository { 32 | fun findByName(name: String): AssignmentTag? 33 | } 34 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AssignmentTagsRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.dropProject.dao.* 23 | import org.springframework.data.jpa.repository.JpaRepository 24 | import org.springframework.transaction.annotation.Transactional 25 | 26 | /** 27 | * Provides functions to query [AssignmentTags]s that have been persisted in the database. 28 | */ 29 | interface AssignmentTagsRepository : JpaRepository { 30 | fun findByAssignmentId(assignmentId: String) : List 31 | fun findByTagId(tagId: Long) : List 32 | fun removeAllByTagId(tagId: Long): Int 33 | fun countAssignmentTagsByTagId(tagId: Long): Long 34 | } 35 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AssignmentTestMethodRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.Assignee 25 | import org.dropProject.dao.AssignmentTestMethod 26 | 27 | /** 28 | * Provides functions to query [AssignmentTestMethodRepository] objects that have been persisted in the database. 29 | */ 30 | interface AssignmentTestMethodRepository : JpaRepository { 31 | 32 | fun findByAssignmentId(assignmentId: String): List 33 | 34 | @Transactional 35 | fun deleteAllByAssignmentId(assignmentId: String) 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/AuthorRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.dropProject.dao.Author 24 | import org.dropProject.dao.ProjectGroup 25 | import org.dropProject.dao.Submission 26 | import org.springframework.data.jpa.repository.Query 27 | 28 | /** 29 | * Provides functions to query [Author]s that have been persisted in the database. 30 | */ 31 | interface AuthorRepository : JpaRepository { 32 | 33 | /** 34 | * Gets all the authors associated with this userId. Notice that the author 35 | * includes the group on which he belongs. If the same student belongs to 36 | * several groups, this function will return several results. 37 | */ 38 | fun findByUserId(userId: String) : List? 39 | 40 | @Query("SELECT a1.group FROM Author a1, Author a2 WHERE a1.userId = ?1 and a2.userId = ?2 and a1.group = a2.group") 41 | fun getGroupId(userId1: String, userId2: String): ProjectGroup? 42 | } 43 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/BuildReportRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.dropProject.dao.BuildReport 24 | 25 | interface BuildReportRepository : JpaRepository { 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/JUnitReportRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.JUnitReport 25 | import org.dropProject.dao.ProjectGroup 26 | import org.dropProject.dao.Submission 27 | import java.util.* 28 | 29 | /** 30 | * Provides functions to query [JUnitReport]s that have been persisted in the database. 31 | */ 32 | interface JUnitReportRepository : JpaRepository { 33 | 34 | fun findBySubmissionId(submissionId: Long) : List? 35 | 36 | @Transactional 37 | fun deleteBySubmissionId(submissionId: Long) 38 | } 39 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/JacocoReportRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.JacocoReport 25 | 26 | /** 27 | * Provides functions to query [JacocoReport]s that have been persisted in the database. 28 | */ 29 | interface JacocoReportRepository : JpaRepository { 30 | 31 | fun findBySubmissionId(submissionId: Long) : List? 32 | 33 | @Transactional 34 | fun deleteBySubmissionId(submissionId: Long) 35 | } 36 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/PersonalTokenRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.Assignee 25 | import org.dropProject.dao.PersonalToken 26 | import org.dropProject.dao.TokenStatus 27 | 28 | /** 29 | * Provides functions to query [PersonalToken]s 30 | */ 31 | interface PersonalTokenRepository : JpaRepository { 32 | 33 | fun getFirstByUserIdAndStatusOrderByStatusDateDesc(userId: String, status: TokenStatus) : PersonalToken? 34 | fun getByPersonalToken(personalToken: String) : PersonalToken? 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/ProjectGroupRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.data.jpa.repository.Query 24 | import org.springframework.data.repository.query.Param 25 | import org.dropProject.dao.ProjectGroup 26 | import org.dropProject.dao.Submission 27 | 28 | /** 29 | * Provides functions to query [ProjectGroup]s that have been persisted in the database. 30 | */ 31 | interface ProjectGroupRepository : JpaRepository { 32 | 33 | @Query("SELECT p FROM ProjectGroup p JOIN p.authors authors WHERE authors.userId = ?1") 34 | fun getGroupsForAuthor(authorNumber: String) : List 35 | } 36 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/ProjectGroupRestrictionsRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.dropProject.dao.ProjectGroupRestrictions 23 | import org.springframework.data.jpa.repository.JpaRepository 24 | 25 | /** 26 | * Provides functions to query [ProjectGroupRestrictions]s that have been persisted in the database. 27 | */ 28 | interface ProjectGroupRestrictionsRepository : JpaRepository 29 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/repository/SubmissionGitInfoRepository.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.repository 21 | 22 | import org.springframework.data.jpa.repository.JpaRepository 23 | import org.springframework.transaction.annotation.Transactional 24 | import org.dropProject.dao.JUnitReport 25 | import org.dropProject.dao.ProjectGroup 26 | import org.dropProject.dao.Submission 27 | import org.dropProject.dao.SubmissionGitInfo 28 | import java.util.* 29 | 30 | /** 31 | * Provides functions to query [SubmissionGitInfo]s that have been persisted in the database. 32 | */ 33 | interface SubmissionGitInfoRepository : JpaRepository { 34 | 35 | fun getBySubmissionId(submissionId: Long) : SubmissionGitInfo? 36 | 37 | @Transactional 38 | fun deleteBySubmissionId(submissionId: Long) 39 | } 40 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/security/PersonalToken.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.security 21 | 22 | import org.springframework.security.authentication.AbstractAuthenticationToken 23 | 24 | 25 | class PersonalToken(val token: String, val detailsParam: Any) : AbstractAuthenticationToken(emptyList()) { 26 | 27 | init { 28 | details = detailsParam 29 | } 30 | 31 | override fun getCredentials(): Any? { 32 | return null 33 | } 34 | 35 | override fun getPrincipal(): String { 36 | return token 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/storage/StorageException.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.storage 21 | 22 | class StorageException(message: String?, cause: Throwable? = null) : RuntimeException(message, cause) 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/dropProject/storage/StorageService.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.storage 21 | 22 | import org.dropProject.dao.Submission 23 | import org.springframework.web.multipart.MultipartFile 24 | import java.io.File 25 | 26 | interface StorageService { 27 | 28 | fun init() 29 | 30 | fun rootFolder() : File 31 | 32 | fun store(file: MultipartFile, assignmentId: String): File? 33 | 34 | fun retrieveProjectFolder(submission: Submission): File? 35 | } 36 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/build-info.properties: -------------------------------------------------------------------------------- 1 | # this will be automatically updated by mvn compile 2 | build.time=2019-02-26T15\:58\:53+0000 3 | build.artifact=drop-project 4 | build.group=org.dropProject 5 | build.name=DropProject 6 | build.version=0.0.0 7 | -------------------------------------------------------------------------------- /src/main/resources/drop-project-mysql.properties: -------------------------------------------------------------------------------- 1 | # MySQL configuration 2 | # This file will only take effect when the "mysql" spring profile is active 3 | 4 | #spring.datasource.url=jdbc:mysql://localhost:3306/dp?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC 5 | spring.datasource.url=${DB_URL} 6 | 7 | spring.datasource.username=${DB_USERNAME:dp} 8 | spring.datasource.password=${DB_PASSWORD:dp123} 9 | spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect 10 | spring.jpa.properties.hibernate.dialect.storage_engine=innodb 11 | spring.jpa.hibernate.ddl-auto=update 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/drop-project-oauth2.properties: -------------------------------------------------------------------------------- 1 | # example github oauth configuration (this will only be effective with profile "oauth2") 2 | # go to https://github.com/settings/developers > New OAuth App 3 | # - Application name: Drop Project 4 | # - Homepage URL: http://localhost:8080 (or the server where you installed) 5 | # - Authorization callback URL: http://localhost:8080/login/oauth2/code/github 6 | # Github will then generate a client id and a client secret, which you should copy to the properties below 7 | spring.security.oauth2.client.registration.github.client-id=xxx 8 | spring.security.oauth2.client.registration.github.client-secret=xxxxx -------------------------------------------------------------------------------- /src/main/resources/static/access-denied.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Access denied 6 | 7 | 8 |

Sorry, you do not have permission to view this page.

9 | 10 | Click here to go back to the Homepage. 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/static/css/bootstrap-tagsinput.css: -------------------------------------------------------------------------------- 1 | .bootstrap-tagsinput { 2 | background-color: #fff; 3 | border: 1px solid #ccc; 4 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); 5 | display: inline-block; 6 | padding: 4px 6px; 7 | color: #555; 8 | vertical-align: middle; 9 | border-radius: 4px; 10 | max-width: 100%; 11 | line-height: 22px; 12 | cursor: text; 13 | } 14 | .bootstrap-tagsinput input { 15 | border: none; 16 | box-shadow: none; 17 | outline: none; 18 | background-color: transparent; 19 | padding: 0 6px; 20 | margin: 0; 21 | width: auto; 22 | max-width: inherit; 23 | } 24 | .bootstrap-tagsinput.form-control input::-moz-placeholder { 25 | color: #777; 26 | opacity: 1; 27 | } 28 | .bootstrap-tagsinput.form-control input:-ms-input-placeholder { 29 | color: #777; 30 | } 31 | .bootstrap-tagsinput.form-control input::-webkit-input-placeholder { 32 | color: #777; 33 | } 34 | .bootstrap-tagsinput input:focus { 35 | border: none; 36 | box-shadow: none; 37 | } 38 | .bootstrap-tagsinput .tag { 39 | margin-right: 2px; 40 | color: white; 41 | } 42 | .bootstrap-tagsinput .tag [data-role="remove"] { 43 | margin-left: 8px; 44 | cursor: pointer; 45 | } 46 | .bootstrap-tagsinput .tag [data-role="remove"]:after { 47 | content: "x"; 48 | padding: 0px 2px; 49 | } 50 | .bootstrap-tagsinput .tag [data-role="remove"]:hover { 51 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); 52 | } 53 | .bootstrap-tagsinput .tag [data-role="remove"]:hover:active { 54 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); 55 | } 56 | -------------------------------------------------------------------------------- /src/main/resources/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/favicon.ico -------------------------------------------------------------------------------- /src/main/resources/static/img/dp_small_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/dp_small_logo.png -------------------------------------------------------------------------------- /src/main/resources/static/img/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/error.png -------------------------------------------------------------------------------- /src/main/resources/static/img/github-clone-ssh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/github-clone-ssh.png -------------------------------------------------------------------------------- /src/main/resources/static/img/github-deploy-keys-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/github-deploy-keys-2.png -------------------------------------------------------------------------------- /src/main/resources/static/img/github-deploy-keys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/github-deploy-keys.png -------------------------------------------------------------------------------- /src/main/resources/static/img/iconfinder_cat_sleep_185528.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/iconfinder_cat_sleep_185528.png -------------------------------------------------------------------------------- /src/main/resources/static/img/if-information_2867914.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/if-information_2867914.png -------------------------------------------------------------------------------- /src/main/resources/static/img/if_sign-check_299110-half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/if_sign-check_299110-half.png -------------------------------------------------------------------------------- /src/main/resources/static/img/if_sign-check_299110.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/if_sign-check_299110.png -------------------------------------------------------------------------------- /src/main/resources/static/img/if_sign-error_299045.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/if_sign-error_299045.png -------------------------------------------------------------------------------- /src/main/resources/static/img/if_sign-question-mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/if_sign-question-mark.png -------------------------------------------------------------------------------- /src/main/resources/static/img/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/info.png -------------------------------------------------------------------------------- /src/main/resources/static/img/setting_environment_variables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/setting_environment_variables.png -------------------------------------------------------------------------------- /src/main/resources/static/img/several-users.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/several-users.png -------------------------------------------------------------------------------- /src/main/resources/static/img/single-user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/single-user.png -------------------------------------------------------------------------------- /src/main/resources/static/img/trophy_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/trophy_16.png -------------------------------------------------------------------------------- /src/main/resources/static/img/trophy_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/trophy_24.png -------------------------------------------------------------------------------- /src/main/resources/static/img/trophy_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/trophy_32.png -------------------------------------------------------------------------------- /src/main/resources/static/img/trophy_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/trophy_64.png -------------------------------------------------------------------------------- /src/main/resources/static/img/warn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/main/resources/static/img/warn.png -------------------------------------------------------------------------------- /src/main/resources/static/js/copyToClipboard.js: -------------------------------------------------------------------------------- 1 | // This function acts on two scenarios, copying the token 2 | // and copying the assigment id that's in the url path 3 | // when targetToCopy is null, it means we're on the assigment id scenario 4 | async function copyToClipboard(buttonContent, targetToCopy=null) { 5 | let target 6 | if (targetToCopy==null){ 7 | const path = window.location.pathname; // current path 8 | const parts = path.split('/'); 9 | target = parts[parts.length - 1]; // last part of the path -> assignment id 10 | } 11 | else { 12 | target = document.getElementById(targetToCopy).textContent; 13 | } 14 | const buttonText = document.getElementById(buttonContent); 15 | const button = buttonText.parentElement 16 | const buttonTextContent = buttonText.textContent 17 | 18 | try { 19 | await navigator.clipboard.writeText(target) 20 | buttonText.textContent = 'Copied!' 21 | button.classList.add("disabled") 22 | setTimeout(() => { 23 | buttonText.textContent = buttonTextContent; 24 | button.classList.remove("disabled") 25 | }, 2000) 26 | } catch (error) { 27 | console.error('Erro ao copiar', error) 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/resources/static/js/dropproject.js: -------------------------------------------------------------------------------- 1 | $( document ).ready(function() { 2 | var gResponse; 3 | 4 | if (typeof Dropzone !== 'undefined') { 5 | 6 | Dropzone.options.dpDropzone = { 7 | paramName: "file", // The name that will be used to transfer the file 8 | maxFilesize: 1, // MB 9 | acceptedFiles: ".zip", 10 | parallelUploads: 1, 11 | dictDefaultMessage: dropzonePlaceholder, 12 | dictInvalidFileType: invalidFileType, 13 | dictFileTooBig: fileTooBig, 14 | init: function () { 15 | this.on("success", function (file) { 16 | gResponse = $.trim(file.xhr.response); 17 | var jsonResponse = JSON.parse($.trim(file.xhr.response)); 18 | window.location.replace(context + "buildReport/" + jsonResponse.submissionId); 19 | }); 20 | this.on('error', function (file, errorMessage, xhr) { 21 | if (errorMessage !== null && typeof errorMessage === 'string' && 22 | (errorMessage.indexOf('401') !== -1 || errorMessage.indexOf('403') !== -1)) { // lost session 23 | location.reload(true); 24 | } else if (errorMessage !== null && errorMessage.error !== undefined) { 25 | // alert(errorMessage.error); 26 | } 27 | 28 | }); 29 | this.on("addedfile", function () { 30 | if (this.files[1] != null) { 31 | this.removeFile(this.files[0]); 32 | } 33 | }); 34 | } 35 | }; 36 | }; 37 | }); 38 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin-pending-submissions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |
12 | 13 |

Pending submissions

14 | 15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 | 23 |

 

24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 47 | 48 | 49 |
StudentsAssignmentSubmission DateStatusActions
43 |
44 | 45 |
46 |
50 | 51 |
52 | 53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin-tags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |
12 | 13 |

All tags

14 | 15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 41 | 42 | 43 |
TagUsage CountActions
Tag NameUsage Count 36 |
37 | 38 | 39 |
40 |
44 | 45 |
46 | 47 |
48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/main/resources/templates/assignments-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |
12 | 13 |

My Assignments

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 37 | 38 | 39 |
Assignment IDNameActions
29 | 30 | 31 | 32 |   33 | 34 | 35 | 36 |
40 | 41 |
42 | You don't have any assignments yet. 43 |
44 | 45 |
46 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/resources/templates/exception.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error 6 | 7 | 8 |

Error

9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 |
Date
Error
Status
Message
Exception
Trace 33 |

34 |         
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/templates/export-status.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |
12 | 13 |

Export status

14 | 15 |
16 | 17 | 18 |
19 |
20 | 21 |
22 | 23 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/resources/templates/setup-git.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |
12 | 13 |

Setup Git Authorization

14 |

Reconnect with Git

15 | 16 |
17 |
18 |
19 | 20 |

You have to authorize Drop Project to access

21 |

You have to reauthorize Drop Project to access . 22 | You may want to remove previous keys associated with this repository.

23 | 24 |

Go to the settings of your repository and add this public key to the list of access/deploy keys:

25 |
26 |

27 |     
28 | 29 |
30 |
31 | 34 |
35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/resources/templates/student-history-form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 |
11 |
12 |
13 |
14 | 15 |

Student History

16 | 17 |
18 |
19 | 20 |
21 | 28 |
29 |
30 | 31 | 32 |
33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/templatesXML/download-all-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | 9 | 1.0-SNAPSHOT 10 | pom 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/users.csv: -------------------------------------------------------------------------------- 1 | username;password;roles 2 | student1;123;STUDENT 3 | teacher1;123;TEACHER 4 | admin;123;TEACHER,DROP_PROJECT_ADMIN -------------------------------------------------------------------------------- /src/orchid/resources/config.yml: -------------------------------------------------------------------------------- 1 | site: 2 | baseUrl: 'https://drop-project-edu.github.io/drop-project' 3 | about: 4 | siteName: Drop Project 5 | siteDescription: 6 | 7 | Editorial: 8 | primaryColor: '#DE9149' 9 | social: 10 | github: 'drop-project-edu/drop-project' 11 | menu: 12 | - type: 'separator' 13 | title: 'Wiki' 14 | - type: 'wiki' 15 | - type: 'separator' 16 | title: 'API Docs' 17 | - type: 'kotlindocPackages' 18 | - type: 'kotlindocClasses' 19 | - type: 'sourcedocPages' 20 | moduleType: 'kotlindoc' 21 | node: 'classes' 22 | asSubmenu: true 23 | submenuTitle: 'Classes' 24 | - type: 'sourcedocPages' 25 | moduleType: 'kotlindoc' 26 | node: 'packages' 27 | asSubmenu: true 28 | submenuTitle: 'Packages' 29 | 30 | kotlindoc: 31 | sourceDirs: './../../../src/main/kotlin' 32 | pages: 33 | menu: 34 | - type: "kotlindocClassLinks" 35 | includeItems: true 36 | 37 | 38 | services: 39 | publications: 40 | stages: 41 | ghPages: 42 | - type: 'githubPages' 43 | username: 'brunompc' 44 | repo: 'drop-project' 45 | -------------------------------------------------------------------------------- /src/orchid/resources/wiki/assignment-creation.md: -------------------------------------------------------------------------------- 1 | This tutorial explains how a teacher can create a new Assignment in Drop Project. 2 | 3 | The first step is to create a git repository with the correct structure. The easiest way to do this is to clone one of the the following repositories: 4 | 5 | https://github.com/drop-project-edu/sampleJavaAssignment 6 | 7 | https://github.com/drop-project-edu/sampleKotlinAssignment 8 | 9 | ## Structure 10 | 11 | The structure of the repository must be the following: 12 | 13 | + assignment 14 | |--- pom.xml (includes the checkstyle and junit plugins) 15 | |--- checkstyle.xml (the rules to validate the code style, e.g., variables must start with lowercase) 16 | |--- instructions.html (optional, the assignment instructions) 17 | |--- src 18 | |------ main 19 | |--------- ... (here goes the reference implementation, in maven structure) 20 | |------ test 21 | |--------- ... (JUnit tests that will validate students' submissions) 22 | 23 | ## Assignment creation 24 | 25 | After the creation of the repository, the following steps should be followed in the Drop Project web-application: 26 | 27 | 1. Login with your teacher account 28 | 2. From the top menu, open the `Manage Assignments` page 29 | 3. Press the `Create Assignment` blue button that appears in the bottom of the page 30 | 4. Fill in the form - below each field there is a short description of its purpose 31 | 32 | ## Tests 33 | 34 | Public tests should be defined in a file whose name should be prefixed with the `TestTeacher`. For example, the tests 35 | for a class `Person` should be defined in a file called `TestTeacherPerson`. 36 | 37 | Private (or Hidden) tests should be defined in a file whose name should be prefixed with `TestTeacherHidden`. For example, `TestTeacherHiddenPerson`. 38 | 39 | It is possible to have multiple test public and private (hidden) test classes. 40 | 41 | For some ideas on how to design your tests, check our [test tips](test-tips.md) page. 42 | -------------------------------------------------------------------------------- /src/orchid/resources/wiki/code-folder-structure.md: -------------------------------------------------------------------------------- 1 | Drop Project's code itself follows the Maven folder structure. 2 | 3 | The following figure represents DP's folder/directory structure. Below the figure, a description of 4 | the contents of each sub-folder is given. 5 | 6 | . src 7 | +-- main 8 | +-- kotlin 9 | +---- org.dropProject 10 | +------ controllers 11 | +------ dao 12 | +------ data 13 | +------ extensions 14 | +------ filters 15 | +------ repositories 16 | +------ security 17 | +------ services 18 | +-- test 19 | +---- kotlin 20 | +---- org.dropProject 21 | +------ controllers 22 | +------ dao 23 | +------ data 24 | +------ ... 25 | +------ other test folders 26 | 27 | #### src/main/kotlin/drop-project/controllers 28 | Contains code related with handling HTTP requests. 29 | 30 | #### src/main/kotlin/drop-project/dao 31 | Contains the Data Access Object classes. This is where you will find the Assignment and Submission classes. 32 | 33 | #### src/main/kotlin/drop-project/data 34 | Contains auxiliary classes used in session. 35 | 36 | #### src/main/kotlin/drop-project/extensions 37 | Code that extends certain classes of the Java API (e.g. Date). 38 | 39 | #### src/main/kotlin/drop-project/filters 40 | Classes that intercept and pre-process HTTP requests. 41 | 42 | #### src/main/kotlin/drop-project/repositories 43 | Code that defines functions/interfaces to find persisted objects. 44 | 45 | #### src/main/kotlin/drop-project/security 46 | Contains access control definitions. 47 | 48 | #### src/main/kotlin/drop-project/services 49 | Business logic code. 50 | 51 | #### src/test/kotlin/drop-project/controllers 52 | Contains tests for controllers. 53 | 54 | #### src/test/kotlin/drop-project/dao 55 | Contains tests for Data Access Object classes. 56 | 57 | #### src/test/kotlin/drop-project/data 58 | Contains tests for the auxiliary classes . 59 | 60 | #### src/test/kotlin/drop-project/... 61 | Tests for other packages. 62 | -------------------------------------------------------------------------------- /src/orchid/resources/wiki/summary.md: -------------------------------------------------------------------------------- 1 | - [Concepts](concepts.md) 2 | - [Assignment Creation Tutorial](assignment-creation.md) 3 | - [Source code structure](code-folder-structure.md) 4 | - [Test creation tips](test-tips.md) -------------------------------------------------------------------------------- /src/test/kotlin/org/dropProject/dao/TestAuthor.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import junit.framework.TestCase.assertEquals 23 | import org.junit.Test 24 | 25 | class TestAuthor { 26 | 27 | @Test 28 | fun testAuthorConstructor() { 29 | var projGroup = ProjectGroup(1) 30 | var author = Author("BC", "1983", projGroup) 31 | assertEquals("BC", author.name) 32 | assertEquals("1983", author.userId) 33 | assertEquals(projGroup, author.group) 34 | } 35 | 36 | @Test 37 | fun testAuthorWithSpacesInName() { 38 | var author = Author(0, " Pedro ", "1234") 39 | assertEquals("Pedro", author.name) 40 | assertEquals("1234", author.userId) 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/test/kotlin/org/dropProject/dao/TestProjectGroup.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.dao 21 | 22 | import junit.framework.TestCase.* 23 | import org.junit.Test 24 | 25 | class TestProjectGroup { 26 | 27 | @Test 28 | fun projectGroup() { 29 | var projectGroup = ProjectGroup(1) 30 | projectGroup.authors.add(Author(1, "BC", "1983")) 31 | assertTrue(projectGroup.contains("1983")) 32 | assertFalse(projectGroup.contains("1143")) 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/test/kotlin/org/dropProject/data/TestMavenResult.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import junit.framework.TestCase.assertFalse 23 | import junit.framework.TestCase.assertEquals 24 | import junit.framework.TestCase.assertTrue 25 | import org.junit.Test 26 | 27 | class TestMavenResult { 28 | @Test 29 | fun testMavenResult() { 30 | val outputLines = mutableListOf() 31 | var mvnResult = MavenResult(100, outputLines, true) 32 | assertTrue(mvnResult.expiredByTimeout) 33 | assertEquals(100, mvnResult.resultCode) 34 | 35 | var mvnResult2 = MavenResult(200, outputLines, false) 36 | assertFalse(mvnResult2.expiredByTimeout) 37 | assertEquals(200, mvnResult2.resultCode) 38 | 39 | mvnResult2.expiredByTimeout = true 40 | assertTrue(mvnResult2.expiredByTimeout) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/kotlin/org/dropProject/data/TestProjectGroup.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2021 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropProject.data 21 | 22 | import junit.framework.TestCase.assertEquals 23 | import org.dropProject.dao.Author 24 | import org.dropProject.dao.ProjectGroup 25 | import org.junit.Test 26 | 27 | class TestProjectGroup { 28 | 29 | @Test 30 | fun testAssignmentStatistics() { 31 | 32 | val pGroup1 = ProjectGroup(1) 33 | pGroup1.authors.add(Author(1, "BC", "1983")) 34 | 35 | val pGroup2 = ProjectGroup(2) 36 | pGroup2.authors.add(Author(2, "Vader, D. Vader", "42")) 37 | 38 | val projGroups = mutableListOf(pGroup1, pGroup2) 39 | val failedTestNames = mutableListOf("test001", "test002", "test003") 40 | val gpg = GroupedProjectGroups(projGroups, failedTestNames) 41 | 42 | assertEquals(2, gpg.getGroupIDs().size) 43 | assert(gpg.getGroupIDs().contains(1)) 44 | assert(gpg.getGroupIDs().contains(2)) 45 | assertEquals(3, gpg.showNrOfFailedTests()) 46 | assertEquals(2, gpg.getGroupMembers().size) 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/test/resources/drop-project-test.properties: -------------------------------------------------------------------------------- 1 | # Sample DP configuration for unit tests 2 | 3 | # folders used by DP 4 | mavenizedProjects.rootLocation=mavenized-projects-test 5 | storage.rootLocation=test-submissions 6 | assignments.rootLocation=src/test/sampleAssignments 7 | 8 | # for tests, it is useful the keep the original project folder 9 | delete.original.projectFolder= false 10 | 11 | # maven properties 12 | dropProject.maven.home=${DP_M2_HOME:/opt/homebrew/Cellar/maven/3.9.9/libexec} 13 | dropProject.maven.repository=${DP_MVN_REPO:/Users/pedroalves/.m2/repository} 14 | 15 | dp.config.location=${DP_CONFIG_LOCATION:src/main/resources/config} 16 | 17 | # logging properties 18 | spring.main.banner-mode=off 19 | spring.output.ansi.enabled=ALWAYS 20 | logging.pattern.console=[%clr(%-5p)] [%clr(%d{yy-MM-dd HH:mm:ss}){blue}] %clr(%logger{36}){blue} %clr(:){red} %clr(%m){faint}%n 21 | logging.level.root=INFO 22 | logging.level.org.dropProject=INFO 23 | logging.level.org.dropProject.InMemoryUserDetailsManagerFactory=ERROR 24 | logging.level.org.dropProject.services=ERROR 25 | logging.level.org.dropProject.filters=INFO 26 | logging.level.org.dropProject.controllers=ERROR 27 | logging.level.org.quartz=WARN 28 | logging.level.org.hibernate=WARN 29 | logging.level.com.zaxxer=WARN 30 | logging.level.org.springframework=WARN 31 | logging.level.org.springframework.web.filter.ControllerRequestsLoggingFilter=INFO 32 | spring.jpa.show-sql=false 33 | 34 | # configuration for H2 embedded in-memory database 35 | spring.datasource.url=jdbc:h2:mem:test;MODE=LEGACY 36 | 37 | # this was added after migrating to spring boot 2, so that generated id's would remain the same 38 | spring.jpa.hibernate.use-new-id-generator-mappings=false 39 | 40 | # this is needed to properly fetch columns from oneToMany relations 41 | spring.jpa.open-in-view=false 42 | 43 | # disable quartz scheduler during tests to speedup execution 44 | spring.quartz.auto-startup=false 45 | -------------------------------------------------------------------------------- /src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/sampleAUTHORS_TXT/with_extra_empty_line.txt: -------------------------------------------------------------------------------- 1 | a21700000;John Doe 2 | 3 | -------------------------------------------------------------------------------- /src/test/sampleAUTHORS_TXT/with_spaces.txt: -------------------------------------------------------------------------------- 1 | a21700000 ; John Doe -------------------------------------------------------------------------------- /src/test/sampleAUTHORS_TXT/without_id.txt: -------------------------------------------------------------------------------- 1 | a22209738;Rodrigo Aguiar 2 | ;Diogo Baltazar -------------------------------------------------------------------------------- /src/test/sampleAssignments/sampleJavaProject/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | target 3 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/sampleJavaProject/README.md: -------------------------------------------------------------------------------- 1 | # Sample Java assignment for Drop Project 2 | 3 | This is a sample assignment skeleton, to be used in Drop Project. -------------------------------------------------------------------------------- /src/test/sampleAssignments/sampleJavaProject/instructions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

Sample Java Assignment

5 |

This is just a very simple Java assignment just to experiment with Drop Project

6 |

The source of this assignment is available on 7 | https://github.com/palves-ulht/sampleJavaAssignment 8 |

9 | 10 |

Instructions

11 |
    12 |
  • 13 |

    Create a Java project in your IDE with the structure depicted at the end of this page.

    14 |
  • 15 |
  • 16 |

    Within your Main class, implement a static function to calculate the 17 | maximum value on an array of integers. This function must have the following signature:
    18 | static int findMax(int[] numbers) 19 |

  • 20 |
  • 21 |

    Create a zip file of your project and drop it on the area above these instructions. 22 | In a few seconds, Drop Project will give you a report with some metrics about your project. 23 |
    If you don't feel like coding this stuff, you can grab a pre-built submission 24 | here. 25 |

    26 |
  • 27 |
28 | 29 |
-------------------------------------------------------------------------------- /src/test/sampleAssignments/sampleJavaProject/src/main/java/org/dropProject/samples/sampleJavaAssignment/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.samples.sampleJavaAssignment; 2 | 3 | public class Main { 4 | 5 | static int findMax(int[] numbers) { 6 | if (numbers == null) { 7 | throw new IllegalArgumentException("numbers cannot be null"); 8 | } 9 | 10 | int max = Integer.MIN_VALUE; 11 | for (int number : numbers) { 12 | if (number > max) { 13 | max = number; 14 | } 15 | } 16 | 17 | return max; 18 | } 19 | 20 | public static void main(String[] args) { 21 | int[] numbers = { 1, 3, 7, 4, 2 }; 22 | System.out.println("max = " + findMax(numbers)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/sampleJavaProject/src/test/java/org/dropProject/samples/sampleJavaAssignment/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.samples.sampleJavaAssignment; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | // in Drop Project, all test classes must begin with "Test" 8 | public class TestTeacherProject { 9 | 10 | @Test 11 | public void testFindMax() { 12 | assertEquals(7, Main.findMax(new int[] { 1, 2, 7, 4 })); 13 | } 14 | 15 | @Test(expected = IllegalArgumentException.class) 16 | public void testFindMaxWithNull() { 17 | Main.findMax(null); 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaComplexProj/README.md: -------------------------------------------------------------------------------- 1 | Este projecto corre testes dependendo do número de aluno. 2 | 3 | Para se conseguir testar no Intellij: 4 | 5 | - Caso se corra a partir do "Run Test", adicionar às VM Options: -DdropProject.currentUserId=p4997 6 | - Caso se corra a partir do Maven, adicionar ao Runner>VM Options: -Ddp.argLine="-DdropProject.currentUserId=p4997" -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaComplexProj/instructions.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

Projecto AED (2ª época)

4 |

Consultar enunciado no Moodle

5 |
6 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaComplexProj/src/main/java/pt/ulusofona/deisi/aedProj2020/Main.java: -------------------------------------------------------------------------------- 1 | package pt.ulusofona.deisi.aedProj2020; 2 | 3 | import java.io.*; 4 | import java.nio.channels.FileChannel; 5 | import java.time.LocalDate; 6 | import java.time.format.DateTimeFormatter; 7 | import java.util.*; 8 | import java.util.stream.Collectors; 9 | 10 | public class Main { 11 | 12 | public static void main(String[] args) { 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaComplexProj/src/test/java/pt/ulusofona/deisi/aedProj2020/TestTeacherHiddenPart1.java: -------------------------------------------------------------------------------- 1 | package pt.ulusofona.deisi.aedProj2020; 2 | 3 | import org.junit.AfterClass; 4 | import org.junit.BeforeClass; 5 | import org.junit.FixMethodOrder; 6 | import org.junit.Test; 7 | import org.junit.runners.MethodSorters; 8 | 9 | import java.io.BufferedWriter; 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.nio.file.Files; 13 | import java.nio.file.Paths; 14 | import java.util.stream.Stream; 15 | 16 | import static org.junit.Assert.assertArrayEquals; 17 | import static org.junit.Assert.assertEquals; 18 | 19 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) 20 | public class TestTeacherHiddenPart1 { 21 | 22 | @BeforeClass // this method only runs once, before all the tests 23 | public static void setup() throws IOException { 24 | 25 | } 26 | 27 | @AfterClass // this method only runs once, after all the tests 28 | public static void cleanup() { 29 | 30 | } 31 | 32 | @Test(timeout = 60000) 33 | public void test01CountIgnored() throws IOException { 34 | 35 | } 36 | 37 | @Test(timeout = 5000) 38 | public void test02CountIgnored2() throws IOException { 39 | 40 | } 41 | 42 | @Test(timeout = 5000) 43 | public void test03CountIgnoredWithQuotes() throws IOException { 44 | 45 | } 46 | 47 | @Test(timeout = 5000) 48 | public void test04GetMoviesActorYearWithQuotes() throws IOException { 49 | 50 | } 51 | 52 | // this must be the last test 53 | @Test(timeout = 5000) 54 | public void test99EmptyFile() throws IOException { 55 | 56 | } 57 | 58 | private static boolean filesAlreadyParsed = false; 59 | 60 | private static void parseFiles() throws IOException { 61 | if (!filesAlreadyParsed) { 62 | Main.parseFiles(); 63 | filesAlreadyParsed = true; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaComplexProj/src/test/java/pt/ulusofona/deisi/aedProj2020/TestTeacherHiddenPart2.java: -------------------------------------------------------------------------------- 1 | package pt.ulusofona.deisi.aedProj2020; 2 | 3 | import org.junit.*; 4 | import org.junit.runners.MethodSorters; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.util.stream.Stream; 9 | 10 | import java.util.List; 11 | import java.util.Arrays; 12 | 13 | import static org.junit.Assert.*; 14 | import static pt.ulusofona.deisi.aedProj2020.TestTeacherWithLargeFiles.runFor; 15 | 16 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) 17 | public class TestTeacherHiddenPart2 { 18 | 19 | @BeforeClass // this method only runs once, before all the tests 20 | public static void setup() throws IOException { 21 | 22 | } 23 | 24 | @AfterClass // this method only runs once, after all the tests 25 | public static void cleanup() { 26 | 27 | } 28 | 29 | @Ignore 30 | @Test(timeout = 60000) 31 | public void testXXGetMoviesActorYearWithQuotesInActorName() throws IOException { 32 | 33 | } 34 | 35 | @Test(timeout = 60000) 36 | public void test01ImparInsertDuplicateActor() throws IOException { 37 | 38 | } 39 | 40 | @Test(timeout = 60000) 41 | public void test02ParInsertDuplicateDirector() throws IOException { 42 | 43 | } 44 | 45 | @Test(timeout=1000) 46 | public void test03BogusQueryCodes() throws IOException { 47 | 48 | } 49 | 50 | /* 51 | @Test(timeout=1000) 52 | public void test04ParDirectorsWith3Names() throws IOException { 53 | 54 | 55 | } 56 | */ 57 | 58 | @Test(timeout=30000) 59 | public void test04ParDirectorsWith3Names() throws IOException { 60 | 61 | } 62 | 63 | @Test(timeout=1000) 64 | public void test04ImparActorsWith3Names() throws IOException { 65 | 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaComplexProj/src/test/java/pt/ulusofona/deisi/aedProj2020/TestTeacherWithSimpleFiles.java: -------------------------------------------------------------------------------- 1 | package pt.ulusofona.deisi.aedProj2020; 2 | 3 | import org.junit.After; 4 | import org.junit.Before; 5 | import org.junit.FixMethodOrder; 6 | import org.junit.Test; 7 | import org.junit.runners.MethodSorters; 8 | 9 | import java.io.BufferedWriter; 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.nio.file.Files; 13 | import java.nio.file.Paths; 14 | import java.util.List; 15 | 16 | import static org.junit.Assert.*; 17 | 18 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) 19 | public class TestTeacherWithSimpleFiles { 20 | 21 | @Before 22 | @After 23 | public void deleteAllFiles() { 24 | new File("deisi_movies.txt").delete(); 25 | new File("deisi_movie_votes.txt").delete(); 26 | new File("deisi_actors.txt").delete(); 27 | new File("deisi_directors.txt").delete(); 28 | new File("deisi_genres.txt").delete(); 29 | new File("deisi_genres_movies.txt").delete(); 30 | } 31 | 32 | @Test(timeout = 1000) 33 | public void test01ParseSimpleFile() throws IOException { 34 | 35 | 36 | 37 | } 38 | 39 | @Test(timeout = 1000) 40 | public void test02ParseFileWithSpaces() throws IOException { 41 | 42 | } 43 | 44 | @Test(timeout = 1000) 45 | public void test03ParseFileWithInvalidLines() throws IOException { 46 | 47 | 48 | } 49 | 50 | @Test(timeout = 1000) 51 | public void test04CountIgnoredLines() throws IOException { 52 | 53 | 54 | } 55 | 56 | private void generateInvalidFiles() throws IOException { 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaComplexProj/src/test/java/pt/ulusofona/deisi/aedProj2020/UtilsTeacher.java: -------------------------------------------------------------------------------- 1 | package pt.ulusofona.deisi.aedProj2020; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileOutputStream; 6 | import java.io.IOException; 7 | import java.nio.channels.FileChannel; 8 | 9 | public class UtilsTeacher { 10 | 11 | public static void copyFile(File sourceFile, File destFile) { 12 | try { 13 | if (!sourceFile.exists()) { 14 | return; 15 | } 16 | if (!destFile.exists()) { 17 | destFile.createNewFile(); 18 | } 19 | FileChannel source = null; 20 | FileChannel destination = null; 21 | source = new FileInputStream(sourceFile).getChannel(); 22 | destination = new FileOutputStream(destFile).getChannel(); 23 | if (source != null) { 24 | destination.transferFrom(source, 0, source.size()); 25 | } 26 | if (source != null) { 27 | source.close(); 28 | } 29 | destination.close(); 30 | } catch (IOException e) { 31 | throw new RuntimeException(e); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProj/public/test.txt: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProj/src/main/java/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | System.out.println("******************************"); 7 | System.out.println("******************************"); 8 | System.out.println("REFERENCE IMPLEMENTATION! THIS SHOULDN'T SHOW UP DURING A STUDENT SUBMISSION!"); 9 | System.out.println("******************************"); 10 | System.out.println("******************************"); 11 | return 3; 12 | } 13 | 14 | static int funcaoLentaParaTestar() { 15 | return 3; 16 | } 17 | 18 | static int funcaoQueRebenta() { 19 | return 3; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProj/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherHiddenProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherHiddenProject { 7 | 8 | @Test 9 | public void testFuncaoParaTestarQueNaoApareceAosAlunos() { 10 | assertEquals(3, Main.funcaoQueRebenta()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProj/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherProject { 7 | 8 | @Test(timeout=500) 9 | public void testFuncaoParaTestar() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | @Test 14 | public void testFuncaoLentaParaTestar() { 15 | assertEquals(3, Main.funcaoLentaParaTestar()); 16 | } 17 | 18 | // @Test 19 | public void testFuncaoIgnorada1() { 20 | 21 | } 22 | 23 | /* 24 | 25 | @Test 26 | public void testFuncaoIgnorada2() { 27 | 28 | } 29 | 30 | */ 31 | } 32 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProj2/src/test/java/org/dropProject/sampleAssignments/testProj/TestProject1.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | import java.security.*; 6 | 7 | public class TestProject1 { 8 | 9 | @Test 10 | public void testFuncaoParaTestar() { 11 | assertEquals(3, Main.funcaoParaTestar()); 12 | } 13 | 14 | @Test 15 | public void testFuncaoLentaParaTestar() { 16 | assertEquals(3, Main.funcaoLentaParaTestar()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProj2/src/test/java/org/dropProject/sampleAssignments/testProj/TestProject2.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestProject2 { 7 | 8 | @Test 9 | public void testFuncaoParaTestar() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | @Test 14 | public void testFuncaoLentaParaTestar() { 15 | assertEquals(3, Main.funcaoLentaParaTestar()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjJUnit5/src/main/java/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | System.out.println("******************************"); 7 | System.out.println("******************************"); 8 | System.out.println("REFERENCE IMPLEMENTATION! THIS SHOULDN'T SHOW UP DURING A STUDENT SUBMISSION!"); 9 | System.out.println("******************************"); 10 | System.out.println("******************************"); 11 | return 3; 12 | } 13 | 14 | static int funcaoLentaParaTestar() { 15 | return 3; 16 | } 17 | 18 | static int funcaoQueRebenta() { 19 | return 3; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjJUnit5/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherHiddenProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.junit.jupiter.api.Timeout; 5 | 6 | import static org.junit.jupiter.api.Assertions.assertEquals; 7 | 8 | @Timeout(1) 9 | public class TestTeacherHiddenProject { 10 | 11 | @Test 12 | public void testFuncaoParaTestarQueNaoApareceAosAlunos() { 13 | assertEquals(3, Main.funcaoQueRebenta()); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjJUnit5/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.junit.jupiter.api.Timeout; 5 | 6 | import static org.junit.jupiter.api.Assertions.assertEquals; 7 | 8 | @Timeout(1) 9 | public class TestTeacherProject { 10 | 11 | @Test 12 | public void testFuncaoParaTestar() { 13 | assertEquals(3, Main.funcaoParaTestar()); 14 | } 15 | 16 | @Test 17 | public void testFuncaoLentaParaTestar() { 18 | assertEquals(3, Main.funcaoLentaParaTestar()); 19 | } 20 | 21 | // @Test 22 | public void testFuncaoIgnorada1() { 23 | 24 | } 25 | 26 | /* 27 | 28 | @Test 29 | public void testFuncaoIgnorada2() { 30 | 31 | } 32 | 33 | */ 34 | } 35 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithCoverage/src/main/java/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | System.out.println("******************************"); 7 | System.out.println("******************************"); 8 | System.out.println("REFERENCE IMPLEMENTATION! THIS SHOULDN'T SHOW UP DURING A STUDENT SUBMISSION!"); 9 | System.out.println("******************************"); 10 | System.out.println("******************************"); 11 | return 3; 12 | } 13 | 14 | static int funcaoLentaParaTestar() { 15 | return 3; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithCoverage/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherHiddenProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherHiddenProject { 7 | 8 | @Test 9 | public void testFuncaoParaTestarQueNaoApareceAosAlunos() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithCoverage/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherProject { 7 | 8 | @Test 9 | public void testFuncaoParaTestar() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | @Test 14 | public void testFuncaoLentaParaTestar() { 15 | assertEquals(3, Main.funcaoLentaParaTestar()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithIgnoredTests/src/main/java/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | System.out.println("******************************"); 7 | System.out.println("******************************"); 8 | System.out.println("REFERENCE IMPLEMENTATION! THIS SHOULDN'T SHOW UP DURING A STUDENT SUBMISSION!"); 9 | System.out.println("******************************"); 10 | System.out.println("******************************"); 11 | return 3; 12 | } 13 | 14 | static int funcaoLentaParaTestar() { 15 | return 3; 16 | } 17 | 18 | static int funcaoQueRebenta() { 19 | return 3; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithIgnoredTests/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherHiddenProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherHiddenProject { 7 | 8 | @Test 9 | public void testFuncaoParaTestarQueNaoApareceAosAlunos() { 10 | assertEquals(3, Main.funcaoQueRebenta()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithIgnoredTests/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherProject { 7 | 8 | @Test(timeout=500) 9 | public void testFuncaoParaTestar() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | @Ignore 14 | @Test 15 | public void testFuncaoLentaParaTestar() { 16 | assertEquals(3, Main.funcaoLentaParaTestar()); 17 | } 18 | 19 | // @Test 20 | public void testFuncaoIgnorada1() { 21 | 22 | } 23 | 24 | /* 25 | 26 | @Test 27 | public void testFuncaoIgnorada2() { 28 | 29 | } 30 | 31 | */ 32 | } 33 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithUserIdNOK/src/main/java/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | System.out.println("******************************"); 7 | System.out.println("******************************"); 8 | System.out.println("REFERENCE IMPLEMENTATION! THIS SHOULDN'T SHOW UP DURING A STUDENT SUBMISSION!"); 9 | System.out.println("******************************"); 10 | System.out.println("******************************"); 11 | 12 | // for automatic tests with currentUserId 13 | System.out.println(">>>> currentUserId = [" + System.getProperty("dropProject.currentUserId") + "]"); 14 | 15 | return 3; 16 | } 17 | 18 | static int funcaoLentaParaTestar() { 19 | return 3; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithUserIdNOK/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherHiddenProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherHiddenProject { 7 | 8 | @Test 9 | public void testFuncaoParaTestarQueNaoApareceAosAlunos() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithUserIdNOK/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherProject { 7 | 8 | @Test 9 | public void testFuncaoParaTestar() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | @Test 14 | public void testFuncaoLentaParaTestar() { 15 | assertEquals(3, Main.funcaoLentaParaTestar()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithUserIdOK/src/main/java/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | System.out.println("******************************"); 7 | System.out.println("******************************"); 8 | System.out.println("REFERENCE IMPLEMENTATION! THIS SHOULDN'T SHOW UP DURING A STUDENT SUBMISSION!"); 9 | System.out.println("******************************"); 10 | System.out.println("******************************"); 11 | 12 | // for automatic tests with currentUserId 13 | System.out.println(">>>> currentUserId = [" + System.getProperty("dropProject.currentUserId") + "]"); 14 | 15 | return 3; 16 | } 17 | 18 | static int funcaoLentaParaTestar() { 19 | return 3; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithUserIdOK/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherHiddenProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherHiddenProject { 7 | 8 | @Test(timeout=1000) 9 | public void testFuncaoParaTestarQueNaoApareceAosAlunos() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithUserIdOK/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherProject { 7 | 8 | @Test(timeout=1000) 9 | public void testFuncaoParaTestar() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | @Test(timeout=1000) 14 | public void testFuncaoLentaParaTestar() { 15 | assertEquals(3, Main.funcaoLentaParaTestar()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithWrongCheckstyleVersion/src/main/java/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | System.out.println("******************************"); 7 | System.out.println("******************************"); 8 | System.out.println("REFERENCE IMPLEMENTATION! THIS SHOULDN'T SHOW UP DURING A STUDENT SUBMISSION!"); 9 | System.out.println("******************************"); 10 | System.out.println("******************************"); 11 | return 3; 12 | } 13 | 14 | static int funcaoLentaParaTestar() { 15 | return 3; 16 | } 17 | 18 | static int funcaoQueRebenta() { 19 | return 3; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithWrongCheckstyleVersion/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherHiddenProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherHiddenProject { 7 | 8 | @Test 9 | public void testFuncaoParaTestarQueNaoApareceAosAlunos() { 10 | assertEquals(3, Main.funcaoQueRebenta()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testJavaProjWithWrongCheckstyleVersion/src/test/java/org/dropProject/sampleAssignments/testProj/TestTeacherProject.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class TestTeacherProject { 7 | 8 | @Test(timeout=500) 9 | public void testFuncaoParaTestar() { 10 | assertEquals(3, Main.funcaoParaTestar()); 11 | } 12 | 13 | @Test 14 | public void testFuncaoLentaParaTestar() { 15 | assertEquals(3, Main.funcaoLentaParaTestar()); 16 | } 17 | 18 | // @Test 19 | public void testFuncaoIgnorada1() { 20 | 21 | } 22 | 23 | /* 24 | 25 | @Test 26 | public void testFuncaoIgnorada2() { 27 | 28 | } 29 | 30 | */ 31 | } 32 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testKotlinProj/instructions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

Instructions

5 |

Develop a simple calculator in Kotlin, that asks for two numbers and prints their sum.

6 |

Example of interaction:

7 | 8 | > Introduza o primeiro número 9 | > 34 10 | > Introduza o segundo número 11 | > 20 12 | > 34 + 20 = 54 13 | 14 |

To pass the tests, you have to print the messages exactly as in the example

15 |

The calculator must be implemented in the file Main.kt, inside the main function

16 |
17 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testKotlinProj/src/main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | 21 | fun main(args: Array) { 22 | println("Introduza o primeiro número") 23 | val num1 = readLine()!!.toInt() 24 | 25 | println("Introduza o segundo número") 26 | val num2 = readLine()!!.toInt() 27 | 28 | val soma = num1 + num2 29 | 30 | println("${num1} + ${num2} = ${soma}") 31 | } 32 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testKotlinProj2/instructions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

Sample Kotlin Assignment

5 |

This is just a very simple Kotlin assignment just to experiment with Drop Project

6 |

The source of this assignment is available on 7 | https://github.com/drop-project-edu/sampleKotlinAssignment 8 |

9 | 10 |

Instructions

11 |
    12 |
  • 13 |

    Create a Kotlin project in your IDE with the structure depicted at the end of this page. In particular, you must create a package 14 | org.dropproject.samples.samplekotlinassignment and create a Main.kt in that package.

    15 |
  • 16 |
  • 17 |

    Within your Main.kt file, implement a top-level function to calculate the 18 | maximum value on an array of integers. This function must have the following signature:
    19 | findMax(numbers: Array<Int>): Int 20 |

  • 21 |
  • 22 |

    Create a zip file of your project and drop it on the area above these instructions. 23 | In a few seconds, Drop Project will give you a report with some metrics about your project. 24 |
    If you don't feel like coding this stuff, you can grab a pre-built submission 25 | here. 26 |

    27 |
  • 28 |
29 | 30 |
-------------------------------------------------------------------------------- /src/test/sampleAssignments/testKotlinProj2/instructions.md: -------------------------------------------------------------------------------- 1 | # Sample Kotlin Assignment 2 | 3 | This is just a very simple Kotlin assignment just to experiment with Drop Project. 4 | 5 | The source of this assignment is available on https://github.com/drop-project-edu/sampleKotlinAssignment 6 | 7 | ## Instructions 8 | 9 | * Create a Kotlin project in your IDE with the structure depicted at the end of this page. 10 | In particular, you must create a package `org.dropproject.samples.samplekotlinassignment` and 11 | create a `Main.kt` in that package. 12 | 13 | 14 | * Within your `Main.kt` file, implement a top-level function to calculate the 15 | maximum value on an array of integers. This function must have the following signature: 16 | 17 | `findMax(numbers: Array): Int` 18 | 19 | 20 | * Create a zip file of your project and drop it on the area above these instructions. 21 | In a few seconds, Drop Project will give you a report with some metrics about your project. 22 | If you don't feel like coding this stuff, you can grab a pre-built submission 23 | [here](https://github.com/drop-project-edu/sampleKotlinAssignment/raw/master/sampleKotlinSubmission.zip). 24 | 25 | ## Additional information 26 | 27 | Check this [file](file.txt) for additional information -------------------------------------------------------------------------------- /src/test/sampleAssignments/testKotlinProj2/public/file.txt: -------------------------------------------------------------------------------- 1 | A file that is made available to students, through the instructions.md -------------------------------------------------------------------------------- /src/test/sampleAssignments/testKotlinProj2/src/main/kotlin/org/dropproject/samples/samplekotlinassignment/Main.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2024 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropproject.samples.samplekotlinassignment 21 | 22 | fun findMax(numbers: Array): Int { 23 | var max = Int.MIN_VALUE 24 | for (number in numbers) { 25 | if (number > max) { 26 | max = number 27 | } 28 | } 29 | 30 | return max 31 | } 32 | 33 | fun main(args: Array) { 34 | val numbers = arrayOf( 1, 3, 7, 4, 2) 35 | println("max = ${findMax(numbers)}") 36 | } 37 | -------------------------------------------------------------------------------- /src/test/sampleAssignments/testKotlinProj2/src/test/kotlin/org/dropproject/samples/samplekotlinassignment/TestTeacherProject.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2024 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropproject.samples.samplekotlinassignment 21 | 22 | import org.junit.Assert.assertEquals 23 | import org.junit.Test 24 | 25 | // in Drop Project, all test classes must begin with "Test" 26 | class TestTeacherProject { 27 | 28 | @Test 29 | fun testFindMax() { 30 | assertEquals(7, findMax(arrayOf(1, 2, 7, 4))) 31 | } 32 | 33 | @Test 34 | fun testFindMaxAllNegative() { 35 | assertEquals(-1, findMax(arrayOf(-7, -5, -3, -1))) 36 | assertEquals(-3, findMax(arrayOf(-7, -5, -3, -99))) 37 | } 38 | 39 | @Test 40 | fun testFindMaxNegativeAndPositive() { 41 | assertEquals(3, findMax(arrayOf(-7, -5, 3, -1))) 42 | assertEquals(5, findMax(arrayOf(-7, 5, -3, -99))) 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/test/sampleExports/export-assignment-and-git-submissions.dp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/test/sampleExports/export-assignment-and-git-submissions.dp -------------------------------------------------------------------------------- /src/test/sampleExports/export-assignment-and-submissions.dp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/test/sampleExports/export-assignment-and-submissions.dp -------------------------------------------------------------------------------- /src/test/sampleExports/export-only-assignment.dp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/test/sampleExports/export-only-assignment.dp -------------------------------------------------------------------------------- /src/test/sampleJacocoReports/jacoco-testProj.csv: -------------------------------------------------------------------------------- 1 | GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,COMPLEXITY_MISSED,COMPLEXITY_COVERED,METHOD_MISSED,METHOD_COVERED 2 | testProj,org.testProj,Main,6,901,16,96,3,188,17,56,1,16 3 | testProj,org.testProj,OtherClass,19,141,3,5,8,19,4,6,2,4 4 | -------------------------------------------------------------------------------- /src/test/sampleMavenOutputs/checkstylePluginFails.txt: -------------------------------------------------------------------------------- 1 | [INFO] Scanning for projects... 2 | [INFO] 3 | [INFO] ----------------< pt.ulusofona.aed2020:aed-projecto-p1 >---------------- 4 | [INFO] Building aed-projecto-p1 1.0-SNAPSHOT 5 | [INFO] from pom_updated.xml 6 | [INFO] --------------------------------[ jar ]--------------------------------- 7 | [INFO] 8 | [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ aed-projecto-p1 --- 9 | [INFO] 10 | [INFO] --- maven-checkstyle-plugin:3.1.1:check (validate) @ aed-projecto-p1 --- 11 | [INFO] ------------------------------------------------------------------------ 12 | [INFO] BUILD FAILURE 13 | [INFO] ------------------------------------------------------------------------ 14 | [INFO] Total time: 3.410 s 15 | [INFO] Finished at: 2024-07-24T17:47:48+01:00 16 | [INFO] ------------------------------------------------------------------------ 17 | [ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:check (validate) on project aed-projecto-p1: Failed during checkstyle configuration: Exception was thrown while processing /srv/drop-project/mavenized-projects/aed-202122-projecto-p1/16-22/1650120665023-src-mavenized-for-rebuild/src/main/java/pt/ulusofona/deisi/aed/deisiflix/Filme.java: MismatchedTokenException occurred while parsing file /srv/drop-project/mavenized-projects/aed-202122-projecto-p1/16-22/1650120665023-src-mavenized-for-rebuild/src/main/java/pt/ulusofona/deisi/aed/deisiflix/Filme.java. expecting EOF, found '}' -> [Help 1] 18 | [ERROR] 19 | [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 20 | [ERROR] Re-run Maven using the -X switch to enable full debug logging. 21 | [ERROR] 22 | [ERROR] For more information about the errors and possible solutions, please read the following articles: 23 | [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException -------------------------------------------------------------------------------- /src/test/sampleProjects/projectCheckstyleErrors/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectCheckstyleErrors/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | class aluno { 4 | int Numero; 5 | int mVotos; 6 | } 7 | 8 | public class Main { 9 | 10 | static final int constante = 30; 11 | 12 | static void FazCoisas() { 13 | int x; 14 | } 15 | 16 | static int funcaoParaTestar() { 17 | return 3; 18 | } 19 | 20 | static int funcaoQueRebenta() { 21 | return 3; 22 | } 23 | 24 | static int funcaoLentaParaTestar() { 25 | return 3; 26 | } 27 | 28 | public static void main(String[] args) { 29 | System.out.println("Sample!"); 30 | if (args.length > 1) System.out.println("aqui"); 31 | System.exit(2); // this instruction is not allowed by checkstyle 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectCompilationErrors/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectCompilationErrors/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Sample { // <<< this should be Main 4 | 5 | static void fazCoisas() { 6 | int x; 7 | } 8 | 9 | static int funcaoParaTestar() { 10 | return 3; 11 | } 12 | 13 | static int funcaoQueRebenta() { 14 | return 3; 15 | } 16 | 17 | static int funcaoLentaParaTestar() { 18 | return 3; 19 | } 20 | 21 | public static void main(String[] args) { 22 | System.out.println("Sample!"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectHackingAttempt/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectHackingAttempt/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import java.io.File; 4 | 5 | public class Main { 6 | 7 | static int funcaoParaTestar() { 8 | // let's try to access the root of the filesystem 9 | new File("/").list(); 10 | 11 | return 3; 12 | } 13 | 14 | static int funcaoLentaParaTestar() { 15 | System.exit(1); // this shouldn't be allowed 16 | return 3; 17 | } 18 | 19 | static int funcaoQueRebenta() { 20 | return 3; 21 | } 22 | 23 | public static void main(String[] args) { 24 | System.out.println("Sample!"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectInvalidStructure1/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectInvalidStructure1/src/org/invalidPackage/sampleAssignments/testProj/Sample.java: -------------------------------------------------------------------------------- 1 | package org.invalidPackage.sampleAssigments.testProj; 2 | 3 | public class Sample { 4 | 5 | static void fazCoisas() { 6 | int x; 7 | } 8 | 9 | static int funcaoParaTestar() { 10 | return 3; 11 | } 12 | 13 | public static void main(String[] args) { 14 | System.out.println("Sample!"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectInvalidStructure2/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectInvalidStructure2/README.md/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/test/sampleProjects/projectInvalidStructure2/README.md/README.md -------------------------------------------------------------------------------- /src/test/sampleProjects/projectInvalidStructure2/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssigments.testProj; 2 | 3 | public class Main { 4 | 5 | static void fazCoisas() { 6 | int x; 7 | } 8 | 9 | static int funcaoParaTestar() { 10 | return 3; 11 | } 12 | 13 | public static void main(String[] args) { 14 | System.out.println("Sample!"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectJUnitErrors/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectJUnitErrors/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 0; 7 | } 8 | 9 | static int funcaoLentaParaTestar() { 10 | return 3; 11 | } 12 | 13 | static int funcaoQueRebenta() { 14 | return 3 / 0; 15 | } 16 | 17 | public static void main(String[] args) { 18 | System.out.println("Sample!"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectJava17/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectJava17/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | 7 | String code = "4"; 8 | 9 | return switch (code) { 10 | case "1" -> 1; 11 | case "2" -> 2; 12 | default -> 3; 13 | }; 14 | 15 | } 16 | 17 | static int funcaoQueRebenta() { 18 | return 3; 19 | } 20 | 21 | static int funcaoLentaParaTestar() { 22 | try { 23 | Thread.sleep(5000); 24 | } catch (Exception ignore) { 25 | // ignore 26 | } 27 | return 3; 28 | } 29 | 30 | public static void main(String[] args) { 31 | System.out.println("Sample!"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinCompilationError/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinCompilationError/src/Main.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | fun f1(i: Int) { 21 | if (i > 0) { 22 | 23 | } 24 | 25 | 26 | fun main(args: Array) { 27 | 28 | // resolução 29 | 30 | println("Introduza o primeiro número") 31 | val num1 = readLine()!!.toInt() 32 | 33 | println("Introduza o segundo número") 34 | val num2 = readLine()!!.toInt() 35 | 36 | val soma = num1 + num2 37 | 38 | println("${num1} + ${num2} = ${soma}") 39 | } 40 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinNoPackageOK/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinNoPackageOK/src/Main.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | fun main(args: Array) { 21 | 22 | // resolução 23 | 24 | println("Introduza o primeiro número") 25 | val num1 = readLine()!!.toInt() 26 | 27 | println("Introduza o segundo número") 28 | val num2 = readLine()!!.toInt() 29 | 30 | val soma = num1 + num2 31 | 32 | println("${num1} + ${num2} = ${soma}") 33 | } 34 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinOK/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinOK/README.md: -------------------------------------------------------------------------------- 1 | # README example 2 | 3 | Some text... -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinOK/src/org/dropproject/samples/samplekotlinassignment/Main.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2024 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropproject.samples.samplekotlinassignment 21 | 22 | fun findMax(numbers: Array): Int { 23 | var result = Int.MIN_VALUE 24 | for (number in numbers) { 25 | if (number > result) { 26 | result = number 27 | } 28 | } 29 | 30 | return result 31 | } 32 | 33 | fun main() { 34 | println("Sample!") 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinOK2/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinOK2/src/org/dropProject/samples/samplekotlinassignment/Main.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 - 2024 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | package org.dropproject.samples.samplekotlinassignment 21 | 22 | fun findMax(numbers: Array): Int { 23 | var max = Int.MIN_VALUE 24 | for (number in numbers) { 25 | if (number > max) { 26 | max = number 27 | } 28 | } 29 | 30 | return max 31 | } 32 | 33 | fun someMethod() { 34 | println("stuff!") 35 | } 36 | 37 | fun main() { 38 | println("Sample copied!") 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinWithStyleErrors/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectKotlinWithStyleErrors/src/Main.kt: -------------------------------------------------------------------------------- 1 | /*- 2 | * ========================LICENSE_START================================= 3 | * DropProject 4 | * %% 5 | * Copyright (C) 2019 Pedro Alves 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================LICENSE_END================================== 19 | */ 20 | fun SomeFunc(Param: String) { 21 | 22 | if (Param == "ola") 23 | println("ole") 24 | 25 | } 26 | 27 | fun main(args: Array) { 28 | println("Introduza o primeiro número") 29 | val num1 = readLine()!!.toInt() 30 | 31 | println("Introduza o segundo número") 32 | val num2 = readLine()!!.toInt() 33 | 34 | var Soma = num1 + num2 35 | 36 | println("${num1} + ${num2} = ${Soma}") 37 | } 38 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOK/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOK/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(5000); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | public static void main(String[] args) { 23 | System.out.println("Sample!"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOKIndividual/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOKIndividual/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(5000); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | public static void main(String[] args) { 23 | System.out.println("Sample!"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOtherEncoding/AUTHORS.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/test/sampleProjects/projectOtherEncoding/AUTHORS.txt -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOtherEncoding/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(5000); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | public static void main(String[] args) { 23 | System.out.println("Sample!"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOutOfMemory/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectOutOfMemory/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Random; 6 | 7 | public class Main { 8 | 9 | static int funcaoParaTestar() { 10 | return 3; 11 | } 12 | 13 | static int funcaoQueRebenta() { 14 | return 3; 15 | } 16 | 17 | static int funcaoLentaParaTestar() { 18 | // let's fill the memory to provoke an out of memory 19 | System.out.println("Starting"); 20 | 21 | Random random = new Random(); 22 | 23 | List lista = new ArrayList<>(); 24 | 25 | for (long i = 0; i < 5000000; i++) { 26 | lista.add(random.nextLong()); 27 | 28 | if (i % 500000 == 0) { 29 | System.out.println("Produced " + (i / 1000) + "K longs"); 30 | } 31 | } 32 | 33 | System.out.println("Finished"); 34 | 35 | return 3; 36 | } 37 | 38 | public static void main(String[] args) { 39 | System.out.println("Sample!"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectSampleJavaAssignmentNOK/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectSampleJavaAssignmentNOK/src/org/dropProject/samples/sampleJavaAssignment/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.samples.sampleJavaAssignment; 2 | 3 | public class Main { 4 | 5 | static int findMax(int[] numbers) { 6 | return 0; 7 | } 8 | 9 | public static void main(String[] args) { 10 | System.out.println("Sample!"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectUnexpectedCharacter/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | p4453;Bruno Cipriano -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith1StudentTest/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith1StudentTest/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(500); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | static int funcaoParaEuTestar() { 23 | System.out.println("aqui"); 24 | System.out.println("--->" + System.getProperty("dropProject.currentUserId")); 25 | return 4; 26 | } 27 | 28 | public static void main(String[] args) { 29 | System.out.println("Sample!"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith1StudentTest/src/org/dropProject/sampleAssignments/testProj/TestStudent.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.Test; 4 | import static org.junit.Assert.*; 5 | 6 | public class TestStudent { 7 | 8 | @Test 9 | public void testFuncaoParaEuTestar() { 10 | assertEquals(4, Main.funcaoParaEuTestar()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith2StudentTests/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith2StudentTests/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(500); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | static int funcaoParaEuTestar() { 23 | return 4; 24 | } 25 | 26 | public static void main(String[] args) { 27 | System.out.println("Sample!"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith2StudentTests/src/org/dropProject/sampleAssignments/testProj/TestStudent.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.Test; 4 | import static org.junit.Assert.*; 5 | 6 | public class TestStudent { 7 | 8 | @Test 9 | public void testFuncaoParaEuTestar() { 10 | assertEquals(4, Main.funcaoParaEuTestar()); 11 | } 12 | 13 | @Test 14 | public void testFuncaoParaEuTestar2() { 15 | assertEquals(4, Main.funcaoParaEuTestar()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith2StudentTestsUsingBeforeClass/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith2StudentTestsUsingBeforeClass/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(500); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | static int funcaoParaEuTestar() { 23 | return 4; 24 | } 25 | 26 | public static void main(String[] args) { 27 | System.out.println("Sample!"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWith2StudentTestsUsingBeforeClass/src/org/dropProject/sampleAssignments/testProj/TestStudent.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.jupiter.api.*; 4 | import static org.junit.jupiter.api.Assertions.*; 5 | 6 | public class TestStudent { 7 | 8 | Integer i = null; 9 | 10 | @BeforeEach 11 | public void setup() { 12 | i = 0; 13 | } 14 | 15 | @Test 16 | public void testFuncaoParaEuTestar() { 17 | assertEquals(4 + i, Main.funcaoParaEuTestar()); 18 | } 19 | 20 | @Test 21 | public void testFuncaoParaEuTestar2() { 22 | assertEquals(4 + i, Main.funcaoParaEuTestar()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithBOM/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | a21702482;Lu�s Gon�alves -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithBOM/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(500); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | public static void main(String[] args) { 23 | System.out.println("Sample!"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithLargeOutput/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithLargeOutput/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | // this fuction will produce too much output and DP should mark it with a fatal error 7 | for (int i = 0; i < 3000; i++) { 8 | System.out.println("Output" + i); 9 | } 10 | return 3; 11 | } 12 | 13 | static int funcaoQueRebenta() { 14 | return 3; 15 | } 16 | 17 | static int funcaoLentaParaTestar() { 18 | try { 19 | Thread.sleep(5000); 20 | } catch (Exception ignore) { 21 | // ignore 22 | } 23 | return 3; 24 | } 25 | 26 | public static void main(String[] args) { 27 | System.out.println("Sample!"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithREADME/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithREADME/README.txt: -------------------------------------------------------------------------------- 1 | Test README -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithREADME/cross_red_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drop-project-edu/drop-project/c207f3e7f7060e64759dbe0bc0bb0b3b925262b3/src/test/sampleProjects/projectWithREADME/cross_red_icon.png -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithREADME/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | 7 | String code = "4"; 8 | 9 | return switch (code) { 10 | case "1" -> 1; 11 | case "2" -> 2; 12 | default -> 3; 13 | }; 14 | 15 | } 16 | 17 | static int funcaoQueRebenta() { 18 | return 3; 19 | } 20 | 21 | static int funcaoLentaParaTestar() { 22 | try { 23 | Thread.sleep(5000); 24 | } catch (Exception ignore) { 25 | // ignore 26 | } 27 | return 3; 28 | } 29 | 30 | public static void main(String[] args) { 31 | System.out.println("Sample!"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithStudentTestNotValid/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithStudentTestNotValid/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(500); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | static int funcaoParaEuTestar() { 23 | System.out.println("aqui"); 24 | System.out.println("--->" + System.getProperty("dropProject.currentUserId")); 25 | return 4; 26 | } 27 | 28 | public static void main(String[] args) { 29 | System.out.println("Sample!"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithStudentTestNotValid/src/org/dropProject/sampleAssignments/testProj/StudentTest.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.Test; 4 | import static org.junit.Assert.*; 5 | 6 | public class StudentTest { 7 | 8 | @Test 9 | public void testFuncaoParaEuTestar() { 10 | assertEquals(4, Main.funcaoParaEuTestar()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithTestInputFiles/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | student1;Student 1 2 | student2;Student 2 -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithTestInputFiles/src/org/dropProject/sampleAssignments/testProj/Main.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | public class Main { 4 | 5 | static int funcaoParaTestar() { 6 | return 3; 7 | } 8 | 9 | static int funcaoQueRebenta() { 10 | return 3; 11 | } 12 | 13 | static int funcaoLentaParaTestar() { 14 | try { 15 | Thread.sleep(500); 16 | } catch (Exception ignore) { 17 | // ignore 18 | } 19 | return 3; 20 | } 21 | 22 | public static void main(String[] args) { 23 | System.out.println("Sample!"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithTestInputFiles/src/org/dropProject/sampleAssignments/testProj/TestStudent.java: -------------------------------------------------------------------------------- 1 | package org.dropProject.sampleAssignments.testProj; 2 | 3 | import org.junit.Test; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.nio.file.Files; 8 | import java.util.List; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | public class TestStudent { 13 | 14 | @Test 15 | public void testFuncaoParaEuTestar() { 16 | try { 17 | List lines = Files.readAllLines(new File("test-files/test.txt").toPath()); 18 | assertEquals(Integer.parseInt(lines.get(0)), Main.funcaoParaTestar()); 19 | } catch (IOException e) { 20 | e.printStackTrace(); 21 | fail("Should not have thrown exception"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/sampleProjects/projectWithTestInputFiles/test-files/test.txt: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /system.properties: -------------------------------------------------------------------------------- 1 | java.runtime.version=11 --------------------------------------------------------------------------------