ru.yandex.qatools.embed.postgresql.distribution.Version Java Examples

The following examples show how to use ru.yandex.qatools.embed.postgresql.distribution.Version. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmbeddedSupplier.java    From ndbc with Apache License 2.0 5 votes vote down vote up
public EmbeddedSupplier(final Config config, final Optional<String> version) {
  if (config.port() == 0)
    this.config = config.port(SocketUtil.findFreePort());
  else
    this.config = config;
  this.version = version.map(Version.Main::valueOf).orElse(Version.Main.V9_6);
}
 
Example #2
Source File: PgRule.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
private static Version getPostgresVersion() {
  String specifiedVersion = System.getProperty("embedded.postgres.version");
  Version version;
  if (specifiedVersion == null || specifiedVersion.isEmpty()) {
    // if version is not specified then V10 will be used by default
    version = V10_6;
  } else {
    version = supportedPgVersions.get(specifiedVersion);
  }
  if (version == null) {
    throw new IllegalArgumentException("embedded postgres only supports the following versions: " + supportedPgVersions.keySet().toString() + "instead of " + specifiedVersion);
  }
  return version;
}
 
Example #3
Source File: DatabaseRule.java    From postgres-async-driver with Apache License 2.0 5 votes vote down vote up
DatabaseRule(NettyConnectibleBuilder builder) {
    this.builder = builder;
    if (builder instanceof EmbeddedConnectionPoolBuilder) {
        String port = System.getProperty("asyncpg.test.postgres.port");
        if (port != null && !port.isBlank()) {
            builder.hostname("localhost");
            builder.port(Integer.valueOf(port));
        } else {
            if (process == null) {
                try {
                    PostgresStarter<PostgresExecutable, PostgresProcess> runtime = PostgresStarter.getDefaultInstance();
                    PostgresConfig config = new PostgresConfig(Version.V11_1, new AbstractPostgresConfig.Net(),
                            new AbstractPostgresConfig.Storage("async-pg"), new AbstractPostgresConfig.Timeout(),
                            new AbstractPostgresConfig.Credentials("async-pg", "async-pg"));
                    PostgresExecutable exec = runtime.prepare(config);
                    process = exec.start();

                    System.out.printf("Started postgres to %s:%d%n", process.getConfig().net().host(), process.getConfig().net().port());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            builder.hostname(process.getConfig().net().host());
            builder.port(process.getConfig().net().port());
        }
    }
}
 
Example #4
Source File: PostgresClient.java    From raml-module-builder with Apache License 2.0 4 votes vote down vote up
private static void rememberEmbeddedPostgres() {
   embeddedPostgres = new EmbeddedPostgres(Version.Main.V10);
}
 
Example #5
Source File: PostgreSqlRule.java    From booties with Apache License 2.0 4 votes vote down vote up
private Path getCachedPath(Version version) {
    return Paths.get(System.getProperty("user.home"), ".embeddedPostgres", version.asInDownloadPath());
}
 
Example #6
Source File: PostgreSqlRule.java    From booties with Apache License 2.0 4 votes vote down vote up
public Builder withVersion(Version version) {
    this.version = version;
    return this;
}
 
Example #7
Source File: VersionToStringTest.java    From booties with Apache License 2.0 4 votes vote down vote up
@Test
public void versionToString() {
    String version = Version.V9_6_8.asInDownloadPath();
    System.out.println(version);
}