mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-10-08 14:51:20 +00:00
Revert "Merge branch 'feature/SEARCH-1617_CMISScoring' into 'master'"
This reverts commit 418b3ccbc351e9d60f7ee21fea1bdeb2f66bea3f, reversing changes made to a45afe1cd7810d208fe7a2a98c3a7d9d39bc6335.
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
<description>Test Project to test Search Service and Analytics Features on a complete setup of Alfresco, Share</description>
|
<description>Test Project to test Search Service and Analytics Features on a complete setup of Alfresco, Share</description>
|
||||||
<properties>
|
<properties>
|
||||||
<tas.rest.api.version>6.0.0.3</tas.rest.api.version>
|
<tas.rest.api.version>6.0.0.3</tas.rest.api.version>
|
||||||
<tas.cmis.api.version>6.0.0.1</tas.cmis.api.version>
|
<tas.cmis.api.version>6.0.0.0</tas.cmis.api.version>
|
||||||
<tas.utility.version>2.0.9</tas.utility.version>
|
<tas.utility.version>2.0.1</tas.utility.version>
|
||||||
<rm.version>2.6.0</rm.version>
|
<rm.version>2.6.0</rm.version>
|
||||||
<suiteXmlFile>src/test/resources/SearchSuite.xml</suiteXmlFile>
|
<suiteXmlFile>src/test/resources/SearchSuite.xml</suiteXmlFile>
|
||||||
<test.exclude></test.exclude>
|
<test.exclude></test.exclude>
|
||||||
@@ -54,24 +54,12 @@
|
|||||||
<artifactId>restapi-test</artifactId>
|
<artifactId>restapi-test</artifactId>
|
||||||
<version>${tas.rest.api.version}</version>
|
<version>${tas.rest.api.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.alfresco.tas</groupId>
|
<groupId>org.alfresco.tas</groupId>
|
||||||
<artifactId>cmis-test</artifactId>
|
<artifactId>cmis-test</artifactId>
|
||||||
<version>${tas.cmis.api.version}</version>
|
<version>${tas.cmis.api.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
@@ -85,12 +73,6 @@
|
|||||||
<version>${rm.version}</version>
|
<version>${rm.version}</version>
|
||||||
<classifier>tests</classifier>
|
<classifier>tests</classifier>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- alfresco tester settings -->
|
<!-- alfresco tester settings -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
package org.alfresco.test.search.functional.searchServices.cmis;
|
package org.alfresco.test.search.functional.searchServices.cmis;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import org.alfresco.cmis.CmisProperties;
|
import org.alfresco.cmis.CmisProperties;
|
||||||
import org.alfresco.cmis.CmisWrapper;
|
import org.alfresco.cmis.CmisWrapper;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest;
|
import org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest;
|
||||||
import org.alfresco.utility.Utility;
|
import org.alfresco.utility.LogFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -25,7 +25,7 @@ import org.testng.annotations.BeforeMethod;
|
|||||||
@Scope(value = "prototype")
|
@Scope(value = "prototype")
|
||||||
public abstract class AbstractCmisE2ETest extends AbstractSearchServicesE2ETest
|
public abstract class AbstractCmisE2ETest extends AbstractSearchServicesE2ETest
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = LoggerFactory.getLogger(AbstractCmisE2ETest.class);
|
private static Logger LOG = LogFactory.getLogger();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected CmisWrapper cmisApi;
|
protected CmisWrapper cmisApi;
|
||||||
@@ -38,50 +38,17 @@ public abstract class AbstractCmisE2ETest extends AbstractSearchServicesE2ETest
|
|||||||
@BeforeMethod(alwaysRun = true)
|
@BeforeMethod(alwaysRun = true)
|
||||||
public void showStartTestInfo(Method method)
|
public void showStartTestInfo(Method method)
|
||||||
{
|
{
|
||||||
LOGGER.info(String.format("*** STARTING Test: [%s] ***", method.getName()));
|
LOG.info(String.format("*** STARTING Test: [%s] ***", method.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterMethod(alwaysRun = true)
|
@AfterMethod(alwaysRun = true)
|
||||||
public void showEndTestInfo(Method method)
|
public void showEndTestInfo(Method method)
|
||||||
{
|
{
|
||||||
LOGGER.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
|
LOG.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSolrWaitTimeInSeconds()
|
public Integer getSolrWaitTimeInSeconds()
|
||||||
{
|
{
|
||||||
return cmisProperties.envProperty().getSolrWaitTimeInSeconds();
|
return cmisProperties.envProperty().getSolrWaitTimeInSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Repeat SOLR Query till results count returns expectedCountResults
|
|
||||||
* @param query CMIS Query to be executed
|
|
||||||
* @param expectedCountResults Number of results expected
|
|
||||||
* @return true when results count is equals to expectedCountResults
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
protected boolean waitForIndexing(String query, long expectedCountResults) throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
for (int searchCount = 1; searchCount <= 3; searchCount++)
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cmisApi.withQuery(query).assertResultsCount().equals(expectedCountResults);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (AssertionError ae)
|
|
||||||
{
|
|
||||||
LOGGER.debug(ae.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Utility.waitToLoopTime(properties.getSolrWaitTimeInSeconds(), "Wait For Indexing");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,195 +0,0 @@
|
|||||||
package org.alfresco.test.search.functional.searchServices.cmis;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import org.alfresco.utility.data.provider.XMLDataConfig;
|
|
||||||
import org.alfresco.utility.data.provider.XMLTestData;
|
|
||||||
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
|
||||||
import org.alfresco.utility.model.TestGroup;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.testng.annotations.AfterClass;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Testing SCORE function queries to solve issues related to
|
|
||||||
* https://issues.alfresco.com/jira/browse/ACE-2479
|
|
||||||
*
|
|
||||||
* @author aborroy
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SolrSearchScoreQueryTests extends AbstractCmisE2ETest
|
|
||||||
{
|
|
||||||
|
|
||||||
private static Logger LOGGER = LoggerFactory.getLogger(SolrSearchScoreQueryTests.class);
|
|
||||||
private XMLTestData testData;
|
|
||||||
|
|
||||||
@AfterClass(alwaysRun = true)
|
|
||||||
public void cleanupEnvironment()
|
|
||||||
{
|
|
||||||
if (testData != null)
|
|
||||||
{
|
|
||||||
testData.cleanup(dataContent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGGER.warn("testData is inexplicably null - skipping clean up.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These tests does not require AbstractSearchServicesE2ETest common tests,
|
|
||||||
* as it's focused on testing scoring function features
|
|
||||||
* @see org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest#searchServicesDataPreparation()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void searchServicesDataPreparation() throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These tests does not require common data preparation from AbstractE2EFunctionalTest
|
|
||||||
* as it's including every test data required in search-score-funtion.xml
|
|
||||||
* @see org.alfresco.test.search.functional.AbstractE2EFunctionalTest#dataPreparation()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void dataPreparation() throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(dataProviderClass = XMLTestDataProvider.class, dataProvider = "getAllData")
|
|
||||||
@XMLDataConfig(file = "src/test/resources/testdata/search-score-function.xml")
|
|
||||||
public void prepareDataForScoreSearch(XMLTestData testData) throws Exception
|
|
||||||
{
|
|
||||||
this.testData = testData;
|
|
||||||
this.testData.createUsers(dataUser);
|
|
||||||
this.testData.createSitesStructure(dataSite, dataContent, dataUser);
|
|
||||||
cmisApi.authenticateUser(dataUser.getCurrentUser());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify that results are ordered
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES }, dependsOnMethods = "prepareDataForScoreSearch")
|
|
||||||
public void scoreQueryOrdered() throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
String query = "SELECT cmis:objectId, SCORE() AS orderCriteria "
|
|
||||||
+ "FROM cmis:document "
|
|
||||||
+ "WHERE CONTAINS('Quidditch') "
|
|
||||||
+ "ORDER BY orderCriteria";
|
|
||||||
|
|
||||||
if (waitForIndexing(query, 3))
|
|
||||||
{
|
|
||||||
cmisApi
|
|
||||||
.withQuery(query)
|
|
||||||
.assertColumnIsOrdered().isOrderedAsc("orderCriteria");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AssertionError("Wait for indexing has failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify that results are inverse ordered
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES }, dependsOnMethods = "prepareDataForScoreSearch")
|
|
||||||
public void scoreQueryOrderedDesc() throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
String query = "SELECT cmis:objectId, SCORE() AS orderCriteria "
|
|
||||||
+ "FROM cmis:document "
|
|
||||||
+ "WHERE CONTAINS('Quidditch') "
|
|
||||||
+ "ORDER BY orderCriteria DESC";
|
|
||||||
|
|
||||||
if (waitForIndexing(query, 3))
|
|
||||||
{
|
|
||||||
cmisApi
|
|
||||||
.withQuery(query).assertColumnIsOrdered().isOrderedDesc("orderCriteria");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AssertionError("Wait for indexing has failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify that all SCORE results are between 0 and 1
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES }, dependsOnMethods = "prepareDataForScoreSearch")
|
|
||||||
public void scoreQueryInRange() throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
String query = "SELECT cmis:objectId, SCORE() "
|
|
||||||
+ "FROM cmis:document "
|
|
||||||
+ "WHERE CONTAINS('Quidditch')";
|
|
||||||
|
|
||||||
if (waitForIndexing(query, 3))
|
|
||||||
{
|
|
||||||
cmisApi
|
|
||||||
.withQuery(query)
|
|
||||||
.assertColumnValuesRange().isReturningValuesInRange("SEARCH_SCORE", BigDecimal.ZERO, BigDecimal.ONE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AssertionError("Wait for indexing has failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify that all SCORE results are between 0 and 1
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES }, dependsOnMethods = "prepareDataForScoreSearch")
|
|
||||||
public void scoreQueryAliasInRange() throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
String query = "SELECT cmis:objectId, SCORE() AS orderCriteria "
|
|
||||||
+ "FROM cmis:document "
|
|
||||||
+ "WHERE CONTAINS('Quidditch')";
|
|
||||||
|
|
||||||
if (waitForIndexing(query, 3))
|
|
||||||
{
|
|
||||||
cmisApi
|
|
||||||
.withQuery(query)
|
|
||||||
.assertColumnValuesRange().isReturningValuesInRange("orderCriteria", BigDecimal.ZERO, BigDecimal.ONE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AssertionError("Wait for indexing has failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify that SCORE is valid name for an alias
|
|
||||||
* Currently only supported with double quotes
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES }, dependsOnMethods = "prepareDataForScoreSearch")
|
|
||||||
public void scoreQueryScoreAsAlias() throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
String query = "SELECT cmis:objectId, SCORE() AS \"score\" "
|
|
||||||
+ "FROM cmis:document "
|
|
||||||
+ "WHERE CONTAINS('Quidditch')";
|
|
||||||
|
|
||||||
if (waitForIndexing(query, 3))
|
|
||||||
{
|
|
||||||
cmisApi
|
|
||||||
.withQuery(query).assertResultsCount().equals(3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AssertionError("Wait for indexing has failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,7 +1,7 @@
|
|||||||
# Alfresco HTTP Server Settings
|
# Alfresco HTTP Server Settings
|
||||||
alfresco.scheme=http
|
alfresco.scheme=http
|
||||||
alfresco.server=localhost
|
alfresco.server=localhost
|
||||||
alfresco.port=8080
|
alfresco.port=8081
|
||||||
|
|
||||||
# sync service related
|
# sync service related
|
||||||
sync.scheme=http
|
sync.scheme=http
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<testData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="https://gitlab.alfresco.com/tas/tas-namespaces/raw/master/input-test-data.xsd">
|
|
||||||
<users>
|
|
||||||
<user id="userSearchProperties" name="userSearchProperties" password="password" />
|
|
||||||
</users>
|
|
||||||
|
|
||||||
<sites>
|
|
||||||
<site name="siteSearchScoreFunction" createdBy="userSearchProperties" visibility="PUBLIC">
|
|
||||||
<folders>
|
|
||||||
<folder name="test-folder" createdBy="userSearchProperties">
|
|
||||||
<files>
|
|
||||||
<file name="test-1.txt" createdBy="userSearchProperties">
|
|
||||||
<content>Quidditch</content>
|
|
||||||
</file>
|
|
||||||
<file name="test-2.txt" createdBy="userSearchProperties">
|
|
||||||
<content>Quidditch Quidditch</content>
|
|
||||||
</file>
|
|
||||||
<file name="test-3.txt" createdBy="userSearchProperties">
|
|
||||||
<content>Quidditch Quidditch Quidditch</content>
|
|
||||||
</file>
|
|
||||||
<file name="no-test.txt" createdBy="userSearchProperties">
|
|
||||||
<content>Some other words</content>
|
|
||||||
</file>
|
|
||||||
</files>
|
|
||||||
</folder>
|
|
||||||
</folders>
|
|
||||||
</site>
|
|
||||||
</sites>
|
|
||||||
|
|
||||||
</testData>
|
|
Reference in New Issue
Block a user