mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (Cloud/4.3) to HEAD (Cloud/4.3)
62533: MNT-10030: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX 61363: MNT-10030 Links on Share Repository search page show incorrect link name; do not work when root-node is defined - New fix for MNT-9056. 62392: MNT-10030 Links on Share Repository search page show incorrect link name; do not work when root-node is defined - In AdvancedSearchTest was added testSearchInSites test. - In search.lib.js in splitQNamePath() was added check: (rootNodeQNamePath != null && path.indexOf(rootNodeQNamePath) === 0). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62792 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,7 +26,9 @@ public class AdvancedSearchTest extends BaseWebScriptTest
|
||||
{
|
||||
private static final String TEST_FILE_NAME1 = "qwe iop.txt";
|
||||
private static final String TEST_FILE_NAME2 = "qwe yu iop.txt";
|
||||
private static final String TEST_IN_SITES_FILE_NAME = "qwesiteiop";
|
||||
private static final String SEARCH_NAME = "qwe iop";
|
||||
private static final String SEARCH_IN_SITES = "qwesiteiop";
|
||||
private static final String TEST_FOLDER = "test_folder-" + System.currentTimeMillis();
|
||||
|
||||
private TransactionService transactionService;
|
||||
@@ -38,6 +40,7 @@ public class AdvancedSearchTest extends BaseWebScriptTest
|
||||
private NodeRef testNodeRef1;
|
||||
private NodeRef testNodeRef2;
|
||||
private NodeRef folderNodeRef;
|
||||
private NodeRef rootNodeRef;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
@@ -52,9 +55,9 @@ public class AdvancedSearchTest extends BaseWebScriptTest
|
||||
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
|
||||
NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||
this.rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||
|
||||
List<NodeRef> results = searchService.selectNodes(rootNodeRef, "/app:company_home", null, namespaceService, false);
|
||||
List<NodeRef> results = searchService.selectNodes(this.rootNodeRef, "/app:company_home", null, namespaceService, false);
|
||||
if (results.size() == 0)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Can't find /app:company_home");
|
||||
@@ -72,6 +75,14 @@ public class AdvancedSearchTest extends BaseWebScriptTest
|
||||
assertNotNull(testNodeRef2);
|
||||
}
|
||||
|
||||
private void deleteNodeIfExists(NodeRef nodeRef)
|
||||
{
|
||||
if (nodeService.exists(nodeRef))
|
||||
{
|
||||
nodeService.deleteNode(nodeRef);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
@@ -87,13 +98,6 @@ public class AdvancedSearchTest extends BaseWebScriptTest
|
||||
return null;
|
||||
}
|
||||
|
||||
private void deleteNodeIfExists(NodeRef nodeRef)
|
||||
{
|
||||
if (nodeService.exists(nodeRef))
|
||||
{
|
||||
nodeService.deleteNode(nodeRef);
|
||||
}
|
||||
}
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(deleteCallback);
|
||||
this.authenticationComponent.clearCurrentSecurityContext();
|
||||
@@ -113,4 +117,29 @@ public class AdvancedSearchTest extends BaseWebScriptTest
|
||||
assertEquals(1, result.getInt("totalRecords"));
|
||||
}
|
||||
|
||||
public void testSearchInSites() throws IOException, JSONException
|
||||
{
|
||||
List<NodeRef> results = searchService.selectNodes(this.rootNodeRef, "/app:company_home/st:sites", null, namespaceService, false);
|
||||
if (results.size() == 0)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Can't find /app:company_home/st:sites");
|
||||
}
|
||||
|
||||
NodeRef sitesNodeRef = results.get(0);
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
NodeRef sitefolderNodeRef = fileFolderService.create(sitesNodeRef, TEST_FOLDER, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||
NodeRef nodeRef = fileFolderService.create(sitefolderNodeRef, TEST_IN_SITES_FILE_NAME + time, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
// String url = "/slingshot/search?site=&term=" + SEARCH_NAME + "&tag=&maxResults=251&sort=&query=&repo=false&rootNode=alfresco%3A%2F%2Fcompany%2Fhome&pageSize=50&startIndex=0";
|
||||
String url = "/slingshot/search?site=&term=&tag=&maxResults=251&sort=&query={\"prop_cm_name\":\"" + SEARCH_IN_SITES + time + "\",\"datatype\":\"cm:content\"}&repo=true&rootNode=alfresco://company/home";
|
||||
Response res = sendRequest(new GetRequest(url), Status.STATUS_OK);
|
||||
JSONObject result = new JSONObject(res.getContentAsString());
|
||||
assertEquals(1, result.getInt("totalRecords"));
|
||||
|
||||
deleteNodeIfExists(nodeRef);
|
||||
deleteNodeIfExists(sitefolderNodeRef);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user