org.testcontainers.containers.Neo4jContainer Java Examples

The following examples show how to use org.testcontainers.containers.Neo4jContainer. 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: Benchmarks.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
Map<String, Object> prepareNeo4j() {
	String neo4jUrl = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEOJ4_URL)).orElse("");
	String neo4jPassword = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEO4J_PASSWORD)).orElse("");

	if (neo4jUrl.isEmpty() || neo4jPassword.isEmpty()) {
		neo4jContainer = new Neo4jContainer<>().withAdminPassword("benchmark");
		neo4jContainer.start();
		neo4jUrl = neo4jContainer.getBoltUrl();
		neo4jPassword = neo4jContainer.getAdminPassword();
	}

	return Map.of(
		"org.neo4j.driver.authentication.password", neo4jPassword,
		"org.neo4j.driver.authentication.username", "neo4j",
		"org.neo4j.driver.uri", neo4jUrl
	);
}
 
Example #2
Source File: Benchmarks.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
Map<String, Object> prepareNeo4j() {
	String neo4jUrl = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEOJ4_URL)).orElse("");
	String neo4jPassword = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEO4J_PASSWORD)).orElse("");

	if (neo4jUrl.isEmpty() || neo4jPassword.isEmpty()) {
		neo4jContainer = new Neo4jContainer<>().withAdminPassword("benchmark");
		neo4jContainer.start();
		neo4jUrl = neo4jContainer.getBoltUrl();
		neo4jPassword = neo4jContainer.getAdminPassword();
	}

	return Map.of(
		"org.neo4j.driver.authentication.password", neo4jPassword,
		"org.neo4j.driver.authentication.username", "neo4j",
		"org.neo4j.driver.uri", neo4jUrl
	);
}
 
Example #3
Source File: Benchmarks.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
Map<String, Object> prepareNeo4j() {
	String neo4jUrl = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEOJ4_URL)).orElse("");
	String neo4jPassword = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEO4J_PASSWORD)).orElse("");

	if (neo4jUrl.isEmpty() || neo4jPassword.isEmpty()) {
		neo4jContainer = new Neo4jContainer<>().withAdminPassword("benchmark");
		neo4jContainer.start();
		neo4jUrl = neo4jContainer.getBoltUrl();
		neo4jPassword = neo4jContainer.getAdminPassword();
	}

	return Map.of(
		"org.neo4j.driver.authentication.password", neo4jPassword,
		"org.neo4j.driver.authentication.username", "neo4j",
		"org.neo4j.driver.uri", neo4jUrl
	);
}
 
Example #4
Source File: Benchmarks.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
Map<String, Object> prepareNeo4j() {
	String neo4jUrl = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEOJ4_URL)).orElse("");
	String neo4jPassword = Optional.ofNullable(System.getenv(SYS_PROPERTY_NEO4J_PASSWORD)).orElse("");
	neo4jUrl = "bolt://localhost:7687";
	neo4jPassword = "benchmark";
	if (neo4jUrl.isEmpty() || neo4jPassword.isEmpty()) {
		neo4jContainer = new Neo4jContainer<>().withAdminPassword("benchmark");
		neo4jContainer.start();
		neo4jUrl = neo4jContainer.getBoltUrl();
		neo4jPassword = neo4jContainer.getAdminPassword();
	}

	return Map.of(
		"spring.data.neo4j.password", neo4jPassword,
		"spring.data.neo4j.username", "neo4j",
		"spring.data.neo4j.uri", neo4jUrl
	);
}
 
Example #5
Source File: TestContainerInitializer.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
	final Neo4jContainer<?> neo4jContainer = new Neo4jContainer<>("neo4j:4.0.0-enterprise")
		.withEnv("NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes");
	neo4jContainer.start();
	configurableApplicationContext
		.addApplicationListener((ApplicationListener<ContextClosedEvent>) event -> neo4jContainer.stop());
	TestPropertyValues
		.of(
			"org.neo4j.driver.uri=" + neo4jContainer.getBoltUrl(),
			"org.neo4j.driver.authentication.username=neo4j",
			"org.neo4j.driver.authentication.password=" + neo4jContainer.getAdminPassword()
		)
		.applyTo(configurableApplicationContext.getEnvironment());
}
 
Example #6
Source File: TestContainerInitializer.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
	final Neo4jContainer<?> neo4jContainer = new Neo4jContainer<>("neo4j:4.0").withoutAuthentication();
	neo4jContainer.start();
	configurableApplicationContext
		.addApplicationListener((ApplicationListener<ContextClosedEvent>) event -> neo4jContainer.stop());
	TestPropertyValues.of("org.neo4j.driver.uri=" + neo4jContainer.getBoltUrl())
		.applyTo(configurableApplicationContext.getEnvironment());
}
 
Example #7
Source File: PostRepositoryTest.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
    final Neo4jContainer<?> neo4jContainer = new Neo4jContainer<>("neo4j:4.0").withoutAuthentication();
    neo4jContainer.start();
    configurableApplicationContext
            .addApplicationListener((ApplicationListener<ContextClosedEvent>) event -> neo4jContainer.stop());
    TestPropertyValues.of("org.neo4j.driver.uri=" + neo4jContainer.getBoltUrl())
            .applyTo(configurableApplicationContext.getEnvironment());
}