Skip to content

Commit 00a739d

Browse files
committed
Remove self-referencing generic type parameter from FirebirdContainer
1 parent 267407e commit 00a739d

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Version History
99
- stay on firebird-testcontainers-java 1.6.1 and org.testcontainers:jdbc 1.21.4,
1010
- switch to using Testcontainers URLs instead of using `@Rule` or `@ClassRule`, or
1111
- write you own rule implementation to start and stop the container.
12+
- Removed self-referencing generic type parameter from `FirebirdContainer`. \
13+
You need to replace occurrences of `FirebirdContainer<?>` and `FirebirdContainer<>` with `FirebirdContainer`.
1214
- Updated various test dependencies
1315

1416
1.6.1

src/main/java/org/firebirdsql/testcontainers/FirebirdContainer.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* <p>
1717
* Exposed ports: 3050
1818
*/
19-
public class FirebirdContainer<SELF extends FirebirdContainer<SELF>> extends JdbcDatabaseContainer<SELF> {
19+
public class FirebirdContainer extends JdbcDatabaseContainer<FirebirdContainer> {
2020

2121
private static final Logger log = LoggerFactory.getLogger(FirebirdContainer.class);
2222

@@ -165,19 +165,19 @@ protected String getTestQueryString() {
165165
}
166166

167167
@Override
168-
public SELF withDatabaseName(final String databaseName) {
168+
public FirebirdContainer withDatabaseName(final String databaseName) {
169169
this.databaseName = databaseName;
170170
return self();
171171
}
172172

173173
@Override
174-
public SELF withUsername(final String username) {
174+
public FirebirdContainer withUsername(final String username) {
175175
this.username = username;
176176
return self();
177177
}
178178

179179
@Override
180-
public SELF withPassword(final String password) {
180+
public FirebirdContainer withPassword(final String password) {
181181
this.password = password;
182182
return self();
183183
}
@@ -187,7 +187,7 @@ public SELF withPassword(final String password) {
187187
*
188188
* @return this container
189189
*/
190-
public SELF withEnableLegacyClientAuth() {
190+
public FirebirdContainer withEnableLegacyClientAuth() {
191191
this.enableLegacyClientAuth = true;
192192
return self();
193193
}
@@ -197,7 +197,7 @@ public SELF withEnableLegacyClientAuth() {
197197
*
198198
* @return this container
199199
*/
200-
public SELF withEnableWireCrypt() {
200+
public FirebirdContainer withEnableWireCrypt() {
201201
this.enableWireCrypt = true;
202202
return self();
203203
}
@@ -208,21 +208,21 @@ public SELF withEnableWireCrypt() {
208208
* @param timeZone Time zone name (prefer long names like Europe/Amsterdam)
209209
* @return this container
210210
*/
211-
public SELF withTimeZone(final String timeZone) {
211+
public FirebirdContainer withTimeZone(final String timeZone) {
212212
this.timeZone = timeZone;
213213
return self();
214214
}
215215

216216
/**
217217
* Set the sysdba password.
218218
* <p>
219-
* If {@code username} is {@code "sysdba"} (case insensitive), then {@code password} is used instead.
219+
* If {@code username} is {@code "sysdba"} (case-insensitive), then {@code password} is used instead.
220220
* </p>
221221
*
222222
* @param sysdbaPassword Sysdba password
223223
* @return this container
224224
*/
225-
public SELF withSysdbaPassword(final String sysdbaPassword) {
225+
public FirebirdContainer withSysdbaPassword(final String sysdbaPassword) {
226226
this.sysdbaPassword = sysdbaPassword;
227227
return self();
228228
}
@@ -253,7 +253,7 @@ public static boolean isWireEncryptionSupported() {
253253
private enum ImageVariant {
254254
PROJECT {
255255
@Override
256-
void setUserAndPassword(FirebirdContainer<?> container) {
256+
void setUserAndPassword(FirebirdContainer container) {
257257
container.addEnv("FIREBIRD_USER", container.username);
258258
container.addEnv("FIREBIRD_PASSWORD", container.password);
259259
if (FIREBIRD_SYSDBA.equalsIgnoreCase(container.username)) {
@@ -264,18 +264,18 @@ void setUserAndPassword(FirebirdContainer<?> container) {
264264
}
265265

266266
@Override
267-
void enableLegacyAuth(FirebirdContainer<?> container) {
267+
void enableLegacyAuth(FirebirdContainer container) {
268268
container.addEnv("FIREBIRD_USE_LEGACY_AUTH", "true");
269269
}
270270

271271
@Override
272-
void setWireCryptEnabled(FirebirdContainer<?> container) {
272+
void setWireCryptEnabled(FirebirdContainer container) {
273273
container.addEnv("FIREBIRD_CONF_WireCrypt", "Enabled");
274274
}
275275
},
276276
JACOBALBERTY {
277277
@Override
278-
void setUserAndPassword(FirebirdContainer<?> container) {
278+
void setUserAndPassword(FirebirdContainer container) {
279279
if (FIREBIRD_SYSDBA.equalsIgnoreCase(container.username)) {
280280
container.addEnv("ISC_PASSWORD", container.password);
281281
} else {
@@ -288,30 +288,30 @@ void setUserAndPassword(FirebirdContainer<?> container) {
288288
}
289289

290290
@Override
291-
void enableLegacyAuth(FirebirdContainer<?> container) {
291+
void enableLegacyAuth(FirebirdContainer container) {
292292
container.addEnv("EnableLegacyClientAuth", "true");
293293
}
294294

295295
@Override
296-
void setWireCryptEnabled(FirebirdContainer<?> container) {
296+
void setWireCryptEnabled(FirebirdContainer container) {
297297
container.addEnv("EnableWireCrypt", "true");
298298
}
299299
},
300300
;
301301

302-
void setTimeZone(FirebirdContainer<?> container) {
302+
void setTimeZone(FirebirdContainer container) {
303303
container.addEnv("TZ", container.timeZone);
304304
}
305305

306-
void setDatabaseName(FirebirdContainer<?> container) {
306+
void setDatabaseName(FirebirdContainer container) {
307307
container.addEnv("FIREBIRD_DATABASE", container.databaseName);
308308
}
309309

310-
abstract void setUserAndPassword(FirebirdContainer<?> container);
310+
abstract void setUserAndPassword(FirebirdContainer container);
311311

312-
abstract void enableLegacyAuth(FirebirdContainer<?> container);
312+
abstract void enableLegacyAuth(FirebirdContainer container);
313313

314-
abstract void setWireCryptEnabled(FirebirdContainer<?> container);
314+
abstract void setWireCryptEnabled(FirebirdContainer container);
315315

316316
static ImageVariant of(String imageNameString) {
317317
DockerImageName imageName = DockerImageName.parse(imageNameString);

src/test/java/org/firebirdsql/testcontainers/FirebirdContainerTest.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424
import static org.junit.jupiter.api.Assertions.assertFalse;
2525
import static org.junit.jupiter.api.Assertions.assertTrue;
2626

27-
@SuppressWarnings("resource")
2827
class FirebirdContainerTest {
2928

3029
@ParameterizedTest
3130
@MethodSource("defaultTestImages")
3231
void testWithSysdbaPassword(DockerImageName imageName) throws SQLException {
3332
final String sysdbaPassword = "sysdbapassword";
34-
try (FirebirdContainer<?> container = new FirebirdContainer<>(imageName)
33+
try (FirebirdContainer container = new FirebirdContainer(imageName)
3534
.withSysdbaPassword(sysdbaPassword)) {
3635
container.start();
3736

@@ -45,7 +44,7 @@ void testWithSysdbaPassword(DockerImageName imageName) throws SQLException {
4544
@Test
4645
void testImplicitImage() throws SQLException {
4746
final String sysdbaPassword = "sysdbapassword";
48-
try (FirebirdContainer<?> container = new FirebirdContainer<>()
47+
try (FirebirdContainer container = new FirebirdContainer()
4948
.withSysdbaPassword(sysdbaPassword)) {
5049
container.start();
5150

@@ -63,7 +62,7 @@ void testImplicitImage() throws SQLException {
6362
void testUserPasswordTakesPrecedenceOverWithSysdbaPassword(DockerImageName imageName) throws SQLException {
6463
final String userPassword = "password1";
6564
final String withSysdbaPassword = "password2";
66-
try (FirebirdContainer<?> container = new FirebirdContainer<>(imageName)
65+
try (FirebirdContainer container = new FirebirdContainer(imageName)
6766
.withUsername("sysdba").withPassword(userPassword).withSysdbaPassword(withSysdbaPassword)) {
6867
container.start();
6968

@@ -76,7 +75,7 @@ void testUserPasswordTakesPrecedenceOverWithSysdbaPassword(DockerImageName image
7675
@ParameterizedTest
7776
@MethodSource("defaultTestImages")
7877
void testWithEnableLegacyClientAuth(DockerImageName imageName) throws SQLException {
79-
try (FirebirdContainer<?> container = new FirebirdContainer<>(imageName)
78+
try (FirebirdContainer container = new FirebirdContainer(imageName)
8079
.withEnableLegacyClientAuth()) {
8180
container.start();
8281

@@ -92,7 +91,7 @@ void testWithEnableLegacyClientAuth(DockerImageName imageName) throws SQLExcepti
9291
@ParameterizedTest
9392
@MethodSource("defaultTestImages")
9493
void testWithEnableLegacyClientAuth_jdbcUrlIncludeAuthPlugins_default(DockerImageName imageName) {
95-
try (FirebirdContainer<?> container = new FirebirdContainer<>(imageName)
94+
try (FirebirdContainer container = new FirebirdContainer(imageName)
9695
.withEnableLegacyClientAuth()) {
9796
container.start();
9897

@@ -106,7 +105,7 @@ void testWithEnableLegacyClientAuth_jdbcUrlIncludeAuthPlugins_default(DockerImag
106105
@ParameterizedTest
107106
@MethodSource("defaultTestImages")
108107
void testWithEnableLegacyClientAuth_jdbcUrlIncludeAuthPlugins_explicitlySet(DockerImageName imageName) {
109-
try (FirebirdContainer<?> container = new FirebirdContainer<>(imageName)
108+
try (FirebirdContainer container = new FirebirdContainer(imageName)
110109
.withEnableLegacyClientAuth()
111110
.withUrlParam("authPlugins", "Legacy_Auth")) {
112111
container.start();
@@ -121,7 +120,7 @@ void testWithEnableLegacyClientAuth_jdbcUrlIncludeAuthPlugins_explicitlySet(Dock
121120
@ParameterizedTest
122121
@MethodSource("defaultTestImages")
123122
void testWithEnableWireCrypt(DockerImageName imageName) throws SQLException {
124-
try (FirebirdContainer<?> container = new FirebirdContainer<>(imageName).withEnableWireCrypt()) {
123+
try (FirebirdContainer container = new FirebirdContainer(imageName).withEnableWireCrypt()) {
125124
container.start();
126125

127126
if (FirebirdContainer.isWireEncryptionSupported()) {
@@ -148,7 +147,7 @@ void testWithEnableWireCrypt(DockerImageName imageName) throws SQLException {
148147
@Disabled
149148
@Test
150149
void test259_scImage() throws Exception {
151-
try (FirebirdContainer<?> container = new FirebirdContainer<>(JACOB_ALBERTY_259_SC_IMAGE).withDatabaseName("test")) {
150+
try (FirebirdContainer container = new FirebirdContainer(JACOB_ALBERTY_259_SC_IMAGE).withDatabaseName("test")) {
152151
assertEquals("test", container.getDatabaseName(), "Expect original database name before start");
153152

154153
container.start();
@@ -174,7 +173,7 @@ void test259_scImage() throws Exception {
174173
@Disabled
175174
@Test
176175
void test259_ssImage() throws Exception {
177-
try (FirebirdContainer<?> container = new FirebirdContainer<>(JACOB_ALBERTY_259_SS_IMAGE).withDatabaseName("test")) {
176+
try (FirebirdContainer container = new FirebirdContainer(JACOB_ALBERTY_259_SS_IMAGE).withDatabaseName("test")) {
178177
assertEquals("test", container.getDatabaseName(), "Expect original database name before start");
179178

180179
container.start();
@@ -197,7 +196,7 @@ void test259_ssImage() throws Exception {
197196
@ParameterizedTest
198197
@MethodSource("projectCompatibleImages")
199198
void projectImage_databaseName(DockerImageName imageName) throws Exception {
200-
try (FirebirdContainer<?> container = new FirebirdContainer<>(imageName).withDatabaseName("test")) {
199+
try (FirebirdContainer container = new FirebirdContainer(imageName).withDatabaseName("test")) {
201200
assertEquals("test", container.getDatabaseName(), "Expect original database name before start");
202201

203202
container.start();
@@ -217,7 +216,7 @@ void projectImage_databaseName(DockerImageName imageName) throws Exception {
217216
@ParameterizedTest
218217
@MethodSource("defaultTestImages")
219218
void testWithAdditionalUrlParamInJdbcUrl(DockerImageName imageName) {
220-
try (FirebirdContainer<?> firebird = new FirebirdContainer<>(imageName)
219+
try (FirebirdContainer firebird = new FirebirdContainer(imageName)
221220
.withUrlParam("charSet", "utf-8")
222221
.withUrlParam("blobBufferSize", "2048")) {
223222

0 commit comments

Comments
 (0)