mirror of
https://github.com/google/nomulus
synced 2026-09-05 15:46:55 +00:00
Upgrade a few pinned dependencies (#2359)
This commit is contained in:
@@ -73,21 +73,17 @@ public final class PgpHelper {
|
||||
*/
|
||||
public static PGPPublicKey lookupPublicKey(
|
||||
PGPPublicKeyRingCollection keyring, String query, KeyRequirement want) {
|
||||
try {
|
||||
Iterator<PGPPublicKeyRing> results =
|
||||
keyring.getKeyRings(checkNotNull(query, "query"), true, true);
|
||||
verify(results.hasNext(), "No public key found matching substring: %s", query);
|
||||
while (results.hasNext()) {
|
||||
Optional<PGPPublicKey> result = lookupPublicSubkey(results.next(), want);
|
||||
if (result.isPresent()) {
|
||||
return result.get();
|
||||
}
|
||||
Iterator<PGPPublicKeyRing> results =
|
||||
keyring.getKeyRings(checkNotNull(query, "query"), true, true);
|
||||
verify(results.hasNext(), "No public key found matching substring: %s", query);
|
||||
while (results.hasNext()) {
|
||||
Optional<PGPPublicKey> result = lookupPublicSubkey(results.next(), want);
|
||||
if (result.isPresent()) {
|
||||
return result.get();
|
||||
}
|
||||
throw new VerifyException(String.format(
|
||||
"No public key (%s) found matching substring: %s", want, query));
|
||||
} catch (PGPException e) {
|
||||
throw new VerifyException(String.format("Public key lookup failed for query: %s", query), e);
|
||||
}
|
||||
throw new VerifyException(
|
||||
String.format("No public key (%s) found matching substring: %s", want, query));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ import schemacrawler.tools.options.OutputOptions;
|
||||
import schemacrawler.tools.options.OutputOptionsBuilder;
|
||||
|
||||
/** Command to generate ER diagrams for SQL schema. */
|
||||
@Parameters(separators = " =", commandDescription = "Generate ER diagrams for SQL schmea.")
|
||||
@Parameters(separators = " =", commandDescription = "Generate ER diagrams for SQL schema.")
|
||||
public class GenerateSqlErDiagramCommand implements Command {
|
||||
|
||||
private static final String DB_NAME = "postgres";
|
||||
@@ -101,14 +101,14 @@ public class GenerateSqlErDiagramCommand implements Command {
|
||||
checkState(outDir.toFile().mkdirs(), "Failed to create directory %s", outDir);
|
||||
}
|
||||
|
||||
PostgreSQLContainer postgresContainer =
|
||||
new PostgreSQLContainer(NomulusPostgreSql.getDockerTag())
|
||||
.withDatabaseName(DB_NAME)
|
||||
.withUsername(DB_USER)
|
||||
.withPassword(DB_PASSWORD);
|
||||
postgresContainer.start();
|
||||
|
||||
try (Connection conn = getConnection(postgresContainer)) {
|
||||
try (PostgreSQLContainer<?> postgresContainer =
|
||||
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerTag())) {
|
||||
postgresContainer
|
||||
.withDatabaseName(DB_NAME)
|
||||
.withUsername(DB_USER)
|
||||
.withPassword(DB_PASSWORD)
|
||||
.start();
|
||||
Connection conn = getConnection(postgresContainer);
|
||||
initDb(conn);
|
||||
if (diagramType == ALL || diagramType == FULL) {
|
||||
improveDiagramHtml(generateErDiagram(conn, FULL_DIAGRAM_COMMAND, FULL_DIAGRAM_FILE_NAME));
|
||||
@@ -116,8 +116,6 @@ public class GenerateSqlErDiagramCommand implements Command {
|
||||
if (diagramType == ALL || diagramType == BRIEF) {
|
||||
improveDiagramHtml(generateErDiagram(conn, BRIEF_DIAGRAM_COMMAND, BRIEF_DIAGRAM_FILE_NAME));
|
||||
}
|
||||
} finally {
|
||||
postgresContainer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +123,7 @@ public class GenerateSqlErDiagramCommand implements Command {
|
||||
try {
|
||||
Document doc = Jsoup.parse(diagram.toFile(), StandardCharsets.UTF_8.name());
|
||||
|
||||
// Add the last name of the flyway file to the HTML so we can have a test to verify that if
|
||||
// Add the last name of the flyway file to the HTML, so we can have a test to verify that if
|
||||
// the generated diagram is up to date.
|
||||
doc.select("body > table > tbody")
|
||||
.first()
|
||||
@@ -140,11 +138,9 @@ public class GenerateSqlErDiagramCommand implements Command {
|
||||
+ "</tr>");
|
||||
|
||||
// Add pan and zoom support for the embedded SVG in the HTML.
|
||||
StringBuilder svgPanZoomLib =
|
||||
new StringBuilder("<script>")
|
||||
.append(ResourceUtils.readResourceUtf8(SVG_PAN_ZOOM_LIB))
|
||||
.append("</script>");
|
||||
doc.select("head").first().append(svgPanZoomLib.toString());
|
||||
String svgPanZoomLib =
|
||||
"<script>" + ResourceUtils.readResourceUtf8(SVG_PAN_ZOOM_LIB) + "</script>";
|
||||
doc.select("head").first().append(svgPanZoomLib);
|
||||
doc.select("svg")
|
||||
.first()
|
||||
.attributes()
|
||||
@@ -163,8 +159,7 @@ public class GenerateSqlErDiagramCommand implements Command {
|
||||
+ "});"
|
||||
+ "</script>");
|
||||
|
||||
Files.write(
|
||||
diagram, doc.outerHtml().getBytes(StandardCharsets.UTF_8), StandardOpenOption.WRITE);
|
||||
Files.writeString(diagram, doc.outerHtml(), StandardOpenOption.WRITE);
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
@@ -194,7 +189,7 @@ public class GenerateSqlErDiagramCommand implements Command {
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
private static Connection getConnection(PostgreSQLContainer container) {
|
||||
private static Connection getConnection(PostgreSQLContainer<?> container) {
|
||||
Properties info = new Properties();
|
||||
info.put("user", container.getUsername());
|
||||
info.put("password", container.getPassword());
|
||||
|
||||
@@ -27,18 +27,17 @@ import java.util.Arrays;
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.ftpserver.FtpServer;
|
||||
import org.apache.ftpserver.ftplet.FtpException;
|
||||
import org.apache.sshd.common.NamedFactory;
|
||||
import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
|
||||
import org.apache.sshd.common.keyprovider.KeyPairProvider;
|
||||
import org.apache.sshd.common.random.SingletonRandomFactory;
|
||||
import org.apache.sshd.common.session.SessionContext;
|
||||
import org.apache.sshd.scp.server.ScpCommandFactory;
|
||||
import org.apache.sshd.server.ServerBuilder;
|
||||
import org.apache.sshd.server.SshServer;
|
||||
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
|
||||
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
|
||||
import org.apache.sshd.server.command.Command;
|
||||
import org.apache.sshd.server.scp.ScpCommandFactory;
|
||||
import org.apache.sshd.server.session.ServerSession;
|
||||
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
|
||||
import org.apache.sshd.sftp.server.SftpSubsystemFactory;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.openssl.PEMKeyPair;
|
||||
import org.bouncycastle.openssl.PEMParser;
|
||||
@@ -131,7 +130,7 @@ public class TestSftpServer implements FtpServer {
|
||||
server.setCommandFactory(new ScpCommandFactory());
|
||||
server.setPort(port);
|
||||
|
||||
NamedFactory<Command> sftpSubsystemFactory = new SftpSubsystemFactory.Builder().build();
|
||||
SftpSubsystemFactory sftpSubsystemFactory = new SftpSubsystemFactory.Builder().build();
|
||||
server.setSubsystemFactories(ImmutableList.of(sftpSubsystemFactory));
|
||||
|
||||
if (authorizedPassword != null) {
|
||||
@@ -150,17 +149,17 @@ public class TestSftpServer implements FtpServer {
|
||||
ImmutableMap.of(KEY_TYPE, HOST_KEY_PAIR);
|
||||
|
||||
@Override
|
||||
public Iterable<KeyPair> loadKeys() {
|
||||
public Iterable<KeyPair> loadKeys(SessionContext context) {
|
||||
return keyPairByTypeMap.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getKeyTypes() {
|
||||
public Iterable<String> getKeyTypes(SessionContext context) {
|
||||
return keyPairByTypeMap.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyPair loadKey(final String type) {
|
||||
public KeyPair loadKey(SessionContext context, final String type) {
|
||||
return keyPairByTypeMap.get(type);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ class GenerateSqlErDiagramCommandTest extends CommandTestCase<GenerateSqlErDiagr
|
||||
|
||||
@Test
|
||||
void testSchemaGeneration() throws Exception {
|
||||
runCommand("--out_dir=" + tmpDir.resolve("diagram").toString());
|
||||
runCommand("--out_dir=" + tmpDir.resolve("diagram"));
|
||||
|
||||
Path fullDiagram = tmpDir.resolve("diagram/full_er_diagram.html");
|
||||
Document fullDiagramDoc = Jsoup.parse(fullDiagram.toFile(), StandardCharsets.UTF_8.name());
|
||||
|
||||
Reference in New Issue
Block a user