Closed Strohgelaender closed 3 days ago
The recent updates involve adding a dependency on "com.sun.activation:jakarta.activation:2.0.1"
to the build.gradle
file to address security concerns and improve functionality. Additionally, new test methods and modifications were made to the FileUploadSubmissionIntegrationTest
class, enhancing its ability to test file submissions with different file paths and media types, thus improving the handling and assessment of diverse file formats, including .ipynb
.
File Path | Change Summary |
---|---|
build.gradle |
Added a new dependency ("com.sun.activation:jakarta.activation:2.0.1" ). Updated guava and gson dependencies. |
src/test/java/.../FileUploadSubmissionIntegrationTest.java |
Modified initTestCase , added submitFileSpecialExtensions , and enhanced submitFile method for varied testing. |
Objective | Addressed | Explanation |
---|---|---|
Ensure the system supports the download and opening of .ipynb files during assessment (#8870). |
✅ |
src/test/java/de/tum/in/www1/artemis/exercise/fileupload/FileUploadSubmissionIntegrationTest.java (1)
Pattern `src/test/java/**/*.java`: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true
build.gradle (2)
`440-440`: **Dependency Addition Approved** The addition of `com.sun.activation:jakarta.activation:2.0.1` is appropriate for handling media type determination issues mentioned in the PR. It's correctly placed in the dependency block, ensuring that it is part of the build. --- `440-440`: **Dependency Update Approved** The update to `com.google.code.gson:gson:2.11.0` is part of the security improvements. It's important to ensure that this update does not introduce any breaking changes or compatibility issues with the existing codebase.src/test/java/de/tum/in/www1/artemis/exercise/fileupload/FileUploadSubmissionIntegrationTest.java (3)
`156-162`: **Approval for adding `submitFileSpecialExtensions` test method.** This method is crucial for testing the submission of `.ipynb` files, aligning with the PR's objective to fix issues related to non-standard file types. The implementation seems correct and directly addresses the problem described in the linked issue. --- `165-168`: **Approval for the overloaded `submitFile` method signature.** The addition of the `MediaType` parameter allows testing different media types, enhancing the flexibility and coverage of file upload tests. This change is well-aligned with the PR's goal to support different file types effectively. --- `97-97`: **Verify removal of `throws Exception` in `initTestCase` method.** The removal of the `throws Exception` clause suggests a change in error handling within the method. Please ensure that all exceptions are properly handled or that none are thrown.Verification successful
--- **Verified removal of `throws Exception` in `initTestCase` method.** The `initTestCase` method in `FileUploadSubmissionIntegrationTest.java` does not throw any checked exceptions, confirming the correctness of removing the `throws Exception` clause. - `FileUploadSubmissionIntegrationTest.java`, line 97Scripts executed
The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Description: Verify that no checked exceptions are thrown within the `initTestCase` method. ast-grep --lang java --pattern $'void initTestCase() { $$$ }' ``` Length of output: 190 --- --- Script: ```shell #!/bin/bash # Description: Verify that no checked exceptions are thrown within the `initTestCase` method, excluding problematic files. ast-grep --lang java --pattern $'void initTestCase() { $$$ }' --exclude src/test/resources/test-data/repository-export/EncodingISO_8559_1.java ``` Length of output: 348 --- --- Script: ```shell #!/bin/bash # Description: Verify that no checked exceptions are thrown within the `initTestCase` method, excluding problematic files using find. find . -type f -name "*.java" ! -path "./src/test/resources/test-data/repository-export/EncodingISO_8559_1.java" -print0 | xargs -0 ast-grep --lang java --pattern $'void initTestCase() { $$$ }' ``` Length of output: 196 --- --- Script: ```shell #!/bin/bash # Description: Search for the `initTestCase` method definition using rg. rg 'void initTestCase\(' ``` Length of output: 12236 --- --- Script: ```shell #!/bin/bash # Description: Extract the implementation of the `initTestCase` method from `FileUploadSubmissionIntegrationTest.java`. ast-grep --lang java --pattern $'void initTestCase() { $$$ }' src/test/java/de/tum/in/www1/artemis/exercise/fileupload/FileUploadSubmissionIntegrationTest.java ``` Length of output: 162 --- --- Script: ```shell #!/bin/bash # Description: Extract the implementation of the `initTestCase` method from `FileUploadSubmissionIntegrationTest.java` using rg. rg -A 20 -B 5 'void initTestCase\(' src/test/java/de/tum/in/www1/artemis/exercise/fileupload/FileUploadSubmissionIntegrationTest.java ``` Length of output: 1759
Checklist
General
Server
Motivation and Context
There is an internal server error when downloading submission files of non-standard data types. Fixes #8870
Description
The fallback solution for determining the media type uses the activation API. Here the necessary dependency got lost, probally during the Spring Boot 3 upgrade due to the package rename
Steps for Testing
Prerequisites:
Testserver States
Review Progress
Code Review
Manual Tests
Test Coverage
Summary by CodeRabbit
New Features
Chores
jakarta.activation:2.0.1
.