Search in sources :

Example 81 with SelectorOptions

use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.

the class PageDebugList method deleteAllIdentitiesConfirmed.

private void deleteAllIdentitiesConfirmed(AjaxRequestTarget target, DeleteAllDto dto) {
    Collection<SelectorOptions<GetOperationOptions>> options = new ArrayList<>();
    GetOperationOptions opt = GetOperationOptions.createRaw();
    options.add(SelectorOptions.create(ItemPath.EMPTY_PATH, opt));
    OperationResult result = new OperationResult(OPERATION_LAXATIVE_DELETE);
    String taskOid = null;
    try {
        if (dto.getDeleteUsers()) {
            ObjectQuery query = createDeleteAllUsersQuery();
            taskOid = deleteObjectsAsync(UserType.COMPLEX_TYPE, query, true, "Delete all users", result);
        }
        if (dto.getDeleteOrgs()) {
            taskOid = deleteObjectsAsync(OrgType.COMPLEX_TYPE, null, true, "Delete all orgs", result);
        }
        if (dto.getDeleteAccountShadow()) {
            taskOid = deleteAllShadowsConfirmed(result, true);
        }
        if (dto.getDeleteNonAccountShadow()) {
            taskOid = deleteAllShadowsConfirmed(result, false);
        }
    } catch (Exception ex) {
        result.computeStatus(getString("pageDebugList.message.laxativeProblem"));
        LoggingUtils.logUnexpectedException(LOGGER, getString("pageDebugList.message.laxativeProblem"), ex);
    }
    if (taskOid != null) {
        PageParameters parameters = new PageParameters();
        parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
        navigateToNext(PageTaskEdit.class, parameters);
    } else {
        navigateToNext(PageTasks.class);
    }
    target.add(getFeedbackPanel());
    result.recomputeStatus();
    showResult(result);
}
Also used : GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 82 with SelectorOptions

use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.

the class TestRoleEntitlement method test103GetGroupRaw.

@Test
public void test103GetGroupRaw() throws Exception {
    final String TEST_NAME = "test103GetGroupRaw";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
    Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
    // WHEN
    PrismObject<ShadowType> shadow = modelService.getObject(ShadowType.class, groupOid, options, task, result);
    display("Account", shadow);
    display("Account def", shadow.getDefinition());
    PrismContainer<Containerable> accountContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES);
    display("Account attributes def", accountContainer.getDefinition());
    display("Account attributes def complex type def", accountContainer.getDefinition().getComplexTypeDefinition());
    assertDummyGroupShadowRepo(shadow, groupOid, GROUP_PIRATE_DUMMY_NAME);
    result.computeStatus();
    TestUtil.assertSuccess("getObject result", result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Containerable(com.evolveum.midpoint.prism.Containerable) Test(org.testng.annotations.Test)

Example 83 with SelectorOptions

use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.

the class TestRoleEntitlement method test110GetRoleResolveEntitlement.

@Test
public void test110GetRoleResolveEntitlement() throws Exception {
    final String TEST_NAME = "test110GetRoleResolveEntitlement";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
    Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(UserType.F_LINK, GetOperationOptions.createResolve());
    // WHEN
    PrismObject<RoleType> role = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, options, task, result);
    RoleType roleType = role.asObjectable();
    assertLinks(role, 1);
    PrismReferenceValue linkRef = getSingleLinkRef(role);
    assertEquals("OID mismatch in linkRefValue", groupOid, linkRef.getOid());
    assertNotNull("Missing account object in linkRefValue", linkRef.getObject());
    ShadowType shadow = roleType.getLink().get(0);
    assertDummyGroupShadowModel(shadow.asPrismObject(), groupOid, GROUP_PIRATE_DUMMY_NAME);
    result.computeStatus();
    TestUtil.assertSuccess("getObject result", result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 84 with SelectorOptions

use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.

the class TestRoleEntitlement method test111GetRoleResolveEntitlement.

@Test
public void test111GetRoleResolveEntitlement() throws Exception {
    final String TEST_NAME = "test111GetRoleResolveEntitlement";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
    Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createResolve(), new ItemPath(UserType.F_LINK), new ItemPath(UserType.F_LINK, ShadowType.F_RESOURCE));
    // WHEN
    PrismObject<RoleType> role = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, options, task, result);
    RoleType roleType = role.asObjectable();
    assertLinks(role, 1);
    PrismReferenceValue linkRef = getSingleLinkRef(role);
    assertEquals("OID mismatch in linkRefValue", groupOid, linkRef.getOid());
    assertNotNull("Missing account object in linkRefValue", linkRef.getObject());
    ShadowType shadow = roleType.getLink().get(0);
    assertDummyGroupShadowModel(shadow.asPrismObject(), groupOid, GROUP_PIRATE_DUMMY_NAME);
    assertNotNull("Resource in account was not resolved", shadow.getResource());
    result.computeStatus();
    TestUtil.assertSuccess("getObject result", result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 85 with SelectorOptions

use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.

the class AbstractManualResourceTest method test108GetAccountWillFuture.

@Test
public void test108GetAccountWillFuture() throws Exception {
    final String TEST_NAME = "test108GetAccountWillFuture";
    displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE));
    // WHEN
    displayWhen(TEST_NAME);
    PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, options, task, result);
    // THEN
    displayThen(TEST_NAME);
    assertSuccess(result);
    display("Model shadow", shadowModel);
    ShadowType shadowTypeProvisioning = shadowModel.asObjectable();
    assertShadowName(shadowModel, USER_WILL_NAME);
    assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
    assertAttribute(shadowModel, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttribute(shadowModel, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
    assertAttributeFromBackingStore(shadowModel, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
    assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.ENABLED);
    assertShadowExists(shadowModel, true);
    // TODO
    //		assertShadowPassword(shadowProvisioning);
    PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
    display("Repo shadow", shadowRepo);
    assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd);
    assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
    assertNoAttribute(shadowRepo, ATTR_DESCRIPTION_QNAME);
    assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.ENABLED);
    assertNoShadowPassword(shadowRepo);
    assertShadowExists(shadowRepo, supportsBackingStore());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractConfiguredModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)

Aggregations

SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)127 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)106 Task (com.evolveum.midpoint.task.api.Task)82 Test (org.testng.annotations.Test)47 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)34 GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)31 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)31 PrismObject (com.evolveum.midpoint.prism.PrismObject)28 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)28 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)28 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)23 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)21 ArrayList (java.util.ArrayList)19 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)17 QName (javax.xml.namespace.QName)17 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)16 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)16 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)14 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)14 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)12