use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test330SearchForPosixAccount.
/**
* Search for account created directly on resource (no shadow in repo). The account has
* posixAccount auxiliary object class. Provisioning should figure that out.
*/
@Test
public void test330SearchForPosixAccount() throws Exception {
final String TEST_NAME = "test330SearchForPosixAccount";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_VANHELGEN_FILE, QueryType.COMPLEX_TYPE);
ObjectQuery query = QueryJaxbConvertor.createObjectQuery(ShadowType.class, queryType, prismContext);
provisioningService.applyDefinition(ShadowType.class, query, task, result);
Entry entry = openDJController.addEntryFromLdifFile(ACCOUNT_POSIX_VANHELGEN_LDIF_FILE);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
List<PrismObject<ShadowType>> objListType = provisioningService.searchObjects(ShadowType.class, query, null, null, result);
// THEN
for (PrismObject<ShadowType> objType : objListType) {
assertNotNull("Null search result", objType);
display("found object", objType);
}
assertEquals("Unexpected number of objects found", 1, objListType.size());
PrismObject<ShadowType> provisioningShadow = objListType.get(0);
assertAttribute(provisioningShadow, "cn", "Edward Van Helgen");
assertAttribute(provisioningShadow, "homeDirectory", "/home/vanhelgen");
assertAttribute(provisioningShadow, "uidNumber", 1002);
assertConnectorOperationIncrement(1, 3);
assertConnectorSimulatedPagingSearchIncrement(0);
assertShadows(17);
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test200SearchObjectsIterative.
@Test
public void test200SearchObjectsIterative() throws Exception {
final String TEST_NAME = "test200SearchObjectsIterative";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
ShadowType object = parseObjectType(ACCOUNT_SEARCH_ITERATIVE_FILE, ShadowType.class);
System.out.println(SchemaDebugUtil.prettyPrint(object));
System.out.println(object.asPrismObject().debugDump());
String addedObjectOid = provisioningService.addObject(object.asPrismObject(), null, null, taskManager.createTaskInstance(), result);
assertEquals(ACCOUNT_SEARCH_ITERATIVE_OID, addedObjectOid);
final List<ShadowType> objectTypeList = new ArrayList<ShadowType>();
QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_ACCOUNTS_FILE, QueryType.COMPLEX_TYPE);
ObjectQuery query = QueryJaxbConvertor.createObjectQuery(ShadowType.class, queryType, prismContext);
provisioningService.searchObjectsIterative(ShadowType.class, query, null, new ResultHandler<ShadowType>() {
@Override
public boolean handle(PrismObject<ShadowType> object, OperationResult parentResult) {
return objectTypeList.add(object.asObjectable());
}
}, task, result);
// TODO: check result
System.out.println("ObjectType list size: " + objectTypeList.size());
for (ObjectType objType : objectTypeList) {
if (objType == null) {
System.out.println("Object not found in repo");
} else {
//System.out.println("obj name: " + objType.getName());
System.out.println(object.asPrismObject().debugDump());
}
}
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestWSSanity method test015SearchLdapConnector.
// TODO: fetch&parse schema http://..?WSDL
@Test
public void test015SearchLdapConnector() throws Exception {
final String TEST_NAME = "test015SearchLdapConnector";
displayTestTitle(TEST_NAME);
QueryType query = new QueryType();
query.setFilter(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:connectorType</path>" + "<value>" + CONNECTOR_LDAP_TYPE + "</value>" + "</equal>"));
Holder<ObjectListType> objectListHolder = new Holder<>();
Holder<OperationResultType> resultHolder = new Holder<>();
// WHEN
modelPort.searchObjects(ModelClientUtil.getTypeQName(ConnectorType.class), query, null, objectListHolder, resultHolder);
// THEN
assertSuccess(resultHolder);
ObjectListType objectList = objectListHolder.value;
assertEquals("Unexpected number of LDAP connectors", 1, objectList.getObject().size());
ConnectorType ldapConnector = (ConnectorType) objectList.getObject().get(0);
assertNotNull("Null LDAP connector", ldapConnector);
connectorLdapOid = ldapConnector.getOid();
assertNotNull("Null LDAP connector OID", connectorLdapOid);
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test234SearchObjectsPagedOffsetSortSn.
@Test
public void test234SearchObjectsPagedOffsetSortSn() throws Exception {
final String TEST_NAME = "test234SearchObjectsPagedOffsetSortSn";
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(2, 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, "jbeckett", "jbond", "cook", "drake");
assertConnectorOperationIncrement(1, 9);
assertConnectorSimulatedPagingSearchIncrement(0);
}
use of com.evolveum.prism.xml.ns._public.query_3.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test231SearchObjectsPagedOffsetZero.
@Test
public void test231SearchObjectsPagedOffsetZero() throws Exception {
final String TEST_NAME = "test231SearchObjectsPagedOffsetZero";
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(0, 4);
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, "cook", "drake", "hbarbossa", "idm");
assertConnectorOperationIncrement(1, 9);
assertConnectorSimulatedPagingSearchIncrement(0);
}
Aggregations