mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-05 03:54:23 +00:00
* Fix childrenCount of organization in team (#19761) * Fix UT (#19761) * Fix code style (#20138) * Fix UT (#20138) (cherry picked from commit 7e8c94c7b8e046cdf697ded132a70eff5794b450)
This commit is contained in:
parent
66b7a8d2cc
commit
a3f730bab2
@ -3789,9 +3789,9 @@ public interface CollectionDAO {
|
||||
@SqlQuery(
|
||||
"SELECT te.id "
|
||||
+ "FROM team_entity te "
|
||||
+ "WHERE te.id NOT IN (SELECT :teamId) UNION "
|
||||
+ "WHERE te.id NOT IN ((SELECT :teamId) UNION "
|
||||
+ "(SELECT toId FROM entity_relationship "
|
||||
+ "WHERE fromId != :teamId AND fromEntity = 'team' AND relation = :relation AND toEntity = 'team')")
|
||||
+ "WHERE fromId != :teamId AND fromEntity = 'team' AND relation = :relation AND toEntity = 'team'))")
|
||||
List<String> listTeamsUnderOrganization(
|
||||
@BindUUID("teamId") UUID teamId, @Bind("relation") int relation);
|
||||
}
|
||||
|
||||
@ -506,20 +506,19 @@ public class TeamResourceTest extends EntityResourceTest<Team, CreateTeam> {
|
||||
invalidParentCount(1, DIVISION));
|
||||
|
||||
// Department can have more than one parent
|
||||
createWithParents(
|
||||
"dep",
|
||||
DEPARTMENT,
|
||||
div12.getEntityReference(),
|
||||
div21.getEntityReference(),
|
||||
ORG_TEAM.getEntityReference());
|
||||
createWithParents("dep", DEPARTMENT, div12.getEntityReference(), div21.getEntityReference());
|
||||
|
||||
ORG_TEAM = getEntity(ORG_TEAM.getId(), "children,childrenCount", ADMIN_AUTH_HEADERS);
|
||||
assertEquals(ORG_TEAM.getChildren().size(), ORG_TEAM.getChildrenCount());
|
||||
|
||||
//
|
||||
// Deletion tests to ensure no dangling parent/children relationship
|
||||
// Delete bu1 and ensure Organization does not have it a child and bu11, div12, dep13 don't
|
||||
// change Org to parent
|
||||
deleteEntity(bu1.getId(), true, true, ADMIN_AUTH_HEADERS);
|
||||
ORG_TEAM = getEntity(ORG_TEAM.getId(), "children", ADMIN_AUTH_HEADERS);
|
||||
ORG_TEAM = getEntity(ORG_TEAM.getId(), "children,childrenCount", ADMIN_AUTH_HEADERS);
|
||||
assertEntityReferencesDoesNotContain(ORG_TEAM.getChildren(), bu1.getEntityReference());
|
||||
assertEquals(ORG_TEAM.getChildren().size(), ORG_TEAM.getChildrenCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user