diff --git a/examples/neo4j-container/src/test/java/org/testcontainers/containers/Neo4jExampleTest.java b/examples/neo4j-container/src/test/java/org/testcontainers/containers/Neo4jExampleTest.java
index 38c22a0ff45..abf42a115de 100644
--- a/examples/neo4j-container/src/test/java/org/testcontainers/containers/Neo4jExampleTest.java
+++ b/examples/neo4j-container/src/test/java/org/testcontainers/containers/Neo4jExampleTest.java
@@ -27,7 +27,7 @@
class Neo4jExampleTest {
@Container
- private static Neo4jContainer> neo4jContainer = new Neo4jContainer<>(DockerImageName.parse("neo4j:4.4"))
+ private static Neo4jContainer neo4jContainer = new Neo4jContainer(DockerImageName.parse("neo4j:4.4"))
.withoutAuthentication(); // Disable password
@Test
diff --git a/modules/neo4j/build.gradle b/modules/neo4j/build.gradle
index f8529beb3ac..0f2f645931d 100644
--- a/modules/neo4j/build.gradle
+++ b/modules/neo4j/build.gradle
@@ -39,6 +39,7 @@ dependencies {
tasks.japicmp {
classExcludes = [
- "org.testcontainers.containers.Neo4jContainer"
+ "org.testcontainers.containers.Neo4jContainer",
+ "org.testcontainers.containers.Neo4jLabsPlugin"
]
}
diff --git a/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java b/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java
index bb6f437f193..bd3499567d4 100644
--- a/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java
+++ b/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java
@@ -31,7 +31,7 @@
*
HTTPS: 7473
*
*/
-public class Neo4jContainer> extends GenericContainer {
+public class Neo4jContainer extends GenericContainer {
/**
* The image defaults to the official Neo4j image: Neo4j.
@@ -205,7 +205,7 @@ public String getHttpsUrl() {
*
* @return This container.
*/
- public S withEnterpriseEdition() {
+ public Neo4jContainer withEnterpriseEdition() {
if (!standardImage) {
throw new IllegalStateException(
String.format("Cannot use enterprise version with alternative image %s.", getDockerImageName())
@@ -227,7 +227,7 @@ public S withEnterpriseEdition() {
* @param adminPassword The admin password for the default database account.
* @return This container.
*/
- public S withAdminPassword(final String adminPassword) {
+ public Neo4jContainer withAdminPassword(final String adminPassword) {
if (adminPassword != null && adminPassword.length() < 8) {
logger().warn("Your provided admin password is too short and will not work with Neo4j 5.3+.");
}
@@ -240,7 +240,7 @@ public S withAdminPassword(final String adminPassword) {
*
* @return This container.
*/
- public S withoutAuthentication() {
+ public Neo4jContainer withoutAuthentication() {
return withAdminPassword(null);
}
@@ -264,7 +264,7 @@ public S withoutAuthentication() {
* @throws IllegalArgumentException If the database version is not 3.5.
* @return This container.
*/
- public S withDatabase(MountableFile graphDb) {
+ public Neo4jContainer withDatabase(MountableFile graphDb) {
if (!isNeo4jDatabaseVersionSupportingDbCopy()) {
throw new IllegalArgumentException(
"Copying database folder is not supported for Neo4j instances with version 4.0 or higher."
@@ -283,7 +283,7 @@ public S withDatabase(MountableFile graphDb) {
* @param plugins
* @return This container.
*/
- public S withPlugins(MountableFile plugins) {
+ public Neo4jContainer withPlugins(MountableFile plugins) {
return withCopyFileToContainer(plugins, "/var/lib/neo4j/plugins/");
}
@@ -295,7 +295,7 @@ public S withPlugins(MountableFile plugins) {
* @param value The value to set
* @return This container.
*/
- public S withNeo4jConfig(String key, String value) {
+ public Neo4jContainer withNeo4jConfig(String key, String value) {
addEnv(formatConfigurationKey(key), value);
return self();
}
@@ -307,31 +307,6 @@ public String getAdminPassword() {
return adminPassword;
}
- /**
- * Registers one or more {@link Neo4jLabsPlugin} for download and server startup.
- *
- * @param neo4jLabsPlugins The Neo4j plugins that should get started with the server.
- * @return This container.
- * @deprecated {@link Neo4jLabsPlugin} were deprecated due to naming changes that cannot be solved by this enumeration.
- * Please use the {@link Neo4jContainer#withPlugins(String...)} method.
- */
- public S withLabsPlugins(Neo4jLabsPlugin... neo4jLabsPlugins) {
- List pluginNames = Arrays
- .stream(neo4jLabsPlugins)
- .map(plugin -> plugin.pluginName)
- .collect(Collectors.toList());
-
- this.labsPlugins.addAll(pluginNames);
- return self();
- }
-
- /**
- * @deprecated Please use {@link Neo4jContainer#withPlugins(String...)} for named plugins.
- */
- public S withLabsPlugins(String... neo4jLabsPlugins) {
- return this.withPlugins(neo4jLabsPlugins);
- }
-
/**
* Registers one or more Neo4j plugins for server startup.
* The plugins are listed here
@@ -343,7 +318,7 @@ public S withLabsPlugins(String... neo4jLabsPlugins) {
* @param plugins The Neo4j plugins that should get started with the server.
* @return This container.
*/
- public S withPlugins(String... plugins) {
+ public Neo4jContainer withPlugins(String... plugins) {
this.labsPlugins.addAll(Arrays.asList(plugins));
return self();
}
@@ -376,7 +351,7 @@ private boolean isNeo4jDatabaseVersionSupportingDbCopy() {
return false;
}
- public S withRandomPassword() {
+ public Neo4jContainer withRandomPassword() {
return withAdminPassword(UUID.randomUUID().toString());
}
}
diff --git a/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jLabsPlugin.java b/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jLabsPlugin.java
deleted file mode 100644
index 0e3bf634140..00000000000
--- a/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jLabsPlugin.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.testcontainers.containers;
-
-/**
- * Reflects a plugin from the official Neo4j 4.4.
- * Neo4j Labs Plugin list.
- * There might be plugins not supported by your selected version of Neo4j.
- *
- * @deprecated Please use {@link Neo4jContainer#withLabsPlugins(String...)} with the matching plugin name for your Neo4j version.
- * Due to some renaming of the (Docker image) plugin names, there is no naming consistency across versions.
- * The plugins are listed here
- *
- */
-public enum Neo4jLabsPlugin {
- APOC("apoc"),
- APOC_CORE("apoc-core"),
- BLOOM("bloom"),
- STREAMS("streams"),
- GRAPH_DATA_SCIENCE("graph-data-science"),
- NEO_SEMANTICS("n10s");
-
- final String pluginName;
-
- Neo4jLabsPlugin(String pluginName) {
- this.pluginName = pluginName;
- }
-}
diff --git a/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerJUnitIntegrationTest.java b/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerJUnitIntegrationTest.java
index b5f9c2ad867..868d7e29f2d 100644
--- a/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerJUnitIntegrationTest.java
+++ b/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerJUnitIntegrationTest.java
@@ -18,7 +18,7 @@
public class Neo4jContainerJUnitIntegrationTest {
@ClassRule
- public static Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4");
+ public static Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4");
@Test
public void shouldStart() {
diff --git a/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerTest.java b/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerTest.java
index 334aa155eac..9827eb09900 100644
--- a/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerTest.java
+++ b/modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerTest.java
@@ -39,7 +39,7 @@ public void shouldDisableAuthentication() {
try (
// spotless:off
// withoutAuthentication {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
.withoutAuthentication()
// }
// spotless:on
@@ -58,7 +58,7 @@ public void shouldCopyDatabase() {
assumeThat(DockerClientFactory.instance().getInfo().getArchitecture()).isNotEqualTo("aarch64");
try (
// copyDatabase {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:3.5.30")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:3.5.30")
.withDatabase(MountableFile.forClasspathResource("/test-graph.db"))
// }
) {
@@ -75,7 +75,7 @@ public void shouldCopyDatabase() {
public void shouldFailOnCopyDatabaseForDefaultNeo4j4Image() {
assertThatIllegalArgumentException()
.isThrownBy(() -> {
- new Neo4jContainer<>("neo4j:4.4.1").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
+ new Neo4jContainer("neo4j:4.4.1").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
})
.withMessage("Copying database folder is not supported for Neo4j instances with version 4.0 or higher.");
}
@@ -84,7 +84,7 @@ public void shouldFailOnCopyDatabaseForDefaultNeo4j4Image() {
public void shouldFailOnCopyDatabaseForCustomNeo4j4Image() {
assertThatIllegalArgumentException()
.isThrownBy(() -> {
- new Neo4jContainer<>("neo4j:4.4.1").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
+ new Neo4jContainer("neo4j:4.4.1").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
})
.withMessage("Copying database folder is not supported for Neo4j instances with version 4.0 or higher.");
}
@@ -93,7 +93,7 @@ public void shouldFailOnCopyDatabaseForCustomNeo4j4Image() {
public void shouldFailOnCopyDatabaseForCustomNonSemverNeo4j4Image() {
assertThatIllegalArgumentException()
.isThrownBy(() -> {
- new Neo4jContainer<>("neo4j:latest").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
+ new Neo4jContainer("neo4j:latest").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
})
.withMessage("Copying database folder is not supported for Neo4j instances with version 4.0 or higher.");
}
@@ -102,7 +102,7 @@ public void shouldFailOnCopyDatabaseForCustomNonSemverNeo4j4Image() {
public void shouldCopyPlugins() {
try (
// registerPluginsPath {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
.withPlugins(MountableFile.forClasspathResource("/custom-plugins"))
// }
) {
@@ -117,7 +117,7 @@ public void shouldCopyPlugins() {
public void shouldCopyPlugin() {
try (
// registerPluginsJar {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
.withPlugins(MountableFile.forClasspathResource("/custom-plugins/hello-world.jar"))
// }
) {
@@ -142,7 +142,7 @@ public void shouldCheckEnterpriseLicense() {
String expectedImageName = "neo4j:4.4-enterprise";
assertThatExceptionOfType(IllegalStateException.class)
- .isThrownBy(() -> new Neo4jContainer<>("neo4j:4.4").withEnterpriseEdition())
+ .isThrownBy(() -> new Neo4jContainer("neo4j:4.4").withEnterpriseEdition())
.withMessageContaining("The image " + expectedImageName + " requires you to accept a license agreement.");
}
@@ -152,7 +152,7 @@ public void shouldRunEnterprise() {
try (
// enterpriseEdition {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
.withEnterpriseEdition()
// }
.withAdminPassword("Picard123")
@@ -172,7 +172,7 @@ public void shouldRunEnterprise() {
@Test
public void shouldAddConfigToEnvironment() {
// neo4jConfiguration {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
.withNeo4jConfig("dbms.security.procedures.unrestricted", "apoc.*,algo.*")
.withNeo4jConfig("dbms.tx_log.rotation.size", "42M");
// }
@@ -184,7 +184,7 @@ public void shouldAddConfigToEnvironment() {
@Test
public void shouldRespectEnvironmentAuth() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withEnv("NEO4J_AUTH", "neo4j/secret");
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withEnv("NEO4J_AUTH", "neo4j/secret");
neo4jContainer.configure();
@@ -194,7 +194,7 @@ public void shouldRespectEnvironmentAuth() {
@Test
public void shouldSetCustomPasswordCorrectly() {
// withAdminPassword {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withAdminPassword("verySecret");
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withAdminPassword("verySecret");
// }
neo4jContainer.configure();
@@ -204,7 +204,7 @@ public void shouldSetCustomPasswordCorrectly() {
@Test
public void containerAdminPasswordOverrulesEnvironmentAuth() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
.withEnv("NEO4J_AUTH", "neo4j/secret")
.withAdminPassword("anotherSecret");
@@ -215,7 +215,7 @@ public void containerAdminPasswordOverrulesEnvironmentAuth() {
@Test
public void containerWithoutAuthenticationOverrulesEnvironmentAuth() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
.withEnv("NEO4J_AUTH", "neo4j/secret")
.withoutAuthentication();
@@ -226,7 +226,7 @@ public void containerWithoutAuthenticationOverrulesEnvironmentAuth() {
@Test
public void shouldRespectAlreadyDefinedPortMappingsBolt() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withExposedPorts(7687);
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withExposedPorts(7687);
neo4jContainer.configure();
@@ -235,7 +235,7 @@ public void shouldRespectAlreadyDefinedPortMappingsBolt() {
@Test
public void shouldRespectAlreadyDefinedPortMappingsHttp() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withExposedPorts(7474);
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withExposedPorts(7474);
neo4jContainer.configure();
@@ -244,7 +244,7 @@ public void shouldRespectAlreadyDefinedPortMappingsHttp() {
@Test
public void shouldRespectAlreadyDefinedPortMappingsWithoutHttps() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withExposedPorts(7687, 7474);
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withExposedPorts(7687, 7474);
neo4jContainer.configure();
@@ -253,7 +253,7 @@ public void shouldRespectAlreadyDefinedPortMappingsWithoutHttps() {
@Test
public void shouldDefaultExportBoltHttpAndHttps() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4");
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4");
neo4jContainer.configure();
@@ -262,67 +262,16 @@ public void shouldDefaultExportBoltHttpAndHttps() {
@Test
public void shouldRespectCustomWaitStrategy() {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").waitingFor(new CustomDummyWaitStrategy());
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").waitingFor(new CustomDummyWaitStrategy());
neo4jContainer.configure();
assertThat(neo4jContainer.getWaitStrategy()).isInstanceOf(CustomDummyWaitStrategy.class);
}
- // Test for deprecated functionality to be still alive, if `Neo4jLabsPlugin` gets removed, remove this test.
- @Test
- public void shouldConfigureSingleLabsPluginByType() {
- try (
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withLabsPlugins(Neo4jLabsPlugin.APOC)
- ) {
- // needs to get called explicitly for setup
- neo4jContainer.configure();
-
- assertThat(neo4jContainer.getEnvMap()).containsEntry("NEO4JLABS_PLUGINS", "[\"apoc\"]");
- }
- }
-
- // Test for deprecated functionality to be still alive, if `Neo4jLabsPlugin` gets removed, remove this test.
- @Test
- public void shouldConfigureMultipleLabsPluginsByType() {
- try (
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4")
- .withLabsPlugins(Neo4jLabsPlugin.APOC, Neo4jLabsPlugin.BLOOM);
- ) {
- // needs to get called explicitly for setup
- neo4jContainer.configure();
-
- assertThat(neo4jContainer.getEnvMap().get("NEO4JLABS_PLUGINS"))
- .containsAnyOf("[\"apoc\",\"bloom\"]", "[\"bloom\",\"apoc\"]");
- }
- }
-
- // Test for deprecated functionality to be still alive, if `Neo4jContainer#withLabsPlugins` gets removed, remove this test.
- @Test
- public void shouldConfigureSingleLabsPlugin() {
- try (Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withLabsPlugins("apoc")) {
- // needs to get called explicitly for setup
- neo4jContainer.configure();
-
- assertThat(neo4jContainer.getEnvMap()).containsEntry("NEO4JLABS_PLUGINS", "[\"apoc\"]");
- }
- }
-
- // Test for deprecated functionality to be still alive, if `Neo4jContainer#withLabsPlugins` gets removed, remove this test.
- @Test
- public void shouldConfigureMultipleLabsPlugins() {
- try (Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withLabsPlugins("apoc", "bloom");) {
- // needs to get called explicitly for setup
- neo4jContainer.configure();
-
- assertThat(neo4jContainer.getEnvMap().get("NEO4JLABS_PLUGINS"))
- .containsAnyOf("[\"apoc\",\"bloom\"]", "[\"bloom\",\"apoc\"]");
- }
- }
-
@Test
public void shouldConfigureSinglePluginByName() {
- try (Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withPlugins("apoc")) {
+ try (Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withPlugins("apoc")) {
// needs to get called explicitly for setup
neo4jContainer.configure();
@@ -334,7 +283,7 @@ public void shouldConfigureSinglePluginByName() {
public void shouldConfigureMultiplePluginsByName() {
try (
// configureLabsPlugins {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4") //
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4") //
.withPlugins("apoc", "bloom");
// }
) {
@@ -350,7 +299,7 @@ public void shouldConfigureMultiplePluginsByName() {
public void shouldCreateRandomUuidBasedPasswords() {
try (
// withRandomPassword {
- Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4").withRandomPassword();
+ Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withRandomPassword();
// }
) {
// It will throw an exception if it's not UUID parsable.
@@ -363,7 +312,7 @@ public void shouldCreateRandomUuidBasedPasswords() {
@Test
public void shouldWarnOnPasswordTooShort() {
- try (Neo4jContainer> neo4jContainer = new Neo4jContainer<>("neo4j:4.4");) {
+ try (Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4");) {
Logger logger = (Logger) DockerLoggerFactory.getLogger("neo4j:4.4");
TestLogAppender testLogAppender = new TestLogAppender();
logger.addAppender(testLogAppender);
@@ -403,7 +352,7 @@ protected void append(ILoggingEvent eventObject) {
}
}
- private static Driver getDriver(Neo4jContainer> container) {
+ private static Driver getDriver(Neo4jContainer container) {
AuthToken authToken = AuthTokens.none();
if (container.getAdminPassword() != null) {
authToken = AuthTokens.basic("neo4j", container.getAdminPassword());