use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project stdlib by petergeneric.
the class WebQueryTest method testParseComplexQueryStringToWebQuery.
@Test
public void testParseComplexQueryStringToWebQuery() {
WebQuery actual = new WebQuery().decode(new ResteasyUriInfo(URI.create("http://example.com/search?q=id+%3C+100+AND+id+%3E+200+AND+%28id+%3D+1+OR+id+%3D+2+OR+%28id+%3D+3+AND+id+%3D+4%29%29")));
assertEquals("id < 100\nAND id > 200\nAND (id = 1 OR id = 2 OR (id = 3 AND id = 4))", actual.constraints.toQueryFragment());
}
use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project stdlib by petergeneric.
the class WebQueryTest method testParseQueryStringToWebQuery.
@Test
public void testParseQueryStringToWebQuery() {
WebQuery expected = new WebQuery().logSQL(true).eq("id", "123").offset(0).limit(200);
WebQuery actual = new WebQuery().decode(new ResteasyUriInfo(URI.create("http://example.com?_log_sql=true&id=123")));
assertEquals(expected.encode().toString(), actual.encode().toString());
}
use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project platform by dashjoin.
the class ACLContainerRequestFilterTest method testQuery.
/**
* authenticated requests pass the filter
*/
@Test
public void testQuery() throws Exception {
ACLContainerRequestFilter f = new ACLContainerRequestFilter();
f.filter(new ResponseContainerRequestContext(null) {
@Override
public SecurityContext getSecurityContext() {
return new SecurityContext() {
@Override
public Principal getUserPrincipal() {
return new UnixPrincipal("root");
}
@Override
public boolean isUserInRole(String role) {
return true;
}
@Override
public boolean isSecure() {
return false;
}
@Override
public String getAuthenticationScheme() {
return null;
}
};
}
@Override
public UriInfo getUriInfo() {
try {
return new ResteasyUriInfo(new URI("/database/query/list"));
} catch (URISyntaxException e) {
throw new RuntimeException();
}
}
});
}
use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project policies-ui-backend by RedHatInsights.
the class TagsFilterTest method filter2.
@Test
void filter2() throws URISyntaxException {
UriInfo info = new ResteasyUriInfo(new URI("https://foo?filter[name]=VM&filter:op[name]=not_equal"));
Pager pager = PagingUtils.extractPager(info);
String query = PolicyHistoryTagFilterHelper.getTagsFilterFromPager(pager);
assertEquals("tags.display_name != 'vm'", query);
}
use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project policies-ui-backend by RedHatInsights.
the class TagsFilterTest method filter4.
@Test
void filter4() throws URISyntaxException {
UriInfo info = new ResteasyUriInfo(new URI("https://foo?filter[name]=VM&filter[id]=123"));
Pager pager = PagingUtils.extractPager(info);
String query = PolicyHistoryTagFilterHelper.getTagsFilterFromPager(pager);
assertEquals("tags.display_name = 'vm' AND tags.inventory_id = '123'", query);
}
Aggregations