mirror of https://github.com/apache/nifi.git
NIFI-8343 - Updated solr from 8.4.1 to 8.8.2. Small code changes were required.
This closes #5074 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
6776765a92
commit
7e54ef9421
|
@ -23,7 +23,7 @@
|
|||
<artifactId>nifi-solr-processors</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<solr.version>8.4.1</solr.version>
|
||||
<solr.version>8.8.2</solr.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
@ -18,25 +18,6 @@
|
|||
*/
|
||||
package org.apache.nifi.processors.solr;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
@ -78,6 +59,26 @@ import org.apache.solr.common.SolrInputDocument;
|
|||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.MultiMapSolrParams;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class SolrUtils {
|
||||
|
||||
public static final AllowableValue SOLR_TYPE_CLOUD = new AllowableValue(
|
||||
|
@ -248,9 +249,9 @@ public class SolrUtils {
|
|||
if (sslContextService != null) {
|
||||
final SSLContext sslContext = sslContextService.createContext();
|
||||
final SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext);
|
||||
HttpClientUtil.setSchemaRegistryProvider(new HttpClientUtil.SchemaRegistryProvider() {
|
||||
HttpClientUtil.setSocketFactoryRegistryProvider(new HttpClientUtil.SocketFactoryRegistryProvider() {
|
||||
@Override
|
||||
public Registry<ConnectionSocketFactory> getSchemaRegistry() {
|
||||
public Registry<ConnectionSocketFactory> getSocketFactoryRegistry() {
|
||||
RegistryBuilder<ConnectionSocketFactory> builder = RegistryBuilder.create();
|
||||
builder.register("http", PlainConnectionSocketFactory.getSocketFactory());
|
||||
builder.register("https", sslSocketFactory);
|
||||
|
|
|
@ -22,11 +22,11 @@ import org.apache.commons.io.FileUtils;
|
|||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
|
||||
import org.apache.solr.core.CoreContainer;
|
||||
import org.apache.solr.core.NodeConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* Helper to create EmbeddedSolrServer instances for testing.
|
||||
|
@ -60,16 +60,17 @@ public class EmbeddedSolrServerFactory {
|
|||
public static SolrClient create(String solrHome, String coreName, String dataDir)
|
||||
throws IOException {
|
||||
|
||||
Map<String,String> props = new HashMap<>();
|
||||
NodeConfig.NodeConfigBuilder nodeConfig = new NodeConfig.NodeConfigBuilder(coreName, Paths.get(solrHome));
|
||||
|
||||
if (dataDir != null) {
|
||||
File coreDataDir = new File(dataDir + "/" + coreName);
|
||||
if (coreDataDir.exists()) {
|
||||
FileUtils.deleteDirectory(coreDataDir);
|
||||
}
|
||||
props.put("dataDir", dataDir + "/" + coreName);
|
||||
nodeConfig.setSolrDataHome(coreDataDir.getPath());
|
||||
}
|
||||
|
||||
final CoreContainer coreContainer = new CoreContainer(solrHome);
|
||||
final CoreContainer coreContainer = new CoreContainer(new NodeConfig.NodeConfigBuilder(coreName, Paths.get(solrHome)).build());
|
||||
coreContainer.load();
|
||||
|
||||
return new EmbeddedSolrServer(coreContainer, coreName);
|
||||
|
|
Loading…
Reference in New Issue