mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Possible fix to QueryTest failure
- Temporarily disable FTS indexing during tests as it may run concurrently with a lag and skew results git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31920 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,6 +33,7 @@ import org.alfresco.opencmis.mapping.CMISMapping;
|
|||||||
import org.alfresco.opencmis.search.CMISQueryService;
|
import org.alfresco.opencmis.search.CMISQueryService;
|
||||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||||
import org.alfresco.repo.dictionary.NamespaceDAOImpl;
|
import org.alfresco.repo.dictionary.NamespaceDAOImpl;
|
||||||
|
import org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexer;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
@@ -111,6 +112,8 @@ public abstract class BaseCMISTest extends TestCase
|
|||||||
|
|
||||||
protected VersionService versionService;
|
protected VersionService versionService;
|
||||||
|
|
||||||
|
protected FullTextSearchIndexer luceneFTS;
|
||||||
|
|
||||||
public void setUp() throws Exception
|
public void setUp() throws Exception
|
||||||
{
|
{
|
||||||
serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
|
serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
|
||||||
@@ -144,6 +147,8 @@ public abstract class BaseCMISTest extends TestCase
|
|||||||
|
|
||||||
dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO");
|
dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO");
|
||||||
namespaceDao = (NamespaceDAOImpl) ctx.getBean("namespaceDAO");
|
namespaceDao = (NamespaceDAOImpl) ctx.getBean("namespaceDAO");
|
||||||
|
luceneFTS = (FullTextSearchIndexer)ctx.getBean("LuceneFullTextSearchIndexer");
|
||||||
|
|
||||||
|
|
||||||
testTX = transactionService.getUserTransaction();
|
testTX = transactionService.getUserTransaction();
|
||||||
testTX.begin();
|
testTX.begin();
|
||||||
|
@@ -241,6 +241,9 @@ public class QueryTest extends BaseCMISTest
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
|
// If FTS kicks in at the wrong moment, it can skew the test results. Temporarily disable it during the test
|
||||||
|
this.luceneFTS.pause();
|
||||||
|
|
||||||
DataTypeDefinition dataType = dictionaryService.getDataType(DataTypeDefinition.DATETIME);
|
DataTypeDefinition dataType = dictionaryService.getDataType(DataTypeDefinition.DATETIME);
|
||||||
String analyserClassName = dataType.resolveAnalyserClassName();
|
String analyserClassName = dataType.resolveAnalyserClassName();
|
||||||
usesDateTimeAnalyser = analyserClassName.equals(DateTimeAnalyser.class.getCanonicalName());
|
usesDateTimeAnalyser = analyserClassName.equals(DateTimeAnalyser.class.getCanonicalName());
|
||||||
@@ -493,6 +496,15 @@ public class QueryTest extends BaseCMISTest
|
|||||||
doc_count++;
|
doc_count++;
|
||||||
nodeService.setProperty(c10, ContentModel.PROP_VERSION_LABEL, "label");
|
nodeService.setProperty(c10, ContentModel.PROP_VERSION_LABEL, "label");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception
|
||||||
|
{
|
||||||
|
super.tearDown();
|
||||||
|
this.luceneFTS.resume();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private <T> T testQuery(String query, int size, boolean dump, String returnPropertyName, T returnType, boolean shouldThrow) throws Exception
|
private <T> T testQuery(String query, int size, boolean dump, String returnPropertyName, T returnType, boolean shouldThrow) throws Exception
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user