Skip to content

feat(ci): integrate SonarQube code quality and JMeter performance testing into CI/CD pipeline - #20

Merged
Lion504 merged 42 commits into
mainfrom
feature/jmeterfix
Apr 23, 2026
Merged

feat(ci): integrate SonarQube code quality and JMeter performance testing into CI/CD pipeline#20
Lion504 merged 42 commits into
mainfrom
feature/jmeterfix

Conversation

@Lion504

@Lion504 Lion504 commented Apr 22, 2026

Copy link
Copy Markdown
Owner

This PR brings together two major quality assurance improvements: SonarQube static code analysis and JMeter-based performance testing, both integrated into the Jenkins CI/CD pipeline.

  1. SonarQube Integration
  • Configured SonarQube project with proper organization and unique project key
  • Updated Jenkinsfile to execute SonarQube analysis with quality gate validation
  • Cleaned up authentication flow by removing redundant parameters and using credentials binding
  • Added documentation for SonarQube setup and local usage in README.md
  1. JMeter Performance Testing
  • Added Dockerized JMeter test execution to Jenkins pipeline
  • Created clboost_performance.jmx test plan for automated load and stress testing
  • Integrated performance test stages (execution, report generation) into CI
  • Updated .gitignore to exclude JMeter artifacts (result.jtl, performance reports)
  • Added DOCKER_IMAGE environment variable support for containerized test execution
  • Authored comprehensive documentation (tests/performance/README.md, dev_instructions.md) covering setup, execution, and interpretation

4.Codebase Quality Improvements

  • Refactored backend services (DocumentService, ProfileService, etc.) for better maintainability
  • Reduced UI view cognitive complexity by extracting constants and centralizing component creation
  • Implemented ViewComponents and AuthComponents utility factories to minimize duplication
  • Hardened test suite reliability with improved Vaadin mock lifecycle management
  • Replaced System.out calls with proper SLF4J logging
  • Applied consistent code formatting and import optimization across all modified files

Lion504 added 30 commits April 19, 2026 20:51
Replace inline regex string matching with precompiled `Pattern` constants
in `AuthenticationService`, `ProfileView`, and `SignUpView` to improve
performance and maintainability.

Also update `.gitignore` to include SonarQube and SonarLint configuration
files.
Replace StreamResource with InputStreamDownloadHandler for file downloads
in EditorView to utilize the modern Vaadin download response API.

Also perform code cleanup in EditorView by removing unused imports,
unused fields (savedFilePath, loadingOverlay), and optimizing regex
patterns for filename sanitization.
Extract hardcoded design system values and repetitive UI construction
logic from LoginView and SignUpView into centralized utility classes.

- Create `StyleConstants` to manage Figma design system color constants.
- Create `AuthComponents` to provide reusable UI elements like cards
  and back links with consistent styling and hover effects.
- Refactor `LoginView` and `SignUpView` to use these new utilities,
  reducing code duplication and improving maintainability.
Move hardcoded "margin" string constants from LoginView to
AuthComponents to improve consistency and reduce duplication.

Update SignUpViewTest to call notification methods directly via
AuthComponents instead of using reflection on SignUpView.
Replace wildcard imports with explicit imports for Vaadin components
to improve code clarity and comply with static analysis standards.
Remove unused imports across multiple view components and restrict visibility of several view classes and test classes to package-private to improve encapsulation and comply with SonarLint recommendations.
Introduce `transient` modifiers to service and user dependencies in various view components to ensure proper serialization behavior. Replace hardcoded session keys with private static constants in `TranslationService` and `ThemeService` to improve maintainability and reduce magic strings.
Replace `System.out.println` calls with SLF4J logging in `ProfileService` to improve observability and follow production standards. Extract magic strings and SQL fragments into private static constants in `DatabaseMigration`, `ProfileService`, and `LocaleMapper` to enhance maintainability.

