mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-10-08 14:51:20 +00:00
pulled latest from master
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<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.10</tas.utility.version>
|
<tas.utility.version>2.0.10</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>
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
||||||
|
<jackson.databind.version>2.7.7</jackson.databind.version>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
@@ -54,24 +55,24 @@
|
|||||||
<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>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</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>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
@@ -79,18 +80,23 @@
|
|||||||
<version>${rm.version}</version>
|
<version>${rm.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>${jackson.databind.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-rm-automation-community-rest-api</artifactId>
|
<artifactId>alfresco-rm-automation-community-rest-api</artifactId>
|
||||||
<version>${rm.version}</version>
|
<version>${rm.version}</version>
|
||||||
<classifier>tests</classifier>
|
<classifier>tests</classifier>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- alfresco tester settings -->
|
<!-- alfresco tester settings -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
46
e2e-test/src/main/java/org/alfresco/search/TestGroup.java
Normal file
46
e2e-test/src/main/java/org/alfresco/search/TestGroup.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package org.alfresco.search;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ ElementType.METHOD })
|
||||||
|
public @interface TestGroup
|
||||||
|
{
|
||||||
|
public static final String SANITY = "sanity";
|
||||||
|
public static final String REGRESSION = "regression";
|
||||||
|
public static final String ENTERPRISE = "enterprise";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String SEARCH = "search";
|
||||||
|
|
||||||
|
public static final String CMIS = "cmis";
|
||||||
|
public static final String REST_API = "rest-api";
|
||||||
|
|
||||||
|
public static final String PREUPGRADE = "pre-upgrade";
|
||||||
|
public static final String POSTUPGRADE = "post-upgrade";
|
||||||
|
|
||||||
|
// Search: Minimum Version Required
|
||||||
|
public static final String ASS_1 = "ASS_1.0.0"; // Alfresco Search Services 1.0. Does not work with Solr4
|
||||||
|
public static final String ASS_112 = "ASS_1.1.2"; // Alfresco Search Services 1.1.2
|
||||||
|
public static final String ASS_12 = "ASS_1.2.0"; // Alfresco Search Services 1.2
|
||||||
|
public static final String PreASS_121 = "PreASS_1.2.1"; // Alfresco Search Services Prior to ASS 1.2.1
|
||||||
|
public static final String ASS_121 = "ASS_1.2.1"; // Alfresco Search Services 1.2.1
|
||||||
|
public static final String ASS_13 = "ASS_1.3.0"; // Alfresco Search Services 1.3
|
||||||
|
public static final String ASS_1302 = "ASS_1.3.0.2"; // Alfresco Search Services 1.3.0.2 (Fingerprint MNT)
|
||||||
|
public static final String ASS_14 = "ASS_1.4.0"; // Alfresco Search Services 1.4
|
||||||
|
public static final String ASS_MASTER_SLAVE = "ASS_Master_Slave"; // Alfresco Search Services using master slave configurations
|
||||||
|
public static final String ASS_MASTER ="ASS_Master"; // Alfresco search services using master/stand alone mode
|
||||||
|
|
||||||
|
public static final String INSIGHT_10 = "InsightEngine_1.0.0"; // Alfresco Insight Engine 1.0
|
||||||
|
public static final String INSIGHT_11 = "InsightEngine_1.1.0"; // Alfresco Insight Engine 1.1
|
||||||
|
public static final String INSIGHT_12 = "InsightEngine_1.2.0"; // Alfresco Insight Engine 1.2
|
||||||
|
public static final String NOT_INSIGHT_ENGINE = "Not_InsightEngine"; // When Alfresco Insight Engine 1.0 isn't running
|
||||||
|
public static final String SOLR = "SOLR"; //To be used for tests for /solr/alfresco/* end-points
|
||||||
|
|
||||||
|
public static final String ACS_52n = "ACS_52n"; // Alfresco Content Services 5.2.n
|
||||||
|
public static final String ACS_60n = "ACS_60n"; // Alfresco Content Services 6.0 or above
|
||||||
|
public static final String ACS_61n = "ACS_61n"; // Alfresco Content Services 6.1 or above
|
||||||
|
}
|
@@ -10,14 +10,12 @@ import org.alfresco.cmis.CmisWrapper;
|
|||||||
import org.alfresco.dataprep.ContentService;
|
import org.alfresco.dataprep.ContentService;
|
||||||
import org.alfresco.dataprep.SiteService.Visibility;
|
import org.alfresco.dataprep.SiteService.Visibility;
|
||||||
import org.alfresco.rest.core.RestProperties;
|
import org.alfresco.rest.core.RestProperties;
|
||||||
import org.alfresco.rest.core.RestResponse;
|
|
||||||
import org.alfresco.rest.core.RestWrapper;
|
import org.alfresco.rest.core.RestWrapper;
|
||||||
import org.alfresco.rest.search.RestRequestHighlightModel;
|
import org.alfresco.rest.search.RestRequestHighlightModel;
|
||||||
import org.alfresco.rest.search.RestRequestQueryModel;
|
import org.alfresco.rest.search.RestRequestQueryModel;
|
||||||
import org.alfresco.rest.search.SearchNodeModel;
|
import org.alfresco.rest.search.SearchNodeModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.rest.search.SearchSqlRequest;
|
|
||||||
import org.alfresco.utility.LogFactory;
|
import org.alfresco.utility.LogFactory;
|
||||||
import org.alfresco.utility.TasProperties;
|
import org.alfresco.utility.TasProperties;
|
||||||
import org.alfresco.utility.Utility;
|
import org.alfresco.utility.Utility;
|
||||||
@@ -32,7 +30,6 @@ import org.alfresco.utility.model.UserModel;
|
|||||||
import org.alfresco.utility.network.ServerHealth;
|
import org.alfresco.utility.network.ServerHealth;
|
||||||
import org.apache.chemistry.opencmis.client.api.CmisObject;
|
import org.apache.chemistry.opencmis.client.api.CmisObject;
|
||||||
import org.apache.chemistry.opencmis.client.api.Session;
|
import org.apache.chemistry.opencmis.client.api.Session;
|
||||||
import org.hamcrest.Matchers;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -227,7 +224,6 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Helper method which create an http post request to Search API end point.
|
* Helper method which create an http post request to Search API end point.
|
||||||
* Executes the given search request without throwing checked exceptions (a {@link RuntimeException} will be thrown in case).
|
* Executes the given search request without throwing checked exceptions (a {@link RuntimeException} will be thrown in case).
|
||||||
*
|
*
|
||||||
@@ -250,16 +246,18 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
|
|||||||
* Wait for Solr to finish indexing and search to return appropriate results
|
* Wait for Solr to finish indexing and search to return appropriate results
|
||||||
*
|
*
|
||||||
* @param userQuery: Search Query
|
* @param userQuery: Search Query
|
||||||
* @param contentName that's expected to be included / excluded from the results
|
* @param contentToFind that's expected to be included / excluded from the results
|
||||||
* @param expectedInResults
|
* @param expectedInResults
|
||||||
* @return true if search returns expected results, i.e. is given content is found or excluded from the results
|
* @return true if search returns expected results, i.e. is given content is found or excluded from the results
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public boolean waitForContent(String userQuery, String contentName, boolean expectedInResults) throws Exception
|
public boolean isContentInSearchResults(String userQuery, String contentToFind, boolean expectedInResults)
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
boolean resultAsExpected = false;
|
boolean resultAsExpected = false;
|
||||||
boolean found = !expectedInResults;
|
boolean found = !expectedInResults;
|
||||||
String expectedStatusCode = HttpStatus.OK.toString();
|
String expectedStatusCode = HttpStatus.OK.toString();
|
||||||
|
String contentName = (contentToFind == null) ? "" : contentToFind;
|
||||||
|
|
||||||
// Repeat search until the query results are as expected or Search Retry count is hit
|
// Repeat search until the query results are as expected or Search Retry count is hit
|
||||||
for (int searchCount = 1; searchCount <= 6; searchCount++)
|
for (int searchCount = 1; searchCount <= 6; searchCount++)
|
||||||
@@ -272,11 +270,23 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
|
|||||||
List<SearchNodeModel> entries = response.getEntries();
|
List<SearchNodeModel> entries = response.getEntries();
|
||||||
if (!entries.isEmpty())
|
if (!entries.isEmpty())
|
||||||
{
|
{
|
||||||
for (SearchNodeModel entry : entries)
|
if (contentName.isEmpty())
|
||||||
{
|
{
|
||||||
found = (contentName.equalsIgnoreCase(entry.getModel().getName()));
|
found = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (SearchNodeModel entry : entries)
|
||||||
|
{
|
||||||
|
found = (contentName.equalsIgnoreCase(entry.getModel().getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
found = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Loop again if result is not as expected: To cater for solr lag: eventual consistency
|
// Loop again if result is not as expected: To cater for solr lag: eventual consistency
|
||||||
resultAsExpected = (expectedInResults == found);
|
resultAsExpected = (expectedInResults == found);
|
||||||
if (resultAsExpected)
|
if (resultAsExpected)
|
||||||
@@ -314,6 +324,7 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* waitForIndexing method that matches / waits for filename, metadata to be indexed.
|
* waitForIndexing method that matches / waits for filename, metadata to be indexed.
|
||||||
|
*
|
||||||
* @param userQuery
|
* @param userQuery
|
||||||
* @param expectedInResults
|
* @param expectedInResults
|
||||||
* @return
|
* @return
|
||||||
@@ -327,6 +338,7 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
|
|||||||
/**
|
/**
|
||||||
* waitForIndexing method that matches / waits for content to be indexed, this can take longer than metadata indexing.
|
* waitForIndexing method that matches / waits for content to be indexed, this can take longer than metadata indexing.
|
||||||
* Since Metadata is indexed first, use this method where tests, queries need content to be indexed too.
|
* Since Metadata is indexed first, use this method where tests, queries need content to be indexed too.
|
||||||
|
*
|
||||||
* @param userQuery
|
* @param userQuery
|
||||||
* @param expectedInResults
|
* @param expectedInResults
|
||||||
* @return
|
* @return
|
||||||
@@ -348,39 +360,9 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
|
|||||||
*/
|
*/
|
||||||
private boolean waitForIndexing(String fieldName, String userQuery, boolean expectedInResults) throws Exception
|
private boolean waitForIndexing(String fieldName, String userQuery, boolean expectedInResults) throws Exception
|
||||||
{
|
{
|
||||||
boolean resultAsExpected = false;
|
String query = (fieldName == null) ? userQuery : String.format("%s:'%s'", fieldName, userQuery);
|
||||||
String expectedStatusCode = HttpStatus.OK.toString();
|
|
||||||
String query = (fieldName == null)? userQuery: String.format("%s:'%s'", fieldName, userQuery);
|
|
||||||
|
|
||||||
// Repeat search until the query results are as expected or Search Retry count is hit
|
return isContentInSearchResults(query, null, expectedInResults);
|
||||||
for (int searchCount = 1; searchCount <= 3; searchCount++)
|
|
||||||
{
|
|
||||||
SearchRequest searchRequest = createQuery(query);
|
|
||||||
SearchResponse response = query(searchRequest);
|
|
||||||
|
|
||||||
if (restClient.getStatusCode().matches(expectedStatusCode))
|
|
||||||
{
|
|
||||||
boolean found = !response.getEntries().isEmpty();
|
|
||||||
|
|
||||||
// Loop again if result is not as expected: To cater for solr lag: eventual consistency
|
|
||||||
resultAsExpected = (expectedInResults == found);
|
|
||||||
if (resultAsExpected)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Wait for the solr indexing.
|
|
||||||
Utility.waitToLoopTime(properties.getSolrWaitTimeInSeconds(), "Wait For Indexing. Retry Attempt: " + searchCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new RuntimeException("API returned status code:" + restClient.getStatusCode() + " Expected: " + expectedStatusCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultAsExpected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -435,7 +417,6 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
|
|||||||
*
|
*
|
||||||
* @return {@link SearchResponse} response.
|
* @return {@link SearchResponse} response.
|
||||||
* @throws Exception if error
|
* @throws Exception if error
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
protected SearchResponse query(RestRequestQueryModel queryReq, RestRequestHighlightModel highlight) throws Exception
|
protected SearchResponse query(RestRequestQueryModel queryReq, RestRequestHighlightModel highlight) throws Exception
|
||||||
{
|
{
|
||||||
|
@@ -6,7 +6,7 @@ import org.alfresco.utility.data.provider.XMLTestData;
|
|||||||
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
||||||
import org.alfresco.utility.exception.TestConfigurationException;
|
import org.alfresco.utility.exception.TestConfigurationException;
|
||||||
import org.alfresco.utility.model.QueryModel;
|
import org.alfresco.utility.model.QueryModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
@@ -50,7 +50,7 @@ public class SolrSearchByAspectTests extends AbstractCmisE2ETest
|
|||||||
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES },
|
@Test(groups = { TestGroup.CMIS },
|
||||||
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData", dependsOnMethods = "prepareDataForAspectSearch")
|
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData", dependsOnMethods = "prepareDataForAspectSearch")
|
||||||
@XMLDataConfig(file = "src/test/resources/testdata/search-by-aspect.xml")
|
@XMLDataConfig(file = "src/test/resources/testdata/search-by-aspect.xml")
|
||||||
public void executeSearchByAspect(QueryModel query) throws Exception
|
public void executeSearchByAspect(QueryModel query) throws Exception
|
||||||
|
@@ -6,7 +6,7 @@ import org.alfresco.utility.data.provider.XMLTestData;
|
|||||||
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
||||||
import org.alfresco.utility.exception.TestConfigurationException;
|
import org.alfresco.utility.exception.TestConfigurationException;
|
||||||
import org.alfresco.utility.model.QueryModel;
|
import org.alfresco.utility.model.QueryModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
@@ -50,7 +50,7 @@ public class SolrSearchByIdTests extends AbstractCmisE2ETest
|
|||||||
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES },
|
@Test(groups = { TestGroup.CMIS },
|
||||||
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData", dependsOnMethods = "prepareDataForSearchById")
|
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData", dependsOnMethods = "prepareDataForSearchById")
|
||||||
@XMLDataConfig(file = "src/test/resources/testdata/search-by-id.xml")
|
@XMLDataConfig(file = "src/test/resources/testdata/search-by-id.xml")
|
||||||
public void executeSortedSearchByID(QueryModel query) throws Exception
|
public void executeSortedSearchByID(QueryModel query) throws Exception
|
||||||
|
@@ -5,7 +5,7 @@ import org.alfresco.utility.data.provider.XMLDataConfig;
|
|||||||
import org.alfresco.utility.data.provider.XMLTestData;
|
import org.alfresco.utility.data.provider.XMLTestData;
|
||||||
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
||||||
import org.alfresco.utility.model.QueryModel;
|
import org.alfresco.utility.model.QueryModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
@@ -48,7 +48,7 @@ public class SolrSearchByPathTests extends AbstractCmisE2ETest
|
|||||||
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES },
|
@Test(groups = { TestGroup.CMIS },
|
||||||
dependsOnMethods = "prepareDataForSearchByPath", dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
|
dependsOnMethods = "prepareDataForSearchByPath", dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
|
||||||
@XMLDataConfig(file = "src/test/resources/testdata/search-by-path.xml")
|
@XMLDataConfig(file = "src/test/resources/testdata/search-by-path.xml")
|
||||||
public void executeSearchByPathQueries(QueryModel query) throws Exception
|
public void executeSearchByPathQueries(QueryModel query) throws Exception
|
||||||
|
@@ -6,7 +6,7 @@ import org.alfresco.utility.data.provider.XMLTestData;
|
|||||||
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
||||||
import org.alfresco.utility.exception.TestConfigurationException;
|
import org.alfresco.utility.exception.TestConfigurationException;
|
||||||
import org.alfresco.utility.model.QueryModel;
|
import org.alfresco.utility.model.QueryModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
@@ -50,7 +50,7 @@ public class SolrSearchByPropertyTests extends AbstractCmisE2ETest
|
|||||||
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
Utility.waitToLoopTime(getSolrWaitTimeInSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES },
|
@Test(groups = { TestGroup.CMIS },
|
||||||
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData", dependsOnMethods = "prepareDataForSearchWithProperty")
|
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData", dependsOnMethods = "prepareDataForSearchWithProperty")
|
||||||
@XMLDataConfig(file = "src/test/resources/testdata/search-by-property.xml")
|
@XMLDataConfig(file = "src/test/resources/testdata/search-by-property.xml")
|
||||||
public void executeSortedSearchByID(QueryModel query) throws Exception
|
public void executeSortedSearchByID(QueryModel query) throws Exception
|
||||||
|
@@ -7,7 +7,7 @@ import org.alfresco.utility.model.FileModel;
|
|||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.QueryModel;
|
import org.alfresco.utility.model.QueryModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@@ -51,7 +51,7 @@ public class SolrSearchInFolderTests extends AbstractCmisE2ETest
|
|||||||
dataContent.deleteSite(testSite);
|
dataContent.deleteSite(testSite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES },
|
@Test(groups = { TestGroup.CMIS },
|
||||||
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
|
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
|
||||||
@XMLDataConfig(file = "src/test/resources/testdata/search-in-folder.xml")
|
@XMLDataConfig(file = "src/test/resources/testdata/search-in-folder.xml")
|
||||||
public void executeCMISQuery(QueryModel query) throws Exception
|
public void executeCMISQuery(QueryModel query) throws Exception
|
||||||
|
@@ -7,7 +7,7 @@ import org.alfresco.utility.model.FileModel;
|
|||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.QueryModel;
|
import org.alfresco.utility.model.QueryModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@@ -55,7 +55,7 @@ public class SolrSearchInTreeTests extends AbstractCmisE2ETest
|
|||||||
dataContent.deleteSite(testSite);
|
dataContent.deleteSite(testSite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.CMIS, TestGroup.QUERIES },
|
@Test(groups = { TestGroup.CMIS },
|
||||||
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
|
dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
|
||||||
@XMLDataConfig(file = "src/test/resources/testdata/search-in-tree.xml")
|
@XMLDataConfig(file = "src/test/resources/testdata/search-in-tree.xml")
|
||||||
public void executeCMISQuery(QueryModel query) throws Exception
|
public void executeCMISQuery(QueryModel query) throws Exception
|
||||||
|
@@ -17,7 +17,7 @@ import org.alfresco.utility.data.DataSite;
|
|||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@@ -1,45 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Alfresco Software Limited.
|
* Copyright (C) 2018 Alfresco Software Limited.
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.test.search.functional.searchServices.search;
|
package org.alfresco.test.search.functional.searchServices.search;
|
||||||
|
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
|
||||||
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
|
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
|
||||||
import org.alfresco.utility.Utility;
|
|
||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
|
||||||
import javax.naming.AuthenticationException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Search test class that contains useful methods
|
* Abstract Search test class that contains useful methods
|
||||||
* such as:
|
* such as:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Preparing the data to index.
|
* <li>Preparing the data to index.
|
||||||
* <li>Preparing search requests.
|
* <li>Preparing search requests.
|
||||||
*
|
*
|
||||||
* @author Michael Suzuki
|
* @author Michael Suzuki
|
||||||
* @author Meenal Bhave
|
* @author Meenal Bhave
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctionalTest
|
public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctionalTest
|
||||||
{
|
{
|
||||||
@@ -52,27 +41,31 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Create the following file structure for preconditions :
|
* Create the following file structure for preconditions :
|
||||||
* |- folder
|
* |- folder
|
||||||
* |-- pangram.txt
|
* |-- pangram.txt
|
||||||
* |-- cars.txt
|
* |-- cars.txt
|
||||||
* |-- alfresco.txt
|
* |-- alfresco.txt
|
||||||
* |-- <uniqueFileName>
|
* |-- <uniqueFileName>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FolderModel folder = new FolderModel(SEARCH_DATA_SAMPLE_FOLDER);
|
FolderModel folder = new FolderModel(SEARCH_DATA_SAMPLE_FOLDER);
|
||||||
dataContent.usingUser(testUser).usingSite(testSite).createFolder(folder);
|
dataContent.usingUser(testUser).usingSite(testSite).createFolder(folder);
|
||||||
|
|
||||||
//Create files
|
// Create files
|
||||||
String title = "Title: " + unique_searchString;
|
String title = "Title: " + unique_searchString;
|
||||||
String description = "Description: File is created for search tests by Author: " + unique_searchString + " . ";
|
String description = "Description: File is created for search tests by Author: " + unique_searchString + " . ";
|
||||||
|
|
||||||
file = new FileModel("pangram.txt", "pangram" + title, description, FileType.TEXT_PLAIN, description + " The quick brown fox jumps over the lazy dog");
|
file = new FileModel("pangram.txt", "pangram" + title, description, FileType.TEXT_PLAIN,
|
||||||
|
description + " The quick brown fox jumps over the lazy dog");
|
||||||
|
|
||||||
file2 = new FileModel("cars.txt", "cars" + title, description, FileType.TEXT_PLAIN, "The landrover discovery is not a sports car ");
|
file2 = new FileModel("cars.txt", "cars" + title, description, FileType.TEXT_PLAIN,
|
||||||
|
"The landrover discovery is not a sports car ");
|
||||||
|
|
||||||
FileModel file3 = new FileModel("alfresco.txt", "alfresco", "alfresco", FileType.TEXT_PLAIN, "Alfresco text file for search ");
|
FileModel file3 = new FileModel("alfresco.txt", "alfresco", "alfresco", FileType.TEXT_PLAIN,
|
||||||
|
"Alfresco text file for search ");
|
||||||
|
|
||||||
file4 = new FileModel(unique_searchString + ".txt", "uniquee" + title, description, FileType.TEXT_PLAIN, "Unique text file for search ");
|
file4 = new FileModel(unique_searchString + ".txt", "uniquee" + title, description, FileType.TEXT_PLAIN,
|
||||||
|
"Unique text file for search ");
|
||||||
|
|
||||||
dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(file);
|
dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(file);
|
||||||
dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(file2);
|
dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(file2);
|
||||||
@@ -81,110 +74,4 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona
|
|||||||
|
|
||||||
waitForMetadataIndexing(file4.getName(), true);
|
waitForMetadataIndexing(file4.getName(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Helper method which create an http post request to Search API end point.
|
|
||||||
// * @param term String search term
|
|
||||||
// * @return {@link SearchResponse} response.
|
|
||||||
// * @throws Exception if error
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// protected SearchResponse query(String term) throws Exception
|
|
||||||
// {
|
|
||||||
// RestRequestQueryModel queryReq = new RestRequestQueryModel();
|
|
||||||
// queryReq.setLanguage("afts");
|
|
||||||
// queryReq.setQuery(term);
|
|
||||||
// SearchRequest query = new SearchRequest(queryReq);
|
|
||||||
// return restClient.authenticateUser(testUser).withSearchAPI().search(query);
|
|
||||||
// }
|
|
||||||
|
|
||||||
protected SearchRequest carsQuery()
|
|
||||||
{
|
|
||||||
return createQuery("cars");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wait for Solr to finish indexing: Indexing has caught up = true if search returns appropriate results
|
|
||||||
*
|
|
||||||
* @param userQuery: search query, this can include the fieldname, unique search string will guarantee accurate results
|
|
||||||
* @param expectedInResults, true if entry is expected in the results set
|
|
||||||
* @return true (indexing is finished) if search returns appropriate results
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public boolean waitForIndexing(String userQuery, boolean expectedInResults) throws Exception
|
|
||||||
{
|
|
||||||
// Use the search query as is: fieldname(s) may or may not be specified within the userQuery
|
|
||||||
return waitForIndexing(null, userQuery, expectedInResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* waitForIndexing method that matches / waits for filename, metadata to be indexed.
|
|
||||||
* @param userQuery
|
|
||||||
* @param expectedInResults
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public boolean waitForMetadataIndexing(String userQuery, boolean expectedInResults) throws Exception
|
|
||||||
{
|
|
||||||
return waitForIndexing("name", userQuery, expectedInResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* waitForIndexing method that matches / waits for content to be indexed, this can take longer than metadata indexing.
|
|
||||||
* Since Metadata is indexed first, use this method where tests, queries need content to be indexed too.
|
|
||||||
* @param userQuery
|
|
||||||
* @param expectedInResults
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public boolean waitForContentIndexing(String userQuery, boolean expectedInResults) throws Exception
|
|
||||||
{
|
|
||||||
return waitForIndexing("cm:content", userQuery, expectedInResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wait for Solr to finish indexing: Indexing has caught up = true if search returns appropriate results
|
|
||||||
*
|
|
||||||
* @param fieldName: specific field to search for, e.g. name. When specified, the query will become: name:'userQuery'
|
|
||||||
* @param userQuery: search string, unique search string will guarantee accurate results
|
|
||||||
* @param expectedInResults, true if entry is expected in the results set
|
|
||||||
* @return true (indexing is finished) if search returns appropriate results
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private boolean waitForIndexing(String fieldName, String userQuery, boolean expectedInResults) throws Exception
|
|
||||||
{
|
|
||||||
boolean resultAsExpected = false;
|
|
||||||
String expectedStatusCode = HttpStatus.OK.toString();
|
|
||||||
String query = (fieldName == null)? userQuery: String.format("%s:'%s'", fieldName, userQuery);
|
|
||||||
|
|
||||||
// Repeat search until the query results are as expected or Search Retry count is hit
|
|
||||||
for (int searchCount = 1; searchCount <= 3; searchCount++)
|
|
||||||
{
|
|
||||||
SearchRequest searchRequest = createQuery(query);
|
|
||||||
SearchResponse response = query(searchRequest);
|
|
||||||
|
|
||||||
if (restClient.getStatusCode().matches(expectedStatusCode))
|
|
||||||
{
|
|
||||||
boolean found = !response.getEntries().isEmpty();
|
|
||||||
|
|
||||||
// Loop again if result is not as expected: To cater for solr lag: eventual consistency
|
|
||||||
resultAsExpected = (expectedInResults == found);
|
|
||||||
if (resultAsExpected)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Wait for the solr indexing.
|
|
||||||
Utility.waitToLoopTime(properties.getSolrWaitTimeInSeconds(), "Wait For Indexing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AuthenticationException("API returned status code:" + restClient.getStatusCode() + " Expected: " + expectedStatusCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultAsExpected;
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -32,12 +32,12 @@ import org.alfresco.rest.search.RestRequestQueryModel;
|
|||||||
import org.alfresco.rest.search.RestResultBucketsModel;
|
import org.alfresco.rest.search.RestResultBucketsModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.data.RandomData;
|
import org.alfresco.utility.data.RandomData;
|
||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.SiteModel;
|
import org.alfresco.utility.model.SiteModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
@@ -26,7 +26,7 @@ import org.alfresco.rest.search.RestRequestFacetIntervalsModel;
|
|||||||
import org.alfresco.rest.search.RestRequestFacetSetModel;
|
import org.alfresco.rest.search.RestRequestFacetSetModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -54,7 +54,7 @@ public class FacetIntervalSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Check facet intervals mandatory fields")
|
description = "Check facet intervals mandatory fields")
|
||||||
public void checkingFacetsMandatoryErrorMessages()throws Exception
|
public void checkingFacetsMandatoryErrorMessages()throws Exception
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
RestRequestFacetIntervalsModel facetIntervalsModel = new RestRequestFacetIntervalsModel();
|
RestRequestFacetIntervalsModel facetIntervalsModel = new RestRequestFacetIntervalsModel();
|
||||||
FacetInterval facetInterval = new FacetInterval(null, null, null);
|
FacetInterval facetInterval = new FacetInterval(null, null, null);
|
||||||
@@ -108,7 +108,7 @@ public class FacetIntervalSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Check basic facet intervals search api")
|
description = "Check basic facet intervals search api")
|
||||||
public void searchWithBasicInterval()throws Exception
|
public void searchWithBasicInterval()throws Exception
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
RestRequestFacetIntervalsModel facetIntervalsModel = new RestRequestFacetIntervalsModel();
|
RestRequestFacetIntervalsModel facetIntervalsModel = new RestRequestFacetIntervalsModel();
|
||||||
RestRequestFacetSetModel restRequestFacetSetModel = new RestRequestFacetSetModel();
|
RestRequestFacetSetModel restRequestFacetSetModel = new RestRequestFacetSetModel();
|
||||||
@@ -151,7 +151,7 @@ public class FacetIntervalSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Check date facet intervals search api")
|
description = "Check date facet intervals search api")
|
||||||
public void searchWithDates() throws Exception
|
public void searchWithDates() throws Exception
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
RestRequestFacetIntervalsModel facetIntervalsModel = new RestRequestFacetIntervalsModel();
|
RestRequestFacetIntervalsModel facetIntervalsModel = new RestRequestFacetIntervalsModel();
|
||||||
RestRequestFacetSetModel restRequestFacetSetModel = new RestRequestFacetSetModel();
|
RestRequestFacetSetModel restRequestFacetSetModel = new RestRequestFacetSetModel();
|
||||||
|
@@ -21,6 +21,8 @@ package org.alfresco.test.search.functional.searchServices.search;
|
|||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.core.Is.is;
|
import static org.hamcrest.core.Is.is;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -32,11 +34,10 @@ import org.alfresco.rest.search.RestGenericBucketModel;
|
|||||||
import org.alfresco.rest.search.RestGenericFacetResponseModel;
|
import org.alfresco.rest.search.RestGenericFacetResponseModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.testng.Assert;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +75,7 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Check facet intervals mandatory fields")
|
description = "Check facet intervals mandatory fields")
|
||||||
public void checkingFacetsMandatoryErrorMessages()
|
public void checkingFacetsMandatoryErrorMessages()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
List<RestRequestRangesModel> ranges = new ArrayList<>();
|
List<RestRequestRangesModel> ranges = new ArrayList<>();
|
||||||
RestRequestRangesModel facetRangeModel = new RestRequestRangesModel();
|
RestRequestRangesModel facetRangeModel = new RestRequestRangesModel();
|
||||||
ranges.add(facetRangeModel);
|
ranges.add(facetRangeModel);
|
||||||
@@ -114,6 +115,227 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
facetRangeModel.setGap("100");
|
facetRangeModel.setGap("100");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 })
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 }, executionType = ExecutionType.REGRESSION,
|
||||||
|
description = "Check basic facet range search api")
|
||||||
|
public void searchWithRangePreASS121()throws Exception
|
||||||
|
{
|
||||||
|
SearchRequest query = createQuery("* AND SITE:'" + testSite.getId() + "'");
|
||||||
|
|
||||||
|
RestRequestRangesModel facetRangeModel = new RestRequestRangesModel();
|
||||||
|
facetRangeModel.setField("content.size");
|
||||||
|
facetRangeModel.setStart("0");
|
||||||
|
facetRangeModel.setEnd("200");
|
||||||
|
facetRangeModel.setGap("20");
|
||||||
|
List<RestRequestRangesModel> ranges = new ArrayList<>();
|
||||||
|
ranges.add(facetRangeModel);
|
||||||
|
query.setRanges(ranges);
|
||||||
|
SearchResponse response = query(query);
|
||||||
|
response.assertThat().entriesListIsNotEmpty();
|
||||||
|
response.getContext().assertThat().field("facets").isNotEmpty();
|
||||||
|
RestGenericFacetResponseModel facetResponseModel = response.getContext().getFacets().get(0);
|
||||||
|
|
||||||
|
RestGenericBucketModel bucket = facetResponseModel.getBuckets().get(0);
|
||||||
|
bucket.assertThat().field("label").is("[0 - 20)");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:[\"0\" TO \"20\">");
|
||||||
|
Map<String,String> metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
assertEquals(Integer.valueOf(metric.get("count")).intValue(), 0, "Unexpected count for first bucket.");
|
||||||
|
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"0");
|
||||||
|
assertEquals(info.get("end"),"20");
|
||||||
|
assertNull(info.get("count"));
|
||||||
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
|
|
||||||
|
bucket = facetResponseModel.getBuckets().get(1);
|
||||||
|
bucket.assertThat().field("label").is("[20 - 40)");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:[\"20\" TO \"40\">");
|
||||||
|
metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
assertEquals(Integer.valueOf(metric.get("count")).intValue(), 2, "Unexpected count for second bucket.");
|
||||||
|
info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"20");
|
||||||
|
assertEquals(info.get("end"),"40");
|
||||||
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 })
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 }, executionType = ExecutionType.REGRESSION,
|
||||||
|
description = "Check date facet intervals search api")
|
||||||
|
public void searchWithRangeHardendPreASS121()throws Exception
|
||||||
|
{
|
||||||
|
SearchRequest query = createQuery("A*");
|
||||||
|
|
||||||
|
RestRequestRangesModel facetRangeModel = new RestRequestRangesModel();
|
||||||
|
facetRangeModel.setField("content.size");
|
||||||
|
facetRangeModel.setStart("0");
|
||||||
|
facetRangeModel.setEnd("500");
|
||||||
|
facetRangeModel.setGap("200");
|
||||||
|
facetRangeModel.setHardend(true);
|
||||||
|
List<RestRequestRangesModel> ranges = new ArrayList<RestRequestRangesModel>();
|
||||||
|
ranges.add(facetRangeModel);
|
||||||
|
query.setRanges(ranges);
|
||||||
|
SearchResponse response = query(query);
|
||||||
|
response.assertThat().entriesListIsNotEmpty();
|
||||||
|
response.getContext().assertThat().field("facets").isNotEmpty();
|
||||||
|
RestGenericFacetResponseModel facetResponseModel = response.getContext().getFacets().get(0);
|
||||||
|
|
||||||
|
RestGenericBucketModel bucket = facetResponseModel.getBuckets().get(0);
|
||||||
|
bucket.assertThat().field("label").is("[0 - 200)");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:[\"0\" TO \"200\">");
|
||||||
|
Map<String,String> metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
assertTrue(Integer.valueOf(metric.get("count")) >= 4);
|
||||||
|
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"0");
|
||||||
|
assertEquals(info.get("end"),"200");
|
||||||
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
|
assertNull(info.get("count"));
|
||||||
|
|
||||||
|
bucket = facetResponseModel.getBuckets().get(1);
|
||||||
|
bucket.assertThat().field("label").is("[200 - 400)");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:[\"200\" TO \"400\">");
|
||||||
|
info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"200");
|
||||||
|
assertEquals(info.get("end"),"400");
|
||||||
|
metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
assertTrue(Integer.valueOf(metric.get("count")) == 4);
|
||||||
|
assertNull(info.get("count"));
|
||||||
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
|
|
||||||
|
bucket = facetResponseModel.getBuckets().get(2);
|
||||||
|
bucket.assertThat().field("label").is("[400 - 500]");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:[\"400\" TO \"500\"]");
|
||||||
|
metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
assertTrue(Integer.valueOf(metric.get("count")) >= 2);
|
||||||
|
info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"400");
|
||||||
|
assertEquals(info.get("end"),"500");
|
||||||
|
assertNull(info.get("count"));
|
||||||
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
|
assertEquals(info.get("endInclusive"),"true");
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 })
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 }, executionType = ExecutionType.REGRESSION,
|
||||||
|
description = "Check date facet intervals search api")
|
||||||
|
public void searchDateRangePreASS121()throws Exception
|
||||||
|
{
|
||||||
|
SearchRequest query = createQuery("name:A*");
|
||||||
|
|
||||||
|
RestRequestRangesModel facetRangeModel = new RestRequestRangesModel();
|
||||||
|
facetRangeModel.setField("created");
|
||||||
|
facetRangeModel.setStart("2015-09-29T10:45:15.729Z");
|
||||||
|
facetRangeModel.setEnd("2016-09-29T10:45:15.729Z");
|
||||||
|
facetRangeModel.setGap("+280DAY");
|
||||||
|
List<RestRequestRangesModel> ranges = new ArrayList<RestRequestRangesModel>();
|
||||||
|
ranges.add(facetRangeModel);
|
||||||
|
query.setRanges(ranges);
|
||||||
|
SearchResponse response = query(query);
|
||||||
|
response.assertThat().entriesListIsNotEmpty();
|
||||||
|
response.getContext().assertThat().field("facets").isNotEmpty();
|
||||||
|
RestGenericFacetResponseModel facetResponseModel = response.getContext().getFacets().get(0);
|
||||||
|
|
||||||
|
List<RestGenericBucketModel> buckets = facetResponseModel.getBuckets();
|
||||||
|
assertThat(buckets.size(),is(2));
|
||||||
|
|
||||||
|
RestGenericBucketModel bucket = buckets.get(0);
|
||||||
|
bucket.assertThat().field("label").is("[2015-09-29T10:45:15.729Z - 2016-07-05T10:45:15.729Z)");
|
||||||
|
bucket.assertThat().field("filterQuery").is("created:[\"2015-09-29T10:45:15.729Z\" TO \"2016-07-05T10:45:15.729Z\">");
|
||||||
|
bucket.getMetrics().get(0).assertThat().field("value").is("{count=1}");
|
||||||
|
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"2015-09-29T10:45:15.729Z");
|
||||||
|
assertEquals(info.get("end"),"2016-07-05T10:45:15.729Z");
|
||||||
|
assertNull(info.get("count"),"Expecting count to be null");
|
||||||
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 })
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 }, executionType = ExecutionType.REGRESSION,
|
||||||
|
description = "Check date facet intervals search api")
|
||||||
|
public void searchDateAndSizeRangesPreASS121()throws Exception
|
||||||
|
{
|
||||||
|
SearchRequest query = createQuery("name:A*");
|
||||||
|
List<RestRequestRangesModel> ranges = new ArrayList<RestRequestRangesModel>();
|
||||||
|
RestRequestRangesModel facetRangeModel = new RestRequestRangesModel();
|
||||||
|
facetRangeModel.setField("created");
|
||||||
|
facetRangeModel.setStart("2015-09-29T10:45:15.729Z");
|
||||||
|
facetRangeModel.setEnd("2016-09-29T10:45:15.729Z");
|
||||||
|
facetRangeModel.setGap("+280DAY");
|
||||||
|
ranges.add(facetRangeModel);
|
||||||
|
RestRequestRangesModel facetCountRangeModel = new RestRequestRangesModel();
|
||||||
|
facetCountRangeModel.setField("content.size");
|
||||||
|
facetCountRangeModel.setStart("0");
|
||||||
|
facetCountRangeModel.setEnd("500");
|
||||||
|
facetCountRangeModel.setGap("200");
|
||||||
|
ranges.add(facetCountRangeModel);
|
||||||
|
query.setRanges(ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 })
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.PreASS_121 }, executionType = ExecutionType.REGRESSION,
|
||||||
|
description = "Check basic facet range search api")
|
||||||
|
public void searchWithRangeAndIncludeUpperBoundPreASS121()throws Exception
|
||||||
|
{
|
||||||
|
SearchRequest query = createQuery("A*");
|
||||||
|
|
||||||
|
RestRequestRangesModel facetRangeModel = new RestRequestRangesModel();
|
||||||
|
facetRangeModel.setField("content.size");
|
||||||
|
facetRangeModel.setStart("0");
|
||||||
|
facetRangeModel.setEnd("500");
|
||||||
|
facetRangeModel.setGap("200");
|
||||||
|
List<String> include = new ArrayList<String>();
|
||||||
|
include.add("upper");
|
||||||
|
facetRangeModel.setInclude(include);
|
||||||
|
List<RestRequestRangesModel> ranges = new ArrayList<RestRequestRangesModel>();
|
||||||
|
ranges.add(facetRangeModel);
|
||||||
|
query.setRanges(ranges);
|
||||||
|
SearchResponse response = query(query);
|
||||||
|
response.assertThat().entriesListIsNotEmpty();
|
||||||
|
response.getContext().assertThat().field("facets").isNotEmpty();
|
||||||
|
RestGenericFacetResponseModel facetResponseModel = response.getContext().getFacets().get(0);
|
||||||
|
|
||||||
|
RestGenericBucketModel bucket = facetResponseModel.getBuckets().get(0);
|
||||||
|
bucket.assertThat().field("label").is("(0 - 200]");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:<\"0\" TO \"200\"]");
|
||||||
|
Map<String,String> metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
assertTrue(Integer.valueOf(metric.get("count")) >= 4);
|
||||||
|
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"0");
|
||||||
|
assertEquals(info.get("end"),"200");
|
||||||
|
assertNull(info.get("count"));
|
||||||
|
assertEquals(info.get("startInclusive"),"false");
|
||||||
|
assertEquals(info.get("endInclusive"),"true");
|
||||||
|
|
||||||
|
bucket = facetResponseModel.getBuckets().get(1);
|
||||||
|
bucket.assertThat().field("label").is("(200 - 400]");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:<\"200\" TO \"400\"]");
|
||||||
|
metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
Integer count = Integer.valueOf(metric.get("count"));
|
||||||
|
assertTrue(count == 4);
|
||||||
|
info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"200");
|
||||||
|
assertEquals(info.get("end"),"400");
|
||||||
|
assertEquals(info.get("startInclusive"),"false");
|
||||||
|
assertEquals(info.get("endInclusive"),"true");
|
||||||
|
|
||||||
|
bucket = facetResponseModel.getBuckets().get(2);
|
||||||
|
bucket.assertThat().field("label").is("(400 - 600]");
|
||||||
|
bucket.assertThat().field("filterQuery").is("content.size:<\"400\" TO \"600\"]");
|
||||||
|
metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
|
assertTrue(Integer.valueOf(metric.get("count")) >= 5);
|
||||||
|
info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
|
assertEquals(info.get("start"),"400");
|
||||||
|
assertEquals(info.get("end"),"600");
|
||||||
|
assertEquals(info.get("startInclusive"),"false");
|
||||||
|
assertEquals(info.get("endInclusive"),"true");
|
||||||
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_121 })
|
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_121 })
|
||||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_121 }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_121 }, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Check basic facet range search api")
|
description = "Check basic facet range search api")
|
||||||
@@ -143,7 +365,7 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
assertEquals(info.get("start"),"20");
|
assertEquals(info.get("start"),"20");
|
||||||
assertEquals(info.get("end"),"40");
|
assertEquals(info.get("end"),"40");
|
||||||
Assert.assertNull(info.get("count"));
|
assertNull(info.get("count"));
|
||||||
assertEquals(info.get("startInclusive"),"true");
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
assertEquals(info.get("endInclusive"),"false");
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
|
|
||||||
@@ -201,7 +423,7 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
assertEquals(info.get("end"),"40");
|
assertEquals(info.get("end"),"40");
|
||||||
assertEquals(info.get("startInclusive"),"true");
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
assertEquals(info.get("endInclusive"),"false");
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
Assert.assertNull(info.get("count"));
|
assertNull(info.get("count"));
|
||||||
|
|
||||||
bucket = facetResponseModel.getBuckets().get(1);
|
bucket = facetResponseModel.getBuckets().get(1);
|
||||||
bucket.assertThat().field("label").is("[40 - 120)");
|
bucket.assertThat().field("label").is("[40 - 120)");
|
||||||
@@ -211,7 +433,7 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
assertEquals(info.get("end"),"120");
|
assertEquals(info.get("end"),"120");
|
||||||
metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
metric = (Map<String, String>) bucket.getMetrics().get(0).getValue();
|
||||||
assertEquals(Integer.valueOf(metric.get("count")).intValue(), 1, "Unexpected count for second bucket.");
|
assertEquals(Integer.valueOf(metric.get("count")).intValue(), 1, "Unexpected count for second bucket.");
|
||||||
Assert.assertNull(info.get("count"));
|
assertNull(info.get("count"));
|
||||||
assertEquals(info.get("startInclusive"),"true");
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
assertEquals(info.get("endInclusive"),"false");
|
assertEquals(info.get("endInclusive"),"false");
|
||||||
|
|
||||||
@@ -223,7 +445,7 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
info = (Map<String, String>) bucket.getBucketInfo();
|
info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
assertEquals(info.get("start"),"120");
|
assertEquals(info.get("start"),"120");
|
||||||
assertEquals(info.get("end"),"200");
|
assertEquals(info.get("end"),"200");
|
||||||
Assert.assertNull(info.get("count"));
|
assertNull(info.get("count"));
|
||||||
assertEquals(info.get("startInclusive"),"true");
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
assertEquals(info.get("endInclusive"),"true");
|
assertEquals(info.get("endInclusive"),"true");
|
||||||
}
|
}
|
||||||
@@ -260,7 +482,7 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
assertEquals(info.get("start"),"2015-09-29T10:45:15.729Z");
|
assertEquals(info.get("start"),"2015-09-29T10:45:15.729Z");
|
||||||
assertEquals(info.get("end"),"2017-04-11T10:45:15.729Z");
|
assertEquals(info.get("end"),"2017-04-11T10:45:15.729Z");
|
||||||
Assert.assertNull(info.get("count"),"1");
|
assertNull(info.get("count"),"1");
|
||||||
assertEquals(info.get("startInclusive"),"true");
|
assertEquals(info.get("startInclusive"),"true");
|
||||||
assertEquals(info.get("endInclusive"),"true");
|
assertEquals(info.get("endInclusive"),"true");
|
||||||
}
|
}
|
||||||
@@ -319,7 +541,7 @@ public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
Map<String, String> info = (Map<String, String>) bucket.getBucketInfo();
|
||||||
assertEquals(info.get("start"),"20");
|
assertEquals(info.get("start"),"20");
|
||||||
assertEquals(info.get("end"),"40");
|
assertEquals(info.get("end"),"40");
|
||||||
Assert.assertNull(info.get("count"));
|
assertNull(info.get("count"));
|
||||||
assertEquals(info.get("startInclusive"),"false");
|
assertEquals(info.get("startInclusive"),"false");
|
||||||
assertEquals(info.get("endInclusive"),"true");
|
assertEquals(info.get("endInclusive"),"true");
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ import org.alfresco.rest.search.RestRequestQueryModel;
|
|||||||
import org.alfresco.rest.search.RestResultBucketsModel;
|
import org.alfresco.rest.search.RestResultBucketsModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
@@ -23,7 +23,7 @@ import org.alfresco.rest.search.SearchResponse;
|
|||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.report.Bug;
|
import org.alfresco.utility.report.Bug;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
@@ -35,7 +35,7 @@ import org.alfresco.rest.search.RestRequestFacetFieldsModel;
|
|||||||
import org.alfresco.rest.search.RestRequestPivotModel;
|
import org.alfresco.rest.search.RestRequestPivotModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -62,7 +62,7 @@ public class PivotFacetedSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks errors with pivot using Search api")
|
description = "Checks errors with pivot using Search api")
|
||||||
public void searchWithPivotingErrors()
|
public void searchWithPivotingErrors()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
||||||
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
||||||
@@ -95,7 +95,7 @@ public class PivotFacetedSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks with pivot using Search api")
|
description = "Checks with pivot using Search api")
|
||||||
public void searchWithPivoting()
|
public void searchWithPivoting()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
||||||
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
||||||
@@ -124,7 +124,7 @@ public class PivotFacetedSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks nested pivot using Search api")
|
description = "Checks nested pivot using Search api")
|
||||||
public void searchWithNestedPivoting()
|
public void searchWithNestedPivoting()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
||||||
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
||||||
@@ -181,7 +181,7 @@ public class PivotFacetedSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks range pivots using Search api")
|
description = "Checks range pivots using Search api")
|
||||||
public void searchWithRangePivoting()
|
public void searchWithRangePivoting()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
String endDate = LocalDateTime.now()
|
String endDate = LocalDateTime.now()
|
||||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")); //the car document is created at runtime, so to include it in range facets end date must be now
|
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")); //the car document is created at runtime, so to include it in range facets end date must be now
|
||||||
@@ -245,7 +245,7 @@ public class PivotFacetedSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks with pivot using Search api and a label as a key")
|
description = "Checks with pivot using Search api and a label as a key")
|
||||||
public void searchWithPivotingUsingLabel()
|
public void searchWithPivotingUsingLabel()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel();
|
||||||
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
List<RestRequestFacetFieldModel> list = new ArrayList<>();
|
||||||
RestRequestFacetFieldModel creatorFacetFieldModel = new RestRequestFacetFieldModel("creator");
|
RestRequestFacetFieldModel creatorFacetFieldModel = new RestRequestFacetFieldModel("creator");
|
||||||
|
@@ -29,7 +29,7 @@ import org.alfresco.rest.search.RestRequestQueryModel;
|
|||||||
import org.alfresco.rest.search.RestResultBucketsModel;
|
import org.alfresco.rest.search.RestResultBucketsModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@@ -1,18 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 Alfresco Software Limited.
|
* Copyright (C) 2017 Alfresco Software Limited.
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -26,24 +22,24 @@ import org.alfresco.rest.search.RestRequestFieldsModel;
|
|||||||
import org.alfresco.rest.search.RestRequestHighlightModel;
|
import org.alfresco.rest.search.RestRequestHighlightModel;
|
||||||
import org.alfresco.rest.search.RestRequestQueryModel;
|
import org.alfresco.rest.search.RestRequestQueryModel;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.report.Bug;
|
import org.alfresco.utility.report.Bug;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search high lighting test.
|
* Search high lighting test.
|
||||||
* @author Michael Suzuki
|
|
||||||
*
|
*
|
||||||
|
* @author Michael Suzuki
|
||||||
*/
|
*/
|
||||||
public class SearchHighLightTest extends AbstractSearchServicesE2ETest
|
public class SearchHighLightTest extends AbstractSearchServicesE2ETest
|
||||||
{
|
{
|
||||||
@Test(groups={TestGroup.SEARCH,TestGroup.REST_API})
|
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API })
|
||||||
@Bug(id = "TAS-3220")
|
@Bug(id = "TAS-3220")
|
||||||
public void searchWithHighLight() throws Exception
|
public void searchWithHighLight() throws Exception
|
||||||
{
|
{
|
||||||
waitForContentIndexing(file2.getContent(), true);
|
waitForContentIndexing(file2.getContent(), true);
|
||||||
|
|
||||||
RestRequestQueryModel queryReq = new RestRequestQueryModel();
|
RestRequestQueryModel queryReq = new RestRequestQueryModel();
|
||||||
queryReq.setQuery("cm:content:cars");
|
queryReq.setQuery("cm:content:cars");
|
||||||
queryReq.setUserQuery("cars");
|
queryReq.setUserQuery("cars");
|
||||||
|
|
||||||
@@ -54,16 +50,16 @@ public class SearchHighLightTest extends AbstractSearchServicesE2ETest
|
|||||||
List<RestRequestFieldsModel> fields = new ArrayList<>();
|
List<RestRequestFieldsModel> fields = new ArrayList<>();
|
||||||
fields.add(new RestRequestFieldsModel("cm:content"));
|
fields.add(new RestRequestFieldsModel("cm:content"));
|
||||||
highlight.setFields(fields);
|
highlight.setFields(fields);
|
||||||
SearchResponse nodes = query(queryReq, highlight);
|
SearchResponse nodes = query(queryReq, highlight);
|
||||||
nodes.assertThat().entriesListIsNotEmpty();
|
nodes.assertThat().entriesListIsNotEmpty();
|
||||||
ResponseHighLightModel hl = nodes.getEntryByIndex(0).getSearch().getHighlight().get(0);
|
ResponseHighLightModel hl = nodes.getEntryByIndex(0).getSearch().getHighlight().get(0);
|
||||||
hl.assertThat().field("snippets").contains( "The landrover discovery is not a sports ¿car?");
|
hl.assertThat().field("snippets").contains("The landrover discovery is not a sports ¿car?");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups={TestGroup.SEARCH,TestGroup.REST_API})
|
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API })
|
||||||
public void searchNonIndexedData() throws Exception
|
public void searchNonIndexedData() throws Exception
|
||||||
{
|
{
|
||||||
RestRequestQueryModel queryReq = new RestRequestQueryModel();
|
RestRequestQueryModel queryReq = new RestRequestQueryModel();
|
||||||
queryReq.setQuery("cm:title");
|
queryReq.setQuery("cm:title");
|
||||||
queryReq.setUserQuery("zoro");
|
queryReq.setUserQuery("zoro");
|
||||||
|
|
||||||
@@ -74,7 +70,7 @@ public class SearchHighLightTest extends AbstractSearchServicesE2ETest
|
|||||||
List<RestRequestFieldsModel> fields = new ArrayList<>();
|
List<RestRequestFieldsModel> fields = new ArrayList<>();
|
||||||
fields.add(new RestRequestFieldsModel("cm:title"));
|
fields.add(new RestRequestFieldsModel("cm:title"));
|
||||||
highlight.setFields(fields);
|
highlight.setFields(fields);
|
||||||
SearchResponse nodes = query(queryReq, highlight);
|
SearchResponse nodes = query(queryReq, highlight);
|
||||||
nodes.assertThat().entriesListDoesNotContain("highlight");
|
nodes.assertThat().entriesListDoesNotContain("highlight");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import org.alfresco.rest.search.SearchRequest;
|
|||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ import org.alfresco.rest.search.SearchRequest;
|
|||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
|
@@ -18,7 +18,7 @@ import org.alfresco.utility.data.DataSite;
|
|||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@@ -1,23 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2018 Alfresco Software Limited.
|
* Copyright (C) 2005-2018 Alfresco Software Limited.
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.test.search.functional.searchServices.search;
|
package org.alfresco.test.search.functional.searchServices.search;
|
||||||
|
|
||||||
|
import org.testng.annotations.Test;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
@@ -31,9 +28,8 @@ import org.alfresco.rest.search.RestInstanceModel;
|
|||||||
import org.alfresco.rest.search.RestShardInfoModel;
|
import org.alfresco.rest.search.RestShardInfoModel;
|
||||||
import org.alfresco.rest.search.RestShardInfoModelCollection;
|
import org.alfresco.rest.search.RestShardInfoModelCollection;
|
||||||
import org.alfresco.rest.search.RestShardModel;
|
import org.alfresco.rest.search.RestShardModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shard info end point REST API test.
|
* Shard info end point REST API test.
|
||||||
@@ -42,10 +38,12 @@ import org.testng.annotations.Test;
|
|||||||
*/
|
*/
|
||||||
public class ShardInfoTest extends AbstractSearchServicesE2ETest
|
public class ShardInfoTest extends AbstractSearchServicesE2ETest
|
||||||
{
|
{
|
||||||
@Test(groups={TestGroup.SEARCH, TestGroup.REST_API, TestGroup.ACS_60n})
|
/* The test that will be excluded when running master slave setup, excluding the ASS_MASTER test group. */
|
||||||
|
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API, TestGroup.ACS_60n, TestGroup.ASS_MASTER })
|
||||||
public void getShardInfoWithAdminAuthority() throws JsonProcessingException
|
public void getShardInfoWithAdminAuthority() throws JsonProcessingException
|
||||||
{
|
{
|
||||||
RestShardInfoModelCollection info = restClient.authenticateUser(dataUser.getAdminUser()).withShardInfoAPI().getInfo();
|
RestShardInfoModelCollection info = restClient.authenticateUser(dataUser.getAdminUser()).withShardInfoAPI()
|
||||||
|
.getInfo();
|
||||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
info.assertThat().entriesListIsNotEmpty();
|
info.assertThat().entriesListIsNotEmpty();
|
||||||
assertEquals(info.getPagination().getTotalItems().intValue(), 2);
|
assertEquals(info.getPagination().getTotalItems().intValue(), 2);
|
||||||
@@ -83,7 +81,45 @@ public class ShardInfoTest extends AbstractSearchServicesE2ETest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups={TestGroup.SEARCH, TestGroup.REST_API, TestGroup.ACS_60n})
|
/* The test that will be run when in master slave setup by including the ASS_MASTER_SLAVE test group. */
|
||||||
|
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API, TestGroup.ACS_60n, TestGroup.ASS_MASTER_SLAVE })
|
||||||
|
public void getShardInfoWithAdminAuthorityMasterSlaveConfig() throws JsonProcessingException
|
||||||
|
{
|
||||||
|
RestShardInfoModelCollection info = restClient.authenticateUser(dataUser.getAdminUser()).withShardInfoAPI()
|
||||||
|
.getInfo();
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
info.assertThat().entriesListIsNotEmpty();
|
||||||
|
assertEquals(info.getPagination().getTotalItems().intValue(), 2);
|
||||||
|
|
||||||
|
List<String> stores = Arrays.asList("workspace://SpacesStore", "archive://SpacesStore");
|
||||||
|
List<String> baseUrls = Arrays.asList("/solr/alfresco", "/solr/archive");
|
||||||
|
|
||||||
|
List<RestShardInfoModel> entries = info.getEntries();
|
||||||
|
for (RestShardInfoModel shardInfoModel : entries)
|
||||||
|
{
|
||||||
|
RestShardInfoModel model = shardInfoModel.getModel();
|
||||||
|
assertEquals(model.getTemplate(), "rerank");
|
||||||
|
assertEquals(model.getShardMethod(), "DB_ID");
|
||||||
|
assertTrue(model.getHasContent());
|
||||||
|
|
||||||
|
assertTrue(stores.contains(model.getStores()));
|
||||||
|
|
||||||
|
List<RestShardModel> shards = model.getShards();
|
||||||
|
assertNotNull(shards);
|
||||||
|
RestShardModel shard = shards.iterator().next();
|
||||||
|
assertNotNull(shard);
|
||||||
|
List<RestInstanceModel> instances = shard.getInstances();
|
||||||
|
assertNotNull(instances);
|
||||||
|
RestInstanceModel instance = instances.iterator().next();
|
||||||
|
assertNotNull(instance);
|
||||||
|
|
||||||
|
assertTrue(baseUrls.contains(instance.getBaseUrl()));
|
||||||
|
|
||||||
|
assertEquals(instance.getState(), "ACTIVE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API, TestGroup.ACS_60n })
|
||||||
public void getShardInfoWithoutAdminAuthority() throws Exception
|
public void getShardInfoWithoutAdminAuthority() throws Exception
|
||||||
{
|
{
|
||||||
restClient.authenticateUser(dataUser.createRandomTestUser()).withShardInfoAPI().getInfo();
|
restClient.authenticateUser(dataUser.createRandomTestUser()).withShardInfoAPI().getInfo();
|
||||||
|
@@ -43,7 +43,7 @@ import org.alfresco.rest.search.RestRequestQueryModel;
|
|||||||
import org.alfresco.rest.search.RestRequestStatsModel;
|
import org.alfresco.rest.search.RestRequestStatsModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -69,7 +69,7 @@ public class StatsSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks errors with stats using Search api")
|
description = "Checks errors with stats using Search api")
|
||||||
public void searchWithBasicStats()
|
public void searchWithBasicStats()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
Pagination pagination = new Pagination();
|
Pagination pagination = new Pagination();
|
||||||
pagination.setMaxItems(2);
|
pagination.setMaxItems(2);
|
||||||
List<RestRequestStatsModel> statsModels = new ArrayList<>();
|
List<RestRequestStatsModel> statsModels = new ArrayList<>();
|
||||||
@@ -153,7 +153,7 @@ public class StatsSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks errors with stats labels using Search api")
|
description = "Checks errors with stats labels using Search api")
|
||||||
public void searchWithStatsLabel()
|
public void searchWithStatsLabel()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
Pagination pagination = new Pagination();
|
Pagination pagination = new Pagination();
|
||||||
pagination.setMaxItems(2);
|
pagination.setMaxItems(2);
|
||||||
List<RestRequestStatsModel> statsModels = new ArrayList<>();
|
List<RestRequestStatsModel> statsModels = new ArrayList<>();
|
||||||
@@ -208,7 +208,7 @@ public class StatsSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks errors with stats with Pivot using Search api")
|
description = "Checks errors with stats with Pivot using Search api")
|
||||||
public void searchWithStatsAndMutlilevelPivot()
|
public void searchWithStatsAndMutlilevelPivot()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
Pagination pagination = new Pagination();
|
Pagination pagination = new Pagination();
|
||||||
pagination.setMaxItems(1);
|
pagination.setMaxItems(1);
|
||||||
@@ -271,7 +271,7 @@ public class StatsSearchTest extends AbstractSearchServicesE2ETest
|
|||||||
description = "Checks errors with stats with Pivot using Search api")
|
description = "Checks errors with stats with Pivot using Search api")
|
||||||
public void searchWithStatsAndPivot()
|
public void searchWithStatsAndPivot()
|
||||||
{
|
{
|
||||||
SearchRequest query = carsQuery();
|
SearchRequest query = createQuery("cars");
|
||||||
|
|
||||||
Pagination pagination = new Pagination();
|
Pagination pagination = new Pagination();
|
||||||
pagination.setMaxItems(2);
|
pagination.setMaxItems(2);
|
||||||
|
@@ -9,7 +9,7 @@ package org.alfresco.test.search.functional.searchServices.search.rm;
|
|||||||
|
|
||||||
import org.alfresco.rest.search.RestRequestQueryModel;
|
import org.alfresco.rest.search.RestRequestQueryModel;
|
||||||
import org.alfresco.rest.search.SearchResponse;
|
import org.alfresco.rest.search.SearchResponse;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@@ -15,7 +15,7 @@ import org.alfresco.utility.model.ContentModel;
|
|||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FileType;
|
import org.alfresco.utility.model.FileType;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -63,7 +63,7 @@ public class CascadingTrackerIntegrationTest extends AbstractE2EFunctionalTest
|
|||||||
|
|
||||||
// Find nodes where Path with new folder name matches
|
// Find nodes where Path with new folder name matches
|
||||||
String parentQueryAfterRename = "NPATH:\"4/Company Home/Sites/" + testSite.getTitle() + "/documentLibrary/" + parentNewName + "\"";
|
String parentQueryAfterRename = "NPATH:\"4/Company Home/Sites/" + testSite.getTitle() + "/documentLibrary/" + parentNewName + "\"";
|
||||||
boolean indexingInProgress = !waitForContent(parentQueryAfterRename, childFile.getName(), true);
|
boolean indexingInProgress = !isContentInSearchResults(parentQueryAfterRename, childFile.getName(), true);
|
||||||
|
|
||||||
// Query using new parent name: Expect parent folder and child file
|
// Query using new parent name: Expect parent folder and child file
|
||||||
int descendantCountOfNewName = query(parentQueryAfterRename).getPagination().getCount();
|
int descendantCountOfNewName = query(parentQueryAfterRename).getPagination().getCount();
|
||||||
@@ -107,7 +107,7 @@ public class CascadingTrackerIntegrationTest extends AbstractE2EFunctionalTest
|
|||||||
|
|
||||||
// Find nodes where Path with new folder name matches
|
// Find nodes where Path with new folder name matches
|
||||||
String parentQueryAfterRename = "NPATH:\"4/Company Home/Sites/" + testSite.getTitle() + "/documentLibrary/" + grandParentNewName + "\"";
|
String parentQueryAfterRename = "NPATH:\"4/Company Home/Sites/" + testSite.getTitle() + "/documentLibrary/" + grandParentNewName + "\"";
|
||||||
boolean indexingInProgress = !waitForContent(parentQueryAfterRename, grandChildFile.getName(), true);
|
boolean indexingInProgress = !isContentInSearchResults(parentQueryAfterRename, grandChildFile.getName(), true);
|
||||||
|
|
||||||
// Query using new parent name: Expect grand parent, child folder, grand child file
|
// Query using new parent name: Expect grand parent, child folder, grand child file
|
||||||
int descendantCountOfNewName = query(parentQueryAfterRename).getPagination().getCount();
|
int descendantCountOfNewName = query(parentQueryAfterRename).getPagination().getCount();
|
||||||
|
@@ -21,7 +21,7 @@ import javax.json.JsonArrayBuilder;
|
|||||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||||
import org.alfresco.rest.model.RestTextResponse;
|
import org.alfresco.rest.model.RestTextResponse;
|
||||||
import org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest;
|
import org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest;
|
||||||
import org.alfresco.utility.model.TestGroup;
|
import org.alfresco.search.TestGroup;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
@@ -13,7 +13,6 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
|||||||
log4j.appender.stdout.Target=System.out
|
log4j.appender.stdout.Target=System.out
|
||||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
|
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||||
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
|
|
||||||
|
|
||||||
# TestRail particular log file
|
# TestRail particular log file
|
||||||
# Direct log messages to a log file
|
# Direct log messages to a log file
|
||||||
|
Reference in New Issue
Block a user