Skip to content

Conversation

@mercyblitz
Copy link
Contributor

This pull request enhances the metadata handling for Redis command methods by adding support for parameter names in addition to parameter types. It updates the MethodMetadata class, the metadata generator, and related test cases to include and validate method parameter names. There are also minor improvements to string formatting and test assertions for clarity and consistency.

Enhancements to Method Metadata:

  • Added a parameterNames field to the MethodMetadata class, with corresponding getter, setter, and inclusion in equals, hashCode, and toString methods. [1] [2] [3]
  • Updated test cases in MethodMetadataTest to set and assert parameterNames, ensuring correct behavior and equality checks. [1] [2] [3]

Metadata Generation Improvements:

  • Modified the SpringDataRedisMetadataGenerationDoclet to extract and store method parameter names alongside parameter types when generating metadata, including a new metadata key and logic for resolving parameter names and types. [1] [2] [3]

Code Quality and Consistency:

  • Improved toString methods in Parameter and ParameterMetadata to use symbolic constants for formatting, ensuring consistency across metadata classes. [1] [2] [3] [4]
  • Updated test assertions in ParameterTest and ParameterMetadataTest to use assertNotEquals for clarity. [1] [2] [3]

Dependency Management:

  • Added a property for junit.version in the parent POM for centralized test dependency management.

Documentation:

  • Fixed the Maven badge in README.md to reference the correct artifact.

Changed the Maven badge in README.md to reference microsphere-redis instead of microsphere-gateway for accuracy.
Introduced junit.version property and added JUnit BOM to dependencyManagement for consistent JUnit version management across modules.
Updated the hashCode test in ParameterMetadataTest to use assertNotEquals instead of assertFalse for improved clarity and correctness.
Updated ParameterTest to use assertNotEquals instead of assertFalse for hashCode comparisons, improving clarity and intent of the assertions.
Moved closing brace to a new line in the @SpringBootTest 'classes' array for improved readability and consistency.
Deleted the trailing newline at the end of DoubleSerializer.java to conform to file formatting standards.
Replaced fully qualified class names with simple class names in Javadoc references for improved readability in RangeModel.
Deleted an unnecessary blank line at the end of the pom.xml file to maintain consistent formatting.
Added explicit parameterNames fields to all method entries in spring-data-redis-metadata.yaml for improved clarity and introspection of Redis command interfaces.
Introduced a new field 'parameterNames' with corresponding getter and setter in MethodMetadata. Updated equals, toString, and related logic to include parameterNames for more detailed method metadata representation.
Updated the toString method in Parameter to use symbol constants for comma and square brackets from SymbolConstants, improving consistency and maintainability.
Updated ParameterMetadata.toString() to use COMMA, LEFT_SQUARE_BRACKET, and RIGHT_SQUARE_BRACKET from SymbolConstants for improved consistency and maintainability.
Extended MethodMetadataTest to include assertions and setup for the parameterNames property, improving test coverage for MethodMetadata's equality and getter/setter methods.
Introduces collection and storage of method parameter names in the generated metadata for Spring Data Redis command methods. Refactors parameter type resolution and updates the metadata map to include both parameter names and types.
Updated getParameterMetadataList to use parameter names from MethodMetadata when available, falling back to buildParameterMetadataList if not. Removed unused Parameter import and related code for improved clarity.
Introduced a unit test to verify that getParameterMetadataList returns the expected parameter metadata for Redis command methods, matching the output of buildParameterMetadataList.
Updated the test to use the parameter name from metadata if the reflection-based name is not present. This ensures compatibility with environments where parameter names are not retained at runtime.
@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ Complexity Δ
.../io/microsphere/redis/metadata/MethodMetadata.java 100.00% <100.00%> (ø) 27.00 <3.00> (+3.00)
.../java/io/microsphere/redis/metadata/Parameter.java 100.00% <100.00%> (ø) 16.00 <1.00> (ø)
.../microsphere/redis/metadata/ParameterMetadata.java 100.00% <100.00%> (ø) 12.00 <1.00> (ø)
...spring/metadata/SpringRedisMetadataRepository.java 100.00% <100.00%> (ø) 40.00 <3.00> (+1.00)
...here/redis/spring/serializer/DoubleSerializer.java 100.00% <ø> (ø) 5.00 <0.00> (ø)
...icrosphere/redis/spring/serializer/RangeModel.java 100.00% <ø> (ø) 12.00 <0.00> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Changed the project name from 'Microsphere Spring' to 'Microsphere Redis' in the license section to accurately reflect the repository.
@sonarqubecloud
Copy link

@mercyblitz mercyblitz merged commit 76fc481 into microsphere-projects:dev-1.x Dec 26, 2025
30 checks passed
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