use of org.apache.openejb.jee.oejb2.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 org.apache.openejb.jee.oejb2.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 org.apache.openejb.jee.oejb2.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 org.apache.openejb.jee.oejb2.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);
}
use of org.apache.openejb.jee.oejb2.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test201SearchObjects.
@Test
public void test201SearchObjects() throws Exception {
final String TEST_NAME = "test201SearchObjects";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
ShadowType object = parseObjectType(ACCOUNT_SEARCH_FILE, ShadowType.class);
display("New object", object);
String addedObjectOid = provisioningService.addObject(object.asPrismObject(), null, null, taskManager.createTaskInstance(), result);
assertEquals(ACCOUNT_SEARCH_OID, addedObjectOid);
QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_ACCOUNTS_FILE, QueryType.COMPLEX_TYPE);
ObjectQuery query = QueryJaxbConvertor.createObjectQuery(ShadowType.class, queryType, prismContext);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
SearchResultList<PrismObject<ShadowType>> searchResults = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
result.computeStatus();
assertSuccess(result);
display("Search resutls", searchResults);
assertEquals("Unexpected number of search results", 14, searchResults.size());
assertConnectorOperationIncrement(1, 29);
assertConnectorSimulatedPagingSearchIncrement(0);
}
Aggregations