You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Jason Gerlowski (Jira)" <ji...@apache.org> on 2020/08/08 02:09:00 UTC

[jira] [Commented] (SOLR-14596) Add equals()/hashCode() impls to SolrJ Request objects

    [ https://issues.apache.org/jira/browse/SOLR-14596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17173543#comment-17173543 ] 

Jason Gerlowski commented on SOLR-14596:
----------------------------------------

The PR linked on this ticket covers what I guessed were the most common SolrRequest objects in practice: SolrRequest, UpdateRequest, and various CollectionAdminRequest implementations.  I'd initially hoped to cover more than that here - there are tons of classes that the equals/hashCode criticism applies to - but I think it's best to land these changes piecemeal.  I'm never sure how much time I can give to this, so I'd rather land _something_ than hope to cover more and never quite finish.  As such I'm going to scope down this ticket to cover only the classes mentioned above, and spin up others to cover CoreAdminRequest, ConfigSetAdminRequest, etc. as I get time or if others get interested.

One thing I'm unsure of in this PR - if we want SolrJ users to be able to rely on these equals implementations in their own test assertions, it'd be nice if we had tests to make sure that equality is reported correctly.  OTOH though, these tests could end up being lots of boilerplate that catches very few actual issues (since the equals() methods themselves are pretty formulaic).  I'm going to try writing some tests and see how it goes, but I may decide against it once I see how it looks.  If anyone has thoughts on the value tradeoff here I'd appreciate it.

> Add equals()/hashCode() impls to SolrJ Request objects
> ------------------------------------------------------
>
>                 Key: SOLR-14596
>                 URL: https://issues.apache.org/jira/browse/SOLR-14596
>             Project: Solr
>          Issue Type: Improvement
>          Components: SolrJ
>    Affects Versions: master (9.0), 8.5.2
>            Reporter: Jason Gerlowski
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, many SolrRequest classes (e.g. UpdateRequest) don't implement {{equals()}} or {{hashCode()}}
> This isn't a problem for Solr's normal operation, but it can be a barrier in unit testing SolrJ client code.  {{equals()}} implementations would make it much easier to assert that client code is building the request that developers _think_ it's building.  Of course, this testing benefit would apply to Solr's own tests which use SolrJ.
> This ticket covers making sure that the more popular SolrRequest objects have equals/hashcode implementations useful for testers.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org