Search in sources :

Example 46 with GetOperationOptions

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) Test(org.testng.annotations.Test)

Example 47 with GetOperationOptions

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());
}
Also used : DirtiesContext(org.springframework.test.annotation.DirtiesContext) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) BreakMode(com.evolveum.icf.dummy.resource.BreakMode) ChangeType(com.evolveum.midpoint.prism.delta.ChangeType) Autowired(org.springframework.beans.factory.annotation.Autowired) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Test(org.testng.annotations.Test) AssertJUnit.assertTrue(org.testng.AssertJUnit.assertTrue) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) DOMUtil(com.evolveum.midpoint.util.DOMUtil) PrismTestUtil(com.evolveum.midpoint.prism.util.PrismTestUtil) AssertJUnit.assertNull(org.testng.AssertJUnit.assertNull) DebugReconciliationTaskResultListener(com.evolveum.midpoint.model.impl.util.DebugReconciliationTaskResultListener) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) AuditEventRecord(com.evolveum.midpoint.audit.api.AuditEventRecord) MutableInt(org.apache.commons.lang.mutable.MutableInt) ObjectQueryUtil(com.evolveum.midpoint.schema.util.ObjectQueryUtil) ResultHandler(com.evolveum.midpoint.schema.ResultHandler) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) PrismAsserts(com.evolveum.midpoint.prism.util.PrismAsserts) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) Collection(java.util.Collection) Task(com.evolveum.midpoint.task.api.Task) ShadowKindType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) ModelService(com.evolveum.midpoint.model.api.ModelService) List(java.util.List) ValuePolicyProcessor(com.evolveum.midpoint.model.common.stringpolicy.ValuePolicyProcessor) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) QName(javax.xml.namespace.QName) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ResourceAttributeDefinitionImpl(com.evolveum.midpoint.schema.processor.ResourceAttributeDefinitionImpl) PasswordType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType) SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyResourceContoller(com.evolveum.midpoint.test.DummyResourceContoller) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) ValuePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType) AuditEventStage(com.evolveum.midpoint.audit.api.AuditEventStage) ArrayList(java.util.ArrayList) AssignmentPolicyEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType) RefinedResourceSchema(com.evolveum.midpoint.common.refinery.RefinedResourceSchema) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) RefinedResourceSchemaImpl(com.evolveum.midpoint.common.refinery.RefinedResourceSchemaImpl) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest) IntegrationTestTools(com.evolveum.midpoint.test.IntegrationTestTools) TestUtil(com.evolveum.midpoint.test.util.TestUtil) Iterator(java.util.Iterator) ProvisioningScriptSpec(com.evolveum.midpoint.test.ProvisioningScriptSpec) ClassMode(org.springframework.test.annotation.DirtiesContext.ClassMode) ReconciliationTaskHandler(com.evolveum.midpoint.model.impl.sync.ReconciliationTaskHandler) OperationResultStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType) DummyResource(com.evolveum.icf.dummy.resource.DummyResource) ObjectClassComplexTypeDefinition(com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition) PrismObject(com.evolveum.midpoint.prism.PrismObject) InternalMonitor(com.evolveum.midpoint.schema.internals.InternalMonitor) File(java.io.File) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) IntegrationTestTools.display(com.evolveum.midpoint.test.IntegrationTestTools.display) CredentialPolicyEvaluator(com.evolveum.midpoint.model.impl.lens.projector.credentials.CredentialPolicyEvaluator) AuditEventType(com.evolveum.midpoint.audit.api.AuditEventType) SearchResultList(com.evolveum.midpoint.schema.SearchResultList) MidPointConstants(com.evolveum.midpoint.schema.constants.MidPointConstants) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) ContextConfiguration(org.springframework.test.context.ContextConfiguration) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) AssertJUnit.assertNotNull(org.testng.AssertJUnit.assertNotNull) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) ObjectDeltaOperation(com.evolveum.midpoint.schema.ObjectDeltaOperation) ResourceSchema(com.evolveum.midpoint.schema.processor.ResourceSchema) AssertJUnit.assertEquals(org.testng.AssertJUnit.assertEquals) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) QName(javax.xml.namespace.QName) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) MutableInt(org.apache.commons.lang.mutable.MutableInt) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Example 48 with GetOperationOptions

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractProvisioningIntegrationTest(com.evolveum.midpoint.provisioning.impl.AbstractProvisioningIntegrationTest)

Example 49 with GetOperationOptions

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractProvisioningIntegrationTest(com.evolveum.midpoint.provisioning.impl.AbstractProvisioningIntegrationTest)

Example 50 with GetOperationOptions

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;
}
Also used : SelectableBeanObjectDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Aggregations

GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)52 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)38 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)31 Task (com.evolveum.midpoint.task.api.Task)22 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)19 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)19 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)13 Collection (java.util.Collection)12 PrismObject (com.evolveum.midpoint.prism.PrismObject)11 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)11 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)11 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)11 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)10 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)10 QName (javax.xml.namespace.QName)10 Test (org.testng.annotations.Test)10 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)9 ArrayList (java.util.ArrayList)9 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)8 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)7