-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #901 from Alfresco/fix/SEARCH-2378_GroupMembersPARENT
SEARCH-2378: Storing every different PARENT for a Document instead of…
- Loading branch information
Showing
2 changed files
with
126 additions
and
26 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
...est/java/org/alfresco/test/search/functional/searchServices/search/SearchParentField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* #%L | ||
* Alfresco Search Services E2E Test | ||
* %% | ||
* Copyright (C) 2005 - 2020 Alfresco Software Limited | ||
* %% | ||
* This file is part of the Alfresco software. | ||
* If the software was purchased under a paid Alfresco license, the terms of | ||
* the paid license agreement will prevail. Otherwise, the software is | ||
* provided under the following open source license terms: | ||
* Alfresco is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* Alfresco is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | ||
* #L% | ||
*/ | ||
|
||
package org.alfresco.test.search.functional.searchServices.search; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.alfresco.rest.search.SearchResponse; | ||
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest; | ||
import org.alfresco.utility.data.DataGroup; | ||
import org.alfresco.utility.model.GroupModel; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.testng.Assert; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Test class tests PARENT field is including all the PARENT Nodes | ||
* Created for SEARCH-2378 | ||
*/ | ||
public class SearchParentField extends AbstractE2EFunctionalTest | ||
{ | ||
@Autowired | ||
protected DataGroup dataGroup; | ||
|
||
List<GroupModel> groups; | ||
|
||
@BeforeClass(alwaysRun = true) | ||
public void dataPreparation() | ||
{ | ||
|
||
groups = new ArrayList<>(); | ||
groups.add(dataGroup.createRandomGroup()); | ||
groups.add(dataGroup.createRandomGroup()); | ||
|
||
dataGroup.addListOfUsersToGroup(groups.get(0), testUser); | ||
dataGroup.addListOfUsersToGroup(groups.get(1), testUser); | ||
|
||
waitForIndexing( | ||
"TYPE:'cm:authorityContainer' AND cm:authorityName:'GROUP_" + groups.get(1).getGroupIdentifier() + "'", | ||
true); | ||
|
||
} | ||
|
||
/** | ||
* Test users in groups can be found using PARENT expressions. | ||
*/ | ||
@Test(priority = 1) | ||
public void testSearchParentForPerson() throws Exception | ||
{ | ||
|
||
for (GroupModel group : groups) | ||
{ | ||
|
||
// Find groupId to be used in the PARENT expression | ||
String queryGroup = "TYPE:'cm:authorityContainer' AND cm:authorityName:'GROUP_" + group.getGroupIdentifier() | ||
+ "'"; | ||
SearchResponse response = queryAsUser(dataUser.getAdminUser(), queryGroup); | ||
String groupId = response.getEntries().get(0).getModel().getId(); | ||
|
||
// Find the user assigned as member of this group with PARENT clause | ||
String queryParentGroup = "(TYPE:'cm:person' OR TYPE:'cm:authorityContainer') AND PARENT:'workspace://SpacesStore/" | ||
+ groupId + "'"; | ||
|
||
response = queryAsUser(dataUser.getAdminUser(), queryParentGroup); | ||
restClient.assertStatusCodeIs(HttpStatus.OK); | ||
Assert.assertEquals(response.getPagination().getCount(), 1, "Expecting 1 user (" + testUser.getUsername() | ||
+ ") as member of this group (" + group.getGroupIdentifier() + ")"); | ||
|
||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters