use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test233SearchObjectsPagedNoOffsetSortSn.
@Test
public void test233SearchObjectsPagedNoOffsetSortSn() throws Exception {
final String TEST_NAME = "test233SearchObjectsPagedNoOffsetSortSn";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_ACCOUNTS_FILE, QueryType.COMPLEX_TYPE);
ObjectQuery query = QueryJaxbConvertor.createObjectQuery(ShadowType.class, queryType, prismContext);
ObjectPaging paging = ObjectPaging.createPaging(null, 4);
paging.setOrdering(ObjectOrdering.createOrdering(new ItemPath(ShadowType.F_ATTRIBUTES, new QName(RESOURCE_NS, "sn")), OrderDirection.ASCENDING));
query.setPaging(paging);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
List<PrismObject<ShadowType>> searchResults = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
assertSuccess(result);
display("Search resutls", searchResults);
assertSearchResults(searchResults, "monk", "hbarbossa", "jbeckett", "jbond");
assertConnectorOperationIncrement(1, 9);
assertConnectorSimulatedPagingSearchIncrement(0);
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestSanity method searchUserByName.
private UserType searchUserByName(String name) throws Exception {
// Document doc = DOMUtil.getDocument();
// Element nameElement = doc.createElementNS(SchemaConstants.C_NAME.getNamespaceURI(),
// SchemaConstants.C_NAME.getLocalPart());
// nameElement.setTextContent(name);
// Element filter = QueryUtil.createEqualFilter(doc, null, nameElement);
//
// QueryType query = new QueryType();
// query.setFilter(filter);
ObjectQuery q = ObjectQueryUtil.createNameQuery(UserType.class, prismContext, name);
QueryType query = QueryJaxbConvertor.createQueryType(q, prismContext);
OperationResultType resultType = new OperationResultType();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>(resultType);
Holder<ObjectListType> listHolder = new Holder<ObjectListType>();
assertNoRepoCache();
modelWeb.searchObjects(ObjectTypes.USER.getTypeQName(), query, null, listHolder, resultHolder);
assertNoRepoCache();
ObjectListType objects = listHolder.value;
TestUtil.assertSuccess("searchObjects has failed", resultHolder.value);
AssertJUnit.assertEquals("User not found (or found too many)", 1, objects.getObject().size());
UserType user = (UserType) objects.getObject().get(0);
AssertJUnit.assertEquals(user.getName(), PrismTestUtil.createPolyStringType(name));
return user;
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestAbstractRestService method test200searchAllUsers.
@Test
public void test200searchAllUsers() {
final String TEST_NAME = "test200searchAllUsers";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/users/search");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(new QueryType());
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertStatus(response, 200);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method listRequestableRoles.
protected Collection<RoleType> listRequestableRoles() throws SAXException, IOException, FaultMessage, JAXBException {
SearchFilterType filter = ModelClientUtil.parseSearchFilterType("<equal xmlns='http://prism.evolveum.com/xml/ns/public/query-3' xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3' >" + "<path>c:requestable</path>" + "<value>true</value>" + "</equal>");
QueryType query = new QueryType();
query.setFilter(filter);
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
modelPort.searchObjects(ModelClientUtil.getTypeQName(RoleType.class), query, options, objectListHolder, resultHolder);
ObjectListType objectList = objectListHolder.value;
return (Collection) objectList.getObject();
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestSanityLegacy method searchUserByName.
private UserType searchUserByName(String name) throws Exception {
// Document doc = DOMUtil.getDocument();
// Element nameElement = doc.createElementNS(SchemaConstants.C_NAME.getNamespaceURI(),
// SchemaConstants.C_NAME.getLocalPart());
// nameElement.setTextContent(name);
// Element filter = QueryUtil.createEqualFilter(doc, null, nameElement);
//
// QueryType query = new QueryType();
// query.setFilter(filter);
ObjectQuery q = ObjectQueryUtil.createNameQuery(UserType.class, prismContext, name);
QueryType query = QueryJaxbConvertor.createQueryType(q, prismContext);
OperationResultType resultType = new OperationResultType();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>(resultType);
Holder<ObjectListType> listHolder = new Holder<ObjectListType>();
assertNoRepoCache();
modelWeb.searchObjects(ObjectTypes.USER.getTypeQName(), query, null, listHolder, resultHolder);
assertNoRepoCache();
ObjectListType objects = listHolder.value;
TestUtil.assertSuccess("searchObjects has failed", resultHolder.value);
AssertJUnit.assertEquals("User not found (or found too many)", 1, objects.getObject().size());
UserType user = (UserType) objects.getObject().get(0);
AssertJUnit.assertEquals(user.getName(), PrismTestUtil.createPolyStringType(name));
return user;
}
Aggregations