AxonFramework / extension-multitenancy

Axon Framework extension providing handles to support multi tenancy with distinct buses and stores per tenant.
Apache License 2.0
10 stars 2 forks source link

Drop `properties` validation in `TenantDescriptor#equals` #158

Closed smcvb closed 8 months ago

smcvb commented 8 months ago

During a clean-up of this repository I (yes, me) accidentally introduces the propeties to the TenantDescriptor#equals method. This was, as it turns out, wrong.

The TenantDescriptor is both constructed by the extension it self and by users, both not necessarily knowledgable about the properties, but definitely knowledgable about the right tenantId. To have the multi-tenancy extension behave as intended, validating the TenantDescriptor based on just it's tenantId is paramount.

As such, this pull request removes properties from the TenantDescriptor#equals method again. Furthermore, I have added a test case to validate the properties field does not have any influence on the behavior of equals.

smcvb commented 8 months ago

Hash function also needs to drop properties return Objects.hash(tenantId, properties);

return Objects.hash(tenantId);

Sharp, and adjusted!

sonarcloud[bot] commented 8 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication