Skip to content

Commit 0a05911

Browse files
committed
#7 Make firebirdsql/firebird the default image
1 parent 1b25ca7 commit 0a05911

File tree

7 files changed

+94
-46
lines changed

7 files changed

+94
-46
lines changed

CHANGES.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,31 @@ Version History
33

44
vNext
55
-----
6+
- The _project_ image (`firebirdsql/firebird`) is now the default. \
7+
Contrary to previously announced, the 5.0.3 tag is the default, not 5.0.1. \
8+
If you want to continue using the _jacobalberty_ image, you'll need to explicitly reference the image name (e.g. using `FirebirdContainer.JACOB_ALBERTY_IMAGE`).
9+
- As a backwards compatibility measure, a subset of tags of the _jacobalberty_ image are recognized in `jdbc:tc:firebird[sql]:...` URLs and `FirebirdContainerProvider.newInstance(String)`. \
10+
Specifically, tags starting with `2.`, `v2`, `v3`, `v4` and `v5` will select the _jacobalberty_ image instead of the _project_ image.
11+
- Support for the _jacobalberty_ image is considered deprecated, but there are currently no plans to remove it. \
12+
Switch to the _project_ image (`firebirdsql/firebird`).
13+
- Support for the _fdcastel_ image was removed as it is no longer available. \
14+
Switch to the _project_ image (`firebirdsql/firebird`).
615
- Updated org.testcontainers:jdbc to 1.21.0
716
- Updated various test-dependencies
817
- Updated Maven build plugins
9-
- Support for the _fdcastel_ image was removed as it is no longer available. \
10-
You'll need to switch to the _project_ image (`firebirdsql/firebird`).
1118

