<commit_before>package org.icij.extract.test;

import java.util.Properties;

import java.io.File;

import java.net.URL;

import org.apache.commons.io.FileUtils;

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.embedded.JettyConfig;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;

import org.junit.Test;
import org.junit.ClassRule;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.rules.TemporaryFolder;

public abstract class SolrJettyTestBase extends TestBase {

	public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;

	public static JettySolrRunner jetty;
	public static HttpSolrClient client;

	@ClassRule
	public static final TemporaryFolder tempSolrFolder = new TemporaryFolder();

	@BeforeClass
	public static void beforeSolrJettyTestBase() throws Exception {
		final File origSolrHome = new File(SolrJettyTestBase.class.getResource("/solr").toURI());
		final File tempSolrHome = tempSolrFolder.getRoot();
		final File tempSolrData = tempSolrFolder.newFolder("data");

		FileUtils.copyDirectory(origSolrHome, tempSolrHome);

		final JettyConfig jettyConfig = JettyConfig.builder()
			.setContext("/solr")
			.setPort(8080)
			.stopAtShutdown(true)
			.build();

		final Properties nodeProperties = new Properties();

		nodeProperties.setProperty("solr.data.dir", tempSolrData.getCanonicalPath());
		nodeProperties.setProperty("coreRootDirectory", tempSolrHome.toString());
		nodeProperties.setProperty("configSetBaseDir", tempSolrHome.toString());

		System.setProperty("jetty.testMode", "true");

		jetty = new JettySolrRunner(tempSolrHome.toString(), nodeProperties, jettyConfig);
		jetty.start();

		client = createNewSolrClient();
	}

	@AfterClass
	public static void afterSolrJettyTestBase() throws Exception {
		if (null != jetty) {
			jetty.stop();
			jetty = null;
		}

		if (null != client) {
			client.close();
			client = null;
		}
	}

	protected static HttpSolrClient createNewSolrClient() {
		try {
			URL url = jetty.getBaseUrl();

			// For debugging in Charles:
			// - set the proxy port to 8888
			// - enable transparent proxying
			// - enable Map Remote and map 127.0.0.1:8888 to 127.0.0.1:8080
			url = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile() + "/collection1"); 

			final HttpSolrClient client = new HttpSolrClient(url.toString());

			client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
			client.setDefaultMaxConnectionsPerHost(100);
			client.setMaxTotalConnections(100);

			return client;
		} catch(Exception e) {
			throw new RuntimeException(e);
		}
	}
}
<commit_msg>Change Solr Jetty test port to less commonly used port<commit_after>package org.icij.extract.test;

import java.util.Properties;

import java.io.File;

import java.net.URL;

import org.apache.commons.io.FileUtils;

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.embedded.JettyConfig;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;

import org.junit.Test;
import org.junit.ClassRule;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.rules.TemporaryFolder;

public abstract class SolrJettyTestBase extends TestBase {

	public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;

	public static JettySolrRunner jetty;
	public static HttpSolrClient client;

	@ClassRule
	public static final TemporaryFolder tempSolrFolder = new TemporaryFolder();

	@BeforeClass
	public static void beforeSolrJettyTestBase() throws Exception {
		final File origSolrHome = new File(SolrJettyTestBase.class.getResource("/solr").toURI());
		final File tempSolrHome = tempSolrFolder.getRoot();
		final File tempSolrData = tempSolrFolder.newFolder("data");

		FileUtils.copyDirectory(origSolrHome, tempSolrHome);

		final JettyConfig jettyConfig = JettyConfig.builder()
			.setContext("/solr")
			.setPort(8888)
			.stopAtShutdown(true)
			.build();

		final Properties nodeProperties = new Properties();

		nodeProperties.setProperty("solr.data.dir", tempSolrData.getCanonicalPath());
		nodeProperties.setProperty("coreRootDirectory", tempSolrHome.toString());
		nodeProperties.setProperty("configSetBaseDir", tempSolrHome.toString());

		System.setProperty("jetty.testMode", "true");

		jetty = new JettySolrRunner(tempSolrHome.toString(), nodeProperties, jettyConfig);
		jetty.start();

		client = createNewSolrClient();
	}

	@AfterClass
	public static void afterSolrJettyTestBase() throws Exception {
		if (null != jetty) {
			jetty.stop();
			jetty = null;
		}

		if (null != client) {
			client.close();
			client = null;
		}
	}

	protected static HttpSolrClient createNewSolrClient() {
		try {
			URL url = jetty.getBaseUrl();

			// For debugging in Charles:
			// - set the proxy port to 8888
			// - enable transparent proxying
			// - enable Map Remote and map 127.0.0.1:8888 to 127.0.0.1:8080
			url = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile() + "/collection1"); 

			final HttpSolrClient client = new HttpSolrClient(url.toString());

			client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
			client.setDefaultMaxConnectionsPerHost(100);
			client.setMaxTotalConnections(100);

			return client;
		} catch(Exception e) {
			throw new RuntimeException(e);
		}
	}
}

{'fraction_non_alphanumeric': 0.11270678058534812, 'fraction_numerical': 0.014542810398109434, 'mean_word_length': 4.853191489361702, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7148274', 'n_tokens_mistral': 2012, 'n_tokens_neox': 1738, 'n_words': 371}