use of com.artipie.asto.memory.InMemoryStorage 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.memory.InMemoryStorage 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.memory.InMemoryStorage 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.memory.InMemoryStorage in project artipie by artipie.
the class ConfigFileTest method valueFromStorageReturnsYamlWhenBothExist.
@Test
void valueFromStorageReturnsYamlWhenBothExist() {
final Storage storage = new InMemoryStorage();
final String yaml = String.join("", Arrays.toString(ConfigFileTest.CONTENT), "some");
this.saveByKey(storage, ".yml");
this.saveByKey(storage, ".yaml", yaml.getBytes());
MatcherAssert.assertThat(new PublisherAs(new ConfigFile(new Key.From(ConfigFileTest.NAME)).valueFrom(storage).toCompletableFuture().join()).asciiString().toCompletableFuture().join(), new IsEqual<>(yaml));
}
use of com.artipie.asto.memory.InMemoryStorage 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));
}
Aggregations