-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73494/
-----------------------------------------------------------

(Updated Aug. 4, 2021, 11:38 a.m.)


Review request for atlas, Jayendra Parab, Nikhil Bonte, Nixon Rodrigues, Pinal 
Shah, and Sarath Subramanian.


Bugs: ATLAS-4376
    https://issues.apache.org/jira/browse/ATLAS-4376


Repository: atlas


Description
-------

When tried to get the typedef of a relationship by:

atlasClient.getRelationshipDefByName(name)
This will get translated into the following REST request: 
/api/atlas/v2/types/structdef/name/

{name}

The correct REST request should be: 
/api/atlas/v2/types/relationshipdef/name/{name}
The reason why it's querying a structdef and not a relationshipdef is due to a 
bug in AtlasClientV2 line 1135:

} else if (AtlasStructDef.class.isAssignableFrom(typeDefClass))

{ return "structdef"; }
else if (AtlasRelationshipDef.class.isAssignableFrom(typeDefClass)) {
return "relationshipdef";
Since AtlasRelationshipDef extends AtlasStructDef, the first "if" branch will 
always be true and the second "if" branch will never happen. The fix for this 
issue is to reverse the two "if" branches.

provide test cases for all "if" branches to ensure the querying works correctly


Diffs (updated)
-----

  client/client-v2/src/main/java/org/apache/atlas/AtlasClientV2.java eb0e630f9 
  client/client-v2/src/test/java/org/apache/atlas/AtlasClientV2Test.java 
83a3391eb 


Diff: https://reviews.apache.org/r/73494/diff/2/

Changes: https://reviews.apache.org/r/73494/diff/1-2/


Testing
-------

mvn clean install -Drat.skip
mvn clean package -Pdist,embedded-hbase-solr -DskipTests -Drat.skip
testcases added


Thanks,

chaitali

Reply via email to