use of com.artipie.asto.blocking.BlockingStorage in project maven-adapter by artipie.
the class ArtifactGetResponseTest method okIfArtifactExists.
@Test
void okIfArtifactExists() throws Exception {
final Storage storage = new InMemoryStorage();
final Key key = new Key.From("repo/artifact.jar");
new BlockingStorage(storage).save(key, "something".getBytes());
MatcherAssert.assertThat(new ArtifactGetResponse(storage, key), new RsHasStatus(RsStatus.OK));
}
use of com.artipie.asto.blocking.BlockingStorage in project maven-adapter by artipie.
the class ArtifactGetResponseTest method hasBodyIfExists.
@Test
void hasBodyIfExists() throws Exception {
final Storage storage = new InMemoryStorage();
final Key key = new Key.From("repo/artifact2.jar");
final byte[] data = "data".getBytes(StandardCharsets.UTF_8);
new BlockingStorage(storage).save(key, data);
MatcherAssert.assertThat(new ArtifactGetResponse(storage, key), new RsHasBody(data));
}
use of com.artipie.asto.blocking.BlockingStorage in project maven-adapter by artipie.
the class ArtifactHeadResponseTest method okIfArtifactExists.
@Test
void okIfArtifactExists() throws Exception {
final Storage storage = new InMemoryStorage();
final Key key = new Key.From("repo/artifact.jar");
new BlockingStorage(storage).save(key, "something".getBytes());
MatcherAssert.assertThat(new ArtifactHeadResponse(storage, key), new RsHasStatus(RsStatus.OK));
}
use of com.artipie.asto.blocking.BlockingStorage in project front by artipie.
the class GetRepositoryPermissionsTest method init.
@BeforeEach
void init() {
this.blsto = new BlockingStorage(new InMemoryStorage());
this.snt = new RepoSettings("flat", this.blsto);
}
use of com.artipie.asto.blocking.BlockingStorage in project front by artipie.
the class GetRepositoryTest method returnsRepositorySettings.
@ParameterizedTest
@CsvSource({ "yaml,my-maven", "yml,my-npm-proxy" })
void returnsRepositorySettings(final String ext, final String name) throws Exception {
final BlockingStorage blsto = new BlockingStorage(new InMemoryStorage());
final String file = String.format("%s.%s", name, ext);
blsto.save(new Key.From(file), new TestResource(String.format("GetRepositoryTest/%s", file)).asBytes());
final var resp = Mockito.mock(Response.class);
final var rqs = Mockito.mock(Request.class);
Mockito.when(rqs.params(GetRepository.NAME_PARAM.toString())).thenReturn(name);
Mockito.when(rqs.attribute(RequestAttr.Standard.USER_ID.attrName())).thenReturn("any");
JSONAssert.assertEquals(new GetRepository(new RepoSettings("flat", blsto)).handle(rqs, resp), new String(new TestResource(String.format("GetRepositoryTest/%s.json", name)).asBytes(), StandardCharsets.UTF_8), true);
Mockito.verify(resp).type("application/json");
}
Aggregations