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

The following examples show how to use ru.yandex.qatools.embed.postgresql.distribution.Version. These examples are extracted from open source projects. 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 Project: ndbc   Source File: EmbeddedSupplier.java    License: 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 Project: vertx-sql-client   Source File: PgRule.java    License: 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 Project: postgres-async-driver   Source File: DatabaseRule.java    License: 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 Project: raml-module-builder   Source File: PostgresClient.java    License: Apache License 2.0 4 votes vote down vote up
private static void rememberEmbeddedPostgres() {
   embeddedPostgres = new EmbeddedPostgres(Version.Main.V10);
}
 
Example 5
Source Project: booties   Source File: PostgreSqlRule.java    License: 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 Project: booties   Source File: PostgreSqlRule.java    License: Apache License 2.0 4 votes vote down vote up
public Builder withVersion(Version version) {
    this.version = version;
    return this;
}
 
Example 7
Source Project: booties   Source File: VersionToStringTest.java    License: 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);
}