Search in sources :

Example 16 with BlockingStorage

use of com.artipie.asto.blocking.BlockingStorage in project front by artipie.

the class PutUserTest method init.

@BeforeEach
void init() {
    this.asto = new BlockingStorage(new InMemoryStorage());
    this.users = new YamlUsers(PutUserTest.CREDS_YAML, this.asto);
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) YamlUsers(com.artipie.front.auth.YamlUsers) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 17 with BlockingStorage

use of com.artipie.asto.blocking.BlockingStorage in project front by artipie.

the class YamlUsersTest method init.

@BeforeEach
void init() {
    this.blsto = new BlockingStorage(new InMemoryStorage());
    this.users = new YamlUsers(YamlUsersTest.KEY, this.blsto);
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 18 with BlockingStorage

use of com.artipie.asto.blocking.BlockingStorage in project maven-adapter by artipie.

the class ArtifactHeadResponseTest method noBodyIfExists.

@Test
void noBodyIfExists() throws Exception {
    final Storage storage = new InMemoryStorage();
    final Key key = new Key.From("repo/artifact2.jar");
    new BlockingStorage(storage).save(key, "data".getBytes(StandardCharsets.UTF_8));
    MatcherAssert.assertThat(new ArtifactHeadResponse(storage, key), new RsHasBody(new byte[0]));
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) Storage(com.artipie.asto.Storage) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) RsHasBody(com.artipie.http.hm.RsHasBody) Key(com.artipie.asto.Key) Test(org.junit.jupiter.api.Test)

Example 19 with BlockingStorage

use of com.artipie.asto.blocking.BlockingStorage in project artipie by artipie.

the class RepositoriesFromStorageCacheTest method readConfigFromCacheAfterSavingNewValueInStorage.

@Test
void readConfigFromCacheAfterSavingNewValueInStorage() {
    final Key key = new Key.From("some-repo.yaml");
    final byte[] old = "some: data".getBytes();
    final byte[] upd = "some: new data".getBytes();
    new BlockingStorage(this.storage).save(key, old);
    final ClientSlices http = new JettyClientSlices();
    new RepositoriesFromStorage(http, this.storage).config(key.string()).toCompletableFuture().join();
    new BlockingStorage(this.storage).save(key, upd);
    MatcherAssert.assertThat(new RepositoriesFromStorage(http, this.storage).config(key.string()).toCompletableFuture().join().toString(), new IsEqual<>(new String(old)));
}
Also used : BlockingStorage(com.artipie.asto.blocking.BlockingStorage) JettyClientSlices(com.artipie.http.client.jetty.JettyClientSlices) Key(com.artipie.asto.Key) ClientSlices(com.artipie.http.client.ClientSlices) JettyClientSlices(com.artipie.http.client.jetty.JettyClientSlices) Test(org.junit.jupiter.api.Test)

Aggregations

BlockingStorage (com.artipie.asto.blocking.BlockingStorage)19 InMemoryStorage (com.artipie.asto.memory.InMemoryStorage)15 Key (com.artipie.asto.Key)13 Test (org.junit.jupiter.api.Test)10 Storage (com.artipie.asto.Storage)7 BeforeEach (org.junit.jupiter.api.BeforeEach)6 TestResource (com.artipie.asto.test.TestResource)4 YamlUsers (com.artipie.front.auth.YamlUsers)3 RepoSettings (com.artipie.front.settings.RepoSettings)3 YamlMapping (com.amihaiemil.eoyaml.YamlMapping)2 ClientSlices (com.artipie.http.client.ClientSlices)2 JettyClientSlices (com.artipie.http.client.jetty.JettyClientSlices)2 RsHasBody (com.artipie.http.hm.RsHasBody)2 RsHasStatus (com.artipie.http.hm.RsHasStatus)2 FileStorage (com.artipie.asto.fs.FileStorage)1 SettingsCaches (com.artipie.cache.SettingsCaches)1 Path (java.nio.file.Path)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 CsvSource (org.junit.jupiter.params.provider.CsvSource)1