Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public enum DatabaseDriver {

/**
* Apache Derby.
* @deprecated Derby is retired, use HSQLDB or H2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at the other deprecation in the codebase, we use a standard format for this.

*/
@Deprecated(forRemoval = true, since = "4.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 4.1.0

DERBY("Apache Derby", "org.apache.derby.jdbc.EmbeddedDriver", "org.apache.derby.jdbc.EmbeddedXADataSource",
"SELECT 1 FROM SYSIBM.SYSDUMMY1"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public enum EmbeddedDatabaseConnection {

/**
* Derby Database Connection.
* @deprecated Derby is retired, use HSQLDB or H2
*/
@Deprecated(forRemoval = true, since = "4.1")
DERBY("jdbc:derby:memory:%s;create=true"),

/**
Expand All @@ -83,6 +85,7 @@ public enum EmbeddedDatabaseConnection {
* Returns the driver class name.
* @return the driver class name
*/
@SuppressWarnings("removal")
public @Nullable String getDriverClassName() {
// See https://github.com/spring-projects/spring-boot/issues/32865
return switch (this) {
Expand All @@ -97,6 +100,7 @@ public enum EmbeddedDatabaseConnection {
* Returns the {@link EmbeddedDatabaseType} for the connection.
* @return the database type
*/
@SuppressWarnings("removal")
public @Nullable EmbeddedDatabaseType getType() {
// See https://github.com/spring-projects/spring-boot/issues/32865
return switch (this) {
Expand All @@ -117,6 +121,7 @@ public enum EmbeddedDatabaseConnection {
return (this.url != null) ? String.format(this.url, databaseName) : null;
}

@SuppressWarnings("removal")
boolean isEmbeddedUrl(String url) {
// See https://github.com/spring-projects/spring-boot/issues/32865
return switch (this) {
Expand Down Expand Up @@ -151,6 +156,7 @@ public static boolean isEmbedded(@Nullable String driverClass, @Nullable String
return (url == null || connection.isEmbeddedUrl(url));
}

@SuppressWarnings("removal")
private static EmbeddedDatabaseConnection getEmbeddedDatabaseConnection(String driverClass) {
return Stream.of(H2, HSQLDB, DERBY)
.filter((connection) -> connection.isDriverCompatible(driverClass))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void unknownOnNullProductName() {
}

@Test
@SuppressWarnings("removal")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should flag the test as deprecated instead;

void databaseProductNameLookups() {
assertThat(DatabaseDriver.fromProductName("newone")).isEqualTo(DatabaseDriver.UNKNOWN);
assertThat(DatabaseDriver.fromProductName("Apache Derby")).isEqualTo(DatabaseDriver.DERBY);
Expand Down Expand Up @@ -88,6 +89,7 @@ void databaseProductNameLookups() {
}

@Test
@SuppressWarnings("removal")
void databaseJdbcUrlLookups() {
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:newone://localhost")).isEqualTo(DatabaseDriver.UNKNOWN);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:derby:sample")).isEqualTo(DatabaseDriver.DERBY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void h2CustomDatabaseName() {
}

@Test
@SuppressWarnings("removal")
void derbyCustomDatabaseName() {
assertThat(EmbeddedDatabaseConnection.DERBY.getUrl("myderbydb"))
.isEqualTo("jdbc:derby:memory:myderbydb;create=true");
Expand Down Expand Up @@ -80,6 +81,7 @@ void isEmbeddedWithDriverAndUrl(String driverClassName, String url, boolean embe
assertThat(EmbeddedDatabaseConnection.isEmbedded(driverClassName, url)).isEqualTo(embedded);
}

@SuppressWarnings("removal")
static Object[] embeddedDriverAndUrlParameters() {
return new Object[] {
new Object[] { EmbeddedDatabaseConnection.H2.getDriverClassName(), "jdbc:h2:~/test", false },
Expand Down