use of io.jans.scim.model.scim2.ListResponse in project jans by JanssenProject.
the class MultipleResourcesSearchTest method search1.
@Test(dependsOnMethods = "searchJson")
public void search1() {
// Build up a request
sr = new SearchRequest();
// return a few attributes
sr.setAttributes("id");
sr.setStartIndex(1);
// Aimed at having both users and groups
sr.setFilter("displayName co \"1111\" or displayName co \"Group\"");
Response response = client.searchResourcesPost(sr);
assertEquals(response.getStatus(), OK.getStatusCode());
listResponse = response.readEntity(ListResponse.class);
// Verify it has results
assertTrue(listResponse.getTotalResults() > 0);
}
use of io.jans.scim.model.scim2.ListResponse in project jans by JanssenProject.
the class MultipleResourcesSearchTest method searchJson.
@Parameters({ "search_multiple_1", "search_multiple_2" })
@Test
public void searchJson(String json1, String json2) {
Response response = client.searchResourcesPost(json1);
assertEquals(response.getStatus(), OK.getStatusCode());
ListResponse anotherLR = response.readEntity(ListResponse.class);
// Verify it has results
assertTrue(anotherLR.getTotalResults() > 0);
response = client.searchResourcesPost(json2);
assertEquals(response.getStatus(), OK.getStatusCode());
ListResponse anotherLR2 = response.readEntity(ListResponse.class);
assertEquals(anotherLR.getTotalResults(), anotherLR2.getTotalResults());
assertNull(anotherLR2.getResources());
// unassigned
assertEquals(anotherLR2.getItemsPerPage(), 0);
// unassigned
assertEquals(anotherLR2.getStartIndex(), 0);
}
use of io.jans.scim.model.scim2.ListResponse in project jans by JanssenProject.
the class SimpleSearchUserTest method searchNoMatches.
@Test(dependsOnMethods = "create", groups = "search")
public void searchNoMatches() {
String nowIsoDateTimeString = Instant.ofEpochMilli(System.currentTimeMillis()).toString();
SearchRequest sr = new SearchRequest();
sr.setFilter(String.format("urn:ietf:params:scim:schemas:extension:gluu:2.0:User:scimCustomThird eq 1 and displayName eq \"%s\" " + "and addresses[postalCode ne null or type eq null] and meta.lastModified gt \"%s\"", "test", nowIsoDateTimeString));
Response response = client.searchUsersPost(sr);
assertEquals(response.getStatus(), OK.getStatusCode());
ListResponse listResponse = response.readEntity(ListResponse.class);
assertNull(listResponse.getResources());
}
use of io.jans.scim.model.scim2.ListResponse in project jans by JanssenProject.
the class SimpleSearchUserTest method searchSimpleAttrGet.
@Test(dependsOnMethods = "create", groups = "search")
public void searchSimpleAttrGet() {
String isoDateString = user.getMeta().getCreated();
String locale = user.getLocale();
logger.debug("Searching user with attribute locale = {} and created date >= {} using GET verb", locale, isoDateString);
Response response = client.searchUsers(String.format("locale eq \"%s\" and meta.created ge \"%s\"", locale, isoDateString), null, null, null, null, null, null);
assertEquals(response.getStatus(), OK.getStatusCode());
ListResponse listResponse = response.readEntity(ListResponse.class);
assertTrue(listResponse.getResources().size() > 0);
// Retrieve first user in results
UserResource same = listResponse.getResources().stream().map(usrClass::cast).findFirst().get();
assertEquals(same.getLocale(), locale);
}
use of io.jans.scim.model.scim2.ListResponse in project jans by JanssenProject.
the class SimpleSearchUserTest method searchNoResults.
@Test(dependsOnMethods = "create", groups = "search")
public void searchNoResults() {
logger.debug("Calculating the total number of users");
// Pass count=0 so no results are retrieved (only total)
Response response = client.searchUsers("userName pr", null, 0, null, null, null, null);
assertEquals(response.getStatus(), OK.getStatusCode());
ListResponse listResponse = response.readEntity(ListResponse.class);
assertNull(listResponse.getResources());
assertTrue(listResponse.getTotalResults() > 0);
logger.debug("There are {} users!", listResponse.getTotalResults());
}
Aggregations