mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
search-1151: added upgrade suite
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="https://gitlab.alfresco.com/tas/tas-namespaces/raw/master/input-test-data.xsd">
|
||||
<users>
|
||||
<user id="userSiteSearch" name="ass-user" password="password" />
|
||||
</users>
|
||||
<sites>
|
||||
<site name="testSiteSearch" createdBy="userSiteSearch" visibility="PUBLIC">
|
||||
<folders>
|
||||
<folder name="folder1" createdBy="userSiteSearch">
|
||||
<files>
|
||||
<file name="sub-file1.txt" createdBy="userSiteSearch">
|
||||
<content>content sub-file 1</content>
|
||||
</file>
|
||||
<file name="sub-file2.txt" createdBy="userSiteSearch">
|
||||
<content>content sub-file 2</content>
|
||||
</file>
|
||||
<file name="sub-file3.txt" createdBy="userSiteSearch">
|
||||
<content>content sub-file 3</content>
|
||||
</file>
|
||||
<file name="sub-file4.txt" createdBy="userSiteSearch">
|
||||
<content>content sub-file 4</content>
|
||||
</file>
|
||||
</files>
|
||||
<folders>
|
||||
<folder name="sub-folder1" createdBy="userSiteSearch"></folder>
|
||||
<folder name="sub-folder2" createdBy="userSiteSearch"></folder>
|
||||
</folders>
|
||||
</folder>
|
||||
<folder name="folder2" createdBy="userSiteSearch"></folder>
|
||||
<folder name="parent-folder3" createdBy="userSiteSearch"></folder>
|
||||
</folders>
|
||||
<files>
|
||||
<file name="file1.txt" createdBy="userSiteSearch">
|
||||
<content>file 1 content</content>
|
||||
</file>
|
||||
<file name="parent-file2.txt" createdBy="admin">
|
||||
<content>file 2 content</content>
|
||||
</file>
|
||||
</files>
|
||||
</site>
|
||||
</sites>
|
||||
|
||||
<!--CMIS Queries: pass here any queries -->
|
||||
<queries>
|
||||
<query
|
||||
value="SELECT * FROM cmis:document"
|
||||
expectedResults="100" />
|
||||
<!-- 2 files in root -->
|
||||
<!-- <query
|
||||
value="SELECT * FROM cmis:document where CONTAINS('PATH:"/app:company_home/st:sites/cm:testSiteSearch/cm:documentLibrary/*"')"
|
||||
expectedResults="2" />
|
||||
2 folder in root
|
||||
<query
|
||||
value="SELECT * FROM cmis:folder where CONTAINS('PATH:"/app:company_home/st:sites/cm:testSiteSearch/cm:documentLibrary/*"')"
|
||||
expectedResults="3" /> -->
|
||||
</queries>
|
||||
</testData>
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.alfresco.service.search.e2e;
|
||||
|
||||
import org.alfresco.cmis.CmisWrapper;
|
||||
import org.alfresco.utility.data.DataContent;
|
||||
import org.alfresco.utility.data.DataSite;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.provider.XMLTestData;
|
||||
import org.alfresco.utility.network.ServerHealth;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
||||
/**
|
||||
* @author Paul Brodner
|
||||
* We can use this class for both SearchService and InsightEngine
|
||||
*
|
||||
*/
|
||||
@ContextConfiguration("classpath:alfresco-search-e2e-context.xml")
|
||||
public abstract class UpgradeTestCase extends AbstractTestNGSpringContextTests {
|
||||
|
||||
@Autowired
|
||||
protected ServerHealth serverHealth;
|
||||
|
||||
@Autowired
|
||||
protected DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
protected DataSite dataSite;
|
||||
|
||||
@Autowired
|
||||
protected DataContent dataContent;
|
||||
|
||||
@Autowired
|
||||
protected CmisWrapper cmisAPI;
|
||||
|
||||
protected XMLTestData testData;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void checkServerHealth() throws Exception
|
||||
{
|
||||
serverHealth.assertServerIsOnline();
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package org.alfresco.service.search.e2e.searchservices;
|
||||
|
||||
import org.alfresco.service.search.e2e.UpgradeTestCase;
|
||||
import org.alfresco.utility.LogFactory;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.data.provider.XMLDataConfig;
|
||||
import org.alfresco.utility.data.provider.XMLTestData;
|
||||
import org.alfresco.utility.data.provider.XMLTestDataProvider;
|
||||
import org.alfresco.utility.model.QueryModel;
|
||||
import org.slf4j.Logger;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SearchServiceUpgradeTests extends UpgradeTestCase {
|
||||
|
||||
private static Logger LOG = LogFactory.getLogger();
|
||||
|
||||
@Test(dataProviderClass = XMLTestDataProvider.class, dataProvider = "getAllData")
|
||||
@XMLDataConfig(file = "src/main/resources/testdata/for-upgrade.xml")
|
||||
public void prepareData(XMLTestData testData) throws Exception {
|
||||
LOG.info("Start Preparing data for Upgrade testing");
|
||||
this.testData = testData;
|
||||
this.testData.createUsers(dataUser);
|
||||
this.testData.createSitesStructure(dataSite, dataContent, dataUser);
|
||||
// wait for solr index
|
||||
Utility.waitToLoopTime(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be executed after prepareData
|
||||
* I am not adding a dependency here, because I want to play with pre/post upgrade scenarios directly in xml suite files.
|
||||
*/
|
||||
@Test(dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
|
||||
@XMLDataConfig(file = "src/main/resources/testdata/for-upgrade.xml")
|
||||
public void checkDataIsSearchable(QueryModel query) throws Exception
|
||||
{
|
||||
LOG.info("Start testing if data is searchable");
|
||||
cmisAPI.authenticateUser(dataUser.getAdminUser())
|
||||
.withQuery(query.getValue())
|
||||
.applyNodeRefsFrom(testData).assertResultsCount().equals(query.getResults());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
|
||||
<suite name="SearchSuite" verbose="6" preserve-order="true">
|
||||
<test name="Post-Upgrade">
|
||||
<classes>
|
||||
<!-- this class depends on data produce and validated by search-pre-upgrade-suite.xml.
|
||||
Execute it after upgrading product to new version -->
|
||||
<class
|
||||
name="org.alfresco.service.search.e2e.searchservices.SearchServiceUpgradeTests">
|
||||
<methods>
|
||||
<include name="checkDataIsSearchable" />
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
<suite name="SearchSuite" verbose="6" preserve-order="true">
|
||||
<test name="Pre-Upgrade">
|
||||
<classes>
|
||||
<!-- execute this before upgrade -->
|
||||
<class
|
||||
name="org.alfresco.service.search.e2e.searchservices.SearchServiceUpgradeTests">
|
||||
<methods>
|
||||
<include name="prepareData" />
|
||||
<include name="checkDataIsSearchable" />
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
Reference in New Issue
Block a user