Skip to content

Review Service: Add entity validation and tests fix #7#34

Open
Gowrishbyndoor wants to merge 34 commits intomainfrom
task/7-validate-Review-entities-before-persisting
Open

Review Service: Add entity validation and tests fix #7#34
Gowrishbyndoor wants to merge 34 commits intomainfrom
task/7-validate-Review-entities-before-persisting

Conversation

@Gowrishbyndoor
Copy link
Copy Markdown

@Gowrishbyndoor Gowrishbyndoor commented Oct 24, 2025

Ref issue #7

  • Annotate fields in ReviewEntity with validation constraints
  • Introduce ReviewValidationTests to validate ReviewEntity constraints
    Fixed manual validation to correspond task description requirements
    Fixed task description requirements : added "no more than 200 characters"

We need to ensure that:

productId / reviewId >= 0
author / subject / content are not blank
content is more than 50  and  **no more than 200 characters**

Additionally: fixed the alignment issue and removed unwanted file change

FAIL_TO_PASS: shop.microservices.core.review.PersistenceTests, shop.microservices.core.review.ReviewServiceApiTests, shop.microservices.core.review.ReviewValidationTests, shop.microservices.core.review.ReviewServiceApplicationTests

dtsaryov and others added 30 commits July 22, 2025 12:44
…er is a non-negative integer

Declare a RestControllerAdvice class to handle API exceptions and return proper responses.
Write tests to check the validation
- Create ServiceUtil for service discovery
- Implement ProductCompositeIntegration and update ProductCompositeService with aggregated responses
- Update tests to check updated behavior
- Configure JPA with MySQL for persistence
- Add `ReviewEntity` and `ReviewRepository` for database operations
- Declare and implement CRUD operations for the 'ReviewService' API endpoint
- Configure MySQL in 'docker-compose.yml'
- Update application properties for local and Docker profiles
- Add integration tests with Testcontainers for API and persistence layer
- Add `spring-boot-starter-validation` dependency to enable bean validation
- Annotate fields in `ReviewEntity` with validation constraints
- Introduce `ReviewValidationTests` to validate `ReviewEntity` constraints
- Add Flyway dependencies to manage DB schema migrations
- Add 'V1__' migration script to create 'reviews' table with constraints
- Add `ReviewDbMigrationTest` to validate Flyway migrations
- Extend `ReviewEntity` with a non-null `date` field
- Update database schema with Flyway migration 'V2__'
- Modify API contract and record `Review` to include `date`
- Adjust validation rules and tests for new field
- Add `LocalDateConverter` for proper `LocalDate` serialization/deserialization
…ayer

- Configure MongoDB Docker container
- Update `docker-compose.yml` to include a MongoDB service with health checks
- Add CRUD operations for recommendation
- Write integration tests with Testcontainers
- Add 'spring-boot-starter-validation' dependency to enable bean validation
- Introduce 'MongoDbValidationConfig' to integrate validation with MongoDB
- Update 'RecommendationEntity' with validation annotations for fields
- Modify tests to include validation scenarios
- Add 'RecommendationValidationTests' to validate entity constraints
… layer

- Configure PostgreSQL in 'docker-compose.yml' and application configurations
- Add 'ProductEntity' and 'ProductRepository' for database operations
- Implement CRUD operations in 'ProductServiceImpl'
- Add API endpoints for product CRUD operations
- Write test cases using Testcontainers for persistence and API integration
…ize schema

- Add Liquibase dependency and initial changelog with 'products' table creation
- Update application configuration to use Liquibase for schema management
- Replace SQL-based initialization with Liquibase
- Add 'ProductMigrationTest' to verify Liquibase migrations with Testcontainers
…delete composite products