- Refactor `ProfileService` to use `log.info` and `log.error` instead of `System.out`.
- Centralize `ENGINE_CHARSET` in `DatabaseMigration`.
- Introduce `NOT_SET` and `EN_US` constants to reduce duplication.
- Optimize `Utf8Validator` by replacing `replaceAll` with `replace` for null character removal.
Refactor `formatResumeContent` in `DocumentService` by extracting complex string building logic into smaller, specialized private methods. This improves readability and reduces the cyclomatic complexity of the main formatting method.

Additionally, remove an unused reflection-based test invocation in `LandingViewTest`.
Refactor various UI components to use private constants instead of hardcoded
CSS values, improving maintainability and consistency.

- Extract common CSS values (colors, margins, letter-spacing) into constants
  within view classes.
- Replace inline style strings with constant references in DashboardView,
  GeneratorWizardView, HistoryView, MainLayout, NotificationsView,
  OnboardingView, ProfileView, ResumeManagerView, and SettingsView.
- Remove unused toggle track and thumb fields in SettingsView.
- Improve DashboardView file listing logic and add fallback mock data.
Refactor multiple view components to improve maintainability, reduce
cognitive complexity, and eliminate magic strings/numbers.

- Extract hardcoded CSS properties and magic strings into private
  constants or `StyleConstants`.
- Decompose complex methods in `CoverLetterEditorView` and `HistoryView`
  into smaller, single-responsibility helper methods.
- Replace inline regex and format patterns with named constants.
- Standardize component styling using helper methods in `SettingsView`.
- Improve password validation logic in `ProfileView` by extracting
  it into a dedicated method.
…ogic

Introduce a centralized `ViewComponents` utility to standardize UI element
creation and reduce boilerplate across view components.

- Add `ViewComponents` factory for buttons, headers, and section cards.
- Replace manual styling and component instantiation in `OnboardingView`,
  `ProfileView`, `NotificationsView`, and `GeneratorWizardView`.
- Delegate DOCX parsing to `Parser` service in `CoverLetterEditorView` and
  `HistoryView`.
- Migrate CLI output from `System.out` to `java.util.logging.Logger`.
- Refactor stream operations to use `.toList()` for improved readability.
Refactor the codebase to improve maintainability and reduce code duplication by:
- Centralizing UI component creation logic in `ViewComponents` and `AuthComponents`.
- Standardizing button styles (gradient vs solid) across various views.
- Improving code formatting and removing redundant whitespace/empty lines.
- Refactoring service methods to follow consistent line-wrapping patterns.
- Cleaning up unused imports and improving code readability in backend services and views.
Address technical debt and code quality issues identified by Sonar:
- Replace string concatenation in logging with parameterized log messages in `CLgenerator_CLI`.
- Refactor `GeneratorWizardView` to use a more robust upload handler.
- Simplify event listener syntax in various views to reduce cognitive complexity.
- Remove unused imports and redundant constant definitions in `NotificationsView`, `OnboardingView`, and `SettingsView`.
- Update unit tests to use `MockedConstruction` for `Parser` instead of manual ZIP manipulation, improving test stability and speed.
- Fix potential null pointer issues and improve error handling in view components.
Refactor view components to reduce complexity and improve maintainability:
- Extract timestamp parsing logic into a private method in `HistoryView`.
- Implement `defaultIfNull` helper in `ProfileView` to streamline field updates.
- Convert manual main-method tests to proper JUnit 5 test cases in `DatabaseConnectionTest`.
- Improve test assertions and visibility in `ThemeServiceTest` and `BaseVaadinViewTest`.
Implement various improvements across the backend and AI service modules to enhance observability, robustness, and compliance with coding standards:

