diff --git a/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/ContentPropertyValueTrackerIT.java b/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/ContentPropertyValueTrackerIT.java index 2f9c2dca3..55263b4ac 100644 --- a/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/ContentPropertyValueTrackerIT.java +++ b/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/ContentPropertyValueTrackerIT.java @@ -74,8 +74,9 @@ public class ContentPropertyValueTrackerIT extends AbstractAlfrescoDistributedIT * * MNT-21076 (SEARCH-1906) * - * This test aims to test that a document with more than one ContentPropertyValue - * is not removed from the index after any update. + * This test aims to test that a document with more than one (not indexed) ContentPropertyValue + * is not removed from the index after any update. The fix prevents an NPE during an update because the + * not indexed ContentPropertyValue is searched and not found in the cached document. * * The second ContentPropertyValue must not be indexed. * @throws Exception @@ -86,6 +87,8 @@ public class ContentPropertyValueTrackerIT extends AbstractAlfrescoDistributedIT putHandleDefaults(); AclChangeSet aclChangeSet = getAclChangeSet(1, 1); Acl acl = getAcl(aclChangeSet); + + // Arbitrary acl data. AclReaders aclReaders = getAclReaders(aclChangeSet, acl, list("joel"), list("phil"), null); indexAclChangeSet(aclChangeSet, list(acl), @@ -96,8 +99,8 @@ public class ContentPropertyValueTrackerIT extends AbstractAlfrescoDistributedIT NodeMetaData fileMetaData = getNodeMetaData(fileNode, txn, acl, "mike", null, false); String author = "Mario"; - // Here we set the PROP_TITLE as a ContentPropertyValye. - // The value is not indexed because the the related indexedField is not found. + // Here we set the PROP_TITLE as a ContentPropertyValue. + // The value is not indexed because the related indexedField is not found (it does not exist). fileMetaData.getProperties() .put(ContentModel.PROP_TITLE, new ContentPropertyValue(Locale.CANADA, 100, "UTF8", "txt", 10l)); fileMetaData.getProperties().put(ContentModel.PROP_AUTHOR, new StringPropertyValue(author)); @@ -105,8 +108,10 @@ public class ContentPropertyValueTrackerIT extends AbstractAlfrescoDistributedIT list(fileNode), list(fileMetaData)); - // Check the document is correctly indexed/ + // Check the document is correctly indexed waitForDocCount(new TermQuery(new Term(authorField, author)), 1, MAX_WAIT_TIME); + + // Update the author. Transaction txn1 = getTransaction(0, 1); String authorAfterUpdate = "Luigi"; fileMetaData.getProperties().put(ContentModel.PROP_AUTHOR, new StringPropertyValue(authorAfterUpdate));