use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test105SeachPiratesByCn.
@Test
public void test105SeachPiratesByCn() throws Exception {
final String TEST_NAME = "test105SeachPiratesByCn";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getGroupObjectClass(), prismContext);
ObjectQueryUtil.filterAnd(query.getFilter(), createAttributeFilter("cn", GROUP_PIRATES_NAME));
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadow = shadows.get(0);
display("Shadow", shadow);
groupPiratesOid = shadow.getOid();
// assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(1);
}
use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test150SeachAllAccounts.
/**
* No paging. It should return all accounts.
*/
@Test
public void test150SeachAllAccounts() throws Exception {
final String TEST_NAME = "test150SeachAllAccounts";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, NUMBER_OF_ACCOUNTS, task, result);
// TODO: why 11? should be 1
// assertConnectorOperationIncrement(11);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
// assertLdapConnectorInstances(2);
}
use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.
the class TestRetirement method reconcileAllOrgs.
private void reconcileAllOrgs() throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
final Task task = createTask("reconcileAllOrgs");
OperationResult result = task.getResult();
ResultHandler<OrgType> handler = new ResultHandler<OrgType>() {
@Override
public boolean handle(PrismObject<OrgType> object, OperationResult parentResult) {
try {
display("reconciling " + object);
reconcileOrg(object.getOid(), task, parentResult);
} catch (SchemaException | PolicyViolationException | ExpressionEvaluationException | ObjectNotFoundException | ObjectAlreadyExistsException | CommunicationException | ConfigurationException | SecurityViolationException e) {
throw new SystemException(e.getMessage(), e);
}
return true;
}
};
display("Reconciling all orgs");
modelService.searchObjectsIterative(OrgType.class, null, handler, null, task, result);
}
use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.
the class TestUnix method test401ListAllAccountsKindIntent.
@Test
public void test401ListAllAccountsKindIntent() throws Exception {
final String TEST_NAME = "test401ListAllAccountsKindIntent";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestUnix.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ACCOUNT, "default", prismContext);
display("query", query);
// WHEN
TestUtil.displayWhen(TEST_NAME);
SearchResultList<PrismObject<ShadowType>> objects = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
display("found objects", objects);
assertEquals("Wrong number of objects found", 7, objects.size());
}
use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.
the class TestUnix method test403ListUnixGroupsKindIntent.
@Test
public void test403ListUnixGroupsKindIntent() throws Exception {
final String TEST_NAME = "test403ListUnixGroupsKindIntent";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestUnix.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "unixGroup", prismContext);
display("query", query);
// WHEN
TestUtil.displayWhen(TEST_NAME);
SearchResultList<PrismObject<ShadowType>> objects = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
display("found objects", objects);
assertEquals("Wrong number of objects found", 3, objects.size());
}
Aggregations