- Implement CRUD operations for composite products in `ProductCompositeService`
- Add new endpoints with OpenAPI documentation: POST, DELETE for composite products
- Enhance service layer with integration methods and logging
- Refactor product, recommendations, and reviews retrieval logic
- Update tests with comprehensive cases for new operations
- Remove `MappingUtils` and its usages
- Introduce `ReviewMapper` interface using MapStruct for mapping logic
- Add MapStruct dependency and configuration in `build.gradle`
- Update `ReviewServiceImpl` to use `ReviewMapper` for mapping operations
- Add `ReviewMapperTest` to verify mapping functionality
- Remove `MappingUtils` and its usages
- Introduce `RecommendationMapper` interface using MapStruct for mapping logic
- Add MapStruct dependency and configuration in `build.gradle`
- Update `RecommendationServiceImpl` to use `RecommendationMapper` for mapping operations
- Add `RecommendationMapperTest` to verify mapping functionality
- Remove `MapperUtils` and its usages
- Introduce `ProductMapper` interface using MapStruct for mapping logic
- Add MapStruct dependency and configuration in `build.gradle`
- Update `ProductServiceImpl` to use `ProductMapper` for mapping operations
- Add `ProductMapperTest` to verify mapping functionality
- Replace synchronous RestTemplate with WebClient across microservices
- Refactor repositories to use reactive CRUD operations
- Update service implementations and test cases accordingly
- Transition from traditional MVC to WebFlux stack for all APIs and testing frameworks
- Remove unused synchronous methods, libraries, and dependencies
- Add messaging support across microservices using Spring Cloud Stream with RabbitMQ
- Replace HTTP-based communication with event-driven messaging for create and delete operations
- Add event models and processing logic in `api` module
- Update `ProductCompositeIntegration` to publish and consume events
- Refactor tests and add message-driven test cases for all event-processing scenarios
- Integrate Health Checks for underlying services using Actuator
…tion

- Add Eureka Server module with Spring Cloud Netflix Eureka
- Integrate Eureka client in all microservices for service discovery
- Replace hardcoded service URLs with dynamic resolution through Eureka
- Update WebClient configuration to support load balancing with Eureka
- Refactor configuration files to include Eureka settings
- Modify Docker Compose to include Eureka Server
- Enhance logging and error handling in `ProductCompositeIntegration` for service calls
- Add tests for Eureka Server and client integration
- Introduce 'NotFoundException'
- Update 'ProductServiceImpl' to throw 'NotFoundException' when no product is found
- Modify 'ProductCompositeIntegration' logic to handle `NotFoundException` from downstream services
- Add 'GlobalControllerExceptionHandler' to process `NotFoundException` responses with proper HTTP status
…management-20250726184713

Add workflow: pr-label-management.yml
- Adjust the DTO and the entity to handle the new field
- Add validation for the new field and update tests
- Generate Flyway update scripts
- Update test cases across all services to include and validate the new field
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

3 similar comments
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor Gowrishbyndoor force-pushed the task/7-validate-Review-entities-before-persisting branch from 217ec0f to 4a56208 Compare October 24, 2025 15:02
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

2 similar comments
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor Gowrishbyndoor force-pushed the task/7-validate-Review-entities-before-persisting branch from 4a56208 to c6bac9b Compare October 25, 2025 15:32
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

2 similar comments
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor Gowrishbyndoor force-pushed the task/7-validate-Review-entities-before-persisting branch from c6bac9b to e0dc145 Compare October 25, 2025 16:40
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

3 similar comments
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor Gowrishbyndoor force-pushed the task/7-validate-Review-entities-before-persisting branch 2 times, most recently from 273e694 to 635c663 Compare October 25, 2025 17:31
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

4 similar comments
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the PR

@Gowrishbyndoor Gowrishbyndoor force-pushed the task/7-validate-Review-entities-before-persisting branch from 635c663 to dc32b70 Compare October 25, 2025 18:33
@Gowrishbyndoor
Copy link
Copy Markdown
Author

@issue-validator validate the issue

- Annotate fields in `ReviewEntity` with validation constraints
- Introduce `ReviewValidationTests` to validate `ReviewEntity` constraints

We need to ensure that:

    productId / reviewId >= 0
    author / subject / content are not blank
    content is more than 50  and  no more than 200 characters

Additionally: fixed the alignment issue and removed unwanted file change

FAIL_TO_PASS: shop.microservices.core.review.PersistenceTests, shop.microservices.core.review.ReviewServiceApiTests, shop.microservices.core.review.ReviewValidationTests, shop.microservices.core.review.ReviewServiceApplicationTests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants