use of com.evolveum.midpoint.repo.api.DeleteObjectResult in project midpoint by Evolveum.
the class SqaleRepoSmokeTest method test110DeleteObject.
@Test
public void test110DeleteObject() throws Exception {
OperationResult result = createOperationResult();
given("existing user");
UserType user = new UserType(prismContext).name("user" + getTestNumber());
String userOid = repositoryService.addObject(user.asPrismObject(), null, result);
and("cleared performance information");
SqlPerformanceMonitorImpl pm = repositoryService.getPerformanceMonitor();
pm.clearGlobalPerformanceInformation();
when("user is deleted from the repository");
DeleteObjectResult deleteResult = repositoryService.deleteObject(UserType.class, userOid, result);
then("added object is assigned OID and operation is success");
assertThat(deleteResult).isNotNull();
assertThatOperationResult(result).isSuccess();
assertThat(selectNullableObjectByOid(QUser.class, userOid)).isNull();
assertSingleOperationRecorded(REPO_OP_PREFIX + RepositoryService.OP_DELETE_OBJECT);
}
use of com.evolveum.midpoint.repo.api.DeleteObjectResult in project midpoint by Evolveum.
the class SqaleRepoAddDeleteObjectTest method test999DeleteAllOtherObjects.
@Test
public void test999DeleteAllOtherObjects() throws Exception {
// this doesn't follow given-when-then, sorry
OperationResult result = createOperationResult();
// we didn't create that many in this class, it should be OK to read them all at once
for (MObject row : select(QObject.CLASS)) {
DeleteObjectResult deleteResult = repositoryService.deleteObject(row.objectType.getSchemaType(), row.oid.toString(), result);
assertThat(deleteResult).isNotNull();
}
assertThatOperationResult(result).isSuccess();
assertThat(select(QObject.CLASS)).isEmpty();
assertThat(select(QContainer.CLASS)).isEmpty();
assertThat(select(QReference.CLASS)).isEmpty();
}
use of com.evolveum.midpoint.repo.api.DeleteObjectResult in project midpoint by Evolveum.
the class SqaleRepoAddDeleteObjectTest method test911DeleteUserUsingFocusWorksOk.
// slight variation of the above, but using lower-level abstract table
@Test
public void test911DeleteUserUsingFocusWorksOk() throws Exception {
OperationResult result = createOperationResult();
given("random user existing in the repository");
// we'll sacrifice one of the users for this
UUID userOid = randomExistingOid(QUser.class);
when("deleting it using the focus type");
DeleteObjectResult deleteResult = repositoryService.deleteObject(FocusType.class, userOid.toString(), result);
then("user is deleted");
assertThatOperationResult(result).isSuccess();
assertThat(deleteResult).isNotNull();
assertThat(deleteResult.getObjectTextRepresentation()).isNotNull();
assertThat(selectNullableObjectByOid(QUser.class, userOid)).isNull();
}
use of com.evolveum.midpoint.repo.api.DeleteObjectResult in project midpoint by Evolveum.
the class SqaleRepoAddDeleteObjectTest method test910DeleteUsingSupertypeWorksOk.
@Test
public void test910DeleteUsingSupertypeWorksOk() throws Exception {
OperationResult result = createOperationResult();
given("any object existing in the repository");
// we'll sacrifice one of the users for this
UUID userOid = randomExistingOid(QUser.class);
when("deleting the object using its supertype");
DeleteObjectResult deleteResult = repositoryService.deleteObject(ObjectType.class, userOid.toString(), result);
then("object is deleted");
assertThatOperationResult(result).isSuccess();
assertThat(deleteResult).isNotNull();
assertThat(deleteResult.getObjectTextRepresentation()).isNotNull();
assertThat(selectNullableObjectByOid(QUser.class, userOid)).isNull();
}
Aggregations