Search in sources :

Example 56 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class ConsistencyTest method createDeltas.

private Collection<ObjectDelta<? extends ObjectType>> createDeltas(Class type, String requestFilename, String objectOid) throws IOException, SchemaException, JAXBException {
    try {
        ObjectDeltaType objectChange = unmarshallValueFromFile(requestFilename, ObjectDeltaType.class);
        objectChange.setOid(objectOid);
        ObjectDelta delta = DeltaConvertor.createObjectDelta(objectChange, prismContext);
        Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(delta);
        return deltas;
    } catch (Exception ex) {
        LOGGER.error("ERROR while unmarshalling: {}", ex);
        throw ex;
    }
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) SystemException(com.evolveum.midpoint.util.exception.SystemException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) PolicyViolationException(com.evolveum.midpoint.util.exception.PolicyViolationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) IOException(java.io.IOException) CommonException(com.evolveum.midpoint.util.exception.CommonException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) JAXBException(javax.xml.bind.JAXBException) TaskManagerException(com.evolveum.midpoint.task.api.TaskManagerException) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) EncryptionException(com.evolveum.midpoint.prism.crypto.EncryptionException)

Example 57 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class AbstractWebserviceTest method deleteObject.

protected <O extends ObjectType> void deleteObject(Class<O> type, String oid, ModelExecuteOptionsType options) throws FaultMessage {
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setObjectType(getTypeQName(type));
    delta.setChangeType(ChangeTypeType.DELETE);
    delta.setOid(oid);
    deltaList.getDelta().add(delta);
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, options);
    assertSuccess(deltaOpList);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 58 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class TestWSSanity method test020AddResourceOpenDj.

@Test
public void test020AddResourceOpenDj() throws Exception {
    final String TEST_NAME = "test020AddResourceOpenDj";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    ResourceType resource = ModelClientUtil.unmarshallFile(RESOURCE_OPENDJ_FILE);
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setObjectType(getTypeQName(ResourceType.class));
    delta.setChangeType(ChangeTypeType.ADD);
    delta.setObjectToAdd(resource);
    deltaList.getDelta().add(delta);
    ModelExecuteOptionsType options = new ModelExecuteOptionsType();
    options.setIsImport(Boolean.TRUE);
    XMLGregorianCalendar startTs = TestUtil.currentTime();
    // WHEN
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, options);
    // THEN
    assertSuccess(deltaOpList);
    String oid = deltaOpList.getDeltaOperation().get(0).getObjectDelta().getOid();
    XMLGregorianCalendar endTs = TestUtil.currentTime();
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "ADD_OBJECT");
    tailer.assertAudit(4);
    assertEquals("Wrong OID", RESOURCE_OPENDJ_OID, oid);
    ResourceType resourceAfter = getObject(ResourceType.class, RESOURCE_OPENDJ_OID);
    display(resourceAfter);
    assertEquals("Wrong connector OID", connectorLdapOid, resourceAfter.getConnectorRef().getOid());
    assertCreateMetadata(resourceAfter, USER_ADMINISTRATOR_OID, startTs, endTs);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) Test(org.testng.annotations.Test)

Example 59 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class Main method deleteUser.

private static void deleteUser(ModelPortType modelPort, String oid) throws FaultMessage {
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(UserType.class));
    deltaType.setChangeType(ChangeTypeType.DELETE);
    deltaType.setOid(oid);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ModelExecuteOptionsType executeOptionsType = new ModelExecuteOptionsType();
    executeOptionsType.setRaw(true);
    modelPort.executeChanges(deltaListType, executeOptionsType);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 60 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class Main method createRole.

private static String createRole(ModelPortType modelPort, RoleType roleType) throws FaultMessage {
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class));
    deltaType.setChangeType(ChangeTypeType.ADD);
    deltaType.setObjectToAdd(roleType);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, null);
    return ModelClientUtil.getOidFromDeltaOperationList(operationListType, deltaType);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Aggregations

ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)136 Test (org.testng.annotations.Test)55 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)53 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)50 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)47 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)47 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)42 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)41 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)37 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)30 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)30 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)29 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)23 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)17 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)16 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)16 ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)14 QName (javax.xml.namespace.QName)14 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)13 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)12