Java Code Examples for pl.allegro.tech.embeddedelasticsearch.EmbeddedElastic#start()

The following examples show how to use pl.allegro.tech.embeddedelasticsearch.EmbeddedElastic#start() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestHelpers.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static EmbeddedElastic startElasticsearch(File installLocation) throws IOException, InterruptedException {

		EmbeddedElastic embeddedElastic = EmbeddedElastic.builder()
				.withElasticVersion(VERSION)
				.withSetting(PopularProperties.TRANSPORT_TCP_PORT, random.nextInt(10000) + 10000)
				.withSetting(PopularProperties.HTTP_PORT, random.nextInt(10000) + 10000)
				.withSetting(PopularProperties.CLUSTER_NAME, "cluster1")
				.withInstallationDirectory(installLocation)
				.withDownloadDirectory(new File("tempElasticsearchDownload"))
//			.withPlugin("analysis-stempel")
				.withStartTimeout(5, TimeUnit.MINUTES)
				.build();

		embeddedElastic.start();
		logger.info("Elasticearch using transport port: " + embeddedElastic.getTransportTcpPort());
		logger.info("Elasticearch using http port: " + embeddedElastic.getHttpPort());

		return embeddedElastic;
	}
 
Example 2
Source File: TestHelpers.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static EmbeddedElastic startElasticsearch(File installLocation, String javaHomePath)
			throws IOException, InterruptedException {

		EmbeddedElastic embeddedElastic = EmbeddedElastic.builder()
				.withElasticVersion(VERSION)
				.withSetting(PopularProperties.TRANSPORT_TCP_PORT, random.nextInt(10000) + 10000)
				.withSetting(PopularProperties.HTTP_PORT, random.nextInt(10000) + 10000)
				.withSetting(PopularProperties.CLUSTER_NAME, CLUSTER)
				.withInstallationDirectory(installLocation)
				.withJavaHome(JavaHomeOption.path(javaHomePath))
				.withDownloadDirectory(new File(ELASTICSEARCH_DOWNLOAD_DIRECTORY))
//			.withPlugin("analysis-stempel")
				.withStartTimeout(5, TimeUnit.MINUTES)
				.build();

		embeddedElastic.start();
		return embeddedElastic;
	}