use of com.artipie.http.hm.RsHasStatus in project artipie by artipie.
the class ContentLengthRestrictionTest method shouldNotPassRequestsAboveLimit.
@Test
public void shouldNotPassRequestsAboveLimit() {
final int limit = 10;
final Slice slice = new ContentLengthRestriction((line, headers, body) -> new RsWithStatus(RsStatus.OK), limit);
final Response response = slice.response("", this.headers("11"), Flowable.empty());
MatcherAssert.assertThat(response, new RsHasStatus(RsStatus.PAYLOAD_TOO_LARGE));
}
use of com.artipie.http.hm.RsHasStatus 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.http.hm.RsHasStatus 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.http.hm.RsHasStatus in project maven-adapter by artipie.
the class CachedProxySliceTest method loadsOriginIfCacheNotFound.
@Test
void loadsOriginIfCacheNotFound() {
final byte[] data = "remote".getBytes();
MatcherAssert.assertThat(new CachedProxySlice((line, headers, body) -> new RsWithBody(ByteBuffer.wrap(data)), (key, supplier, control) -> supplier.get()), new SliceHasResponse(Matchers.allOf(new RsHasStatus(RsStatus.OK), new RsHasBody(data)), new RequestLine(RqMethod.GET, "/bar")));
}
use of com.artipie.http.hm.RsHasStatus in project maven-adapter by artipie.
the class HeadProxySliceTest method passesStatusAndHeadersFromResponse.
@Test
void passesStatusAndHeadersFromResponse() {
final RsStatus status = RsStatus.CREATED;
final Headers.From headers = new Headers.From("abc", "123");
MatcherAssert.assertThat(new HeadProxySlice(new SliceSimple(new RsWithHeaders(new RsWithStatus(status), headers))), new SliceHasResponse(Matchers.allOf(new RsHasStatus(status), new RsHasHeaders(headers)), new RequestLine(RqMethod.HEAD, "/")));
}
Aggregations