Feat/quality improvement - #18
Merged
Merged
Conversation
Implement comprehensive localization infrastructure for database entities, including support for multiple locales with fallback mechanisms and UTF-8 validation. Changes include: - Added LocalizableDAO interface for locale-aware data access - Updated DatabaseConnection with UTF-8 charset parameters for proper internationalization support - Created migration script to convert tables to utf8mb4, add locale tables, and migrate existing profile data to translations - Enhanced ProfileDAO to implement LocalizableDAO with translation methods using fallback resolution - Added LocaleFallbackResolver utility for locale chaining - Added Utf8Validator utility for UTF-8 input validation and sanitization This enables the application to serve localized content across supported languages including RTL languages like Arabic and Persian.
…branding Added new message keys for dashboard statuses (archived and finalized) in both English and Chinese properties files. Corrected Chinese translations
…essages Add new database tables (locale, profile_translation, system_message_translation) to store localized content. Implement database migration utility to create tables and populate initial locale data. Update ProfileDAO, ProfileService, and UserDAO to handle locale-specific data retrieval and updates using a new LocaleMapper utility. Modify ProfileView to support first name, last name, and localized profile loading. Enhance AuthenticationService with setCurrentUser method for session management. Deprecate old methods to ensure backward compatibility while transitioning to locale-aware operations.
This adds SonarQube project metadata, configures coverage report paths, and includes the Sonar scanner plugin. A logger has also been added to ProfileDAO to aid in debugging database operations.
Add unit tests for TranslationService, ThemeService, and all Vaadin view components. The tests cover constructor initialization, view rendering, input validation, and helper method functionality, providing regression coverage for UI components.
Include spring-boot Actuator for health monitoring enable Sonar coverage reporting and set Jacoco plugin update Cobertura includes for comprehensive coverage.
Expand test coverage for AIService, locale utilities, database migration and general backend services. New tests exercise edge cases, use mocks to isolate dependencies and verify the behavior of private methods via reflection. This improves overall code quality and reduces regressions.
…ackend services Add comprehensive unit tests that validate error paths, logger output, and utility helpers. The changes replace raw `printStackTrace()` calls with structured `log.error()` statements, remove extraneous comments, reorganize SQL table creation, and tighten whitespace formatting. Updated `LocaleFallbackResolver`, `LocaleMapper`, and `Utf8Validator` now expose parameterless constructors, improving mockability in tests. Additional tests confirm that profile updates, authentication errors, and database migration behave correctly under failure scenarios.
…ation Implement SLF4J logging throughout backend services and the frontend view. Replace print statements with logger calls, reduce stdout logging levels, and add path validation in `DocumentService` to guard against directory traversal. Update error handling in `CoverLetterDAO`, `CoverLetterService` and `SettingsDAO` to log exceptions instead of printing stack traces. No breaking changes introduced.
Update SecurityConfig to expose only basic public paths and require authentication for the rest. Adjust form login to default and disable HTTP Basic. Add unit tests for the public/login route and redirection for protected routes.
Use local SonarQube instance for development and CI instead of public SonarCloud. Update pom.xml with a local host.
Remove @Push and install Spring Security for user authentication. Add @permitAll annotations to all public views to allow anonymous access.
…vice and refresh security config Add logic to create and clear a Spring Security authentication token when a user logs in or out, storing the context in the HTTP session. Update SecurityConfig to use VaadinSecurityConfigurer, map public endpoints, and expose the LoginView. Included tests cover the new behavior.
Refactor AuthenticationService to construct UsernamePasswordAuthenticationToken in a single line and set the authentication context more concisely. Simplify SecurityConfig request matcher list to a single line for readability. Update corresponding tests to reflect the formatting changes.
…ackend services Add comprehensive unit tests that validate error paths, logger output, and utility helpers. The changes replace raw `printStackTrace()` calls with structured `log.error()` statements, remove extraneous comments, reorganize SQL table creation, and tighten whitespace formatting. Updated `LocaleFallbackResolver`, `LocaleMapper`, and `Utf8Validator` now expose parameterless constructors, improving mockability in tests. Additional tests confirm that profile updates, authentication errors, and database migration behave correctly under failure scenarios.
Add username formatting and a separate email line to the ProfileView UI. Update messages.properties to include new keys for username and email labels.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR broadens localization and Unicode support across the app (DB + UI), integrates Vaadin with Spring Security, improves file-path safety for stored documents, and adds extensive automated tests plus code-quality tooling configuration.
Changes:
- Added localization database migration + locale/profile translation utilities, and expanded i18n message bundles.
- Integrated Spring Security (VaadinSecurityConfigurer) and aligned app routes with security annotations.
- Improved storage safety (path normalization/containment) and expanded unit/integration test coverage; added Jacoco/SonarQube/Actuator configuration.
Reviewed changes
Copilot reviewed 79 out of 79 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/clbooster/app/views/SignUpViewTest.java | Adds view-level tests for signup validation and password strength UI behavior. |
| src/test/java/com/clbooster/app/views/SettingsViewTest.java | Adds tests for settings persistence and UI branches (including language mapping). |
| src/test/java/com/clbooster/app/views/ResumeManagerViewTest.java | Adds tests for resume parsing, sorting, deletion, and formatting helpers. |
| src/test/java/com/clbooster/app/views/ResumeManagerViewAdditionalTest.java | Adds extra tests for resume UI helper methods and error paths. |
| src/test/java/com/clbooster/app/views/ProfileViewTest.java | Adds tests for profile edit/save flows and password change validations. |
| src/test/java/com/clbooster/app/views/OnboardingViewTest.java | Adds tests for onboarding step rendering and navigation logic. |
| src/test/java/com/clbooster/app/views/NotificationsViewTest.java | Adds basic coverage for notifications view construction and actions. |
| src/test/java/com/clbooster/app/views/MainLayoutTest.java | Adds tests for layout initialization with/without users. |
| src/test/java/com/clbooster/app/views/LoginViewTest.java | Adds tests for login validation and auth-service interaction. |
| src/test/java/com/clbooster/app/views/LandingViewTest.java | Adds tests for landing page component builders and language select behavior. |
| src/test/java/com/clbooster/app/views/HistoryViewAdditionalTest.java | Adds tests for history dialogs and preview logic branches. |
| src/test/java/com/clbooster/app/views/HelpViewTest.java | Adds tests for FAQ filtering, expansion toggles, and notifications. |
| src/test/java/com/clbooster/app/views/DashboardViewTest.java | Adds tests for dashboard file filtering/count helpers and UI filtering behavior. |
| src/test/java/com/clbooster/app/views/CoverLetterEditorViewTest.java | Adds tests for cover letter editor file IO and docx text extraction. |
| src/test/java/com/clbooster/app/views/CLgenerator_CLITest.java | Adds CLI test coverage for login/register/profile/edit/delete flows. |
| src/test/java/com/clbooster/app/views/BaseVaadinViewTest.java | Introduces shared Vaadin static mocking base for view unit tests. |
| src/test/java/com/clbooster/app/theme/ThemeServiceTest.java | Adds tests for theme initialization and JS/session integration. |
| src/test/java/com/clbooster/app/security/SecurityConfigTest.java | Adds integration tests verifying public vs protected routes. |
| src/test/java/com/clbooster/app/i18n/TranslationServiceTest.java | Adds tests for locale selection, RTL handling, and translation fallbacks. |
| src/test/java/com/clbooster/app/backend/util/Utf8ValidatorTest.java | Adds tests for UTF-8 sanitization and control character removal. |
| src/test/java/com/clbooster/app/backend/util/LocaleMapperTest.java | Adds tests for app-locale to DB-locale mapping logic. |
| src/test/java/com/clbooster/app/backend/util/LocaleFallbackResolverTest.java | Adds tests for locale fallback-chain construction. |
| src/test/java/com/clbooster/app/backend/service/StoredFileTest.java | Adds tests documenting StoredFile mutability/defensive-copy behavior. |
| src/test/java/com/clbooster/app/backend/service/settings/SettingsTest.java | Adds tests for Settings defaults and accessors. |
| src/test/java/com/clbooster/app/backend/service/settings/SettingsServiceTest.java | Adds tests verifying service-to-DAO delegation. |
| src/test/java/com/clbooster/app/backend/service/settings/SettingsDAOTest.java | Adds DB-layer tests using mocked JDBC for settings persistence. |
| src/test/java/com/clbooster/app/backend/service/profile/UserServiceTest.java | Adds tests verifying user service delegation to DAO. |
| src/test/java/com/clbooster/app/backend/service/profile/ProfileServiceTest.java | Updates tests for new localized profile APIs and identity updates. |
| src/test/java/com/clbooster/app/backend/service/profile/CoverLetterTest.java | Adds tests for CoverLetter model constructors/toString. |
| src/test/java/com/clbooster/app/backend/service/profile/CoverLetterServiceTest.java | Expands coverage for file-based cover letter persistence behavior. |
| src/test/java/com/clbooster/app/backend/service/profile/CoverLetterDAOTest.java | Adds/updates mocked JDBC tests for cover letter DAO error paths. |
| src/test/java/com/clbooster/app/backend/service/GreetServiceTest.java | Adds tests for greet service behavior. |
| src/test/java/com/clbooster/app/backend/service/FileUploadServiceTest.java | Adds tests for file upload validation and persistence behavior. |
| src/test/java/com/clbooster/app/backend/service/database/DatabaseMigrationTest.java | Adds tests for executing DB migration statements safely. |
| src/test/java/com/clbooster/app/backend/service/authentication/AuthenticationServiceTest.java | Expands tests for Spring Security context integration and validation. |
| src/test/java/com/clbooster/app/ApplicationTest.java | Adds tests for Vaadin annotations and SpringApplication.run delegation. |
| src/test/java/com/clbooster/aiservice/MainTest.java | Adds tests for AI workflow orchestration and path normalization. |
| src/test/java/com/clbooster/aiservice/AIServiceTest.java | Expands tests for tone selection and language model lazy init behavior. |
| src/main/resources/messages.properties | Updates/extends English UI keys for new UI labels and status localization. |
| src/main/resources/messages_zh.properties | Updates Chinese translations for new keys and wording adjustments. |
| src/main/resources/messages_ur.properties | Updates Urdu translations and adds new settings/profile keys. |
| src/main/resources/messages_pt.properties | Updates Portuguese translations and adds new settings/profile keys. |
| src/main/resources/messages_fi.properties | Updates Finnish translations and adds new settings/profile keys. |
| src/main/resources/messages_fa.properties | Updates Persian translations and adds new settings/profile keys. |
| src/main/java/com/clbooster/app/views/SettingsView.java | Adds @PermitAll and replaces console output with structured logging. |
| src/main/java/com/clbooster/app/views/ResumeManagerView.java | Adds @PermitAll to align route access with security integration. |
| src/main/java/com/clbooster/app/views/ProfileView.java | Uses locale-aware profile reads/writes and improves header display. |
| src/main/java/com/clbooster/app/views/OnboardingView.java | Adds @PermitAll for route security integration. |
| src/main/java/com/clbooster/app/views/NotificationsView.java | Adds @PermitAll for route security integration. |
| src/main/java/com/clbooster/app/views/MainLayout.java | Adds @PermitAll and hardens avatar initials generation against blanks/nulls. |
| src/main/java/com/clbooster/app/views/HistoryView.java | Adds @PermitAll for route security integration. |
| src/main/java/com/clbooster/app/views/HelpView.java | Adds @PermitAll for route security integration. |
| src/main/java/com/clbooster/app/views/GeneratorWizardView.java | Adds @PermitAll for route security integration. |
| src/main/java/com/clbooster/app/views/EditorView.java | Adds @PermitAll for route security integration. |
| src/main/java/com/clbooster/app/views/DashboardView.java | Localizes status badge text via TranslationService keys. |
| src/main/java/com/clbooster/app/views/CoverLetterEditorView.java | Adds @PermitAll for route security integration. |
| src/main/java/com/clbooster/app/security/SecurityConfig.java | Replaces open security config with Vaadin/Spring Security integration. |
| src/main/java/com/clbooster/app/backend/util/Utf8Validator.java | Adds UTF-8 validation/sanitization helper used by localization persistence. |
| src/main/java/com/clbooster/app/backend/util/LocaleMapper.java | Maps app locales to DB locale codes for translation tables. |
| src/main/java/com/clbooster/app/backend/util/LocaleFallbackResolver.java | Provides locale fallback-chain generation for localized reads. |
| src/main/java/com/clbooster/app/backend/service/settings/SettingsDAO.java | Replaces stdout/stderr prints with SLF4J logging. |
| src/main/java/com/clbooster/app/backend/service/profile/UserDAO.java | Replaces stack traces with structured SLF4J logging; adds updateUser. |
| src/main/java/com/clbooster/app/backend/service/profile/ProfileService.java | Introduces locale-aware profile reads/writes and identity updates. |
| src/main/java/com/clbooster/app/backend/service/profile/ProfileDAO.java | Implements LocalizableDAO for profile translations and fallbacks. |
| src/main/java/com/clbooster/app/backend/service/profile/CoverLetterService.java | Hardens file path handling and extension normalization; adds logging. |
| src/main/java/com/clbooster/app/backend/service/profile/CoverLetterDAO.java | Replaces stack traces with structured SLF4J logging. |
| src/main/java/com/clbooster/app/backend/service/document/DocumentService.java | Enforces storage directory containment for resume file read/delete paths. |
| src/main/java/com/clbooster/app/backend/service/database/migration_v1_localization.sql | Adds SQL migration for locales + translation tables + utf8mb4 conversion. |
| src/main/java/com/clbooster/app/backend/service/database/DatabaseMigration.java | Adds Java-based migration utility to create/populate localization tables. |
| src/main/java/com/clbooster/app/backend/service/database/DatabaseConnection.java | Forces utf8mb4 charset/collation in MariaDB JDBC connection settings. |
| src/main/java/com/clbooster/app/backend/service/authentication/AuthenticationService.java | Integrates login/logout with Spring Security context + Vaadin session storage. |
| src/main/java/com/clbooster/app/backend/dao/LocalizableDAO.java | Adds a generic localization DAO interface for localized entity persistence. |
| src/main/java/com/clbooster/app/Application.java | Removes unused @Push annotation. |
| pom.xml | Adds Actuator, Jacoco XML/HTML reporting config, and Sonar Maven plugin properties. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to localization support, security integration, and code quality in the project. The main changes include a new database migration for localization, enhancements to authentication with Spring Security integration, improved database character encoding, and the addition of code quality and monitoring tools. Below are the most important changes grouped by theme:
Localization and Database Migration:
locale,profile_translation, andsystem_message_translation, as well as migration of existing profile data to the new translation table. All relevant tables are now set to useutf8mb4_unicode_cifor full Unicode support. [1] [2]DatabaseConnection.javato ensure all connections useutf8mb4character set and collation for proper Unicode handling.Authentication and Security:
AuthenticationServiceto integrate with Spring Security: user logins now establish a Spring Security context, and logouts clear it. Logging replaces console output for better traceability, and error handling is improved throughout registration, login, and password change flows. [1] [2] [3]Code Quality and Monitoring:
pom.xmlfor improved code quality monitoring, and included the Spring Boot Actuator for application health checks. [1] [2] [3]General Improvements:
LocalizableDAOinterface to standardize localization-related data access.DocumentServiceby using a safer path resolution method and removing unnecessary stack trace printing. [1] [2]@Pushannotation fromApplication.java. [1] [2]