Skip to content

Commit

Permalink
Merge branch 'support-4.4' of https://github.com/Evolveum/midpoint in…
Browse files Browse the repository at this point in the history
…to support-4.4
  • Loading branch information
KaterynaHonchar committed Jan 26, 2022
2 parents e1b0049 + f8fa0b6 commit 7183b1c
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ function initEditor(textAreaId, readonly, resize, height, minHeight, mode) {
});

//add editor to global map, so we can find it later
if ($.aceEditors === undefined) {
$.aceEditors = {}
}
$.aceEditors[editorId] = editor;

//todo handle readonly for text area [lazyman] add "disabled" class to .ace_scroller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class ImportActivityRun

@Override
public @NotNull ActivityReportingCharacteristics createReportingCharacteristics() {
return new ActivityReportingCharacteristics()
return super.createReportingCharacteristics()
.actionsExecutedStatisticsSupported(true)
.synchronizationStatisticsSupported(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void beforeResourceObjectsReconciliation(
XMLGregorianCalendar now = XmlTypeConverter.createXMLGregorianCalendar();
reconState.setWorkStateItemRealValues(F_RESOURCE_OBJECTS_RECONCILIATION_START_TIMESTAMP, now);
reconState.flushPendingTaskModifications(result);
LOGGER.info("Set recon start timestamp to {}", now);
LOGGER.debug("Set recon start timestamp to {}", now);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public boolean doesRequireDirectRepositoryAccess() {

@Override
public @NotNull ActivityReportingCharacteristics createReportingCharacteristics() {
return new ActivityReportingCharacteristics()
return super.createReportingCharacteristics()
.actionsExecutedStatisticsSupported(true)
.synchronizationStatisticsSupported(false);
// TODO We will eventually want to provide sync statistics even for this part, in order to see transitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void beforeRun(OperationResult result) throws CommonException, ActivityRu

@Override
public @NotNull ActivityReportingCharacteristics createReportingCharacteristics() {
return new ActivityReportingCharacteristics()
return super.createReportingCharacteristics()
.actionsExecutedStatisticsSupported(true)
.synchronizationStatisticsSupported(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public LiveSyncActivityRun(

@Override
public @NotNull ActivityReportingCharacteristics createReportingCharacteristics() {
return new ActivityReportingCharacteristics()
return super.createReportingCharacteristics()
.determineOverallSizeDefault(ActivityOverallItemCountingOptionType.NEVER)
.bucketCompletionLoggingDefault(NONE) // To avoid log noise.
.actionsExecutedStatisticsSupported(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,28 @@ void logBucketCompletion(boolean complete) {
current.getAverageTime(), current.getAverageWallClockTime(end), current.getThroughput(end));
}

String overallBrief = String.format(Locale.US, "Overall: processed %,d objects in %.1f seconds, got %,d errors. Real progress: %,d.",
overall.getItemsProcessed(), ActivityItemProcessingStatisticsUtil.toSeconds(overall.getWallClockTime()),
overall.getErrors(), overall.getProgress());
Long wallClockTime = overall.getWallClockTime();

// Wall-clock time information is not available e.g. for activities with persistent state (like LiveSync)
boolean hasWallClockTime = wallClockTime != null && wallClockTime > 0;

String wallClockTimeString;
if (hasWallClockTime) {
wallClockTimeString = String.format(Locale.US, " in %.1f seconds", ActivityItemProcessingStatisticsUtil.toSeconds(wallClockTime));
} else {
wallClockTimeString = "";
}
String overallBrief = String.format(Locale.US,
"Overall: processed %,d objects%s, got %,d errors. Real progress: %,d.",
overall.getItemsProcessed(), wallClockTimeString, overall.getErrors(), overall.getProgress());
if (overall.getItemsProcessed() > 0) {
overallBrief += String.format(Locale.US, " Average processing time for one object: %,.1f milliseconds. "
+ "Wall clock average: %,.1f milliseconds, throughput: %,.1f items per minute.",
overall.getAverageTime(), overall.getAverageWallClockTime(),
overall.getThroughput());
overallBrief += String.format(Locale.US,
" Average processing time for one object: %,.1f milliseconds.", overall.getAverageTime());
if (hasWallClockTime && overall.getAverageWallClockTime() != null) {
overallBrief += String.format(Locale.US,
" Wall clock average: %,.1f milliseconds, throughput: %,.1f items per minute.",
overall.getAverageWallClockTime(), overall.getThroughput());
}
}

String mainMessageAddition = "\n" + currentBrief + "\n" + overallBrief;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 Evolveum and contributors
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand All @@ -21,7 +21,6 @@
import com.evolveum.midpoint.audit.api.AuditEventStage;
import com.evolveum.midpoint.audit.api.AuditEventType;
import com.evolveum.midpoint.prism.PrismReferenceValue;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.repo.sqale.SqaleRepoContext;
import com.evolveum.midpoint.repo.sqale.SqaleUtils;
Expand Down Expand Up @@ -144,7 +143,7 @@ public AuditEventRecordType toSchemaObject(MAuditEventRecord row) {
.message(row.message);

mapDeltas(record, row.deltas);
mapChangedItems(record, row.changedItemPaths);
// Changed items are only for searching, we don't want to reconstruct them, they are even "canonicalized".
mapRefValues(record, row.refValues);
mapProperties(record, row.properties);
mapResourceOids(record, row.resourceOids);
Expand All @@ -161,17 +160,6 @@ private void mapDeltas(AuditEventRecordType record, Collection<MAuditDelta> delt
}
}

private void mapChangedItems(AuditEventRecordType record, String[] changedItemPaths) {
if (changedItemPaths == null) {
return;
}

for (String changedItemPath : changedItemPaths) {
ItemPath itemPath = ItemPath.create(changedItemPath);
record.getChangedItem().add(new ItemPathType(itemPath));
}
}

private void mapRefValues(
AuditEventRecordType record, Map<String, List<MAuditRefValue>> refValues) {
if (refValues == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 Evolveum and contributors
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand Down Expand Up @@ -985,8 +985,10 @@ public void test300SearchReturnsMappedToManyAttributes() throws SchemaException
AuditEventRecordPropertyType prop1 = record1.getProperty().get(0);
assertThat(prop1.getName()).isEqualTo("prop1");
assertThat(prop1.getValue()).containsExactly("val1");
// Changed items are not returned, they are used for query only and can be found in deltas.
// Also, they may be stored in wrong format (e.g. "canonicalized").
assertThat(record1.getChangedItem()).isNullOrEmpty();
// for other attributes we just use the size check, fetch mechanism is similar
assertThat(record1.getChangedItem()).hasSize(4);
assertThat(record1.getDelta()).hasSize(3)
.allMatch(d -> d.getObjectDelta() != null);
assertThat(record1.getReference()).hasSize(2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2020 Evolveum and contributors
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand Down Expand Up @@ -949,8 +949,10 @@ public void test300SearchReturnsMappedToManyAttributes() throws SchemaException
AuditEventRecordPropertyType prop1 = record1.getProperty().get(0);
assertThat(prop1.getName()).isEqualTo("prop1");
assertThat(prop1.getValue()).containsExactly("val1");
// Changed items are not returned, they are used for query only and can be found in deltas.
// Also, they may be stored in wrong format (e.g. "canonicalized").
assertThat(record1.getChangedItem()).isNullOrEmpty();
// for other attributes we just use the size check, fetch mechanism is similar
assertThat(record1.getChangedItem()).hasSize(4);
assertThat(record1.getDelta()).hasSize(3)
.allMatch(d -> d.getObjectDelta() != null);
assertThat(record1.getReference()).hasSize(2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 Evolveum and contributors
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand All @@ -10,7 +10,6 @@
import static com.evolveum.midpoint.repo.sql.audit.querymodel.QAuditEventRecord.TABLE_NAME;
import static com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType.*;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand All @@ -25,7 +24,6 @@
import com.evolveum.midpoint.audit.api.AuditEventStage;
import com.evolveum.midpoint.audit.api.AuditEventType;
import com.evolveum.midpoint.prism.PrismReferenceValue;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.repo.sql.audit.beans.MAuditDelta;
import com.evolveum.midpoint.repo.sql.audit.beans.MAuditEventRecord;
Expand All @@ -47,7 +45,6 @@
import com.evolveum.midpoint.xml.ns._public.common.audit_3.*;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

/**
Expand Down Expand Up @@ -159,7 +156,6 @@ protected QAuditEventRecord newAliasInstance(String alias) {
public AuditEventRecordType toSchemaObject(MAuditEventRecord row) {
AuditEventRecordType record = mapSimpleAttributes(row);
mapDeltas(record, row.deltas);
mapChangedItems(record, row.changedItemPaths);
mapRefValues(record, row.refValues);
mapProperties(record, row.properties);
mapResourceOids(record, row.resourceOids);
Expand Down Expand Up @@ -213,17 +209,6 @@ private void mapDeltas(AuditEventRecordType record, List<MAuditDelta> deltas) {
}
}

private void mapChangedItems(AuditEventRecordType record, Collection<String> changedItemPaths) {
if (changedItemPaths == null) {
return;
}

for (String changedItemPath : changedItemPaths) {
ItemPath itemPath = ItemPath.create(changedItemPath);
record.getChangedItem().add(new ItemPathType(itemPath));
}
}

private void mapRefValues(
AuditEventRecordType record, Map<String, List<MAuditRefValue>> refValues) {
if (refValues == null) {
Expand Down

0 comments on commit 7183b1c

Please sign in to comment.