From 9f2c10e6be46be1d9071c37a572e0454d0962b46 Mon Sep 17 00:00:00 2001 From: Angel Borroy Date: Fri, 4 Dec 2020 13:13:35 +0100 Subject: [PATCH] SEARCH-2589: Check Solr6 subsystem doesn't include the ShardRegistry reference for Community --- .../alfresco/repo/search/SearchTestSuite.java | 4 +- .../search/impl/solr/SolrSubsystemTest.java | 59 +++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 repository/src/test/java/org/alfresco/repo/search/impl/solr/SolrSubsystemTest.java diff --git a/repository/src/test/java/org/alfresco/repo/search/SearchTestSuite.java b/repository/src/test/java/org/alfresco/repo/search/SearchTestSuite.java index d01be4c55f..4c6dbaf53c 100644 --- a/repository/src/test/java/org/alfresco/repo/search/SearchTestSuite.java +++ b/repository/src/test/java/org/alfresco/repo/search/SearchTestSuite.java @@ -29,6 +29,7 @@ import org.alfresco.repo.search.impl.parsers.CMISTest; import org.alfresco.repo.search.impl.parsers.CMIS_FTSTest; import org.alfresco.repo.search.impl.parsers.FTSTest; import org.alfresco.repo.search.impl.solr.SolrChildApplicationContextFactoryTest; +import org.alfresco.repo.search.impl.solr.SolrSubsystemTest; import org.alfresco.util.NumericEncodingTest; import org.junit.experimental.categories.Categories; import org.junit.runner.RunWith; @@ -44,7 +45,8 @@ import org.junit.runners.Suite; CMIS_FTSTest.class, CMISTest.class, FTSTest.class, - SolrChildApplicationContextFactoryTest.class + SolrChildApplicationContextFactoryTest.class, + SolrSubsystemTest.class }) public class SearchTestSuite diff --git a/repository/src/test/java/org/alfresco/repo/search/impl/solr/SolrSubsystemTest.java b/repository/src/test/java/org/alfresco/repo/search/impl/solr/SolrSubsystemTest.java new file mode 100644 index 0000000000..05cc38af02 --- /dev/null +++ b/repository/src/test/java/org/alfresco/repo/search/impl/solr/SolrSubsystemTest.java @@ -0,0 +1,59 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ + +package org.alfresco.repo.search.impl.solr; + +import org.alfresco.repo.management.subsystems.SwitchableApplicationContextFactory; +import org.alfresco.repo.solr.SOLRTrackingComponentImpl; +import org.alfresco.util.BaseSpringTest; +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.ApplicationContext; + +public class SolrSubsystemTest extends BaseSpringTest +{ + + private SOLRTrackingComponentImpl solr6TrackingBean; + + @Before + public void buildElasticsearchClient() throws Exception + { + SwitchableApplicationContextFactory subsystemManager = ((SwitchableApplicationContextFactory) applicationContext + .getBean("Search")); + ApplicationContext solrContext = subsystemManager.getApplicationContext(); + solr6TrackingBean = (SOLRTrackingComponentImpl) solrContext.getBean("search.trackingComponent"); + } + + /** + * Solr Tracking Bean doesn't include Shard Registry reference for Community + */ + @Test + public void shouldNotShardRegistryAttachedToSolrBean() + { + assertNull(solr6TrackingBean.getShardRegistry()); + } + +} \ No newline at end of file