SEARCH-2139 tests for test definition in the solr schema

This commit is contained in:
Keerat
2020-05-05 11:46:07 +01:00
parent 6566d9c1bc
commit e2572e839d
2 changed files with 201 additions and 0 deletions
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="allfieldtypes:allfieldtypes">
<author>Administrator</author>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
</imports>
<namespaces>
<namespace uri="allfieldtypes" prefix="allfieldtypes"/>
</namespaces>
<data-types/>
<constraints/>
<types>
<type name="allfieldtypes:document">
<title>allfieldtypes Content</title>
<parent>cm:content</parent>
<properties>
<property name="allfieldtypes:TextPropertyA">
<title>Text</title>
<type>d:text</type>
</property>
</properties>
<associations>
<association name="allfieldtypes:allfieldtypesContent">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:content</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
</type>
</types>
<aspects>
<aspect name="allfieldtypes:text">
<title>text</title>
<properties>
<property name="allfieldtypes:mltextLOVPartial">
<title>mltextLOVPartial</title>
<type>d:mltext</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>BOTH</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="allfieldtypes:textPatternUnique">
<title>textPatternUnique</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>FALSE</tokenised>
<facetable>false</facetable>
</index>
</property>
<property name="allfieldtypes:mltextFree">
<title>mltextFree</title>
<type>d:mltext</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>TRUE</tokenised>
<facetable>false</facetable>
</index>
</property>
<property name="allfieldtypes:textLOVPartial">
<title>textLOVPartial</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>BOTH</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="allfieldtypes:mltextPatternUnique">
<title>mltextPatternUnique</title>
<type>d:mltext</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>FALSE</tokenised>
<facetable>false</facetable>
</index>
</property>
<property name="allfieldtypes:mltextPatternMany">
<title>mltextPatternMany</title>
<type>d:mltext</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>BOTH</tokenised>
<facetable>false</facetable>
</index>
</property>
<property name="allfieldtypes:textLOVWhole">
<title>textLOVWhole</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>FALSE</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="allfieldtypes:mltextNone">
<title>mltextNone</title>
<type>d:mltext</type>
<mandatory>false</mandatory>
<index enabled="false">
<tokenised>TRUE</tokenised>
</index>
</property>
<property name="allfieldtypes:textNone">
<title>textNone</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="false">
<tokenised>TRUE</tokenised>
</index>
</property>
<property name="allfieldtypes:textFree">
<title>textFree</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>TRUE</tokenised>
<facetable>false</facetable>
</index>
</property>
<property name="allfieldtypes:mltextLOVWhole">
<title>mltextLOVWhole</title>
<type>d:mltext</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>FALSE</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="allfieldtypes:textPatternMany">
<title>textPatternMany</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>BOTH</tokenised>
<facetable>false</facetable>
</index>
</property>
</properties>
<associations/>
<overrides/>
<mandatory-aspects/>
</aspect>
</aspects>
</model>
@@ -0,0 +1,47 @@
package org.alfresco.test.search.functional.searchServices.search;
import org.alfresco.rest.search.SearchResponse;
import org.alfresco.utility.data.CustomObjectTypeProperties;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
import org.springframework.http.HttpStatus;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* A test for fields defined in the solr schema
* Based on https://issues.alfresco.com/jira/browse/SEARCH-2139
*/
public class FieldDefinitionTest extends AbstractSearchServicesE2ETest {
private FolderModel Folder1;
private FileModel File1;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
dataContent.usingAdmin().deployContentModel("model/search-2139-model.xml");
Folder1 = new FolderModel("folder1");
File1 = new FileModel("standard-file1.txt");
File1.setContent("file1");
// dataContent.usingUser(testUser).usingResource(Folder1).createCustomContent(File1, "D:text:document", new CustomObjectTypeProperties()
// .addProperty("allfieldtypes:mltextLOVPartial", "text file-1"));
// dataContent.usingUser(testUser).usingSite(testSite).createCustomContent(File1, "D:allfieldtypes:document", new CustomObjectTypeProperties()
// .addProperty("allfieldtypes:mltextLOVPartial", "text folder-2"));
dataContent.usingUser(testUser).usingSite(testSite).createCustomContent(File1, "allfieldtypes:document", new CustomObjectTypeProperties());
}
@Test(priority = 1)
public void testTextField()
{
SearchResponse response = queryAsUser(testUser, "allfieldtypes_mltextLOVPartial:text file-1");
restClient.assertStatusCodeIs(HttpStatus.OK);
Assert.assertEquals(response.getPagination().getCount(), 1);
}
}