120
120
import org .junit .jupiter .api .AfterAll ;
121
121
import org .junit .jupiter .api .Assumptions ;
122
122
import org .junit .jupiter .api .BeforeAll ;
123
- import org .junit .jupiter .api .Order ;
124
123
import org .junit .jupiter .api .Test ;
125
124
import org .junit .jupiter .api .TestInfo ;
126
125
import org .junit .jupiter .api .TestInstance ;
131
130
import org .openmetadata .csv .EntityCsvTest ;
132
131
import org .openmetadata .schema .CreateEntity ;
133
132
import org .openmetadata .schema .EntityInterface ;
134
- import org .openmetadata .schema .api .VoteRequest ;
135
133
import org .openmetadata .schema .api .data .RestoreEntity ;
136
134
import org .openmetadata .schema .api .data .TermReference ;
137
135
import org .openmetadata .schema .api .domains .CreateDataProduct ;
@@ -901,36 +899,14 @@ void test_fieldFetchersEfficiency(TestInfo test) throws HttpResponseException {
901
899
}
902
900
903
901
if (fields .contains ("followers" ) && supportsFollowers ) {
904
- // Get the actual followers from both bulk and individual loading
905
- List <EntityReference > bulkFollowers = entity .getFollowers ();
906
- List <EntityReference > individualFollowers = individualEntity .getFollowers ();
907
-
908
- // The test should verify that followers are actually fetched and populated
909
- // Previously this might have passed because both were null/empty due to missing field
910
- // support
902
+ // Note: followers might be null if no followers exist, which is expected
903
+ List <?> bulkFollowers = (List <?>) getField (entity , "followers" );
904
+ List <?> individualFollowers = (List <?>) getField (individualEntity , "followers" );
911
905
assertEquals (
912
906
listOrEmpty (bulkFollowers ).size (),
913
907
listOrEmpty (individualFollowers ).size (),
914
908
"Followers field should be consistently loaded in bulk operations for fields: "
915
909
+ fields );
916
-
917
- // Add verification that if followers exist, they have proper entity references
918
- if (!listOrEmpty (bulkFollowers ).isEmpty ()) {
919
- for (EntityReference follower : bulkFollowers ) {
920
- assertNotNull (follower .getId (), "Follower should have valid ID" );
921
- assertNotNull (follower .getName (), "Follower should have valid name" );
922
- assertNotNull (follower .getType (), "Follower should have valid type" );
923
- }
924
- }
925
-
926
- // Verify that the followers data matches between bulk and individual fetch
927
- if (!listOrEmpty (bulkFollowers ).isEmpty ()
928
- && !listOrEmpty (individualFollowers ).isEmpty ()) {
929
- assertEquals (
930
- bulkFollowers ,
931
- individualFollowers ,
932
- "Followers data should be identical between bulk and individual loading" );
933
- }
934
910
}
935
911
}
936
912
@@ -947,70 +923,6 @@ void test_fieldFetchersEfficiency(TestInfo test) throws HttpResponseException {
947
923
}
948
924
}
949
925
950
- @ Test
951
- @ Order (5 )
952
- @ Execution (ExecutionMode .CONCURRENT )
953
- void test_bulkFollowersVotesFetchers (TestInfo test ) throws IOException {
954
- // Use a name that always lands first alphabetically.
955
- // Note: The special character "\!A_" is prefixed to ensure the entity sorts before others.
956
- // This allows us to verify ordering without listing all 100 entities.
957
- String alwaysFirstName = "!A_AlwaysFirstEntity" ;
958
-
959
- if (!supportsFieldsQueryParam ) {
960
- return ;
961
- }
962
-
963
- K request = createRequest (alwaysFirstName );
964
- T entity = createEntity (request , ADMIN_AUTH_HEADERS );
965
-
966
- // Add a follower if supported.
967
- if (supportsFollowers ) {
968
- addFollower (entity .getId (), USER1 .getId (), OK , ADMIN_AUTH_HEADERS );
969
- }
970
-
971
- // Vote up the entity if supported.
972
- if (supportsVotes ) {
973
- VoteRequest voteReq = new VoteRequest ().withUpdatedVoteType (VoteRequest .VoteType .VOTED_UP );
974
- WebTarget voteTarget = getResource (entity .getId ()).path ("vote" );
975
- TestUtils .put (voteTarget , voteReq , ChangeEvent .class , OK , ADMIN_AUTH_HEADERS );
976
- }
977
-
978
- // Bulk fetch of entities with all allowed fields.
979
- String allFields = getAllowedFields ();
980
- Map <String , String > params = new HashMap <>();
981
- params .put ("fields" , allFields );
982
- ResultList <T > bulk = listEntities (params , ADMIN_AUTH_HEADERS );
983
-
984
- // Verify that the created entity is present in the bulk results.
985
- T bulkEntity =
986
- bulk .getData ().stream ()
987
- .filter (e -> e .getId ().equals (entity .getId ()))
988
- .findFirst ()
989
- .orElse (null );
990
- assertNotNull (bulkEntity );
991
-
992
- // Fetch the individual entity to compare details.
993
- T individual = getEntity (entity .getId (), allFields , ADMIN_AUTH_HEADERS );
994
-
995
- // Ensure follower counts match for both bulk and individual fetches.
996
- if (supportsFollowers ) {
997
- assertNotNull (bulkEntity .getFollowers ());
998
- assertEquals (
999
- listOrEmpty (individual .getFollowers ()).size (),
1000
- listOrEmpty (bulkEntity .getFollowers ()).size ());
1001
- }
1002
-
1003
- // Ensure vote counts match for bulk and individual fetching.
1004
- if (supportsVotes ) {
1005
- assertNotNull (bulkEntity .getVotes ());
1006
- assertEquals (individual .getVotes ().getUpVotes (), bulkEntity .getVotes ().getUpVotes ());
1007
- assertEquals (individual .getVotes ().getDownVotes (), bulkEntity .getVotes ().getDownVotes ());
1008
- }
1009
-
1010
- // Clean up the created test entity.
1011
- deleteEntity (entity .getId (), ADMIN_AUTH_HEADERS );
1012
- }
1013
-
1014
926
// Helper method to get field value using reflection
1015
927
private Object getField (T entity , String fieldName ) {
1016
928
try {
0 commit comments