use of com.evolveum.midpoint.schema.GetOperationOptions in project midpoint by Evolveum.
the class TestResources method test053GetResourceNoFetchReadOnly.
/**
* MID-3424
*/
@Test
public void test053GetResourceNoFetchReadOnly() throws Exception {
final String TEST_NAME = "test053GetResourceNoFetchReadOnly";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
preTestCleanup(AssignmentPolicyEnforcementType.POSITIVE);
// precondition
assertResourceSchemaFetchIncrement(0);
assertResourceSchemaParseCountIncrement(0);
assertConnectorCapabilitiesFetchIncrement(0);
assertConnectorInitializationCountIncrement(0);
assertConnectorSchemaParseIncrement(0);
rememberPrismObjectCloneCount();
GetOperationOptions option = GetOperationOptions.createNoFetch();
option.setReadOnly(true);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(option);
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObject<ResourceType> resource = modelService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, options, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
display("Resource", resource);
assertPrismObjectCloneIncrement(0);
assertResourceDummy(resource, false);
assertNull("Schema sneaked in", ResourceTypeUtil.getResourceXsdSchema(resource));
assertResourceSchemaFetchIncrement(0);
assertResourceSchemaParseCountIncrement(0);
assertConnectorCapabilitiesFetchIncrement(0);
assertConnectorInitializationCountIncrement(0);
assertConnectorSchemaParseIncrement(0);
}
use of com.evolveum.midpoint.schema.GetOperationOptions in project midpoint by Evolveum.
the class TestImportRecon method assertDummyAccountShadows.
private void assertDummyAccountShadows(int expected, boolean raw, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(RESOURCE_DUMMY_OID, new QName(RESOURCE_DUMMY_NAMESPACE, "AccountObjectClass"), prismContext);
final MutableInt count = new MutableInt(0);
ResultHandler<ShadowType> handler = (shadow, parentResult) -> {
count.increment();
display("Found", shadow);
return true;
};
Collection<SelectorOptions<GetOperationOptions>> options = null;
if (raw) {
options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
}
modelService.searchObjectsIterative(ShadowType.class, query, handler, options, task, result);
assertEquals("Unexpected number of search results (raw=" + raw + ")", expected, count.getValue());
}
use of com.evolveum.midpoint.schema.GetOperationOptions in project midpoint by Evolveum.
the class AbstractManualResourceTest method test109GetAccountWillFutureNoFetch.
@Test
public void test109GetAccountWillFutureNoFetch() throws Exception {
final String TEST_NAME = "test109GetAccountWillFutureNoFetch";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
GetOperationOptions options = GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE);
options.setNoFetch(true);
// WHEN
displayWhen(TEST_NAME);
PrismObject<ShadowType> shadowProvisioningFuture = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, SelectorOptions.createCollection(options), task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
display("Provisioning shadow (future,noFetch)", shadowProvisioningFuture);
assertNotNull("no OID", shadowProvisioningFuture.getOid());
ShadowType shadowTypeProvisioning = shadowProvisioningFuture.asObjectable();
assertShadowName(shadowProvisioningFuture, ACCOUNT_WILL_USERNAME);
assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
assertAttribute(shadowProvisioningFuture, ATTR_USERNAME_QNAME, ACCOUNT_WILL_USERNAME);
assertAttributeFromCache(shadowProvisioningFuture, ATTR_FULLNAME_QNAME, ACCOUNT_WILL_FULLNAME);
assertNoAttribute(shadowProvisioningFuture, ATTR_DESCRIPTION_QNAME);
assertShadowActivationAdministrativeStatusFromCache(shadowProvisioningFuture, ActivationStatusType.ENABLED);
assertShadowExists(shadowProvisioningFuture, true);
// TODO
// assertShadowPassword(shadowProvisioningFuture);
}
use of com.evolveum.midpoint.schema.GetOperationOptions in project midpoint by Evolveum.
the class AbstractManualResourceTest method test303GetAccountWillFutureNoFetch.
@Test
public void test303GetAccountWillFutureNoFetch() throws Exception {
final String TEST_NAME = "test303GetAccountWillFutureNoFetch";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
GetOperationOptions options = GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE);
options.setNoFetch(true);
// WHEN
displayWhen(TEST_NAME);
PrismObject<ShadowType> shadowProvisioningFuture = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, SelectorOptions.createCollection(options), task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
display("Provisioning shadow (future,noFetch)", shadowProvisioningFuture);
assertNotNull("no OID", shadowProvisioningFuture.getOid());
assertShadowName(shadowProvisioningFuture, ACCOUNT_WILL_USERNAME);
assertShadowDead(shadowProvisioningFuture);
assertNoShadowPassword(shadowProvisioningFuture);
}
use of com.evolveum.midpoint.schema.GetOperationOptions in project midpoint by Evolveum.
the class ObjectListPanel method initProvider.
protected BaseSortableDataProvider<SelectableBean<O>> initProvider() {
Set<O> selectedObjectsSet = selectedObjects == null ? null : new HashSet<O>(selectedObjects);
SelectableBeanObjectDataProvider<O> provider = new SelectableBeanObjectDataProvider<O>(parentPage, type, selectedObjectsSet) {
private static final long serialVersionUID = 1L;
@Override
protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
String storageKey = getStorageKey();
if (StringUtils.isNotEmpty(storageKey)) {
PageStorage storage = getPageStorage(storageKey);
if (storage != null) {
storage.setPaging(paging);
}
}
}
@Override
public SelectableBean<O> createDataObjectWrapper(O obj) {
SelectableBean<O> bean = super.createDataObjectWrapper(obj);
List<InlineMenuItem> inlineMenu = createInlineMenu();
if (inlineMenu != null) {
bean.getMenuItems().addAll(inlineMenu);
}
return bean;
}
};
if (options == null) {
if (ResourceType.class.equals(type)) {
options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
}
} else {
if (ResourceType.class.equals(type)) {
GetOperationOptions root = SelectorOptions.findRootOptions(options);
root.setNoFetch(Boolean.TRUE);
}
provider.setOptions(options);
}
provider.setQuery(getQuery());
return provider;
}
Aggregations