Skip to content

Commit e3fe7c9

Browse files
committed
Revert "Make Neo4jContainer generic and drop deprecated method (#10388)"
This reverts commit 71cc729.
1 parent 49637a0 commit e3fe7c9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

examples/neo4j-container/src/test/java/org/testcontainers/containers/Neo4jExampleTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class Neo4jExampleTest {
2828

2929
@Container
30-
private static Neo4jContainer neo4jContainer = new Neo4jContainer(DockerImageName.parse("neo4j:4.4"))
30+
private static Neo4jContainer<?> neo4jContainer = new Neo4jContainer<>(DockerImageName.parse("neo4j:4.4"))
3131
.withoutAuthentication(); // Disable password
3232

3333
@Test

modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @deprecated use {@link org.testcontainers.neo4j.Neo4jContainer} instead.
3535
*/
3636
@Deprecated
37-
public class Neo4jContainer extends GenericContainer<Neo4jContainer> {
37+
public class Neo4jContainer<S extends Neo4jContainer<S>> extends GenericContainer<S> {
3838

3939
/**
4040
* The image defaults to the official Neo4j image: <a href="https://hub.docker.com/_/neo4j/">Neo4j</a>.
@@ -217,7 +217,7 @@ public String getHttpsUrl() {
217217
*
218218
* @return This container.
219219
*/
220-
public Neo4jContainer withEnterpriseEdition() {
220+
public S withEnterpriseEdition() {
221221
if (!standardImage) {
222222
throw new IllegalStateException(
223223
String.format("Cannot use enterprise version with alternative image %s.", getDockerImageName())
@@ -239,7 +239,7 @@ public Neo4jContainer withEnterpriseEdition() {
239239
* @param adminPassword The admin password for the default database account.
240240
* @return This container.
241241
*/
242-
public Neo4jContainer withAdminPassword(final String adminPassword) {
242+
public S withAdminPassword(final String adminPassword) {
243243
if (adminPassword != null && adminPassword.length() < 8) {
244244
logger().warn("Your provided admin password is too short and will not work with Neo4j 5.3+.");
245245
}
@@ -252,7 +252,7 @@ public Neo4jContainer withAdminPassword(final String adminPassword) {
252252
*
253253
* @return This container.
254254
*/
255-
public Neo4jContainer withoutAuthentication() {
255+
public S withoutAuthentication() {
256256
return withAdminPassword(null);
257257
}
258258

@@ -276,7 +276,7 @@ public Neo4jContainer withoutAuthentication() {
276276
* @throws IllegalArgumentException If the database version is not 3.5.
277277
* @return This container.
278278
*/
279-
public Neo4jContainer withDatabase(MountableFile graphDb) {
279+
public S withDatabase(MountableFile graphDb) {
280280
if (!isNeo4jDatabaseVersionSupportingDbCopy()) {
281281
throw new IllegalArgumentException(
282282
"Copying database folder is not supported for Neo4j instances with version 4.0 or higher."
@@ -295,7 +295,7 @@ public Neo4jContainer withDatabase(MountableFile graphDb) {
295295
* @param plugins
296296
* @return This container.
297297
*/
298-
public Neo4jContainer withPlugins(MountableFile plugins) {
298+
public S withPlugins(MountableFile plugins) {
299299
return withCopyFileToContainer(plugins, "/var/lib/neo4j/plugins/");
300300
}
301301

@@ -307,7 +307,7 @@ public Neo4jContainer withPlugins(MountableFile plugins) {
307307
* @param value The value to set
308308
* @return This container.
309309
*/
310-
public Neo4jContainer withNeo4jConfig(String key, String value) {
310+
public S withNeo4jConfig(String key, String value) {
311311
addEnv(formatConfigurationKey(key), value);
312312
return self();
313313
}
@@ -330,7 +330,7 @@ public String getAdminPassword() {
330330
* @param plugins The Neo4j plugins that should get started with the server.
331331
* @return This container.
332332
*/
333-
public Neo4jContainer withPlugins(String... plugins) {
333+
public S withPlugins(String... plugins) {
334334
this.labsPlugins.addAll(Arrays.asList(plugins));
335335
return self();
336336
}
@@ -363,7 +363,7 @@ private boolean isNeo4jDatabaseVersionSupportingDbCopy() {
363363
return false;
364364
}
365365

366-
public Neo4jContainer withRandomPassword() {
366+
public S withRandomPassword() {
367367
return withAdminPassword(UUID.randomUUID().toString());
368368
}
369369
}

0 commit comments

Comments
 (0)