use of com.artipie.asto.blocking.BlockingStorage in project front by artipie.
the class DeleteUserTest method init.
@BeforeEach
void init() {
this.blsto = new BlockingStorage(new InMemoryStorage());
this.users = new YamlUsers(DeleteUserTest.KEY, this.blsto);
}
use of com.artipie.asto.blocking.BlockingStorage in project front by artipie.
the class RepositoriesTest method listsRepositories.
@Test
void listsRepositories() throws JSONException {
final BlockingStorage blsto = new BlockingStorage(new InMemoryStorage());
blsto.save(new Key.From("Jane", "maven.yaml"), new byte[] {});
blsto.save(new Key.From("Jane", "python.yaml"), new byte[] {});
blsto.save(new Key.From("Jane", "binary.yaml"), new byte[] {});
blsto.save(new Key.From("John", "anaconda.yml"), new byte[] {});
blsto.save(new Key.From("John", "maven.yml"), new byte[] {});
blsto.save(new Key.From("rpm.yml"), new byte[] {});
final var resp = Mockito.mock(Response.class);
JSONAssert.assertEquals(new Repositories(new RepoSettings("org", blsto)).handle(Mockito.mock(Request.class), resp), String.join("\n", "[", "{\"fullName\":\"Jane/binary\"},", "{\"fullName\":\"Jane/maven\"},", "{\"fullName\":\"Jane/python\"},", "{\"fullName\":\"John/anaconda\"},", "{\"fullName\":\"John/maven\"},", "{\"fullName\":\"rpm\"}", "]"), true);
Mockito.verify(resp).type("application/json");
}
use of com.artipie.asto.blocking.BlockingStorage in project front by artipie.
the class UsersTest method init.
@BeforeEach
void init() {
this.blsto = new BlockingStorage(new InMemoryStorage());
this.users = new YamlUsers(UsersTest.CREDS, this.blsto);
}
use of com.artipie.asto.blocking.BlockingStorage in project artipie by artipie.
the class CachedCredsTest method getsOriginForSameConfigurationButDifferentStorages.
@Test
void getsOriginForSameConfigurationButDifferentStorages() {
final String path = "_credentials.yaml";
final Key key = new Key.From(path);
final CredsConfigCache configs = new CachedCreds(this.cache);
final Storage another = new InMemoryStorage();
new TestResource(path).saveTo(this.storage);
new BlockingStorage(another).save(key, "credentials: another val".getBytes(StandardCharsets.UTF_8));
final YamlMapping frst = configs.credentials(this.storage, key).toCompletableFuture().join();
final YamlMapping scnd = configs.credentials(another, key).toCompletableFuture().join();
MatcherAssert.assertThat("Obtained configurations were the same", frst.equals(scnd), new IsEqual<>(false));
MatcherAssert.assertThat("Credentials configuration was not cached", this.cache.size(), new IsEqual<>(2L));
}
use of com.artipie.asto.blocking.BlockingStorage in project artipie by artipie.
the class CachedCredsTest method getsOriginForDifferentConfigurations.
@Test
void getsOriginForDifferentConfigurations() {
final CredsConfigCache configs = new CachedCreds(this.cache);
final Key onekey = new Key.From("first.yml");
final Key twokey = new Key.From("credentials.yml");
final BlockingStorage blck = new BlockingStorage(this.storage);
blck.save(onekey, "credentials: val".getBytes(StandardCharsets.UTF_8));
blck.save(twokey, "credentials: another val".getBytes(StandardCharsets.UTF_8));
final YamlMapping frst = configs.credentials(this.storage, onekey).toCompletableFuture().join();
final YamlMapping scnd = configs.credentials(this.storage, twokey).toCompletableFuture().join();
MatcherAssert.assertThat("Obtained configurations were the same", frst.equals(scnd), new IsEqual<>(false));
MatcherAssert.assertThat("Credentials configuration was not cached", this.cache.size(), new IsEqual<>(2L));
}
Aggregations