Search in sources :

Example 1 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project policies-ui-backend by RedHatInsights.

the class TagsFilterTest method filter3.

@Test
void filter3() throws URISyntaxException {
    UriInfo info = new ResteasyUriInfo(new URI("https://foo?filter[name]=VM&filter:op[name]=like"));
    Pager pager = PagingUtils.extractPager(info);
    String query = PolicyHistoryTagFilterHelper.getTagsFilterFromPager(pager);
    assertEquals("tags.display_name MATCHES '*vm*'", query);
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) Pager(com.redhat.cloud.policies.app.model.pager.Pager) URI(java.net.URI) ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.jupiter.api.Test)

Example 2 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project policies-ui-backend by RedHatInsights.

the class TagsFilterTest method filter1.

@Test
void filter1() throws URISyntaxException {
    UriInfo info = new ResteasyUriInfo(new URI("https://foo?filter[name]=VM"));
    Pager pager = PagingUtils.extractPager(info);
    String query = PolicyHistoryTagFilterHelper.getTagsFilterFromPager(pager);
    assertEquals("tags.display_name = 'vm'", query);
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) Pager(com.redhat.cloud.policies.app.model.pager.Pager) URI(java.net.URI) ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.jupiter.api.Test)

Example 3 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project policies-ui-backend by RedHatInsights.

the class TagsFilterTest method filter6.

@Test
void filter6() throws URISyntaxException {
    UriInfo info = new ResteasyUriInfo(new URI("https://foo?filter[name]=VM&filter:op[id]=not_equal"));
    Pager pager = PagingUtils.extractPager(info);
    String query = PolicyHistoryTagFilterHelper.getTagsFilterFromPager(pager);
    assertEquals("tags.display_name = 'vm'", query);
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) Pager(com.redhat.cloud.policies.app.model.pager.Pager) URI(java.net.URI) ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.jupiter.api.Test)

Example 4 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project policies-ui-backend by RedHatInsights.

the class PagingUtilsTest method testExtractPagerSortWrongDirection.

@Test
public void testExtractPagerSortWrongDirection() throws URISyntaxException {
    UriInfo info = new ResteasyUriInfo(new URI("https://foo?sortColumn=foo&sortDirection=bar"));
    assertThrows(IllegalArgumentException.class, () -> {
        PagingUtils.extractPager(info);
    });
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) URI(java.net.URI) ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.jupiter.api.Test)

Example 5 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project policies-ui-backend by RedHatInsights.

the class PagingUtilsTest method extractBadFilterBooleanOperator.

@Test
public void extractBadFilterBooleanOperator() throws URISyntaxException {
    UriInfo info = new ResteasyUriInfo(new URI("https://foo?filter[bar]=true&filter:op[bar]=boolean_is"));
    try {
        PagingUtils.extractPager(info);
    } catch (IllegalArgumentException e) {
        return;
    }
    fail("Should not reach this");
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) URI(java.net.URI) ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.jupiter.api.Test)

Aggregations

ResteasyUriInfo (org.jboss.resteasy.specimpl.ResteasyUriInfo)42 URI (java.net.URI)19 UriInfo (javax.ws.rs.core.UriInfo)14 Test (org.junit.jupiter.api.Test)14 Pager (com.redhat.cloud.policies.app.model.pager.Pager)8 Test (org.junit.Test)6 ResteasyHttpHeaders (org.jboss.resteasy.specimpl.ResteasyHttpHeaders)5 HttpServletRequest (jakarta.servlet.http.HttpServletRequest)4 NotFoundException (jakarta.ws.rs.NotFoundException)4 IOException (java.io.IOException)3 WebQuery (com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery)2 Context (io.vertx.core.Context)2 HttpServerResponse (io.vertx.core.http.HttpServerResponse)2 PathSegment (jakarta.ws.rs.core.PathSegment)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 SecurityContext (javax.ws.rs.core.SecurityContext)2 HttpRequest (org.jboss.resteasy.spi.HttpRequest)2 HttpResponse (org.jboss.resteasy.spi.HttpResponse)2