Search in sources :

Example 6 with RsStatus

use of com.artipie.http.rs.RsStatus in project artipie by artipie.

the class ResponseMetricsSliceTest method shouldForwardResponseUnmodified.

@Test
void shouldForwardResponseUnmodified() {
    final Header rsheader = new Header("header2", "value2");
    final byte[] body = "piece of code".getBytes();
    final RsStatus rsstatus = RsStatus.CREATED;
    final Response response = new ResponseMetricsSlice((rsline, rsheaders, rsbody) -> new RsFull(rsstatus, new Headers.From(rsheader), Flowable.just(ByteBuffer.wrap(body))), this.metrics).response(new RequestLine(RqMethod.PUT, "/").toString(), Headers.EMPTY, Flowable.empty());
    MatcherAssert.assertThat(response, new ResponseMatcher(rsstatus, body, rsheader));
}
Also used : Response(com.artipie.http.Response) RqMethod(com.artipie.http.rq.RqMethod) BeforeEach(org.junit.jupiter.api.BeforeEach) RsWithStatus(com.artipie.http.rs.RsWithStatus) Headers(com.artipie.http.Headers) Header(com.artipie.http.headers.Header) InMemoryMetrics(com.artipie.metrics.memory.InMemoryMetrics) ResponseMatcher(com.artipie.http.hm.ResponseMatcher) Response(com.artipie.http.Response) RsStatus(com.artipie.http.rs.RsStatus) CompletableFuture(java.util.concurrent.CompletableFuture) ByteBuffer(java.nio.ByteBuffer) RsFull(com.artipie.http.rs.RsFull) Test(org.junit.jupiter.api.Test) Authorization(com.artipie.http.headers.Authorization) RequestLine(com.artipie.http.rq.RequestLine) MatcherAssert(org.hamcrest.MatcherAssert) Flowable(io.reactivex.Flowable) IsEqual(org.hamcrest.core.IsEqual) RequestLine(com.artipie.http.rq.RequestLine) ResponseMatcher(com.artipie.http.hm.ResponseMatcher) RsFull(com.artipie.http.rs.RsFull) Header(com.artipie.http.headers.Header) Headers(com.artipie.http.Headers) RsStatus(com.artipie.http.rs.RsStatus) Test(org.junit.jupiter.api.Test)

Example 7 with RsStatus

use of com.artipie.http.rs.RsStatus 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, "/")));
}
Also used : RequestLine(com.artipie.http.rq.RequestLine) SliceHasResponse(com.artipie.http.hm.SliceHasResponse) RsWithStatus(com.artipie.http.rs.RsWithStatus) RsHasStatus(com.artipie.http.hm.RsHasStatus) RsWithHeaders(com.artipie.http.rs.RsWithHeaders) RsHasHeaders(com.artipie.http.hm.RsHasHeaders) Headers(com.artipie.http.Headers) RsWithHeaders(com.artipie.http.rs.RsWithHeaders) RsStatus(com.artipie.http.rs.RsStatus) RsHasHeaders(com.artipie.http.hm.RsHasHeaders) SliceSimple(com.artipie.http.slice.SliceSimple) Test(org.junit.jupiter.api.Test)

Aggregations

RequestLine (com.artipie.http.rq.RequestLine)7 RsStatus (com.artipie.http.rs.RsStatus)7 Test (org.junit.jupiter.api.Test)7 RsWithStatus (com.artipie.http.rs.RsWithStatus)6 RsHasStatus (com.artipie.http.hm.RsHasStatus)5 SliceSimple (com.artipie.http.slice.SliceSimple)5 BasicAuthSlice (com.artipie.http.auth.BasicAuthSlice)4 Permission (com.artipie.http.auth.Permission)4 Authorization (com.artipie.http.headers.Authorization)4 Map (java.util.Map)3 ListOf (org.cactoos.list.ListOf)3 Base64Encoded (org.cactoos.text.Base64Encoded)3 Headers (com.artipie.http.Headers)2 Header (com.artipie.http.headers.Header)2 ResponseMatcher (com.artipie.http.hm.ResponseMatcher)2 RsFull (com.artipie.http.rs.RsFull)2 Response (com.artipie.http.Response)1 RsHasHeaders (com.artipie.http.hm.RsHasHeaders)1 SliceHasResponse (com.artipie.http.hm.SliceHasResponse)1 RqMethod (com.artipie.http.rq.RqMethod)1