mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged DEV/SWIFT to HEAD
27168: Added generics for cannedQueryRegistry 27169: Fixed formatting 27170: SOLR queries - ALF-7072 RSOLR 013: Remote API to get ACLs and readers - Queries for ACL ChangeSets and ACLs - WebScripts for AclChangeSetsGet - ALF-7071 and ALF-7072: Fix naming conventions 27171: Fixed MySQL create script (ALF-8336: RSOLR 013: DB upgrade scripts for ACL changes) 27337: Initial draft of the publishing API 27516: Get the basic WCM ML tests working, covering the simpler use cases 27517: More on the WCM-QS multi lingual support, further on the aspect and the unit tests for it 27518: Begin the WCM-QS webscript to return the translation details on a node 27519: Push some WCM-QS ML search logic into SiteHelper, and add a unit test for it 27542: - Initial skeleton of the channel API. - Initial draft of the publishing content model. 27546: ALF-7481: RSOLR 018: Execute query against SOLR - pass authority filter in json body to avoid possible issue over-running the max URL length 27559: Created a Web Site Generator tool which randomly generates WCM QS websites. 27561: Created ChannelServiceImpl and implemented the ChannelType registry. 27577: Start to pull across the WCM-QS ML custom action 27579: More pulling across the WCM-QS ML custom action 27580: More WCM-QS ML ui porting 27588: ALF-8421: RSOLR 037: Encapsulate the CMIS Query Parser 27589: Created a PublishingModel to hold Web Publishing constants. 27610: ALF-7874 Add iWorks mimetype entries 27624: Restructure index tracking 27630: ALF-8182: SVC 03: Object Picker needs to use new NodeLocatorService to resolve startLocation parameter The picker now uses the NodeLocatorService to look up some start locations and most importantly allows custom 'locators' to be used. All the current start location tokens are still supported i.e. {companyhome}, {userhome}, {siteshome}, {doclib}, {self} and {parent}. A new one has been added called {ancestor}, this will allow an ancestor node to be located, the node can be selected by type or aspect, see example below. Some node locators can take parameters, a "startLocationParams" has therefore been added to allow these to be specified. The example below shows how to configure a picker to start in the root folder of the site the node being edited is located within. <field id="fdk:contentMultiple"> <control> <control-param name="startLocation">{ancestor}</control-param> <control-param name="startLocationParams">type=st:site</control-param> </control> </field> 27631: ALF-8182: SVC 03: Object Picker needs to use new NodeLocatorService to resolve startLocation parameter Centralised node locator classes to repo.nodelocator package (moved out of repo.node package as that area is reserved for low level node processing) and made all naming consistent i.e. nodelocator rather than nodelocation. 27633: Fixed cmis:objectTypeId property definition (required = true, see CMIS 1.0 errata 1) 27635: CMIS compliance fixes 27638: - Initial operational publishing context with model bootstrapped. - First implementation of ChannelService.getChannels and ChannelService.createChannel. Test cases to follow imminently... git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28301 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,13 +19,20 @@
|
||||
package org.alfresco.repo.domain.solr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.repo.domain.node.Node;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.solr.Acl;
|
||||
import org.alfresco.repo.solr.AclChangeSet;
|
||||
import org.alfresco.repo.solr.NodeParameters;
|
||||
import org.alfresco.repo.solr.Transaction;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -51,7 +58,117 @@ public class SOLRDAOTest extends TestCase
|
||||
authenticationComponent.setSystemUserAsCurrentUser();
|
||||
}
|
||||
|
||||
public void testQueryTransactionsNoLimit()
|
||||
public void testQueryChangeSets_NoLimit()
|
||||
{
|
||||
long startTime = System.currentTimeMillis() - (5 * 60000L);
|
||||
|
||||
try
|
||||
{
|
||||
solrDAO.getAclChangeSets(null, startTime, 0);
|
||||
fail("Must have result limit");
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testQueryChangeSets_Time()
|
||||
{
|
||||
long startTime = System.currentTimeMillis() + (5 * 60000L); // The future
|
||||
List<AclChangeSet> results = solrDAO.getAclChangeSets(null, startTime, 50);
|
||||
assertTrue("ChangeSet count not limited", results.size() == 0);
|
||||
}
|
||||
|
||||
public void testQueryChangeSets_Limit()
|
||||
{
|
||||
List<AclChangeSet> results = solrDAO.getAclChangeSets(null, 0L, 50);
|
||||
assertTrue("Transaction count not limited", results.size() <= 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Argument checks.
|
||||
*/
|
||||
public void testQueryAcls_Arguments()
|
||||
{
|
||||
try
|
||||
{
|
||||
// No IDs
|
||||
solrDAO.getAcls(Collections.<Long>emptyList(), null, 50);
|
||||
fail("Expected IllegalArgumentException");
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
try
|
||||
{
|
||||
// No limit on results
|
||||
solrDAO.getAcls(Collections.<Long>singletonList(1L), null, 0);
|
||||
fail("Expected IllegalArgumentException");
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testQueryAcls_All()
|
||||
{
|
||||
// Do a query for some changesets
|
||||
List<AclChangeSet> aclChangeSets = solrDAO.getAclChangeSets(null, 0L, 50);
|
||||
|
||||
// Choose some changesets with changes
|
||||
int aclTotal = 0;
|
||||
Iterator<AclChangeSet> aclChangeSetsIterator = aclChangeSets.iterator();
|
||||
while (aclChangeSetsIterator.hasNext())
|
||||
{
|
||||
AclChangeSet aclChangeSet = aclChangeSetsIterator.next();
|
||||
if (aclChangeSet.getAclCount() == 0)
|
||||
{
|
||||
aclChangeSetsIterator.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
aclTotal += aclChangeSet.getAclCount();
|
||||
}
|
||||
}
|
||||
// Stop if we don't have ACLs
|
||||
if (aclTotal == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<Long> aclChangeSetIds = toIds(aclChangeSets);
|
||||
|
||||
// Now use those to query for details
|
||||
List<Acl> acls = solrDAO.getAcls(aclChangeSetIds, null, 10);
|
||||
assertTrue("Results not limited", acls.size() <= 10);
|
||||
|
||||
// Get again, but allow all results
|
||||
acls = solrDAO.getAcls(aclChangeSetIds, null, aclTotal);
|
||||
assertEquals("Expected exact results", aclTotal, acls.size());
|
||||
|
||||
// Check that the ACL ChangeSet IDs are correct
|
||||
Set<Long> aclChangeSetIdsSet = new HashSet<Long>(aclChangeSetIds);
|
||||
for (Acl acl : acls)
|
||||
{
|
||||
Long aclChangeSetId = acl.getAclChangeSetId();
|
||||
assertTrue("ACL ChangeSet ID not in original list", aclChangeSetIdsSet.contains(aclChangeSetId));
|
||||
}
|
||||
}
|
||||
|
||||
private List<Long> toIds(List<AclChangeSet> aclChangeSets)
|
||||
{
|
||||
List<Long> ids = new ArrayList<Long>(aclChangeSets.size());
|
||||
for (AclChangeSet aclChangeSet : aclChangeSets)
|
||||
{
|
||||
ids.add(aclChangeSet.getId());
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void testQueryTransactions_NoLimit()
|
||||
{
|
||||
long startTime = System.currentTimeMillis() - (5 * 60000L);
|
||||
|
||||
@@ -66,17 +183,17 @@ public class SOLRDAOTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public void testQueryTransactionsTime()
|
||||
public void testQueryTransactions_Time()
|
||||
{
|
||||
long startTime = System.currentTimeMillis() + (5 * 60000L); // The future
|
||||
List<Transaction> txns = solrDAO.getTransactions(null, startTime, 50);
|
||||
assertTrue("Transaction count not limited", txns.size() == 0);
|
||||
List<Transaction> results = solrDAO.getTransactions(null, startTime, 50);
|
||||
assertTrue("Transaction count not limited", results.size() == 0);
|
||||
}
|
||||
|
||||
public void testQueryTransactionsLimit()
|
||||
public void testQueryTransactions_Limit()
|
||||
{
|
||||
List<Transaction> txns = solrDAO.getTransactions(null, 0L, 50);
|
||||
assertTrue("Transaction count not limited", txns.size() <= 50);
|
||||
List<Transaction> results = solrDAO.getTransactions(null, 0L, 50);
|
||||
assertTrue("Transaction count not limited", results.size() <= 50);
|
||||
}
|
||||
|
||||
public void testGetNodesSimple()
|
||||
|
Reference in New Issue
Block a user