- Replace `System.out` calls with SLF4J logging in `AIService`, `Exporter`, and `Main`.
- Update `DocumentService` to use structured logging with `java.util.logging.Level`.
- Improve exception handling by replacing generic `RuntimeException` with more specific `IllegalStateException` in `Exporter`, `Parser`, and `UserDAO`.
- Refactor `ProfileService` to use explicit `Locale` in deprecated methods and improve email validation logic.
- Enhance `CoverLetterService` to return empty byte arrays instead of `null` to prevent potential `NullPointerException`.
- Add private constructor to `LocaleMapper` to prevent instantiation of utility class.
- Update unit tests in `ProfileServiceTest` and `CLgenerator_CLITest` to reflect changes in method signatures and improve assertion accuracy.
- Update `CoverLetterServiceTest` to assert empty byte arrays instead of null to match service implementation changes.
- Add `tearDownVaadinMockEnvironment` to `BaseVaadinViewTest` to ensure proper cleanup of Vaadin mocks after test execution.
Improve the reliability of the `tearDownVaadinMockEnvironment` method by
adding checks to ensure mocks are not already closed and wrapping
individual close operations in try-catch blocks to prevent exceptions
from interrupting the cleanup process.
Remove redundant try-catch blocks from the `tearDownVaadinMockEnvironment` method to streamline the cleanup process.
Enhance the Jenkins pipeline by adding automated static code analysis
via SonarQube with quality gate enforcement and performance testing
using JMeter. Includes configuration for JMeter environment paths
and automated archiving of performance test reports.
Add a comprehensive section detailing the Apache JMeter test plan,
including test scenarios, local execution instructions, CI integration
details, and guidance on interpreting performance metrics.
Add detailed instructions for installing Apache JMeter and running
the performance test plans, including command-line arguments and
how to interpret the generated HTML reports.
Add a new JMeter test plan to evaluate the performance of the
clboost component, including thread groups, HTTP request defaults,
and cookie management for session handling.
Create a README for the performance testing directory to guide users
on how to execute JMeter test plans, configure parameters, and
interpret results. Also update .gitignore to exclude local JTL
result files.
Pass the SONAR_TOKEN environment variable to the sonar:sonar goal to
ensure authenticated analysis. Simplify the quality gate stage by
using the built-in abortPipeline parameter and adding a timeout to
prevent the pipeline from hanging indefinitely.
Lion504 added 11 commits April 22, 2026 17:16
Update the SonarQube configuration to use the new project key 'CLboost'
and remove the legacy organization setting to match the updated
project identity.
The sonar token is already provided by the `withSonarQubeEnv` wrapper,
making the explicit `-Dsonar.token` flag unnecessary.
Define the DOCKER_IMAGE variable to specify the Docker Hub repository for use in subsequent pipeline stages.
Add report directory to .gitignore to prevent performance test artifacts from being tracked.
Refactor the Performance Test stage to run JMeter against a containerized
instance of the application instead of a local process. This includes
automated container lifecycle management (build, run, stop, rm) and
a health check loop to ensure the service is ready before testing.

Additionally, updates the deployment stage to push the built images to
Docker Hub upon successful pipeline execution.
Update the `credentialsId` used in the `withDockerRegistry` block from `DOCKER_HUB_CREDS` to `docker-hub-credentials` to match the updated environment configuration.
Replace the hardcoded credential ID in the `withDockerRegistry` block with the `DOCKER_HUB_CREDS` environment variable to improve maintainability and centralize configuration.
Replace the `withDockerRegistry` DSL with a `withCredentials` block and manual `docker login` shell commands to handle image pushing.
Reformat various source files and tests to improve code style and readability. This includes:
- Adjusting line wraps and indentation in service, view, and utility classes.
- Cleaning up whitespace in `LocaleMapper.java` and `OnboardingView.java`.
- Reformatting event listener lambdas in multiple view components for better clarity.
- Updating test files to follow consistent formatting standards.
@Lion504 Lion504 changed the title Feature/jmeterfix feat(ci): integrate SonarQube code quality and JMeter performance testing into CI/CD pipeline Apr 23, 2026
Add integration test to verify database connection functionality.
@Lion504
Lion504 marked this pull request as ready for review April 23, 2026 08:16
Copilot AI review requested due to automatic review settings April 23, 2026 08:16
@Lion504
Lion504 merged commit 175d7a6 into main Apr 23, 2026
2 checks passed
@Lion504
Lion504 deleted the feature/jmeterfix branch April 23, 2026 08:16
@Lion504
Lion504 removed the request for review from Copilot April 23, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant