Search in sources :

Example 61 with OperationResultType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.

the class TestSanityLegacy method test109UnassignRoleCaptainAgain.

/**
     * Captain role was assigned twice. It has to also be unassigned twice.
     */
@Test
public void test109UnassignRoleCaptainAgain() throws Exception {
    final String TEST_NAME = "test109UnassignRoleCaptainAgain";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    OperationResultType result = new OperationResultType();
    assertNoRepoCache();
    ObjectDeltaType objectChange = unmarshallValueFromFile(REQUEST_USER_MODIFY_DELETE_ROLE_CAPTAIN_2_FILENAME, ObjectDeltaType.class);
    // WHEN ObjectTypes.USER.getTypeQName(), 
    result = modifyObjectViaModelWS(objectChange);
    // THEN
    assertNoRepoCache();
    displayJaxb("modifyObject result", result, SchemaConstants.C_RESULT);
    //TODO TODO TODO TODO operation result from repostiory.getObject is unknown...find out why..
    //        assertSuccess("modifyObject has failed", result);
    // Check if user object was modified in the repo
    OperationResult repoResult = new OperationResult("getObject");
    PropertyReferenceListType resolve = new PropertyReferenceListType();
    PrismObject<UserType> repoUser = repositoryService.getObject(UserType.class, USER_GUYBRUSH_OID, null, repoResult);
    UserType repoUserType = repoUser.asObjectable();
    repoResult.computeStatus();
    display("User (repository)", repoUserType);
    List<ObjectReferenceType> accountRefs = repoUserType.getLinkRef();
    assertEquals(0, accountRefs.size());
    // Check if shadow was deleted from the repo
    repoResult = new OperationResult("getObject");
    try {
        PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, accountShadowOidGuybrushOpendj, null, repoResult);
        AssertJUnit.fail("Account shadow was not deleted from repo");
    } catch (ObjectNotFoundException ex) {
    // This is expected
    }
    // check if account was deleted from LDAP
    Entry entry = openDJController.searchByEntryUuid(accountGuybrushOpendjEntryUuuid);
    display("LDAP account", entry);
    assertNull("LDAP account was not deleted", entry);
// TODO: Derby
}
Also used : PropertyReferenceListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.PropertyReferenceListType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismAsserts.assertEqualsPolyString(com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 62 with OperationResultType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.

the class ProvisioningServiceImpl method handleRepoObject.

private <T extends ObjectType> boolean handleRepoObject(final Class<T> type, PrismObject<T> object, final Collection<SelectorOptions<GetOperationOptions>> options, final ResultHandler<T> handler, Task task, final OperationResult objResult) {
    PrismObject<T> completeObject;
    try {
        completeObject = completeObject(type, object, options, task, objResult);
    } catch (SchemaException | ObjectNotFoundException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
        LOGGER.error("Error while completing {}: {}. Using non-complete object.", new Object[] { object, e.getMessage(), e });
        objResult.recordFatalError(e);
        object.asObjectable().setFetchResult(objResult.createOperationResultType());
        completeObject = object;
    }
    validateObject(completeObject);
    if (ShadowType.class.isAssignableFrom(type) && GetOperationOptions.isMaxStaleness(SelectorOptions.findRootOptions(options))) {
        CachingMetadataType cachingMetadata = ((ShadowType) completeObject.asObjectable()).getCachingMetadata();
        if (cachingMetadata == null) {
            objResult.recordFatalError("Requested cached data but no cached data are available in the shadow");
        }
    }
    objResult.computeStatus();
    objResult.recordSuccessIfUnknown();
    if (!objResult.isSuccess()) {
        OperationResultType resultType = objResult.createOperationResultType();
        completeObject.asObjectable().setFetchResult(resultType);
    }
    return handler.handle(completeObject, objResult);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) PrismObject(com.evolveum.midpoint.prism.PrismObject) CachingMetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType)

Example 63 with OperationResultType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.

the class ConsistencyTest method test001TestConnectionOpenDJ.

/**
	 * Test the testResource method. Expect a complete success for now.
	 */
@Test
public void test001TestConnectionOpenDJ() throws Exception {
    final String TEST_NAME = "test001TestConnectionOpenDJ";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = taskManager.createTaskInstance();
    // GIVEN
    assertNoRepoCache();
    // WHEN
    OperationResultType result = modelWeb.testResource(RESOURCE_OPENDJ_OID);
    // THEN
    assertNoRepoCache();
    displayJaxb("testResource result:", result, SchemaConstants.C_RESULT);
    TestUtil.assertSuccess("testResource has failed", result);
    OperationResult opResult = new OperationResult(ConsistencyTest.class.getName() + "." + TEST_NAME);
    PrismObject<ResourceType> resourceOpenDjRepo = repositoryService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, opResult);
    resourceTypeOpenDjrepo = resourceOpenDjRepo.asObjectable();
    assertNoRepoCache();
    assertEquals(RESOURCE_OPENDJ_OID, resourceTypeOpenDjrepo.getOid());
    display("Initialized OpenDJ resource (respository)", resourceTypeOpenDjrepo);
    assertNotNull("Resource schema was not generated", resourceTypeOpenDjrepo.getSchema());
    Element resourceOpenDjXsdSchemaElement = ResourceTypeUtil.getResourceXsdSchema(resourceTypeOpenDjrepo);
    assertNotNull("Resource schema was not generated", resourceOpenDjXsdSchemaElement);
    PrismObject<ResourceType> openDjResourceProvisioninig = provisioningService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, task, opResult);
    display("Initialized OpenDJ resource resource (provisioning)", openDjResourceProvisioninig);
    PrismObject<ResourceType> openDjResourceModel = provisioningService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, task, opResult);
    display("Initialized OpenDJ resource OpenDJ resource (model)", openDjResourceModel);
    checkOpenDjResource(resourceTypeOpenDjrepo, "repository");
    System.out.println("------------------------------------------------------------------");
    display("OpenDJ resource schema (repo XML)", DOMUtil.serializeDOMToString(ResourceTypeUtil.getResourceXsdSchema(resourceOpenDjRepo)));
    System.out.println("------------------------------------------------------------------");
    checkOpenDjResource(openDjResourceProvisioninig.asObjectable(), "provisioning");
    checkOpenDjResource(openDjResourceModel.asObjectable(), "model");
// TODO: model web
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 64 with OperationResultType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.

the class TestWSSanity method test112CheckJackAccountShadowRaw.

@Test
public void test112CheckJackAccountShadowRaw() throws Exception {
    final String TEST_NAME = "test112CheckJackAccountShadowRaw";
    displayTestTitle(TEST_NAME);
    Holder<ObjectType> objectHolder = new Holder<>();
    Holder<OperationResultType> resultHolder = new Holder<>();
    // WHEN
    modelPort.getObject(ModelClientUtil.getTypeQName(ShadowType.class), accountJackOid, ModelClientUtil.createRootGetOptions(ModelClientUtil.createRawGetOption()), objectHolder, resultHolder);
    // THEN
    assertSuccess(resultHolder);
    ShadowType shadow = (ShadowType) objectHolder.value;
    display(shadow);
    assertAttribute(shadow, ATTR_ICF_NAME_NAME, "uid=" + USER_JACK_USERNAME + "," + openDJController.getSuffixPeople());
    assertNoAttribute(shadow, "uid");
    assertNoAttribute(shadow, "givenName");
    assertNoAttribute(shadow, "sn");
    assertNoAttribute(shadow, "cn");
    assertNoAttribute(shadow, "displayName");
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) Holder(javax.xml.ws.Holder) Test(org.testng.annotations.Test)

Example 65 with OperationResultType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType 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);
}
Also used : ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) ObjectListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) Test(org.testng.annotations.Test)

Aggregations

OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)172 Test (org.testng.annotations.Test)106 Holder (javax.xml.ws.Holder)78 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)75 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)63 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)57 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)56 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)53 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)49 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)47 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)34 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)34 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)32 ObjectListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType)26 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)23 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)21 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)18 FaultMessage (com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage)18 QName (javax.xml.namespace.QName)18 GenericObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.GenericObjectType)17