Skip to content

Commit 3c1c8aa

Browse files
authored
Merge pull request #2235 from schemacrawler/docker
Cleanup code and start standardization of Docker image build
2 parents 8e95581 + 9a308c9 commit 3c1c8aa

File tree

10 files changed

+193
-20
lines changed

10 files changed

+193
-20
lines changed

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@
5757
<module>schemacrawler-website</module>
5858
</modules>
5959
</profile>
60+
<profile>
61+
<id>verification-tests</id>
62+
<activation>
63+
<property>
64+
<name>verify</name>
65+
</property>
66+
</activation>
67+
<modules>
68+
<module>schemacrawler-verify</module>
69+
</modules>
70+
</profile>
6071
</profiles>
6172

6273
</project>

schemacrawler-commandline/src/main/java/schemacrawler/tools/commandline/utility/CommandLineUtility.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import picocli.CommandLine.Model.UsageMessageSpec;
2828
import picocli.CommandLine.ParseResult;
2929
import schemacrawler.schemacrawler.Version;
30+
import schemacrawler.schemacrawler.exceptions.InternalRuntimeException;
3031
import schemacrawler.tools.catalogloader.CatalogLoaderRegistry;
3132
import schemacrawler.tools.commandline.command.AvailableCatalogLoaders;
3233
import schemacrawler.tools.commandline.command.AvailableCommands;
@@ -191,7 +192,7 @@ public static void printEnvironment(final ShellState state) {
191192
public static CommandSpec toCommandSpec(final PluginCommand pluginCommand) {
192193
requireNonNull(pluginCommand, "No plugin command provided");
193194
if (pluginCommand.isEmpty()) {
194-
throw new NullPointerException("Empty plugin command provided");
195+
throw new InternalRuntimeException("Empty plugin command provided");
195196
}
196197

197198
final String pluginCommandName = pluginCommand.getName();

schemacrawler-commandline/src/main/java/schemacrawler/tools/commandline/utility/GenerateCliSupport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import picocli.CommandLine;
1919
import picocli.CommandLine.Command;
2020
import picocli.codegen.docgen.manpage.ManPageGenerator;
21+
import schemacrawler.schemacrawler.exceptions.IORuntimeException;
22+
import schemacrawler.schemacrawler.exceptions.InternalRuntimeException;
2123
import schemacrawler.tools.commandline.SchemaCrawlerCommandLineCommands;
2224
import schemacrawler.tools.commandline.command.ConfigFileCommand;
2325
import schemacrawler.tools.commandline.command.ConnectCommand;
@@ -67,15 +69,15 @@ public void run() {
6769
}
6870

6971
if (isErrored) {
70-
throw new RuntimeException("Could not generate CLI support files");
72+
throw new InternalRuntimeException("Could not generate CLI support files");
7173
}
7274
}
7375

7476
protected Path createOutputDirectory() {
7577
try {
7678
Files.createDirectories(outputDir);
7779
} catch (final IOException e) {
78-
throw new RuntimeException("Could not create output directory", e);
80+
throw new IORuntimeException("Could not create output directory", e);
7981
}
8082
return outputDir.toAbsolutePath();
8183
}

schemacrawler-distrib/pom.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,16 @@
171171
<version>0.9.14</version>
172172
</dependency>
173173

174-
<!--
175-
Consistent logging:
176-
Direct Apache Log4j logs to Simple Logging Facade for Java (SLF4J), and then
177-
direct SLF4J to Java logging (JUL).
178-
-->
179-
<dependency>
180-
<groupId>org.apache.logging.log4j</groupId>
181-
<artifactId>log4j-to-slf4j</artifactId>
182-
<version>2.25.3</version>
183-
</dependency>
174+
<!--
175+
Consistent logging:
176+
Direct Apache Log4j logs to Simple Logging Facade for Java (SLF4J), and then
177+
direct SLF4J to Java logging (JUL).
178+
-->
179+
<dependency>
180+
<groupId>org.apache.logging.log4j</groupId>
181+
<artifactId>log4j-to-slf4j</artifactId>
182+
<version>2.25.3</version>
183+
</dependency>
184184
<dependency>
185185
<groupId>org.slf4j</groupId>
186186
<artifactId>slf4j-jdk14</artifactId>

schemacrawler-offline/src/main/java/schemacrawler/tools/offline/OfflineCatalogLoader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010

1111
import static schemacrawler.tools.formatter.serialize.CatalogSerializationUtility.deserializeCatalog;
1212
import static schemacrawler.utility.MetaDataUtility.reduceCatalog;
13+
1314
import java.io.IOException;
1415
import java.nio.file.Path;
1516
import java.sql.Connection;
1617
import java.sql.SQLException;
18+
import java.util.logging.Level;
1719
import java.util.logging.Logger;
1820
import schemacrawler.schema.Catalog;
1921
import schemacrawler.schemacrawler.SchemaCrawlerOptions;
@@ -59,6 +61,7 @@ public void loadCatalog() {
5961
}
6062

6163
final Path offlineDatabasePath = dbConnection.getOfflineDatabasePath();
64+
LOGGER.log(Level.FINE, "Derserializing from path: " + offlineDatabasePath);
6265
catalog = deserializeCatalog(offlineDatabasePath);
6366

6467
final SchemaCrawlerOptions schemaCrawlerOptions = getSchemaCrawlerOptions();

schemacrawler-text/pom.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project
33
xmlns="http://maven.apache.org/POM/4.0.0"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
56
<modelVersion>4.0.0</modelVersion>
7+
68
<parent>
79
<groupId>us.fatehi</groupId>
810
<artifactId>schemacrawler-parent</artifactId>
911
<version>17.4.0</version>
12+
<relativePath />
1013
</parent>
1114
<artifactId>schemacrawler-text</artifactId>
1215
<packaging>jar</packaging>
16+
1317
<name>SchemaCrawler Text</name>
18+
1419
<dependencies>
1520
<dependency>
1621
<groupId>us.fatehi</groupId>
@@ -37,6 +42,8 @@
3742
<scope>test</scope>
3843
</dependency>
3944
</dependencies>
45+
46+
4047
<build>
4148
<plugins>
4249
<plugin>
@@ -76,6 +83,8 @@
7683
<skip>true</skip>
7784
</configuration>
7885
</plugin>
86+
7987
</plugins>
8088
</build>
89+
8190
</project>

schemacrawler-text/src/main/java/schemacrawler/tools/command/text/schema/options/BaseSchemaTextOptionsBuilder.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,16 @@
3030
import static schemacrawler.tools.command.text.schema.options.HideDependantDatabaseObjectsType.hideTableConstraints;
3131
import static schemacrawler.tools.command.text.schema.options.HideDependantDatabaseObjectsType.hideTriggers;
3232
import static schemacrawler.tools.command.text.schema.options.HideDependantDatabaseObjectsType.hideWeakAssociations;
33+
3334
import java.util.EnumMap;
3435
import java.util.Map;
35-
import java.util.logging.Logger;
3636
import schemacrawler.tools.options.Config;
3737
import schemacrawler.tools.text.options.BaseTextOptionsBuilder;
3838

3939
public abstract class BaseSchemaTextOptionsBuilder<
4040
B extends BaseSchemaTextOptionsBuilder<B, O>, O extends SchemaTextOptions>
4141
extends BaseTextOptionsBuilder<BaseSchemaTextOptionsBuilder<B, O>, O> {
4242

43-
private static final Logger LOGGER =
44-
Logger.getLogger(BaseSchemaTextOptionsBuilder.class.getName());
45-
4643
private static final String SHOW_ORDINAL_NUMBERS =
4744
SCHEMACRAWLER_FORMAT_PREFIX + "show_ordinal_numbers";
4845
private static final String SHOW_STANDARD_COLUMN_TYPE_NAMES =

schemacrawler-verify/pom.xml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<parent>
9+
<groupId>us.fatehi</groupId>
10+
<artifactId>schemacrawler-parent</artifactId>
11+
<version>17.4.0</version>
12+
<relativePath />
13+
</parent>
14+
<artifactId>schemacrawler-verify</artifactId>
15+
<packaging>jar</packaging>
16+
17+
<name>SchemaCrawler - Docker Verification Tests</name>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>us.fatehi</groupId>
22+
<artifactId>schemacrawler</artifactId>
23+
<version>${project.version}</version>
24+
</dependency>
25+
26+
<dependency>
27+
<groupId>us.fatehi</groupId>
28+
<artifactId>schemacrawler-testdb</artifactId>
29+
<version>${project.version}</version>
30+
<scope>test</scope>
31+
</dependency>
32+
<dependency>
33+
<groupId>us.fatehi</groupId>
34+
<artifactId>schemacrawler-test-utility</artifactId>
35+
<version>${project.version}</version>
36+
<scope>test</scope>
37+
</dependency>
38+
<dependency>
39+
<groupId>us.fatehi</groupId>
40+
<artifactId>schemacrawler-tests</artifactId>
41+
<version>${project.version}</version>
42+
<scope>test</scope>
43+
</dependency>
44+
</dependencies>
45+
46+
47+
<build>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-install-plugin</artifactId>
52+
<configuration>
53+
<skip>true</skip>
54+
</configuration>
55+
</plugin>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-deploy-plugin</artifactId>
59+
<configuration>
60+
<skip>true</skip>
61+
</configuration>
62+
</plugin>
63+
<plugin>
64+
<groupId>org.sonatype.central</groupId>
65+
<artifactId>central-publishing-maven-plugin</artifactId>
66+
<configuration>
67+
<skipPublishing>true</skipPublishing>
68+
</configuration>
69+
</plugin>
70+
71+
</plugins>
72+
</build>
73+
74+
</project>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* SchemaCrawler AI
3+
* http://www.schemacrawler.com
4+
* Copyright (c) 2000-2026, Sualeh Fatehi <sualeh@hotmail.com>.
5+
* All rights reserved.
6+
* SPDX-License-Identifier: CC-BY-NC-4.0
7+
*/
8+
9+
package schemacrawler.verification_test;
10+
11+
import static org.hamcrest.CoreMatchers.is;
12+
import static org.hamcrest.MatcherAssert.assertThat;
13+
import static org.hamcrest.Matchers.emptyString;
14+
import static org.hamcrest.Matchers.startsWith;
15+
16+
import java.io.IOException;
17+
import java.time.Duration;
18+
import java.util.logging.Level;
19+
import java.util.logging.Logger;
20+
import org.junit.jupiter.api.DisplayName;
21+
import org.junit.jupiter.api.Tag;
22+
import org.junit.jupiter.api.Test;
23+
import org.testcontainers.containers.Container.ExecResult;
24+
import org.testcontainers.containers.GenericContainer;
25+
import org.testcontainers.junit.jupiter.Container;
26+
import org.testcontainers.junit.jupiter.Testcontainers;
27+
import org.testcontainers.utility.DockerImageName;
28+
import schemacrawler.schemacrawler.Version;
29+
import us.fatehi.utility.readconfig.SystemPropertiesConfig;
30+
31+
/** Integration test to verify the published Docker image is viable by starting it. */
32+
@Testcontainers
33+
@Tag("docker")
34+
@DisplayName("Test Docker image build")
35+
public class DockerImageBuildTest {
36+
37+
private static final Logger LOGGER =
38+
Logger.getLogger(DockerImageBuildTest.class.getCanonicalName());
39+
40+
private static final DockerImageName DOCKER_IMAGE_NAME =
41+
DockerImageName.parse("schemacrawler/schemacrawler")
42+
.withTag(new SystemPropertiesConfig().getStringValue("docker_image_tag", "latest"));
43+
44+
@Container
45+
private final GenericContainer<?> mcpServerContainer =
46+
new GenericContainer<>(DOCKER_IMAGE_NAME)
47+
.withImagePullPolicy(imageName -> false)
48+
.withStartupTimeout(Duration.ofSeconds(60))
49+
.withCommand("tail", "-f", "/dev/null");
50+
51+
@Test
52+
@DisplayName("Docker image starts successfully and SchemaCrawler runs")
53+
public void testDockerImageHealth() throws IOException, InterruptedException {
54+
55+
LOGGER.log(Level.CONFIG, "Verifying " + DOCKER_IMAGE_NAME);
56+
57+
// Run SchemaCrawler command and capture output
58+
final ExecResult result =
59+
mcpServerContainer.execInContainer("/opt/schemacrawler/bin/schemacrawler.sh", "-V");
60+
61+
// Assert successful execution
62+
assertThat(result.getExitCode(), is(0));
63+
assertThat(result.getStdout(), startsWith(Version.version().toString()));
64+
assertThat(result.getStderr(), is(emptyString()));
65+
}
66+
}

schemacrawler-website/src/site/markdown/changes-report.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
SchemaCrawler release notes.
44

5+
<a name="v17.4.0"></a>
6+
## Release 17.4.0 - 2026-01-05
7+
- Drop support for Apache Derby, since the project has been discontinued
8+
9+
10+
<a name="v17.3.0"></a>
11+
## Release 17.3.0 - 2025-12-31
12+
- Milestone release with modularity
13+
14+
515
<a name="v17.2.8"></a>
616
## Release 17.2.8 - 2025-12-30
717
- Further work on modularity

0 commit comments

Comments
 (0)