Search in sources :

Example 1 with MService

use of com.evolveum.midpoint.repo.sqale.qmodel.role.MService in project midpoint by Evolveum.

the class SqaleRepoModifyObjectTest method test116DeleteIntegerAttribute.

@Test
public void test116DeleteIntegerAttribute() throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException {
    OperationResult result = createOperationResult();
    given("delta with display order replace to null for service 1");
    ObjectDelta<ServiceType> delta = prismContext.deltaFor(ServiceType.class).item(ServiceType.F_DISPLAY_ORDER).replace().asObjectDelta(service1Oid);
    and("service row previously having the display order value");
    MService originalRow = selectObjectByOid(QService.class, service1Oid);
    assertThat(originalRow.displayOrder).isNotNull();
    when("modifyObject is called");
    repositoryService.modifyObject(ServiceType.class, service1Oid, delta.getModifications(), result);
    then("operation is successful");
    assertThatOperationResult(result).isSuccess();
    and("serialized form (fullObject) is updated and display order is gone");
    ServiceType serviceObject = repositoryService.getObject(ServiceType.class, service1Oid, null, result).asObjectable();
    assertThat(serviceObject.getVersion()).isEqualTo(String.valueOf(originalRow.version + 1));
    assertThat(serviceObject.getDisplayOrder()).isNull();
    and("externalized column is set to NULL");
    MService row = selectObjectByOid(QService.class, service1Oid);
    assertThat(row.version).isEqualTo(originalRow.version + 1);
    assertThat(row.displayOrder).isNull();
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) MService(com.evolveum.midpoint.repo.sqale.qmodel.role.MService) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Example 2 with MService

use of com.evolveum.midpoint.repo.sqale.qmodel.role.MService in project midpoint by Evolveum.

the class SqaleRepoModifyObjectTest method test115ChangeIntegerAttribute.

@Test
public void test115ChangeIntegerAttribute() throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException {
    OperationResult result = createOperationResult();
    MService originalRow = selectObjectByOid(QService.class, service1Oid);
    given("delta with display order change for service 1");
    ObjectDelta<ServiceType> delta = prismContext.deltaFor(ServiceType.class).item(ServiceType.F_DISPLAY_ORDER).replace(5).asObjectDelta(service1Oid);
    when("modifyObject is called");
    repositoryService.modifyObject(ServiceType.class, service1Oid, delta.getModifications(), result);
    then("operation is successful");
    assertThatOperationResult(result).isSuccess();
    and("serialized form (fullObject) is updated");
    ServiceType serviceObject = repositoryService.getObject(ServiceType.class, service1Oid, null, result).asObjectable();
    assertThat(serviceObject.getVersion()).isEqualTo(String.valueOf(originalRow.version + 1));
    assertThat(serviceObject.getDisplayOrder()).isEqualTo(5);
    and("externalized column is updated");
    MService row = selectObjectByOid(QService.class, service1Oid);
    assertThat(row.version).isEqualTo(originalRow.version + 1);
    assertThat(row.displayOrder).isEqualTo(5);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) MService(com.evolveum.midpoint.repo.sqale.qmodel.role.MService) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Aggregations

SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)2 MService (com.evolveum.midpoint.repo.sqale.qmodel.role.MService)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Test (org.testng.annotations.Test)2