1219
1.5.1
1320
-----
1421
- Added support for [firebirdsql/firebird](https://hub.docker.com/r/firebirdsql/firebird). \
1522
This was originally the _fdcastel_ image. \
16-
The name is defined in `FirebirdContainer.PROJECT_IMAGE` (`String`) and `FirebirdContainer.PROJECT_IMAGE_NAME` (`DockerImageName`). \
23+
The name is defined in `FirebirdContainer.PROJECT_IMAGE`. \
1724
In 1.5.x, these images are not accessible as a `jdbc:tc:firebird[sql]:...` URL, only through `FirebirdContainer`; this will change with version 1.6.0. \
1825
All existing configuration options are mapped in a backwards compatible way.
19-
- Defined `JACOB_ALBERTY_IMAGE` and `JACOB_ALBERY_IMAGE_NAME` constants in `FirebirdContainer`.
26+
- Defined `JACOB_ALBERTY_IMAGE` constants in `FirebirdContainer`.
2027
- Support for the _fdcastel_ image is considered deprecated, but there are currently no plans to remove it. \
2128
Switch to the _project_ image.
2229
- In the 1.6.0 release, the 5.0.1 version of the _project_ image will become the default image. \
23-
Make sure you explicitly use this image name (and a version tag) if you want to stick to the _Jacob Alberty_ image with the next release.
30+
Make sure you explicitly use this image name (and a version tag) if you want to stick to the _jacobalberty_ image with the next release.
2431
- Updated various test-dependencies
2532

2633
1.5.0
@@ -29,7 +36,7 @@ vNext
2936
- Updated various test-dependencies
3037
- Updated Maven build plugins
3138
- Added support for [ghcr.io/fdcastel/firebird](https://github.com/fdcastel/firebird-docker) images. \
32-
The name is defined in `FirebirdContainer.FDCASTEL_IMAGE` (`String`) and `FirebirdContainer.FDCASTEL_IMAGE_NAME` (`DockerImageName`). \
39+
The name is defined in `FirebirdContainer.FDCASTEL_IMAGE`. \
3340
These images are not accessible as a `jdbc:tc:firebird[sql]:...` URL, only through `FirebirdContainer`.\
3441
All existing configuration options are mapped in a backwards compatible way.
3542

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ firebird-testcontainers-java
66
Firebird-testcontainers-java is a module for [Testcontainers](https://www.testcontainers.org/)
77
to provide lightweight, throwaway instances of Firebird for JUnit tests.
88

9-
The default Docker image used is [jacobalberty/firebird](https://hub.docker.com/r/jacobalberty/firebird/), and also supports
10-
[firebirdsql/firebird](https://hub.docker.com/r/firebirdsql/firebird) (since 1.5.1) and
11-
[ghcr.io/fdcastel/firebird](https://github.com/fdcastel/firebird-docker) (since 1.5.0).
12-
13-
The `firebirdsql/firebird` image will become the default image in version 1.6.0.
9+
The default Docker image used is [firebirdsql/firebird](https://hub.docker.com/r/firebirdsql/firebird), and also supports
10+
[jacobalberty/firebird](https://hub.docker.com/r/jacobalberty/firebird/).
1411

1512
If you want to use Firebird 2.5, use the 2.5.x-sc (SuperClassic) variant of
1613
the `jacobalberty/firebird` image, or 2.5.9-ss as earlier versions of the 2.5.x-ss
17-
(SuperServer) variant seem to be broken.
14+
(SuperServer) variant seem to be broken. However, recently, it seems that the
15+
2.5.x-sc variants also no longer work reliably.
1816

1917
Prerequisites
2018
-------------
@@ -65,20 +63,20 @@ Important standard options are:
6563
For `jacobalberty/firebird`, if the value is `sysdba`, `FIREBIRD_USER` is not set.
6664
- `withPassword(String)` - Sets the password of the user (defaults to `test`); sets the docker environment variable `FIREBIRD_PASSWORD`. \
6765
For `jacobalberty/firebird`, if the username is `sysdba`, `ISC_PASSWORD` is set instead of `FIREBIRD_PASSWORD`. \
68-
For `ghcr.io/fdcastel/firebird`, if the username is `sysdba`, it also sets `FIREBIRD_ROOT_PASSWORD`.
66+
For `firebirdsql/firebird`, if the username is `sysdba`, it also sets `FIREBIRD_ROOT_PASSWORD`.
6967
- `withDatabaseName(String)` - Sets the database name (defaults to `test`); sets docker environment variable `FIREBIRD_DATABASE`
7068

7169
Firebird specific options are:
7270

7371
- `withEnableLegacyClientAuth()` - (_Firebird 3+_) Enables `LegacyAuth` and uses it as the default for creating users, also relaxes `WireCrypt` to `Enabled`;
74-
sets docker environment variable `EnableLegacyClientAuth` (`jacobalberty/firebird`) or `FIREBIRD_USE_LEGACY_AUTH` (`firebirdsql/firebird` and `ghcr.io/fdcastel/firebird`) to `true`;
72+
sets docker environment variable `EnableLegacyClientAuth` (`jacobalberty/firebird`) or `FIREBIRD_USE_LEGACY_AUTH` (`firebirdsql/firebird`) to `true`;
7573
passes connection property `authPlugins` with value `Srp256,Srp,Legacy_Auth` if this property is not explicitly set through `withUrlParam`.
7674
- `withEnableWireCrypt` - (_Firebird 3+_) Relaxes `WireCrypt` from `Required` to `Enabled`;
77-
sets docker environment variable `EnableWireCrypt` (`jacobalberty/firebird`) to `true`, or `FIREBIRD_CONF_WireCrypt` (`firebirdsql/firebird` and `ghcr.io/fdcastel/firebird`) to `Enabled`.
75+
sets docker environment variable `EnableWireCrypt` (`jacobalberty/firebird`) to `true`, or `FIREBIRD_CONF_WireCrypt` (`firebirdsql/firebird`) to `Enabled`.
7876
- `withTimeZone(String)` - Sets the time zone (defaults to JVM default time zone);
7977
- sets docker environment variable `TZ` to the specified value
8078
- `withSysdbaPassword(String)` - Sets the SYSDBA password, but if `withUsername(String)` is set to `sysdba` (case-insensitive), this property is ignored and the value of `withPassword` is used instead;
81-
sets docker environment variable `ISC_PASSWORD` (`jacobalberty/firebird`) or `FIREBIRD_ROOT_PASSWORD` (`ghcr.io/fdcastel/firebird`) to the specified value.
79+
sets docker environment variable `ISC_PASSWORD` (`jacobalberty/firebird`) or `FIREBIRD_ROOT_PASSWORD` (`firebirdsql/firebird`) to the specified value.
8280

8381
Example of use:
8482

@@ -92,7 +90,7 @@ import org.testcontainers.utility.DockerImageName;
9290
public class ExampleRuleTest {
9391

9492
private static final DockerImageName IMAGE =
95-
DockerImageName.parse(FirebirdContainer.IMAGE).withTag("v4.0.2");
93+
DockerImageName.parse(FirebirdContainer.IMAGE).withTag("5.0.3");
9694

9795
@Rule
9896
public final FirebirdContainer<?> container = new FirebirdContainer<?>(IMAGE)
@@ -127,14 +125,16 @@ Where:
127125
- `<image-tag>` (_optional, but recommended_) is the tag of the docker image to
128126
use, otherwise the default is used (which might change between versions)
129127
- `<databasename>` (_optional_) is the name of the database (defaults to `test`)
130-
- `<property>` is a connection property (Jaybird properties **and** testcontainers properties are possible) \
128+
- `<property>` is a connection property (Jaybird properties **and** testcontainers
129+
properties are possible) \
131130
Of special note are the properties:
132131
- `user` (_optional_) specifies the username to create and connect (defaults to `test`)
133132
- `password` (_optional_) specifies the password for the user (defaults to `test`)
134133
- `<value>` is the value of the property
135134

136-
Currently, these URLs can only use the `jacobalberty/firebird` images. In 1.6.0,
137-
this will switch to use `firebirdsql/firebird`.
135+
These URLs use the `firebirdsql/firebird` images, except for tags starting with
136+
`2.`, `v2`, `v3`, `v4` or `v5`, which will select the `jacobalberty/firebird`
137+
images for backwards compatibility.
138138

139139
Example of use:
140140

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/**
1313
* Testcontainers implementation for Firebird.
1414
* <p>
15-
* Supported image: {@code jacobalberty/firebird}, {@code firebirdsql/firebird}.
15+
* Supported image: {@code firebirdsql/firebird} and {@code jacobalberty/firebird} (deprecated).
1616
* <p>
1717
* Exposed ports: 3050
1818
*/
@@ -23,12 +23,20 @@ public class FirebirdContainer<SELF extends FirebirdContainer<SELF>> extends Jdb
2323
public static final String NAME = "firebird";
2424
public static final String ALTERNATE_NAME = "firebirdsql";
2525
public static final String PROJECT_IMAGE = "firebirdsql/firebird";
26+
/**
27+
* @deprecated Use {@link #PROJECT_IMAGE}
28+
*/
29+
@Deprecated
2630
public static final String JACOB_ALBERTY_IMAGE = "jacobalberty/firebird";
27-
public static final String IMAGE = JACOB_ALBERTY_IMAGE;
31+
public static final String IMAGE = PROJECT_IMAGE;
2832
static final DockerImageName PROJECT_IMAGE_NAME = DockerImageName.parse(PROJECT_IMAGE);
33+
/**
34+
* @deprecated Use {@link #PROJECT_IMAGE_NAME}
35+
*/
36+
@Deprecated
2937
static final DockerImageName JACOB_ALBERTY_IMAGE_NAME = DockerImageName.parse(JACOB_ALBERTY_IMAGE);
30-
static final DockerImageName DEFAULT_IMAGE_NAME = JACOB_ALBERTY_IMAGE_NAME;
31-
public static final String DEFAULT_TAG = "v4.0.2";
38+
static final DockerImageName DEFAULT_IMAGE_NAME = PROJECT_IMAGE_NAME;
39+
public static final String DEFAULT_TAG = "5.0.3";
3240

3341
public static final Integer FIREBIRD_PORT = 3050;
3442
private static final String FIREBIRD_SYSDBA = "sysdba";
@@ -54,7 +62,7 @@ public FirebirdContainer() {
5462
}
5563

5664
/**
57-
* Creates a Firebird container with an image name (e.g. {@code "jacobalberty/firebird:3.0.7"}.
65+
* Creates a Firebird container with an image name (e.g. {@code "firebirdsql/firebird:5.0.3"}.
5866
*
5967
* @param dockerImageName Image name
6068
*/

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
import org.testcontainers.jdbc.ConnectionUrl;
66
import org.testcontainers.utility.DockerImageName;
77

8+
import java.util.Arrays;
9+
import java.util.HashSet;
10+
import java.util.Set;
11+
12+
import static java.util.Collections.unmodifiableSet;
13+
814
/**
915
* Factory for Firebird containers.
1016
*/
@@ -23,9 +29,21 @@ public JdbcDatabaseContainer newInstance() {
2329
return newInstance(FirebirdContainer.DEFAULT_TAG);
2430
}
2531

32+
// Two character prefix of tags of the jacobalberty image
33+
// The firebirdsql image uses versions without v prefix and doesn't provide a Firebird 2.x image
34+
private static final Set<String> LEGACY_TAG_PREFIXES = unmodifiableSet(new HashSet<>(
35+
Arrays.asList("2.", "v2", "v3", "v4", "v5")));
36+
37+
private static boolean isLegacyTag(String tag) {
38+
return tag.length() >= 2 && LEGACY_TAG_PREFIXES.contains(tag.substring(0, 2));
39+
}
40+
2641
@Override
2742
public JdbcDatabaseContainer newInstance(String tag) {
28-
return new FirebirdContainer(DockerImageName.parse(FirebirdContainer.IMAGE).withTag(tag));
43+
DockerImageName imageName = isLegacyTag(tag)
44+
? FirebirdContainer.JACOB_ALBERTY_IMAGE_NAME
45+
: FirebirdContainer.DEFAULT_IMAGE_NAME;
46+
return new FirebirdContainer(imageName.withTag(tag));
2947
}
3048

3149
@Override

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
import java.util.stream.Stream;
1313

1414
import static org.firebirdsql.testcontainers.FirebirdContainer.FIREBIRD_PORT;
15-
import static org.firebirdsql.testcontainers.FirebirdTestImages.FIREBIRD_259_SC_IMAGE;
16-
import static org.firebirdsql.testcontainers.FirebirdTestImages.FIREBIRD_259_SS_IMAGE;
15+
import static org.firebirdsql.testcontainers.FirebirdTestImages.JACOB_ALBERTY_259_SC_IMAGE;
16+
import static org.firebirdsql.testcontainers.FirebirdTestImages.JACOB_ALBERTY_259_SS_IMAGE;
1717
import static org.firebirdsql.testcontainers.FirebirdTestImages.FIREBIRD_TEST_IMAGE;
18+
import static org.firebirdsql.testcontainers.FirebirdTestImages.JACOB_ALBERTY_TEST_IMAGE;
1819
import static org.firebirdsql.testcontainers.FirebirdTestImages.PROJECT_TEST_IMAGE;
1920
import static org.hamcrest.CoreMatchers.allOf;
2021
import static org.hamcrest.CoreMatchers.containsString;
@@ -139,11 +140,15 @@ void testWithEnableWireCrypt(DockerImageName imageName) throws SQLException {
139140
}
140141

141142
/**
142-
* The 2.5 images of jacobalberty/firebird handle FIREBIRD_DATABASE and need an absolute path to access the database
143+
* The 2.5 images of jacobalberty/firebird handle FIREBIRD_DATABASE and need an absolute path to access the database.
144+
* <p>
145+
* NOTE: This test is ignored because it occasionally fails locally and repeatedly on GitHub Actions.
146+
* </p>
143147
*/
148+
@Disabled
144149
@Test
145150
void test259_scImage() throws Exception {
146-
try (FirebirdContainer<?> container = new FirebirdContainer<>(FIREBIRD_259_SC_IMAGE).withDatabaseName("test")) {
151+
try (FirebirdContainer<?> container = new FirebirdContainer<>(JACOB_ALBERTY_259_SC_IMAGE).withDatabaseName("test")) {
147152
assertEquals("test", container.getDatabaseName(), "Expect original database name before start");
148153

149154
container.start();
@@ -161,15 +166,15 @@ void test259_scImage() throws Exception {
161166
}
162167

163168
/**
164-
* The 2.5 images of jacobalberty/firebird handle FIREBIRD_DATABASE and need an absolute path to access the database
169+
* The 2.5 images of jacobalberty/firebird handle FIREBIRD_DATABASE and need an absolute path to access the database.
165170
* <p>
166171
* NOTE: This test is ignored because it occasionally fails locally and repeatedly on GitHub Actions.
167172
* </p>
168173
*/
169174
@Disabled
170175
@Test
171176
void test259_ssImage() throws Exception {
172-
try (FirebirdContainer<?> container = new FirebirdContainer<>(FIREBIRD_259_SS_IMAGE).withDatabaseName("test")) {
177+
try (FirebirdContainer<?> container = new FirebirdContainer<>(JACOB_ALBERTY_259_SS_IMAGE).withDatabaseName("test")) {
173178
assertEquals("test", container.getDatabaseName(), "Expect original database name before start");
174179

175180
container.start();
@@ -187,8 +192,7 @@ void test259_ssImage() throws Exception {
187192
}
188193

189194
/**
190-
* The firebirdsql/firebird and fdcastel/firebird images handle FIREBIRD_DATABASE and need an absolute path to
191-
* access the database
195+
* The firebirdsql/firebird images handle FIREBIRD_DATABASE and need an absolute path to access the database.
192196
*/
193197
@ParameterizedTest
194198
@MethodSource("projectCompatibleImages")
@@ -228,7 +232,7 @@ void testWithAdditionalUrlParamInJdbcUrl(DockerImageName imageName) {
228232
}
229233

230234
static Stream<DockerImageName> defaultTestImages() {
231-
return Stream.of(PROJECT_TEST_IMAGE, FIREBIRD_TEST_IMAGE);
235+
return Stream.of(FIREBIRD_TEST_IMAGE, JACOB_ALBERTY_TEST_IMAGE);
232236
}
233237

234238
static Stream<DockerImageName> projectCompatibleImages() {

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
public final class FirebirdTestImages {
66

7-
public static final DockerImageName FIREBIRD_402_IMAGE = FirebirdContainer.DEFAULT_IMAGE_NAME.withTag("v4.0.2");
8-
public static final DockerImageName FIREBIRD_259_SC_IMAGE = FirebirdContainer.DEFAULT_IMAGE_NAME.withTag("2.5.9-sc");
9-
public static final DockerImageName FIREBIRD_259_SS_IMAGE = FirebirdContainer.DEFAULT_IMAGE_NAME.withTag("2.5.9-ss");
10-
public static final DockerImageName PROJECT_501_IMAGE = FirebirdContainer.PROJECT_IMAGE_NAME.withTag("5.0.1");
11-
public static final DockerImageName FIREBIRD_TEST_IMAGE = FIREBIRD_402_IMAGE;
12-
public static final DockerImageName PROJECT_TEST_IMAGE = PROJECT_501_IMAGE;
7+
public static final DockerImageName JACOB_ALBERTY_402_IMAGE = FirebirdContainer.JACOB_ALBERTY_IMAGE_NAME.withTag("v4.0.2");
8+
public static final DockerImageName JACOB_ALBERTY_259_SC_IMAGE = FirebirdContainer.JACOB_ALBERTY_IMAGE_NAME.withTag("2.5.9-sc");
9+
public static final DockerImageName JACOB_ALBERTY_259_SS_IMAGE = FirebirdContainer.JACOB_ALBERTY_IMAGE_NAME.withTag("2.5.9-ss");
10+
public static final DockerImageName PROJECT_503_IMAGE = FirebirdContainer.PROJECT_IMAGE_NAME.withTag("5.0.3");
11+
public static final DockerImageName PROJECT_TEST_IMAGE = PROJECT_503_IMAGE;
12+
public static final DockerImageName JACOB_ALBERTY_TEST_IMAGE = JACOB_ALBERTY_402_IMAGE;
13+
public static final DockerImageName FIREBIRD_TEST_IMAGE = PROJECT_TEST_IMAGE;
1314

1415
private FirebirdTestImages() {
1516
throw new AssertionError("no instances");

0 commit comments

Comments
 (0)