diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index b0d9d7147..926c04a09 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -3,8 +3,8 @@ 4.0.0 org.alfresco - alfresco-super-pom - 10 + alfresco-search-and-insight-parent + 1.5.0-SNAPSHOT search-analytics-e2e-test search-analytics-e2e-test @@ -14,28 +14,16 @@ 6.0.1.2 6.0.0.4 3.0.11 - 2.6.0 + + 3.1.0 src/test/resources/SearchSuite.xml - 11 - ${java.version} - ${java.version} - 3.8.1 2.7.7 - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - true - true - - org.apache.maven.plugins maven-surefire-plugin @@ -51,80 +39,85 @@ + + org.alfresco + alfresco-insight-jdbc + ${project.version} + org.alfresco.tas restapi-test ${tas.rest.api.version} test - - - com.fasterxml.jackson.core - jackson-databind - - + + + com.fasterxml.jackson.core + jackson-databind + + org.alfresco.tas cmis-test ${tas.cmis.api.version} test - - - com.fasterxml.jackson.core - jackson-databind - - + + + com.fasterxml.jackson.core + jackson-databind + + org.alfresco - alfresco-rm-automation-enterprise-rest-api + alfresco-governance-services-automation-enterprise-rest-api ${rm.version} test - - com.fasterxml.jackson.core - jackson-databind - ${jackson.databind.version} - + + com.fasterxml.jackson.core + jackson-databind + ${jackson.databind.version} + org.alfresco - alfresco-rm-automation-community-rest-api + alfresco-governance-services-automation-community-rest-api ${rm.version} tests test - - - com.fasterxml.jackson.core - jackson-databind - - + + + com.fasterxml.jackson.core + jackson-databind + + + + + + org.alfresco.tas + utility + ${tas.utility.version} + + + slf4j-api + org.slf4j + + + junit + junit + + - - - org.alfresco.tas - utility - ${tas.utility.version} - - - slf4j-api - org.slf4j - - - junit - junit - - - org.projectlombok lombok - 1.18.8 + 1.18.10 test - org.openjfx - javafx-fxml - 12-ea+10 - + org.openjfx + javafx-fxml + 12-ea+10 + - \ No newline at end of file + diff --git a/e2e-test/src/main/resources/model/sharding-content-model.xml b/e2e-test/src/main/resources/model/sharding-content-model.xml new file mode 100644 index 000000000..159d02f12 --- /dev/null +++ b/e2e-test/src/main/resources/model/sharding-content-model.xml @@ -0,0 +1,27 @@ + + + + Explicit Routing for Sharding Sample Model + + + + + + + + + + + + Sharding + + + + Shard Id + d:text + + + + + + diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/ExplicitRoutingTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/ExplicitRoutingTest.java new file mode 100644 index 000000000..541e1d1d1 --- /dev/null +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/ExplicitRoutingTest.java @@ -0,0 +1,79 @@ +package org.alfresco.test.search.functional.searchServices.search; + +import org.alfresco.search.TestGroup; +import org.alfresco.test.search.functional.AbstractE2EFunctionalTest; +import org.alfresco.utility.model.FileModel; +import org.alfresco.utility.model.FileType; +import org.apache.chemistry.opencmis.commons.PropertyIds; +import org.apache.chemistry.opencmis.commons.enums.VersioningState; +import org.testng.annotations.Test; + +import java.util.List; +import java.util.Map; + +import static org.testng.Assert.assertTrue; + +public class ExplicitRoutingTest extends AbstractE2EFunctionalTest { + + + /** + * Checks indexing still works after sharding model used for explicit routing has been disabled + * @throws Exception + */ + @Test(priority = 1, groups = {TestGroup.NOT_BAMBOO, TestGroup.EXPLICIT_SHARDING }) + public void testIndexingStillWorkingAfterShardModelIsDeactivated() throws Exception + { + + // Deploy sharding model + assertTrue(deployCustomModel("model/sharding-content-model.xml"), + "failing while deploying sharding model"); + + // Create a first child in parent folder. It will be indexed in the parent shard (shard 0) + FileModel file = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content"); + Map propertiesFirstChild = Map.of(PropertyIds.NAME, file.getName(), + PropertyIds.OBJECT_TYPE_ID, "cmis:document", + "cmis:secondaryObjectTypeIds", List.of("P:shard:sharding"), + "shard:shardId", "0"); + + // Create file using shard:shardId + cmisApi.authenticateUser(testUser).usingSite(testSite) + .createFile(file, + Map.of(PropertyIds.NAME, file.getName(), + PropertyIds.OBJECT_TYPE_ID, "cmis:document"), + VersioningState.MAJOR) + .assertThat().existsInRepo(); + + // Wait for file to be indexed + assertTrue(isContentInSearchResults(file.getName(), file.getName(), true), + "A file using sharding model has not been indexed"); + + + // Deleting file + dataContent.usingSite(testSite).usingUser(testUser).usingResource(file).deleteContent(); + restClient.withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(file); + + // Deleting sharding model + assertTrue(deactivateCustomModel("sharding-content-model.xml"), + "failing while deactivating sharding model"); + assertTrue(deleteCustomModel("sharding-content-model.xml"), + "failing while removing sharding model"); + + assertTrue(waitForIndexing("TYPE:'" + "shard:shardId" + "'", false), + "Indexes are not updated after deactivating a model"); + + // Create a file in the parent folder + file = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content"); + + cmisApi.authenticateUser(testUser).usingSite(testSite) + .createFile(file, + Map.of(PropertyIds.NAME, file.getName(), + PropertyIds.OBJECT_TYPE_ID, "cmis:document"), + VersioningState.MAJOR) + .assertThat().existsInRepo(); + + + assertTrue(isContentInSearchResults(file.getName(), file.getName(), true), + "Indexing is not working after the sharding model has been removed"); + + } +} diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FacetFieldsSearchTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FacetFieldsSearchTest.java index 7c0f4d129..50e75cc67 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FacetFieldsSearchTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FacetFieldsSearchTest.java @@ -90,7 +90,7 @@ public class FacetFieldsSearchTest extends AbstractE2EFunctionalTest restClient.authenticateUser(testUser).withCoreAPI().usingNode(textFile).updateNode(putBody); // Wait for the file to be indexed - waitForIndexing(htmlFile.getName(), true); + waitForContentIndexing(htmlFile.getContent(), true); } @Test diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchAPATHTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchAPATHTest.java index 33592222e..1016869cc 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchAPATHTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchAPATHTest.java @@ -29,7 +29,6 @@ import org.alfresco.rest.search.RestRequestQueryModel; import org.alfresco.rest.search.RestResultBucketsModel; import org.alfresco.rest.search.SearchRequest; import org.alfresco.rest.search.SearchResponse; -import org.alfresco.search.TestGroup; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -105,14 +104,18 @@ public class SearchAPATHTest extends AbstractSearchServicesE2ETest buckets.forEach(bucket -> bucket.assertThat().field("label").contains("0/")); } + /** + * Test to test that the facet buckets are returned correctly for sub-level 1/ + * Test to search for a searchString, that's unique to the test run and hence stable for any environment + */ @Test public void searchLevel0andIncludeSubLevel1() { - SearchRequest searchQuery = searchRequestWithAPATHFacet("name:*", "1/"); + SearchRequest searchQuery = searchRequestWithAPATHFacet("name:" + unique_searchString, "1/"); SearchResponse response = query(searchQuery); List buckets = getBuckets(response); - Assert.assertEquals(4, buckets.size()); + Assert.assertEquals(buckets.size(), 1, "Incorrect bucket count"); getFirstBucket(response).assertThat().field("label").contains("1/"); } diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/tracker/CascadingTrackerIntegrationTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/tracker/CascadingTrackerIntegrationTest.java index daf9e0ce0..3d66f1922 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/tracker/CascadingTrackerIntegrationTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/tracker/CascadingTrackerIntegrationTest.java @@ -19,8 +19,12 @@ import org.apache.chemistry.opencmis.commons.PropertyIds; import org.apache.chemistry.opencmis.commons.enums.VersioningState; import org.springframework.beans.factory.annotation.Autowired; import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import static org.testng.Assert.assertTrue; + /** * Test class tests cascading updates for a child node when parent node is updated * @@ -31,6 +35,46 @@ public class CascadingTrackerIntegrationTest extends AbstractE2EFunctionalTest { @Autowired protected DataContent dataContent; + private FolderModel parentFolderSharded; + private FileModel firstChildFileSharded; + private FileModel secondChildFileSharded; + + + @BeforeClass(alwaysRun = true) + public void setupEnvironment() + { + assertTrue(deployCustomModel("model/sharding-content-model.xml"), + "failing while deploying sharding model"); + } + + + @AfterClass + public void cleanUpEnvironment() + { + if (firstChildFileSharded != null) + { + dataContent.usingSite(testSite).usingUser(testUser).usingResource(firstChildFileSharded).deleteContent(); + restClient.withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(firstChildFileSharded); + } + + if (secondChildFileSharded != null) + { + dataContent.usingSite(testSite).usingUser(testUser).usingResource(secondChildFileSharded).deleteContent(); + restClient.withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(secondChildFileSharded); + } + + if (parentFolderSharded != null) + { + dataContent.usingSite(testSite).usingUser(testUser).usingResource(parentFolderSharded).deleteContent(); + restClient.withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(parentFolderSharded); + } + + dataContent.deleteSite(testSite); + assertTrue(deactivateCustomModel("sharding-content-model.xml"), + "failing while deactivating sharding model"); + assertTrue(deleteCustomModel("sharding-content-model.xml"), + "failing while removing sharding model"); + } @Test(priority = 1) public void testChildPathWhenParentRenamed() throws Exception @@ -143,53 +187,53 @@ public class CascadingTrackerIntegrationTest extends AbstractE2EFunctionalTest * Check that, after parent renaming, both the children are searchable in the new path * (computed accordingly with the new parent folder name) */ - @Test(priority = 1, groups = {TestGroup.NOT_BAMBOO, TestGroup.EXPLICIT_SHARDING }) + @Test(priority = 3, groups = {TestGroup.NOT_BAMBOO, TestGroup.EXPLICIT_SHARDING }) public void testChildrenPathOnParentRenamedWithChildrenInDifferentShards() throws Exception { // Create Parent folder. It will be indexed in shard 0 - FolderModel parentFolder = FolderModel.getRandomFolderModel(); + parentFolderSharded = FolderModel.getRandomFolderModel(); List secondaryTypes = List.of("P:shard:sharding"); - Map parentProperties = Map.of(PropertyIds.NAME, parentFolder.getName(), + Map parentProperties = Map.of(PropertyIds.NAME, parentFolderSharded.getName(), PropertyIds.OBJECT_TYPE_ID, "cmis:folder", "cmis:secondaryObjectTypeIds", secondaryTypes, "shard:shardId", "0"); // Create a first child in parent folder. It will be indexed in the parent shard (shard 0) - FileModel firstChildFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content"); - Map propertiesFirstChild = Map.of(PropertyIds.NAME, firstChildFile.getName(), + firstChildFileSharded = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content"); + Map propertiesFirstChild = Map.of(PropertyIds.NAME, firstChildFileSharded.getName(), PropertyIds.OBJECT_TYPE_ID, "cmis:document", "cmis:secondaryObjectTypeIds", secondaryTypes, "shard:shardId", "0"); // Create a second child in parent folder. It will be indexed in shard 1. - FileModel secondChildFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content"); - Map propertiesSecondChild = Map.of(PropertyIds.NAME, secondChildFile.getName(), + secondChildFileSharded = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content"); + Map propertiesSecondChild = Map.of(PropertyIds.NAME, secondChildFileSharded.getName(), PropertyIds.OBJECT_TYPE_ID, "cmis:document", "cmis:secondaryObjectTypeIds", secondaryTypes, "shard:shardId", "1"); - cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(parentFolder, parentProperties).then() - .usingResource(parentFolder) - .createFile(firstChildFile, propertiesFirstChild, VersioningState.MAJOR) - .createFile(secondChildFile, propertiesSecondChild, VersioningState.MAJOR); + cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(parentFolderSharded, parentProperties).then() + .usingResource(parentFolderSharded) + .createFile(firstChildFileSharded, propertiesFirstChild, VersioningState.MAJOR) + .createFile(secondChildFileSharded, propertiesSecondChild, VersioningState.MAJOR); // Check everything is indexed - Assert.assertTrue(waitForIndexing(firstChildFile.getName(), true), "file: " + firstChildFile.getName() + " has not been indexed."); - Assert.assertTrue(waitForIndexing(secondChildFile.getName(), true), "file: " + secondChildFile.getName() + " has not been indexed."); - Assert.assertTrue(waitForIndexing(parentFolder.getName(), true), "file: " + parentFolder.getName() + " has not been indexed."); + assertTrue(waitForIndexing(firstChildFileSharded.getName(), true), "file: " + firstChildFileSharded.getName() + " has not been indexed."); + assertTrue(waitForIndexing(secondChildFileSharded.getName(), true), "file: " + secondChildFileSharded.getName() + " has not been indexed."); + assertTrue(waitForIndexing(parentFolderSharded.getName(), true), "file: " + parentFolderSharded.getName() + " has not been indexed."); // Query to find nodes where Path with original folder name matches String parentQuery = "PATH:\"/app:company_home/st:sites/cm:" + testSite.getTitle() + - "/cm:documentLibrary/cm:" + parentFolder.getName() + "/*\""; + "/cm:documentLibrary/cm:" + parentFolderSharded.getName() + "/*\""; // Rename parent folder String parentNewName = "parentRenamedSharding"; - parentFolder.setName(parentNewName); + parentFolderSharded.setName(parentNewName); ContentModel parentNewNameModel = new ContentModel(parentNewName); - dataContent.usingUser(testUser).usingResource(parentFolder).renameContent(parentNewNameModel); + dataContent.usingUser(testUser).usingResource(parentFolderSharded).renameContent(parentNewNameModel); String parentQueryAfterRename = "PATH:\"/app:company_home/st:sites/cm:" + testSite.getTitle() + "/cm:documentLibrary/cm:" + parentNewName + "/*\""; @@ -199,9 +243,9 @@ public class CascadingTrackerIntegrationTest extends AbstractE2EFunctionalTest Assert.assertEquals(descendantCountOfNewNameBeforeUpdate, 0, "There should be 0 results performing the new query before updating parent name"); - Assert.assertTrue(waitForMetadataIndexing(parentNewName, true), "failing while renaming " + parentFolder.getName() + " to " + parentNewName); + assertTrue(waitForMetadataIndexing(parentNewName, true), "failing while renaming " + parentFolderSharded.getName() + " to " + parentNewName); - boolean indexingInProgress = !isContentInSearchResults(parentQueryAfterRename, firstChildFile.getName(), true); + boolean indexingInProgress = !isContentInSearchResults(parentQueryAfterRename, firstChildFileSharded.getName(), true); // Query using new parent name: Expect the two children int descendantCountOfNewName = query(parentQueryAfterRename).getPagination().getCount(); @@ -210,6 +254,7 @@ public class CascadingTrackerIntegrationTest extends AbstractE2EFunctionalTest // Query using old parent name: Expect no descendant after rename int descendantCountOfOriginalName = query(parentQuery).getPagination().getCount(); Assert.assertEquals(descendantCountOfOriginalName, 0, "Old path still has descendants: " + parentQuery); + } } diff --git a/pom.xml b/pom.xml index c305c9aeb..5731b13fe 100644 --- a/pom.xml +++ b/pom.xml @@ -24,9 +24,10 @@ scm:git:https://git.alfresco.com/search_discovery/insightengine.git scm:git:https://git.alfresco.com/search_discovery/insightengine.git https://git.alfresco.com/search_discovery/insightengine.git - 1.1.0 + HEAD + 11 6.6.5 ${solr.base.version}-patched @@ -38,7 +39,23 @@ search-services insight-engine + e2e-test + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + true + true + + + + diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java index aabfb2f40..58778d865 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; +import java.util.Optional; import java.util.Properties; import java.util.concurrent.ConcurrentLinkedQueue; @@ -59,6 +60,7 @@ import org.slf4j.LoggerFactory; import static java.util.Optional.of; +import static java.util.Optional.ofNullable; import static org.alfresco.solr.tracker.DocRouterFactory.SHARD_KEY_KEY; /* @@ -82,9 +84,9 @@ public class MetadataTracker extends AbstractTracker implements Tracker private ConcurrentLinkedQueue queriesToReindex = new ConcurrentLinkedQueue(); private DocRouter docRouter; /** The string representation of the shard key. */ - private String shardKey; + private Optional shardKey; /** The property to use for determining the shard. */ - private QName shardProperty; + private Optional shardProperty = Optional.empty(); public MetadataTracker(Properties p, SOLRAPIClient client, String coreName, InformationServer informationServer) @@ -92,8 +94,8 @@ public class MetadataTracker extends AbstractTracker implements Tracker super(p, client, coreName, informationServer, Tracker.Type.MetaData); transactionDocsBatchSize = Integer.parseInt(p.getProperty("alfresco.transactionDocsBatchSize", "100")); shardMethod = p.getProperty("shard.method", SHARD_METHOD_DBID); - shardKey = p.getProperty(SHARD_KEY_KEY); - updateShardProperty(); + shardKey = ofNullable(p.getProperty(SHARD_KEY_KEY)); + firstUpdateShardProperty(); docRouter = DocRouterFactory.getRouter(p, ShardMethodEnum.getShardMethod(shardMethod)); nodeBatchSize = Integer.parseInt(p.getProperty("alfresco.nodeBatchSize", "10")); threadHandler = new ThreadHandler(p, coreName, "MetadataTracker"); @@ -104,12 +106,35 @@ public class MetadataTracker extends AbstractTracker implements Tracker */ private void updateShardProperty() { - if(shardProperty == null && shardKey != null) - { - shardProperty = getShardProperty(shardKey); - } + shardKey.ifPresent(shardKeyName -> { + Optional updatedShardProperty = getShardProperty(shardKeyName); + if (!shardProperty.equals(updatedShardProperty)) + { + if (updatedShardProperty.isEmpty()) + { + log.warn("The model defining " + shardKeyName + " property has been disabled"); + } + else + { + log.info("New " + SHARD_KEY_KEY + " property found for " + shardKeyName); + } + } + shardProperty = updatedShardProperty; + }); } + private void firstUpdateShardProperty() + { + shardKey.ifPresent( shardKeyName -> { + updateShardProperty(); + if (shardProperty.isEmpty()) + { + log.warn("Sharding property " + SHARD_KEY_KEY + " was set to " + shardKeyName + ", but no such property was found."); + } + }); + } + + MetadataTracker() { super(Tracker.Type.MetaData); @@ -174,7 +199,6 @@ public class MetadataTracker extends AbstractTracker implements Tracker * will pull its data from a "tracking" Solr node using Solr's master/slave replication, rather then tracking the repository. * */ - ShardState shardstate = getShardState(); client.getTransactions(0L, null, 0L, null, 0, shardstate); return; @@ -240,8 +264,9 @@ public class MetadataTracker extends AbstractTracker implements Tracker propertyBag.put("coreName", coreName); HashMap extendedPropertyBag = new HashMap<>(propertyBag); updateShardProperty(); - extendedPropertyBag.putAll(docRouter.getProperties(shardProperty)); - + + shardProperty.ifPresent(p -> extendedPropertyBag.putAll(docRouter.getProperties(p))); + return ShardStateBuilder.shardState() .withMaster(isMaster) .withLastUpdated(System.currentTimeMillis()) @@ -382,7 +407,9 @@ public class MetadataTracker extends AbstractTracker implements Tracker gnp.setStoreProtocol(storeRef.getProtocol()); gnp.setStoreIdentifier(storeRef.getIdentifier()); updateShardProperty(); - gnp.setShardProperty(shardProperty); + + shardProperty.ifPresent(p -> gnp.setShardProperty(p)); + gnp.setCoreName(coreName); List nodes = client.getNodes(gnp, (int) info.getUpdates()); @@ -478,7 +505,7 @@ public class MetadataTracker extends AbstractTracker implements Tracker gnp.setStoreProtocol(storeRef.getProtocol()); gnp.setStoreIdentifier(storeRef.getIdentifier()); gnp.setCoreName(coreName); - List nodes = client.getNodes(gnp, (int) info.getUpdates()); + List nodes = client.getNodes(gnp, (int) info.getUpdates()); for (Node node : nodes) { docCount++; @@ -903,7 +930,8 @@ public class MetadataTracker extends AbstractTracker implements Tracker gnp.setStoreProtocol(storeRef.getProtocol()); gnp.setStoreIdentifier(storeRef.getIdentifier()); updateShardProperty(); - gnp.setShardProperty(shardProperty); + shardProperty.ifPresent(p -> gnp.setShardProperty(p)); + gnp.setCoreName(coreName); List nodes = client.getNodes(gnp, Integer.MAX_VALUE); @@ -1203,7 +1231,17 @@ public class MetadataTracker extends AbstractTracker implements Tracker this.queriesToReindex.offer(query); } - public static QName getShardProperty(String field) + + /** + * Given the field name, returns the name of the property definition. + * If the property definition is not found, Empty optional is returned. + * + * @param field + * + * @return the name of the associated property definition if present, Optional.Empty() otherwise + * + */ + public static Optional getShardProperty(String field) { if (StringUtils.isBlank(field)) { @@ -1218,8 +1256,8 @@ public class MetadataTracker extends AbstractTracker implements Tracker field); if (propertyDef == null) { - throw new IllegalStateException("Sharding property " + SHARD_KEY_KEY + " was set to " + field + ", but no such property was found."); + return Optional.empty(); } - return propertyDef.getName(); + return of(propertyDef.getName()); } } diff --git a/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateAbstractSolrTrackerTest.java b/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateAbstractSolrTrackerTest.java index 29cb84f21..6aacd0282 100644 --- a/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateAbstractSolrTrackerTest.java +++ b/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateAbstractSolrTrackerTest.java @@ -20,6 +20,7 @@ package org.alfresco.solr.tracker; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; +import org.alfresco.service.namespace.QName; import org.alfresco.solr.AbstractAlfrescoDistributedTest; import org.alfresco.solr.AlfrescoSolrDataModel; import org.alfresco.solr.client.Acl; @@ -43,6 +44,7 @@ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; +import java.util.Optional; import static java.util.Collections.singletonList; import static java.util.stream.IntStream.range; @@ -120,8 +122,11 @@ public abstract class DistributedDateAbstractSolrTrackerTest extends AbstractAlf indexTransaction(bigTxn, nodes, nodeMetaDatas); waitForDocCount(new TermQuery(new Term("content@s___t@{http://www.alfresco.org/model/content/1.0}content", "world")), numNodes, 100000); + Optional shardProperty = MetadataTracker.getShardProperty("created"); + assertTrue("'created' field is expected to be found in data model", shardProperty.isPresent()); + List fieldInstanceList = - AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(MetadataTracker.getShardProperty("created")).getFields(); + AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(shardProperty.get()).getFields(); AlfrescoSolrDataModel.FieldInstance fieldInstance = fieldInstanceList.get(0); String fieldName = fieldInstance.getField(); diff --git a/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateMonthAlfrescoSolrTrackerTest.java b/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateMonthAlfrescoSolrTrackerTest.java index 4e4c03541..e0a569b4a 100644 --- a/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateMonthAlfrescoSolrTrackerTest.java +++ b/search-services/alfresco-search/src/test/java/org/alfresco/solr/tracker/DistributedDateMonthAlfrescoSolrTrackerTest.java @@ -32,6 +32,7 @@ import static org.alfresco.solr.AlfrescoSolrUtils.indexAclChangeSet; import org.alfresco.model.ContentModel; import org.alfresco.repo.index.shard.ShardMethodEnum; import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; +import org.alfresco.service.namespace.QName; import org.alfresco.solr.AbstractAlfrescoDistributedTest; import org.alfresco.solr.AlfrescoSolrDataModel; import org.alfresco.solr.SolrInformationServer; @@ -57,6 +58,7 @@ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; +import java.util.Optional; import java.util.Properties; import java.util.TimeZone; @@ -139,7 +141,10 @@ public class DistributedDateMonthAlfrescoSolrTrackerTest extends AbstractAlfresc waitForDocCount(new TermQuery(new Term("content@s___t@{http://www.alfresco.org/model/content/1.0}content", "world")), numNodes, 100000); waitForDocCountAllCores(new TermQuery(new Term(FIELD_DOC_TYPE, SolrInformationServer.DOC_TYPE_ACL)), numAcls, 100000); - List fieldInstanceList = AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(MetadataTracker.getShardProperty("created")).getFields(); + Optional shardProperty = MetadataTracker.getShardProperty("created"); + assertTrue(shardProperty.isPresent()); + + List fieldInstanceList = AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(shardProperty.get()).getFields(); AlfrescoSolrDataModel.FieldInstance fieldInstance = fieldInstanceList.get(0); String fieldName = fieldInstance.getField(); diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index 152d25d5e..6223ec5d7 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -22,7 +22,7 @@ - 8.48 + 8.49 2.10.0.pr2 diff --git a/search-services/packaging/src/docker/6.x/.env b/search-services/packaging/src/docker/6.x/.env index 37cd93f01..f23d97f96 100644 --- a/search-services/packaging/src/docker/6.x/.env +++ b/search-services/packaging/src/docker/6.x/.env @@ -1,6 +1,7 @@ # In order to start the community edition set the value of ALFRESCO_IMAGE to alfresco/alfresco-content-repository-community -ALFRESCO_IMAGE=alfresco/alfresco-content-repository +ALFRESCO_IMAGE=quay.io/alfresco/alfresco-content-repository ALFRESCO_TAG=6.1.0-EA3 +SHARE_IMAGE=quay.io/alfresco/alfresco-share SHARE_TAG=6.0 POSTGRES_TAG=10.1 SEARCH_TAG=latest \ No newline at end of file diff --git a/search-services/packaging/src/docker/6.x/docker-compose.yml b/search-services/packaging/src/docker/6.x/docker-compose.yml index 5b07ec59b..b7e4c3bbc 100644 --- a/search-services/packaging/src/docker/6.x/docker-compose.yml +++ b/search-services/packaging/src/docker/6.x/docker-compose.yml @@ -20,7 +20,7 @@ services: - "5005:5005" #Java debugging - "8081:8080" #Browser port for Alfresco share: - image: alfresco/alfresco-share:${SHARE_TAG} + image: ${SHARE_IMAGE}:${SHARE_TAG} environment: - REPO_HOST=alfresco - REPO_PORT=8080 diff --git a/search-services/packaging/src/docker/Dockerfile b/search-services/packaging/src/docker/Dockerfile index 230214ca9..852223ecf 100644 --- a/search-services/packaging/src/docker/Dockerfile +++ b/search-services/packaging/src/docker/Dockerfile @@ -1,6 +1,6 @@ # Alfresco Search Services ${project.version} Docker Image -FROM alfresco/alfresco-base-java:11.0.1-openjdk-centos-7-3e4e9f4e5d6a +FROM alfresco/alfresco-base-java:11.0.1-openjdk-centos-7-6784d76a7b81 LABEL creator="Gethin James" maintainer="Alfresco Search Services Team" ENV DIST_DIR /opt/alfresco-search-services