diff --git a/pom.xml b/pom.xml index 923df3f..7e14116 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ postgresql-embedded 2.10-SNAPSHOT Embedded PostgreSQL (based on Flapdoodle-OSS embedded services) + bundle An embedded PostgreSQL... @@ -102,6 +103,12 @@ -Xdoclint:none + + org.apache.felix + maven-bundle-plugin + true + 3.5.0 + diff --git a/src/main/java/ru/yandex/qatools/embed/postgresql/EmbeddedPostgres.java b/src/main/java/ru/yandex/qatools/embed/postgresql/EmbeddedPostgres.java index 6c36efa..2d587d0 100644 --- a/src/main/java/ru/yandex/qatools/embed/postgresql/EmbeddedPostgres.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/EmbeddedPostgres.java @@ -5,7 +5,7 @@ import de.flapdoodle.embed.process.distribution.Platform; import de.flapdoodle.embed.process.io.directories.FixedPath; import de.flapdoodle.embed.process.runtime.ICommandLinePostProcessor; -import de.flapdoodle.embed.process.store.PostgresArtifactStoreBuilder; +import ru.yandex.qatools.embed.postgresql.store.PostgresArtifactStoreBuilder; import ru.yandex.qatools.embed.postgresql.config.AbstractPostgresConfig; import ru.yandex.qatools.embed.postgresql.config.PostgresDownloadConfigBuilder; import ru.yandex.qatools.embed.postgresql.config.PostgresConfig; diff --git a/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java b/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java index ad837d5..9bf139e 100644 --- a/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java @@ -12,9 +12,9 @@ import de.flapdoodle.embed.process.runtime.Executable; import de.flapdoodle.embed.process.runtime.ProcessControl; import de.flapdoodle.embed.process.store.IArtifactStore; -import de.flapdoodle.embed.process.store.IMutableArtifactStore; -import de.flapdoodle.embed.process.store.PostgresArtifactStore; -import de.flapdoodle.embed.process.store.PostgresArtifactStoreBuilder; +import ru.yandex.qatools.embed.postgresql.store.IMutableArtifactStore; +import ru.yandex.qatools.embed.postgresql.store.PostgresArtifactStore; +import ru.yandex.qatools.embed.postgresql.store.PostgresArtifactStoreBuilder; import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import ru.yandex.qatools.embed.postgresql.config.IMutableDownloadConfig; diff --git a/src/main/java/ru/yandex/qatools/embed/postgresql/config/RuntimeConfigBuilder.java b/src/main/java/ru/yandex/qatools/embed/postgresql/config/RuntimeConfigBuilder.java index b25f104..b919f3f 100644 --- a/src/main/java/ru/yandex/qatools/embed/postgresql/config/RuntimeConfigBuilder.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/config/RuntimeConfigBuilder.java @@ -5,7 +5,7 @@ import de.flapdoodle.embed.process.io.progress.Slf4jProgressListener; import de.flapdoodle.embed.process.runtime.ICommandLinePostProcessor; import ru.yandex.qatools.embed.postgresql.Command; -import de.flapdoodle.embed.process.store.PostgresArtifactStoreBuilder; +import ru.yandex.qatools.embed.postgresql.store.PostgresArtifactStoreBuilder; /** * Configuration builder diff --git a/src/main/java/de/flapdoodle/embed/process/store/CachedPostgresArtifactStore.java b/src/main/java/ru/yandex/qatools/embed/postgresql/store/CachedPostgresArtifactStore.java similarity index 96% rename from src/main/java/de/flapdoodle/embed/process/store/CachedPostgresArtifactStore.java rename to src/main/java/ru/yandex/qatools/embed/postgresql/store/CachedPostgresArtifactStore.java index 2bd34c4..bc3fa06 100644 --- a/src/main/java/de/flapdoodle/embed/process/store/CachedPostgresArtifactStore.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/store/CachedPostgresArtifactStore.java @@ -1,4 +1,4 @@ -package de.flapdoodle.embed.process.store; +package ru.yandex.qatools.embed.postgresql.store; import de.flapdoodle.embed.process.config.store.FileSet; import de.flapdoodle.embed.process.config.store.FileType; @@ -8,6 +8,8 @@ import de.flapdoodle.embed.process.extract.ITempNaming; import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder; import de.flapdoodle.embed.process.io.directories.IDirectory; +import de.flapdoodle.embed.process.store.IDownloader; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/de/flapdoodle/embed/process/store/EmptyFileSet.java b/src/main/java/ru/yandex/qatools/embed/postgresql/store/EmptyFileSet.java similarity index 92% rename from src/main/java/de/flapdoodle/embed/process/store/EmptyFileSet.java rename to src/main/java/ru/yandex/qatools/embed/postgresql/store/EmptyFileSet.java index 589c8d9..5e07a62 100644 --- a/src/main/java/de/flapdoodle/embed/process/store/EmptyFileSet.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/store/EmptyFileSet.java @@ -1,4 +1,4 @@ -package de.flapdoodle.embed.process.store; +package ru.yandex.qatools.embed.postgresql.store; import de.flapdoodle.embed.process.config.store.FileType; import de.flapdoodle.embed.process.extract.IExtractedFileSet; diff --git a/src/main/java/de/flapdoodle/embed/process/store/IMutableArtifactStore.java b/src/main/java/ru/yandex/qatools/embed/postgresql/store/IMutableArtifactStore.java similarity index 64% rename from src/main/java/de/flapdoodle/embed/process/store/IMutableArtifactStore.java rename to src/main/java/ru/yandex/qatools/embed/postgresql/store/IMutableArtifactStore.java index 4006f41..c9d3212 100644 --- a/src/main/java/de/flapdoodle/embed/process/store/IMutableArtifactStore.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/store/IMutableArtifactStore.java @@ -1,6 +1,7 @@ -package de.flapdoodle.embed.process.store; +package ru.yandex.qatools.embed.postgresql.store; import de.flapdoodle.embed.process.config.store.IDownloadConfig; +import de.flapdoodle.embed.process.store.IArtifactStore; public interface IMutableArtifactStore extends IArtifactStore { void setDownloadConfig(IDownloadConfig downloadConfig); diff --git a/src/main/java/de/flapdoodle/embed/process/store/NonCachedPostgresArtifactStoreBuilder.java b/src/main/java/ru/yandex/qatools/embed/postgresql/store/NonCachedPostgresArtifactStoreBuilder.java similarity index 72% rename from src/main/java/de/flapdoodle/embed/process/store/NonCachedPostgresArtifactStoreBuilder.java rename to src/main/java/ru/yandex/qatools/embed/postgresql/store/NonCachedPostgresArtifactStoreBuilder.java index 641576d..6f80721 100644 --- a/src/main/java/de/flapdoodle/embed/process/store/NonCachedPostgresArtifactStoreBuilder.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/store/NonCachedPostgresArtifactStoreBuilder.java @@ -1,4 +1,6 @@ -package de.flapdoodle.embed.process.store; +package ru.yandex.qatools.embed.postgresql.store; + +import de.flapdoodle.embed.process.store.IArtifactStore; public class NonCachedPostgresArtifactStoreBuilder extends PostgresArtifactStoreBuilder { diff --git a/src/main/java/de/flapdoodle/embed/process/store/PostgresArtifactStore.java b/src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresArtifactStore.java similarity index 88% rename from src/main/java/de/flapdoodle/embed/process/store/PostgresArtifactStore.java rename to src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresArtifactStore.java index 0ac275f..d25706b 100644 --- a/src/main/java/de/flapdoodle/embed/process/store/PostgresArtifactStore.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresArtifactStore.java @@ -1,4 +1,4 @@ -package de.flapdoodle.embed.process.store; +package ru.yandex.qatools.embed.postgresql.store; import de.flapdoodle.embed.process.config.store.FileSet; import de.flapdoodle.embed.process.config.store.FileType; @@ -11,6 +11,9 @@ import de.flapdoodle.embed.process.extract.IExtractor; import de.flapdoodle.embed.process.extract.ITempNaming; import de.flapdoodle.embed.process.io.directories.IDirectory; +import de.flapdoodle.embed.process.store.ArtifactStore; +import de.flapdoodle.embed.process.store.IDownloader; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,18 +27,17 @@ * @author Ilya Sadykov * Hacky ArtifactStore. Just to override the default FilesToExtract with PostgresFilesToExtract */ -public class PostgresArtifactStore implements IMutableArtifactStore { +public class PostgresArtifactStore extends ArtifactStore implements IMutableArtifactStore { private static final Logger LOGGER = LoggerFactory.getLogger(PostgresArtifactStore.class); private IDownloadConfig downloadConfig; private IDirectory tempDirFactory; private ITempNaming executableNaming; - private IDownloader downloader; PostgresArtifactStore(IDownloadConfig downloadConfig, IDirectory tempDirFactory, ITempNaming executableNaming, IDownloader downloader) { + super(downloadConfig, tempDirFactory, executableNaming, downloader); this.downloadConfig = downloadConfig; this.tempDirFactory = tempDirFactory; this.executableNaming = executableNaming; - this.downloader = downloader; } public IDirectory getTempDir() { @@ -60,14 +62,6 @@ public void removeFileSet(Distribution distribution, IExtractedFileSet all) { } } - @Override - public boolean checkDistribution(Distribution distribution) throws IOException { - if (!LocalArtifactStore.checkArtifact(downloadConfig, distribution)) { - return LocalArtifactStore.store(downloadConfig, distribution, downloader.download(downloadConfig, distribution)); - } - return true; - } - public IDownloadConfig getDownloadConfig() { return downloadConfig; } diff --git a/src/main/java/de/flapdoodle/embed/process/store/PostgresArtifactStoreBuilder.java b/src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresArtifactStoreBuilder.java similarity index 85% rename from src/main/java/de/flapdoodle/embed/process/store/PostgresArtifactStoreBuilder.java rename to src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresArtifactStoreBuilder.java index 2af2d53..f1f609b 100644 --- a/src/main/java/de/flapdoodle/embed/process/store/PostgresArtifactStoreBuilder.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresArtifactStoreBuilder.java @@ -1,6 +1,8 @@ -package de.flapdoodle.embed.process.store; +package ru.yandex.qatools.embed.postgresql.store; import de.flapdoodle.embed.process.extract.UUIDTempNaming; +import de.flapdoodle.embed.process.store.Downloader; +import de.flapdoodle.embed.process.store.IArtifactStore; import ru.yandex.qatools.embed.postgresql.Command; import ru.yandex.qatools.embed.postgresql.config.PostgresDownloadConfigBuilder; import ru.yandex.qatools.embed.postgresql.ext.SubdirTempDir; diff --git a/src/main/java/de/flapdoodle/embed/process/store/PostgresFilesToExtract.java b/src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresFilesToExtract.java similarity index 99% rename from src/main/java/de/flapdoodle/embed/process/store/PostgresFilesToExtract.java rename to src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresFilesToExtract.java index 1753740..c12cd19 100644 --- a/src/main/java/de/flapdoodle/embed/process/store/PostgresFilesToExtract.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/store/PostgresFilesToExtract.java @@ -1,4 +1,4 @@ -package de.flapdoodle.embed.process.store; +package ru.yandex.qatools.embed.postgresql.store; import de.flapdoodle.embed.process.config.store.FileSet; import de.flapdoodle.embed.process.config.store.FileType; diff --git a/src/test/java/ru/yandex/qatools/embed/postgresql/PostgresqlService.java b/src/test/java/ru/yandex/qatools/embed/postgresql/PostgresqlService.java index 8c70214..fedbb04 100644 --- a/src/test/java/ru/yandex/qatools/embed/postgresql/PostgresqlService.java +++ b/src/test/java/ru/yandex/qatools/embed/postgresql/PostgresqlService.java @@ -1,7 +1,7 @@ package ru.yandex.qatools.embed.postgresql; import de.flapdoodle.embed.process.config.IRuntimeConfig; -import de.flapdoodle.embed.process.store.PostgresArtifactStoreBuilder; +import ru.yandex.qatools.embed.postgresql.store.PostgresArtifactStoreBuilder; import ru.yandex.qatools.embed.postgresql.config.AbstractPostgresConfig; import ru.yandex.qatools.embed.postgresql.config.PostgresConfig; import ru.yandex.qatools.embed.postgresql.config.PostgresDownloadConfigBuilder; diff --git a/src/test/java/ru/yandex/qatools/embed/postgresql/TestDownloads.java b/src/test/java/ru/yandex/qatools/embed/postgresql/TestDownloads.java index a93f36e..e58a75e 100644 --- a/src/test/java/ru/yandex/qatools/embed/postgresql/TestDownloads.java +++ b/src/test/java/ru/yandex/qatools/embed/postgresql/TestDownloads.java @@ -5,7 +5,7 @@ import de.flapdoodle.embed.process.distribution.IVersion; import de.flapdoodle.embed.process.distribution.Platform; import de.flapdoodle.embed.process.store.IArtifactStore; -import de.flapdoodle.embed.process.store.PostgresArtifactStoreBuilder; +import ru.yandex.qatools.embed.postgresql.store.PostgresArtifactStoreBuilder; import org.junit.Test; import ru.yandex.qatools.embed.postgresql.distribution.Version; diff --git a/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresCachedDirStarter.java b/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresCachedDirStarter.java index 6192bc6..182a4bc 100644 --- a/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresCachedDirStarter.java +++ b/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresCachedDirStarter.java @@ -2,7 +2,7 @@ import de.flapdoodle.embed.process.config.IRuntimeConfig; import de.flapdoodle.embed.process.io.directories.FixedPath; -import de.flapdoodle.embed.process.store.PostgresArtifactStoreBuilder; +import ru.yandex.qatools.embed.postgresql.store.PostgresArtifactStoreBuilder; import ru.yandex.qatools.embed.postgresql.config.PostgresDownloadConfigBuilder; import ru.yandex.qatools.embed.postgresql.config.RuntimeConfigBuilder; diff --git a/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresStarter.java b/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresStarter.java index e72a1ed..b8d211b 100644 --- a/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresStarter.java +++ b/src/test/java/ru/yandex/qatools/embed/postgresql/TestPostgresStarter.java @@ -2,7 +2,7 @@ import de.flapdoodle.embed.process.config.IRuntimeConfig; import de.flapdoodle.embed.process.io.progress.LoggingProgressListener; -import de.flapdoodle.embed.process.store.NonCachedPostgresArtifactStoreBuilder; +import ru.yandex.qatools.embed.postgresql.store.NonCachedPostgresArtifactStoreBuilder; import org.junit.After; import org.junit.Before; import org.junit.Test;