Search in sources :

Example 16 with ObjectDeltaOperationListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType 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 17 with ObjectDeltaOperationListType

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

the class TestWSSecurity method test165DarthAdderDeleteOwnPassword.

@Test
public void test165DarthAdderDeleteOwnPassword() throws Exception {
    final String TEST_NAME = "test165DarthAdderDeleteOwnPassword";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "credentials/password", // no values here
    ModificationTypeType.REPLACE);
    // 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);
    assertNull("Credentials sneaked in: " + user.getCredentials(), user.getCredentials());
}
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)

Example 18 with ObjectDeltaOperationListType

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

the class TestWSSecurity method test140AssignRoleToDarthAdderAsAdministrator.

@Test
public void test140AssignRoleToDarthAdderAsAdministrator() throws Exception {
    final String TEST_NAME = "test140AssignRoleToDarthAdderAsAdministrator";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort();
    ObjectDeltaListType deltaList = ModelClientUtil.createAssignDeltaList(UserType.class, USER_DARTHADDER_OID, RoleType.class, ROLE_MODIFIER_OID);
    // 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);
}
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) Test(org.testng.annotations.Test)

Example 19 with ObjectDeltaOperationListType

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

the class TestWSSecurity method test141ModifyTitleAsDarthAdder.

@Test
public void test141ModifyTitleAsDarthAdder() throws Exception {
    final String TEST_NAME = "test141ModifyTitleAsDarthAdder";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD, WSConstants.PW_DIGEST);
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "title", ModificationTypeType.REPLACE, ModelClientUtil.createPolyStringType("Dark Lord"));
    // 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);
    UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
    PolyStringType title = user.getTitle();
    assertEquals("Wrong title", "Dark Lord", ModelClientUtil.getOrig(title));
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) 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)

Example 20 with ObjectDeltaOperationListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType 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

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