use of com.artipie.asto.memory.InMemoryStorage 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]));
}
use of com.artipie.asto.memory.InMemoryStorage in project artipie by artipie.
the class UsersFromStorageYamlTest method init.
@BeforeEach
void init() {
this.storage = new InMemoryStorage();
this.key = new Key.From("_cred.yaml");
}
use of com.artipie.asto.memory.InMemoryStorage in project artipie by artipie.
the class MetricSliceTest method shouldReturnMetricsInJsonArray.
@Test
void shouldReturnMetricsInJsonArray() {
final String keyone = "one";
final String keytwo = "two";
final String json = "[{\"key\":\"%s\",\"value\":%s},{\"key\":\"%s\",\"value\":%s}]";
final long valone = 1;
final long valtwo = 2;
final String dirorder = String.format(json, keyone, valone, keytwo, valtwo);
final String revorder = String.format(json, keytwo, valtwo, keyone, valone);
final Storage storage = new InMemoryStorage();
storage.save(new Key.From(keyone), this.getContent(valone));
storage.save(new Key.From(keytwo), this.getContent(valtwo));
MatcherAssert.assertThat(new MetricSlice(storage), new SliceHasResponse(new AllOf<>(Arrays.asList(new RsHasStatus(RsStatus.OK), new AnyOf<>(Arrays.asList(new RsHasBody(dirorder, StandardCharsets.UTF_8), new RsHasBody(revorder, StandardCharsets.UTF_8))))), new RequestLine(RqMethod.GET, "/api/repositories/")));
}
use of com.artipie.asto.memory.InMemoryStorage in project artipie by artipie.
the class ConfigFileTest method existInStorageReturnsTrueWhenYamlExist.
@ParameterizedTest
@ValueSource(strings = { ".yaml", ".yml", "" })
void existInStorageReturnsTrueWhenYamlExist(final String extension) {
final Storage storage = new InMemoryStorage();
this.saveByKey(storage, ".yaml");
MatcherAssert.assertThat(new ConfigFile(new Key.From(ConfigFileTest.NAME + extension)).existsIn(storage).toCompletableFuture().join(), new IsEqual<>(true));
}
use of com.artipie.asto.memory.InMemoryStorage in project artipie by artipie.
the class ConfigFileTest method valueFromStorageReturnsContentWhenYamlExist.
@ParameterizedTest
@ValueSource(strings = { ".yaml", ".yml", "" })
void valueFromStorageReturnsContentWhenYamlExist(final String extension) {
final Storage storage = new InMemoryStorage();
this.saveByKey(storage, ".yml");
MatcherAssert.assertThat(new PublisherAs(new ConfigFile(new Key.From(ConfigFileTest.NAME + extension)).valueFrom(storage).toCompletableFuture().join()).bytes().toCompletableFuture().join(), new IsEqual<>(ConfigFileTest.CONTENT));
}
Aggregations