use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationAuditType in project midpoint by Evolveum.
the class AuditDeltaOperationResultTest method test140StoringCleanedUpSuccessResults.
@Test
public void test140StoringCleanedUpSuccessResults() throws Exception {
// this is like default without any settings
OperationResult result = createOperationResult();
given("clear audit and audit configuration set to TOP");
clearAudit();
auditService.applyAuditConfiguration(new SystemConfigurationAuditType(prismContext).eventRecording(new SystemConfigurationAuditEventRecordingType(prismContext).deltaSuccessExecutionResult(OperationResultDetailLevel.CLEANED_UP)));
when("audit event with delta operation executions is stored");
createAuditRecordWithDeltas(result);
then("success result for delta preserved completely");
QAuditEventRecord a = QAuditEventRecordMapping.get().defaultAlias();
assertThat(selectOne(a)).isNotNull();
QAuditDelta d = QAuditDeltaMapping.get().defaultAlias();
List<MAuditDelta> deltaRows = select(d);
assertThat(deltaRows).hasSize(2).extracting(row -> (OperationResultType) parseFullObject(row.fullResult)).anyMatch(ort -> // warning is preserved fully
ort.getPartialResults().size() == 3 && ort.getStatus() == OperationResultStatusType.WARNING).anyMatch(ort -> ort.getPartialResults().size() == 2 && ort.getStatus() == OperationResultStatusType.SUCCESS);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationAuditType in project midpoint by Evolveum.
the class AuditDeltaOperationResultTest method test130StoringOnlyTopSuccessResults.
@Test
public void test130StoringOnlyTopSuccessResults() throws Exception {
OperationResult result = createOperationResult();
given("clear audit and audit configuration set to TOP");
clearAudit();
auditService.applyAuditConfiguration(new SystemConfigurationAuditType(prismContext).eventRecording(new SystemConfigurationAuditEventRecordingType(prismContext).deltaSuccessExecutionResult(OperationResultDetailLevel.TOP)));
when("audit event with delta operation executions is stored");
createAuditRecordWithDeltas(result);
then("success result for delta preserved completely");
QAuditEventRecord a = QAuditEventRecordMapping.get().defaultAlias();
assertThat(selectOne(a)).isNotNull();
QAuditDelta d = QAuditDeltaMapping.get().defaultAlias();
List<MAuditDelta> deltaRows = select(d);
assertThat(deltaRows).hasSize(2).extracting(row -> (OperationResultType) parseFullObject(row.fullResult)).anyMatch(ort -> // warning is preserved fully
ort.getPartialResults().size() == 3 && ort.getStatus() == OperationResultStatusType.WARNING).anyMatch(ort -> // no subresults for success
ort.getPartialResults().isEmpty() && ort.getStatus() == OperationResultStatusType.SUCCESS);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationAuditType in project midpoint by Evolveum.
the class AuditDeltaOperationResultTest method test120StoringNoneSuccessResults.
@Test
public void test120StoringNoneSuccessResults() throws Exception {
OperationResult result = createOperationResult();
given("clear audit and audit configuration set to NONE");
clearAudit();
auditService.applyAuditConfiguration(new SystemConfigurationAuditType(prismContext).eventRecording(new SystemConfigurationAuditEventRecordingType(prismContext).deltaSuccessExecutionResult(OperationResultDetailLevel.NONE)));
when("audit event with delta operation executions is stored");
createAuditRecordWithDeltas(result);
then("success result for delta preserved completely");
QAuditEventRecord a = QAuditEventRecordMapping.get().defaultAlias();
assertThat(selectOne(a)).isNotNull();
QAuditDelta d = QAuditDeltaMapping.get().defaultAlias();
List<MAuditDelta> deltaRows = select(d);
assertThat(deltaRows).hasSize(2).anyMatch(row -> row.fullResult == null && row.status == OperationResultStatusType.SUCCESS).filteredOn(row -> row.fullResult != null).extracting(row -> (OperationResultType) parseFullObject(row.fullResult)).singleElement().matches(ort -> // warning is preserved fully
ort.getPartialResults().size() == 3 && ort.getStatus() == OperationResultStatusType.WARNING);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationAuditType in project midpoint by Evolveum.
the class AuditDeltaOperationResultTest method test110StoringFullSuccessResults.
@Test
public void test110StoringFullSuccessResults() throws Exception {
OperationResult result = createOperationResult();
given("clear audit and audit configuration set to FULL");
clearAudit();
auditService.applyAuditConfiguration(new SystemConfigurationAuditType(prismContext).eventRecording(new SystemConfigurationAuditEventRecordingType(prismContext).deltaSuccessExecutionResult(OperationResultDetailLevel.FULL)));
when("audit event with delta operation executions is stored");
createAuditRecordWithDeltas(result);
then("success result for delta preserved completely");
QAuditEventRecord a = QAuditEventRecordMapping.get().defaultAlias();
assertThat(selectOne(a)).isNotNull();
QAuditDelta d = QAuditDeltaMapping.get().defaultAlias();
List<MAuditDelta> deltaRows = select(d);
assertThat(deltaRows).hasSize(2).extracting(row -> (OperationResultType) parseFullObject(row.fullResult)).allMatch(// both results have all subresults
ort -> ort.getPartialResults().size() == 3);
}
Aggregations