Search in sources :

Example 31 with ObjectDeltaOperationListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method createOrg.

protected String createOrg(OrgType orgType) throws FaultMessage {
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(OrgType.class));
    deltaType.setChangeType(ChangeTypeType.ADD);
    deltaType.setObjectToAdd(orgType);
    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) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) 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 32 with ObjectDeltaOperationListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.

the class TestSanityLegacy method getOdoFromDeltaOperationList.

// ugly hack...
private static ObjectDeltaOperationType getOdoFromDeltaOperationList(ObjectDeltaOperationListType operationListType, ObjectDeltaType originalDelta) {
    Validate.notNull(operationListType);
    Validate.notNull(originalDelta);
    for (ObjectDeltaOperationType operationType : operationListType.getDeltaOperation()) {
        ObjectDeltaType objectDeltaType = operationType.getObjectDelta();
        if (originalDelta.getChangeType() == ChangeTypeType.ADD) {
            if (objectDeltaType.getChangeType() == originalDelta.getChangeType() && objectDeltaType.getObjectToAdd() != null) {
                ObjectType objectAdded = (ObjectType) objectDeltaType.getObjectToAdd();
                if (objectAdded.getClass().equals(originalDelta.getObjectToAdd().getClass())) {
                    return operationType;
                }
            }
        } else {
            if (objectDeltaType.getChangeType() == originalDelta.getChangeType() && originalDelta.getOid().equals(objectDeltaType.getOid())) {
                return operationType;
            }
        }
    }
    throw new IllegalStateException("No suitable ObjectDeltaOperationType (" + originalDelta.getChangeType() + ")found. We have: " + operationListType);
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) GenericObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.GenericObjectType)

Example 33 with ObjectDeltaOperationListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.

the class AbstractWebserviceTest method checkAuditEnabled.

private void checkAuditEnabled(SystemConfigurationType configurationType) throws FaultMessage {
    LoggingConfigurationType loggingConfig = configurationType.getLogging();
    AuditingConfigurationType auditConfig = loggingConfig.getAuditing();
    if (auditConfig == null) {
        auditConfig = new AuditingConfigurationType();
        auditConfig.setEnabled(true);
        loggingConfig.setAuditing(auditConfig);
    } else {
        if (BooleanUtils.isTrue(auditConfig.isEnabled())) {
            return;
        }
        auditConfig.setEnabled(true);
    }
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), "logging", ModificationTypeType.REPLACE, loggingConfig);
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    assertSuccess(deltaOpList);
}
Also used : 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 34 with ObjectDeltaOperationListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.

the class AbstractWebserviceTest method addObject.

protected <O extends ObjectType> String addObject(O object) throws FaultMessage {
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setObjectType(getTypeQName(object.getClass()));
    delta.setChangeType(ChangeTypeType.ADD);
    delta.setObjectToAdd(object);
    deltaList.getDelta().add(delta);
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    assertSuccess(deltaOpList);
    return deltaOpList.getDeltaOperation().get(0).getObjectDelta().getOid();
}
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 35 with ObjectDeltaOperationListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.

the class TestWSSecurity method test142DisableHimselfAsDarthAdder.

@Test
public void test142DisableHimselfAsDarthAdder() throws Exception {
    final String TEST_NAME = "test142DisableHimselfAsDarthAdder";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "activation/administrativeStatus", ModificationTypeType.REPLACE, ActivationStatusType.DISABLED);
    // WHEN
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    // THEN
    assertSuccess(deltaOpList);
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "MODIFY_OBJECT");
    tailer.assertAudit(4);
    modelPort = createModelPort();
    UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
    display(user);
    assertEquals("Wrong administrative status in " + ModelClientUtil.toString(user), ActivationStatusType.DISABLED, user.getActivation().getAdministrativeStatus());
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)34 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)31 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)28 ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)15 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)10 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)9 Test (org.testng.annotations.Test)9 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)7 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)6 ModelExecuteOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType)4 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)4 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)3 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)3 GenericObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.GenericObjectType)2 FaultMessage (com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage)2 ExecuteChangesType (com.evolveum.midpoint.xml.ns._public.model.model_3.ExecuteChangesType)2 ModelPortType (com.evolveum.midpoint.xml.ns._public.model.model_3.ModelPortType)2 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)2 Collection (java.util.Collection)2 QName (javax.xml.namespace.QName)2