Skip to content

Commit

Permalink
add since 3.0 tags
Browse files Browse the repository at this point in the history
  • Loading branch information
hgschmie committed Dec 16, 2021
1 parent 94ac85f commit e34846c
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public abstract class DatabaseInfo {
* PostgreSQL JDBC driver documentation</a> for a comprehensive list.
*
* @return Map of key-value pairs representing data source connection properties.
* @since 3.0
*/
@NonNull
public abstract ImmutableMap<String, String> connectionProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private DatabaseManager(Set<EmbeddedPostgresPreparer<DataSource>> databasePrepar
}

/**
* Creates a new {@link Builder<DatabaseManager>} instance that will create a new database on each call to {@link #getDatabaseInfo()}.
* Creates a new {@link Builder<DatabaseManager>} instance that will create a new database on each call to {@link DatabaseManager#getDatabaseInfo()}.
*
* @return A builder instance.
*/
Expand All @@ -75,7 +75,8 @@ public static Builder<DatabaseManager> multiDatabases() {
}

/**
* Creates a new {@link Builder<DatabaseManager>} instance that will return a connection to the same database on each call to {@link #getDatabaseInfo()}.
* Creates a new {@link Builder<DatabaseManager>} instance that will return a connection to the same database on each call to {@link
* DatabaseManager#getDatabaseInfo()}.
*
* @return A builder instance.
*/
Expand Down Expand Up @@ -277,7 +278,7 @@ protected Builder(boolean multiMode) {
}

/**
* @deprecated Use {@link #withDatabasePreparer(EmbeddedPostgresPreparer)}.
* @deprecated Use {@link DatabaseManager.Builder#withDatabasePreparer(EmbeddedPostgresPreparer)}.
*/
@Deprecated
@NonNull
Expand All @@ -293,6 +294,7 @@ public Builder<T> withPreparer(@NonNull DatabasePreparer databasePreparer) {
*
* @param databasePreparer A {@link EmbeddedPostgresPreparer<DataSource>} instance. Must not be null.
* @return This object instance.
* @since 3.0
*/
@NonNull
public Builder<T> withDatabasePreparer(@NonNull EmbeddedPostgresPreparer<DataSource> databasePreparer) {
Expand All @@ -307,6 +309,7 @@ public Builder<T> withDatabasePreparer(@NonNull EmbeddedPostgresPreparer<DataSou
*
* @param databasePreparers A set of {@link EmbeddedPostgresPreparer<DataSource>} instances. Must not be null.
* @return This object instance.
* @since 3.0
*/
@NonNull
public Builder<T> withDatabasePreparers(@NonNull Set<EmbeddedPostgresPreparer<DataSource>> databasePreparers) {
Expand All @@ -320,6 +323,7 @@ public Builder<T> withDatabasePreparers(@NonNull Set<EmbeddedPostgresPreparer<Da
*
* @param instancePreparer A {@link EmbeddedPostgresPreparer<EmbeddedPostgres.Builder>} instance. Must not be null.
* @return This object instance.
* @since 3.0
*/
@NonNull
public Builder<T> withInstancePreparer(@NonNull EmbeddedPostgresPreparer<EmbeddedPostgres.Builder> instancePreparer) {
Expand All @@ -333,6 +337,7 @@ public Builder<T> withInstancePreparer(@NonNull EmbeddedPostgresPreparer<Embedde
*
* @param instancePreparers A set of {@link EmbeddedPostgresPreparer<EmbeddedPostgres.Builder>} instances. Must not be null.
* @return This object instance.
* @since 3.0
*/
@NonNull
public Builder<T> withInstancePreparers(@NonNull Set<EmbeddedPostgresPreparer<EmbeddedPostgres.Builder>> instancePreparers) {
Expand All @@ -341,7 +346,7 @@ public Builder<T> withInstancePreparers(@NonNull Set<EmbeddedPostgresPreparer<Em
}

/**
* @deprecated Use {@link #withInstancePreparer(EmbeddedPostgresPreparer)}.
* @deprecated Use {@link DatabaseManager.Builder#withInstancePreparer(EmbeddedPostgresPreparer)}.
*/
@Deprecated
@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ public static EmbeddedPostgres.Builder builderWithDefaults() {
}

/**
* This returns an {@link EmbeddedPostgres} instance that can be solely used for version checking. It has not been booted
* and will not work for any other things but executing {@link #getPostgresVersion()}. This is a performance optimization
* for code that needs to do version checking and does not want to pay the penalty of spinning up and shutting down an instance.
* This returns an {@link EmbeddedPostgres} instance that can be solely used for version checking. It has not been booted and will not work for any other
* things but executing {@link EmbeddedPostgres#getPostgresVersion()}. This is a performance optimization for code that needs to do version checking and
* does not want to pay the penalty of spinning up and shutting down an instance.
*
* @since 4.1
* @return An unstarted {@link EmbeddedPostgres} instance.
* @throws IOException Could not create the instance.
* @since 4.1
*/
public static EmbeddedPostgres forVersionCheck() throws IOException {
return new Builder(false).build();
Expand Down Expand Up @@ -287,7 +287,6 @@ public String instanceId() {
*
* @return A string representing the Postgres version as described in the <a href="https://www.postgresql.org/support/versioning/">Postgres versioning
* policy</a>.
*
* @since 4.1
*/
public String getPostgresVersion() throws IOException {
Expand Down Expand Up @@ -799,7 +798,7 @@ public Builder addServerConfiguration(@NonNull String key, @NonNull String value
}

/**
* @deprecated Use {@link #addInitDbConfiguration(String, String)}.
* @deprecated Use {@link Builder#addInitDbConfiguration(String, String)}.
*/
@Deprecated
@NonNull
Expand All @@ -821,6 +820,7 @@ public Builder addLocaleConfiguration(@NonNull String key, @NonNull String value
* @param value initdb parameter value. Must not be null. When the empty string is used as the value, the resulting command line parameter will not have
* a equal sign and a value assigned.
* @return The builder itself.
* @since 3.0
*/
@NonNull
public Builder addInitDbConfiguration(@NonNull String key, @NonNull String value) {
Expand Down Expand Up @@ -855,6 +855,7 @@ public Builder addConnectionProperty(@NonNull String key, @NonNull String value)
* @param installationBaseDirectory The directory to unpack the postgres distribution. The current user must be able to create and write this directory.
* Must not be null.
* @return The builder itself.
* @since 3.0
*/
@NonNull
public Builder setInstallationBaseDirectory(@NonNull File installationBaseDirectory) {
Expand All @@ -880,12 +881,14 @@ public Builder setPort(int port) {

/**
* Set the version of the PostgreSQL server. This value is passed to the default binary manager which will try to resolve this version from existing
* Maven artifacts. The value is ignored if {@link #setNativeBinaryManager(NativeBinaryManager)} is called.
* Maven artifacts. The value is ignored if {@link Builder#setNativeBinaryManager(NativeBinaryManager)} is called.
* <p>
* Not every PostgreSQL version is supported by pg-embedded. Some older versions lack the necessary options for the command line parameters and will
* fail at startup. Currently, every version 10 or newer should be working.
*
* @param serverVersion A partial or full version. Valid values are e.g. "12" or "11.3".
* @return The builder itself.
* @since 3.0
*/
@NonNull
public Builder setServerVersion(@NonNull String serverVersion) {
Expand Down Expand Up @@ -920,11 +923,12 @@ public Builder setOutputRedirector(@NonNull ProcessBuilder.Redirect outputRedire

/**
* Sets the {@link NativeBinaryManager} that provides the location of the postgres installation. Explicitly setting a binary manager overrides the
* installation base directory location set with {@link #setInstallationBaseDirectory(File)} as this is only used by the default binary manager. Calling
* {@link #setInstallationBaseDirectory(File)} after this method undoes setting the binary manager.
* installation base directory location set with {@link Builder#setInstallationBaseDirectory(File)} as this is only used by the default binary manager.
* Calling {@link Builder#setInstallationBaseDirectory(File)} after this method undoes setting the binary manager.
*
* @param nativeBinaryManager A {@link NativeBinaryManager} implementation. Must not be null.
* @return The builder itself.
* @since 3.0
*/
@NonNull
public Builder setNativeBinaryManager(@NonNull NativeBinaryManager nativeBinaryManager) {
Expand All @@ -935,10 +939,12 @@ public Builder setNativeBinaryManager(@NonNull NativeBinaryManager nativeBinaryM
/**
* Use a locally installed PostgreSQL server for tests. The tests will still spin up a new instance and locate the data in the data directory but it
* will use the locally installed binaries for starting and stopping. Calling this method sets a binary manager, so it overrides {@link
* #setNativeBinaryManager(NativeBinaryManager)}. Calling this method makes the builder ignore the {@link #setInstallationBaseDirectory(File)} setting.
* Builder#setNativeBinaryManager(NativeBinaryManager)}. Calling this method makes the builder ignore the {@link
* Builder#setInstallationBaseDirectory(File)} setting.
*
* @param directory A local directory that contains a standard PostgreSQL installation. The directory must exist and read and executable.
* @return The builder itself.
* @since 3.0
*/
@NonNull
public Builder useLocalPostgresInstallation(@NonNull File directory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Allows e.g. for preparation of data sources, postgres instances and other places where additional degrees of customization are needed.
*
* @param <T> The object type to be prepared.
* @since 3.0
*/
@FunctionalInterface
public interface EmbeddedPostgresPreparer<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public static FlywayPreparer forClasspathLocation(String... locations) {
}

/**
* Create a new, uninitialized preparer instance. Use {@link #addCustomizer(Consumer)} to modify the configuration for the {@link FluentConfiguration}
* object.
* Create a new, uninitialized preparer instance. Use {@link FlywayPreparer#addCustomizer(Consumer)} to modify the configuration for the {@link
* FluentConfiguration} object.
*/
public FlywayPreparer() {
}
Expand All @@ -64,6 +64,7 @@ public FlywayPreparer() {
*
* @param customizer A {@link Consumer<FluentConfiguration>} instance. Must not be null.
* @return This object.
* @since 3.0
*/
@NonNull
public FlywayPreparer addCustomizer(@NonNull Consumer<FluentConfiguration> customizer) {
Expand All @@ -79,6 +80,7 @@ public FlywayPreparer addCustomizer(@NonNull Consumer<FluentConfiguration> custo
*
* @param customizers A set of {@link Consumer<FluentConfiguration>} instances. Must not be null.
* @return This object.
* @since 3.0
*/
@NonNull
public FlywayPreparer addCustomizers(@NonNull Set<Consumer<FluentConfiguration>> customizers) {
Expand All @@ -89,7 +91,7 @@ public FlywayPreparer addCustomizers(@NonNull Set<Consumer<FluentConfiguration>>
}

/**
* @deprecated Use {@link #addCustomizer(Consumer)}.
* @deprecated Use {@link FlywayPreparer#addCustomizer(Consumer)}.
*/
@Deprecated
@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
/**
* Locates a native binary on the Filesystem. If necessary, it should download the binary first from the network.
* <p>
* Implementations of this class <b>must</b> implement {@link Object#hashCode()} and {@link Object#equals(Object)} and *should* implement {@link Object#toString()}.
* Implementations of this class <b>must</b> implement {@link Object#hashCode()} and {@link Object#equals(Object)} and <i>should</i> implement {@link
* Object#toString()}.
*
* @since 3.0
*/
public interface NativeBinaryLocator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

/**
* Returns an installation location for a native binary. The implementation is responsible for locating and optionally unpacking installing the binary.
*
* @since 3.0
*/
@FunctionalInterface
public interface NativeBinaryManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

/**
* Loads a native binary installation and returns the location of it.
*
* @since 3.0
*/
public final class TarXzCompressedBinaryManager implements NativeBinaryManager {

Expand All @@ -66,8 +68,8 @@ public final class TarXzCompressedBinaryManager implements NativeBinaryManager {
* <p>
* The implementation of {@link NativeBinaryLocator} to locate the stream that gets unpacked must satisfy the following criteria:
* <ul>
* <li>It must implement {@link #equals(Object)} and {@link #hashCode()}.</li>
* <li>It should implement {@link #toString()} to return meaningful information about the locator.</li>
* <li>It must override {@link Object#equals(Object)} and {@link Object#hashCode()}.</li>
* <li>It should implement {@link Object#toString()} to return meaningful information about the locator.</li>
* <li>It must allow multiple calls to {@link NativeBinaryLocator#getInputStream()} which all return the same, byte-identical contents.
* The operation should be cheap as it may be called multiple times.</li>
* </ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
* <code>io.zonky.test.postgres:embedded-postgres-binaries-&lt;os&gt;-&lt;arch&gt;</code>.
* <p>
* See <a href="https://github.com/zonkyio/embedded-postgres-binaries">The Zonky IO github page</a> for more details.
*
* @since 3.0
*/
public final class ZonkyIOPostgresLocator implements NativeBinaryLocator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
* This extension can provide the {@link EmbeddedPostgres} instance, a {@link DatabaseInfo} or a {@link DataSource} object as test parameters.
*
* <ul>
* <li>Using a {@link DatabaseInfo} parameter is equivalent to calling {@link #createDatabaseInfo()}.</li>
* <li>Using a {@link DataSource} parameter is equivalent to calling {@link #createDataSource()}.</li>
* <li>Using a {@link DatabaseInfo} parameter is equivalent to calling {@link EmbeddedPgExtension#createDatabaseInfo()}.</li>
* <li>Using a {@link DataSource} parameter is equivalent to calling {@link EmbeddedPgExtension#createDataSource()}.</li>
* </ul>
*/
public final class EmbeddedPgExtension implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback, ParameterResolver {
Expand Down Expand Up @@ -95,6 +95,8 @@ static EmbeddedPgExtensionBuilder singleDatabase() {
* @RegisterExtension
* public static EmbeddedPgExtension pg = MultiDatabaseBuilder.instanceWithDefaults().build();
* }</pre>
*
* @since 3.0
*/
public EmbeddedPgExtension() {
this(new DatabaseManagerBuilder(true).withInstancePreparer(EmbeddedPostgres.Builder::withDefaults));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> instanceWithDefaults(
}

/**
* @deprecated Use {@link #preparedInstance(EmbeddedPostgresPreparer)}.
* @deprecated Use {@link MultiDatabaseBuilder#preparedInstance(EmbeddedPostgresPreparer)}.
*/
@Deprecated
@NonNull
Expand All @@ -61,7 +61,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstance(@Non
}

/**
* @deprecated Use {@link #preparedInstanceWithDefaults(EmbeddedPostgresPreparer)}.
* @deprecated Use {@link MultiDatabaseBuilder#preparedInstanceWithDefaults(EmbeddedPostgresPreparer)}.
*/
@Deprecated
@NonNull
Expand All @@ -74,6 +74,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstanceWithD
*
* @param databasePreparer A {@link EmbeddedPostgresPreparer<DataSource>} instance. Must not be null.
* @return A {@link DatabaseManager.Builder<EmbeddedPgExtension>} instance that can be customized further.
* @since 3.0
*/
@NonNull
public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstance(@NonNull EmbeddedPostgresPreparer<DataSource> databasePreparer) {
Expand All @@ -86,6 +87,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstance(@Non
*
* @param databasePreparer A {@link EmbeddedPostgresPreparer<DataSource>} instance. Must not be null.
* @return A {@link DatabaseManager.Builder<EmbeddedPgExtension>} instance that can be customized further.
* @since 3.0
*/
@NonNull
public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstanceWithDefaults(@NonNull EmbeddedPostgresPreparer<DataSource> databasePreparer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.junit.jupiter.api.extension.ExtendWith;

/**
* {@code @RequirePostgresVersion} signals the annotated test class or method that it only should execute if the PostgreSQL server is within a specific range.
* {@code RequirePostgresVersion} signals the annotated test class or method that it only should execute if the PostgreSQL server is within a specific range.
* If the version is outside the range, the annotated test class or method is skipped.
* <p>
* PostgreSQL versions are interpreted as described in the <a href="https://www.postgresql.org/support/versioning/">Versioning Policy</a> and structured as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> instanceWithDefaults(
}

/**
* @deprecated Use {@link #preparedInstance(EmbeddedPostgresPreparer)}.
* @deprecated Use {@link SingleDatabaseBuilder#preparedInstance(EmbeddedPostgresPreparer)}.
*/
@Deprecated
@NonNull
Expand All @@ -62,7 +62,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstance(@Non
}

/**
* @deprecated Use {@link #preparedInstanceWithDefaults(EmbeddedPostgresPreparer)}.
* @deprecated Use {@link SingleDatabaseBuilder#preparedInstanceWithDefaults(EmbeddedPostgresPreparer)}.
*/
@Deprecated
@NonNull
Expand All @@ -75,6 +75,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstanceWithD
*
* @param databasePreparer A {@link EmbeddedPostgresPreparer<DataSource>} instance. Must not be null.
* @return A {@link DatabaseManager.Builder<EmbeddedPgExtension>} instance that can be customized further.
* @since 3.0
*/
@NonNull
public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstance(@NonNull EmbeddedPostgresPreparer<DataSource> databasePreparer) {
Expand All @@ -87,6 +88,7 @@ public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstance(@Non
*
* @param databasePreparer A {@link EmbeddedPostgresPreparer<DataSource>} instance. Must not be null.
* @return A {@link DatabaseManager.Builder<EmbeddedPgExtension>} instance that can be customized further.
* @since 3.0
*/
@NonNull
public static DatabaseManager.Builder<EmbeddedPgExtension> preparedInstanceWithDefaults(@NonNull EmbeddedPostgresPreparer<DataSource> databasePreparer) {
Expand Down

0 comments on commit e34846c

Please sign in to comment.