ACS-2276 Add missing indexControl on hidden nodes to avoid Elasticsearch indexing

* ACS-2276 - Add indexControl to extensions and module-deployments

* ACS-2276 - Remove unnecessary test import
This commit is contained in:
Domenico Sibilio
2022-02-11 11:44:48 +01:00
committed by GitHub
parent 64b9564dc7
commit 105c83ca7e
3 changed files with 56 additions and 0 deletions

View File

@@ -33,9 +33,12 @@
<view:properties>
<cm:description></cm:description>
<cm:name>extensions</cm:name>
<cm:isIndexed>false</cm:isIndexed>
<cm:isContentIndexed>false</cm:isContentIndexed>
</view:properties>
<view:aspects>
<sys:hidden/>
<cm:indexControl/>
</view:aspects>
</cm:folder>
</cm:contains>
@@ -50,9 +53,12 @@
<view:properties>
<cm:description></cm:description>
<cm:name>module-deployments</cm:name>
<cm:isIndexed>false</cm:isIndexed>
<cm:isContentIndexed>false</cm:isContentIndexed>
</view:properties>
<view:aspects>
<sys:hidden/>
<cm:indexControl/>
</view:aspects>
</cm:folder>
</cm:contains>

View File

@@ -113,6 +113,31 @@ public class ImporterComponentTest extends BaseSpringTest
importerService.importView(testReader, location, null, new ImportTimerProgress());
System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
}
@Test
public void testImportNotIndexedSubfolder() throws Exception
{
InputStream test = getClass().getClassLoader().getResourceAsStream(
"org/alfresco/repo/importer/import_not_indexed_subfolder.xml");
try (InputStreamReader testReader = new InputStreamReader(test, "UTF-8"))
{
Location location = new Location(storeRef);
importerService.importView(testReader, location, null, new ImportTimerProgress());
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
NodeRef testParentFolderRef = nodeService.getChildAssocs(rootNodeRef).get(0).getChildRef();
NodeRef testSubfolderRef = nodeService.getChildAssocs(testParentFolderRef).get(0).getChildRef();
assertFalse("The node's isIndexed property should be false.",
DefaultTypeConverter.INSTANCE.convert(Boolean.class,
nodeService.getProperty(testSubfolderRef, ContentModel.PROP_IS_INDEXED)));
assertFalse("The node's isContentIndexed property should be false.",
DefaultTypeConverter.INSTANCE.convert(Boolean.class,
nodeService.getProperty(testSubfolderRef, ContentModel.PROP_IS_CONTENT_INDEXED)));
assertTrue("The node should be marked with the indexControl aspect.",
nodeService.getAspects(testSubfolderRef).contains(ContentModel.ASPECT_INDEX_CONTROL));
}
}
@Test
public void testImportWithAuditableProperties() throws Exception

View File

@@ -0,0 +1,25 @@
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0">
<cm:folder view:childName="cm:test-parent-folder">
<view:properties>
<cm:description>Test Parent Folder</cm:description>
<cm:name>test-parent-folder</cm:name>
</view:properties>
<view:aspects>
<sys:hidden />
</view:aspects>
<cm:contains>
<cm:folder view:childName="cm:test-not-indexed-subfolder">
<view:properties>
<cm:description>Test Subfolder</cm:description>
<cm:name>test-not-indexed-subfolder</cm:name>
<cm:isIndexed>false</cm:isIndexed>
<cm:isContentIndexed>false</cm:isContentIndexed>
</view:properties>
<view:aspects>
<sys:hidden />
<cm:indexControl />
</view:aspects>
</cm:folder>
</cm:contains>
</cm:folder>
</view:view>