Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Add architecture test for endpoint naming conventions #8493

Merged
merged 18 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2ef2223
`Development`: Add architecture test for endpoint naming conventions
Strohgelaender Apr 28, 2024
dbbadd6
fix lti server test
Strohgelaender Apr 28, 2024
e748c53
remove `value =`
Strohgelaender Apr 28, 2024
1bd2fd0
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender Apr 30, 2024
3124401
Merge branch 'develop' of https://github.com/ls1intum/Artemis into ch…
Strohgelaender May 1, 2024
62a787a
improve code
Strohgelaender May 1, 2024
490b0af
Update src/main/java/de/tum/in/www1/artemis/config/lti/CustomLti13Con…
Strohgelaender May 2, 2024
bf1881b
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 2, 2024
08511f6
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 2, 2024
b9856e9
Merge branch 'develop' into chore/endpoint-namings
julian-christl May 3, 2024
6f020c9
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 5, 2024
73f51ac
Merge branch 'develop' of https://github.com/ls1intum/Artemis into ch…
Strohgelaender May 5, 2024
927632d
fix violations after merge
Strohgelaender May 5, 2024
69934c7
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 8, 2024
96f95da
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 9, 2024
fe2fa98
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 10, 2024
4ff414e
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 11, 2024
2cd4552
Merge branch 'develop' into chore/endpoint-namings
Strohgelaender May 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class CustomLti13Configurer extends Lti13Configurer {
private static final String LOGIN_INITIATION_PATH = "/initiate-login";

/** Base path for LTI 1.3 API endpoints. */
public static final String LTI13_BASE_PATH = "/api/public/lti13";
public static final String LTI13_BASE_PATH = "api/public/lti13";

/** Full path for LTI 1.3 login. */
public static final String LTI13_LOGIN_PATH = LTI13_BASE_PATH + LOGIN_PATH;
Expand Down Expand Up @@ -72,7 +72,7 @@ public void configure(HttpSecurity http) {
// https://www.imsglobal.org/spec/security/v1p0/#step-3-authentication-response
OAuth2LoginAuthenticationFilter defaultLoginFilter = configureLoginFilter(clientRegistrationRepository(http), oidcLaunchFlowAuthenticationProvider,
authorizationRequestRepository);
http.addFilterAfter(new Lti13LaunchFilter(defaultLoginFilter, LTI13_BASE_PATH + LOGIN_PATH, lti13Service(http)), AbstractPreAuthenticatedProcessingFilter.class);
http.addFilterAfter(new Lti13LaunchFilter(defaultLoginFilter, "/" + LTI13_LOGIN_PATH, lti13Service(http)), AbstractPreAuthenticatedProcessingFilter.class);
}

protected Lti13Service lti13Service(HttpSecurity http) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public AeolusTemplateResource(AeolusTemplateService aeolusTemplateService, Build
* @param testCoverage Whether the test coverage template should be used
* @return The requested file, or 404 if the file doesn't exist
*/
@GetMapping({ "templates/{language}/{projectType}", "/templates/{language}" })
@GetMapping({ "templates/{language}/{projectType}", "templates/{language}" })
@EnforceAtLeastEditor
public ResponseEntity<String> getAeolusTemplate(@PathVariable ProgrammingLanguage language, @PathVariable Optional<ProjectType> projectType,
@RequestParam(value = "staticAnalysis", defaultValue = "false") boolean staticAnalysis,
Expand All @@ -91,7 +91,7 @@ public ResponseEntity<String> getAeolusTemplate(@PathVariable ProgrammingLanguag
* @param testCoverage Whether the test coverage template should be used
* @return The requested file, or 404 if the file doesn't exist
*/
@GetMapping({ "templateScripts/{language}/{projectType}", "/templateScripts/{language}" })
@GetMapping({ "templateScripts/{language}/{projectType}", "templateScripts/{language}" })
@EnforceAtLeastEditor
public ResponseEntity<String> getAeolusTemplateScript(@PathVariable ProgrammingLanguage language, @PathVariable Optional<ProjectType> projectType,
@RequestParam(value = "staticAnalysis", defaultValue = "false") boolean staticAnalysis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public ResponseEntity<ApollonDiagram> updateApollonDiagram(@RequestBody ApollonD
* @param diagramId the id of the diagram
* @return the ResponseEntity with status 200 (OK) and with body the title of the diagram or 404 Not Found if no diagram with that id exists
*/
@GetMapping(value = "/apollon-diagrams/{diagramId}/title")
@GetMapping("apollon-diagrams/{diagramId}/title")
@EnforceAtLeastStudent
public ResponseEntity<String> getDiagramTitle(@PathVariable Long diagramId) {
final var title = apollonDiagramRepository.getDiagramTitle(diagramId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public ResponseEntity<Competency> createCompetency(@PathVariable long courseId,
* @return the ResponseEntity with status 201 (Created) and body the created competencies
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/courses/{courseId}/competencies/bulk")
@PostMapping("courses/{courseId}/competencies/bulk")
@EnforceAtLeastInstructor
public ResponseEntity<List<Competency>> createCompetencies(@PathVariable Long courseId, @RequestBody List<Competency> competencies) throws URISyntaxException {
log.debug("REST request to create Competencies : {}", competencies);
Expand Down Expand Up @@ -316,7 +316,7 @@ public ResponseEntity<Competency> importCompetency(@PathVariable long courseId,
* @return the ResponseEntity with status 201 (Created) and with body containing the imported competencies
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/courses/{courseId}/competencies/import/bulk")
@PostMapping("courses/{courseId}/competencies/import/bulk")
@EnforceAtLeastEditor
public ResponseEntity<List<CompetencyWithTailRelationDTO>> importCompetencies(@PathVariable long courseId, @RequestBody List<Competency> competenciesToImport,
@RequestParam(defaultValue = "false") boolean importRelations) throws URISyntaxException {
Expand Down Expand Up @@ -349,7 +349,7 @@ public ResponseEntity<List<CompetencyWithTailRelationDTO>> importCompetencies(@P
* @return the ResponseEntity with status 201 (Created) and with body containing the imported competencies (and relations)
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/courses/{courseId}/competencies/import-all/{sourceCourseId}")
@PostMapping("courses/{courseId}/competencies/import-all/{sourceCourseId}")
@EnforceAtLeastInstructor
public ResponseEntity<List<CompetencyWithTailRelationDTO>> importAllCompetenciesFromCourse(@PathVariable long courseId, @PathVariable long sourceCourseId,
@RequestParam(defaultValue = "false") boolean importRelations) throws URISyntaxException {
Expand Down Expand Up @@ -385,7 +385,7 @@ public ResponseEntity<List<CompetencyWithTailRelationDTO>> importAllCompetencies
* @return the ResponseEntity with status 201 (Created) and with body containing the imported competencies
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/courses/{courseId}/competencies/import-standardized")
@PostMapping("courses/{courseId}/competencies/import-standardized")
@EnforceAtLeastEditorInCourse
public ResponseEntity<List<CompetencyImportResponseDTO>> importStandardizedCompetencies(@PathVariable long courseId, @RequestBody List<Long> competencyIdsToImport)
throws URISyntaxException {
Expand Down Expand Up @@ -612,7 +612,7 @@ public ResponseEntity<Void> removePrerequisite(@PathVariable long competencyId,
* @param courseDescription the text description of the course
* @return the ResponseEntity with status 200 (OK) and body the genrated competencies
*/
@PostMapping("/courses/{courseId}/competencies/generate-from-description")
@PostMapping("courses/{courseId}/competencies/generate-from-description")
@EnforceAtLeastEditor
public ResponseEntity<List<Competency>> generateCompetenciesFromCourseDescription(@PathVariable Long courseId, @RequestBody String courseDescription) {
var irisService = irisCompetencyGenerationSessionService.orElseThrow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public ResponseEntity<SearchResultPageDTO<Lecture>> getAllLecturesOnPage(SearchT
* @param courseId the courseId of the course for which all lectures should be returned
* @return the ResponseEntity with status 200 (OK) and the list of lectures in body
*/
@GetMapping(value = "/courses/{courseId}/lectures")
@GetMapping("courses/{courseId}/lectures")
@EnforceAtLeastEditor
public ResponseEntity<Set<Lecture>> getLecturesForCourse(@PathVariable Long courseId, @RequestParam(required = false, defaultValue = "false") boolean withLectureUnits) {
log.debug("REST request to get all Lectures for the course with id : {}", courseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private ResponseEntity<ModelingSubmission> handleModelingSubmission(Long exercis
@ResponseStatus(HttpStatus.OK)
@ApiResponses({ @ApiResponse(code = 200, message = GET_200_SUBMISSIONS_REASON, response = ModelingSubmission.class, responseContainer = "List"),
@ApiResponse(code = 403, message = ErrorConstants.REQ_403_REASON), @ApiResponse(code = 404, message = ErrorConstants.REQ_404_REASON), })
@GetMapping(value = "/exercises/{exerciseId}/modeling-submissions")
@GetMapping("exercises/{exerciseId}/modeling-submissions")
@EnforceAtLeastTutor
public ResponseEntity<List<Submission>> getAllModelingSubmissions(@PathVariable Long exerciseId, @RequestParam(defaultValue = "false") boolean submittedOnly,
@RequestParam(defaultValue = "false") boolean assessedByTutor, @RequestParam(value = "correction-round", defaultValue = "0") int correctionRound) {
Expand Down Expand Up @@ -255,7 +255,7 @@ public ResponseEntity<ModelingSubmission> getModelingSubmission(@PathVariable Lo
* @param correctionRound correctionRound for which submissions without a result should be returned
* @return the ResponseEntity with status 200 (OK) and a modeling submission without assessment in body
*/
@GetMapping(value = "/exercises/{exerciseId}/modeling-submission-without-assessment")
@GetMapping("exercises/{exerciseId}/modeling-submission-without-assessment")
@EnforceAtLeastTutor
public ResponseEntity<ModelingSubmission> getModelingSubmissionWithoutAssessment(@PathVariable Long exerciseId,
@RequestParam(value = "lock", defaultValue = "false") boolean lockSubmission, @RequestParam(value = "correction-round", defaultValue = "0") int correctionRound) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public QuizExerciseResource(QuizExerciseService quizExerciseService, QuizMessagi
* @return the ResponseEntity with status 201 (Created) and with body the new quizExercise, or with status 400 (Bad Request) if the quizExercise has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping(value = "/quiz-exercises", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PostMapping(value = "quiz-exercises", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@EnforceAtLeastEditor
public ResponseEntity<QuizExercise> createQuizExercise(@RequestPart("exercise") QuizExercise quizExercise,
@RequestPart(value = "files", required = false) List<MultipartFile> files) throws URISyntaxException, IOException {
Expand Down Expand Up @@ -222,7 +222,7 @@ public ResponseEntity<QuizExercise> createQuizExercise(@RequestPart("exercise")
* @return the ResponseEntity with status 200 (OK) and with body the updated quizExercise, or with status 400 (Bad Request) if the quizExercise is not valid, or with status 500
* (Internal Server Error) if the quizExercise couldn't be updated
*/
@PutMapping(value = "/quiz-exercises/{exerciseId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PutMapping(value = "quiz-exercises/{exerciseId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@EnforceAtLeastEditor
public ResponseEntity<QuizExercise> updateQuizExercise(@PathVariable Long exerciseId, @RequestPart("exercise") QuizExercise quizExercise,
@RequestPart(value = "files", required = false) List<MultipartFile> files, @RequestParam(value = "notificationText", required = false) String notificationText)
Expand Down Expand Up @@ -283,7 +283,7 @@ public ResponseEntity<QuizExercise> updateQuizExercise(@PathVariable Long exerci
* @param courseId id of the course of which all exercises should be fetched
* @return the ResponseEntity with status 200 (OK) and the list of quiz exercises in body
*/
@GetMapping(value = "/courses/{courseId}/quiz-exercises")
@GetMapping("courses/{courseId}/quiz-exercises")
@EnforceAtLeastTutor
public ResponseEntity<List<QuizExercise>> getQuizExercisesForCourse(@PathVariable Long courseId) {
log.info("REST request to get all quiz exercises for the course with id : {}", courseId);
Expand Down Expand Up @@ -640,7 +640,7 @@ public ResponseEntity<Void> deleteQuizExercise(@PathVariable Long quizExerciseId
* @return the ResponseEntity with status 200 (OK) and with body the re-evaluated quizExercise, or with status 400 (Bad Request) if the quizExercise is not valid, or with
* status 500 (Internal Server Error) if the quizExercise couldn't be re-evaluated
*/
@PutMapping(value = "/quiz-exercises/{quizExerciseId}/re-evaluate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PutMapping(value = "quiz-exercises/{quizExerciseId}/re-evaluate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@EnforceAtLeastInstructor
public ResponseEntity<QuizExercise> reEvaluateQuizExercise(@PathVariable Long quizExerciseId, @RequestPart("exercise") QuizExercise quizExercise,
@RequestPart(value = "files", required = false) List<MultipartFile> files) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ public ResponseEntity<Void> deleteTestRun(@PathVariable Long courseId, @PathVari
* @param examId the exam to which the student exam belongs to
* @return ResponseEntity containing the list of generated participations
*/
@PostMapping(value = "/courses/{courseId}/exams/{examId}/student-exams/start-exercises")
@PostMapping(value = "courses/{courseId}/exams/{examId}/student-exams/start-exercises")
@EnforceAtLeastInstructor
public ResponseEntity<Void> startExercises(@PathVariable Long courseId, @PathVariable Long examId) {
long start = System.nanoTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public ResponseEntity<List<Team>> importTeamsFromSourceExercise(@PathVariable lo
* @param teamShortName short name of the team (all teams with the short name in the course are seen as the same team)
* @return Course with exercises and participations (and latest submissions) for the team
*/
@GetMapping(value = "/courses/{courseId}/teams/{teamShortName}/with-exercises-and-participations")
@GetMapping("courses/{courseId}/teams/{teamShortName}/with-exercises-and-participations")
@EnforceAtLeastStudent
public ResponseEntity<Course> getCourseWithExercisesAndParticipationsForTeam(@PathVariable Long courseId, @PathVariable String teamShortName) {
log.debug("REST request to get Course {} with exercises and participations for Team with short name {}", courseId, teamShortName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public ResponseEntity<TextSubmission> getTextSubmissionWithResults(@PathVariable
* @param assessedByTutor mark if only assessed Submissions should be returned
* @return the ResponseEntity with status 200 (OK) and the list of textSubmissions in body
*/
@GetMapping(value = "/exercises/{exerciseId}/text-submissions")
@GetMapping("exercises/{exerciseId}/text-submissions")
@EnforceAtLeastTutor
public ResponseEntity<List<Submission>> getAllTextSubmissions(@PathVariable Long exerciseId, @RequestParam(defaultValue = "false") boolean submittedOnly,
@RequestParam(defaultValue = "false") boolean assessedByTutor, @RequestParam(value = "correction-round", defaultValue = "0") int correctionRound) {
Expand All @@ -205,7 +205,7 @@ public ResponseEntity<List<Submission>> getAllTextSubmissions(@PathVariable Long
* @param lockSubmission optional value to define if the submission should be locked and has the value of false if not set manually
* @return the ResponseEntity with status 200 (OK) and the list of textSubmissions in body
*/
@GetMapping(value = "/exercises/{exerciseId}/text-submission-without-assessment")
@GetMapping("exercises/{exerciseId}/text-submission-without-assessment")
@EnforceAtLeastTutor
public ResponseEntity<TextSubmission> getTextSubmissionWithoutAssessment(@PathVariable Long exerciseId,
@RequestParam(value = "head", defaultValue = "false") boolean skipAssessmentOrderOptimization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public ResponseEntity<Void> cancelAllRunningBuildJobs() {
* @param agentName the name of the agent
* @return the ResponseEntity with the result of the cancellation
*/
@DeleteMapping("/cancel-all-running-jobs-for-agent")
@DeleteMapping("cancel-all-running-jobs-for-agent")
@EnforceAdmin
public ResponseEntity<Void> cancelAllRunningBuildJobsForAgent(@RequestParam String agentName) {
log.debug("REST request to cancel all running build jobs for agent {}", agentName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public ResponseEntity<Void> addLtiPlatformConfiguration(@RequestBody LtiPlatform
* @param registrationToken Optional token for the registration process.
* @return a {@link ResponseEntity} with status 200 (OK) if the dynamic registration process was successful.
*/
@PostMapping("/lti13/dynamic-registration")
@PostMapping("lti13/dynamic-registration")
@EnforceAdmin
public ResponseEntity<Void> lti13DynamicRegistration(@RequestParam(name = "openid_configuration") String openIdConfiguration,
@RequestParam(name = "registration_token", required = false) String registrationToken) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public ResponseEntity<Void> cancelAllRunningBuildJobs(@PathVariable long courseI
* @param search the search criteria
* @return the page of finished build jobs
*/
@GetMapping("/courses/{courseId}/finished-jobs")
@GetMapping("courses/{courseId}/finished-jobs")
@EnforceAtLeastInstructorInCourse
public ResponseEntity<List<FinishedBuildJobDTO>> getFinishedBuildJobsForCourse(@PathVariable long courseId, PageableSearchDTO<String> search) {
log.debug("REST request to get the finished build jobs for course {}", courseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

@Profile(PROFILE_CORE)
@RestController
@RequestMapping("api/courses")
@RequestMapping("api/courses/")
public class ChannelResource extends ConversationManagementResource {

private static final Logger log = LoggerFactory.getLogger(ChannelResource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

@Profile(PROFILE_CORE)
@RestController
@RequestMapping("api/courses")
@RequestMapping("api/courses/")
public class ConversationResource extends ConversationManagementResource {

private static final Logger log = LoggerFactory.getLogger(ConversationResource.class);
Expand Down Expand Up @@ -135,7 +135,7 @@ public ResponseEntity<Void> updateIsHidden(@PathVariable Long courseId, @PathVar
* @param isMuted the new muted status
* @return ResponseEntity with status 200 (Ok)
*/
@PostMapping("/{courseId}/conversations/{conversationId}/muted")
@PostMapping("{courseId}/conversations/{conversationId}/muted")
@EnforceAtLeastStudent
public ResponseEntity<Void> updateIsMuted(@PathVariable Long courseId, @PathVariable Long conversationId, @RequestParam boolean isMuted) {
checkMessagingOrCommunicationEnabledElseThrow(courseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@Profile(PROFILE_CORE)
@RestController
@RequestMapping("api/courses")
@RequestMapping("api/courses/")
public class GroupChatResource extends ConversationManagementResource {

private static final Logger log = LoggerFactory.getLogger(GroupChatResource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

@Profile(PROFILE_CORE)
@RestController
@RequestMapping("api/courses")
@RequestMapping("api/courses/")
public class OneToOneChatResource extends ConversationManagementResource {

private static final Logger log = LoggerFactory.getLogger(OneToOneChatResource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public PublicOAuth2JWKSResource(OAuth2JWKSService jwksService) {
*
* @return ResponseEntity containing the JWKS as a JSON string with status 200 (OK). If an error occurs, returns null.
*/
@GetMapping("/.well-known/jwks.json")
@GetMapping(".well-known/jwks.json")
@EnforceNothing
@ManualConfig
public ResponseEntity<String> getJwkSet() {
Expand Down
Loading
Loading