Skip to content

Commit

Permalink
Adapt TestReconTask to changes in statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jun 19, 2021
1 parent ead3c14 commit 6389cf8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.model.api.ModelPublicConstants;

import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -158,11 +160,15 @@ public void test110AddDummyGreenAccountMancomb() throws Exception {
assertThat(getOrig(provisioningStatistics.getEntry().get(0).getResourceRef().getTargetName())).isEqualTo("Dummy Resource Green");
assertThat(provisioningStatistics.getEntry().get(0).getOperation()).isNotEmpty(); // search and sometimes get

Integer itemsProcessed = TaskOperationStatsUtil.getItemsProcessed(stats);

// MID-6930: We should process exactly 1 item even for partitioned reconciliation:
// mancomb must not be processed in the 3rd part!
assertThat(itemsProcessed).as("items processed").isEqualTo(1);
assertPerformance(syncTaskOid, "progress")
.display()
.child(ModelPublicConstants.RECONCILIATION_RESOURCE_OBJECTS_ID)
.assertItemsProcessed(1)
.end()
.child(ModelPublicConstants.RECONCILIATION_REMAINING_SHADOWS_ID)
.assertItemsProcessed(0);
}

// notifications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.repo.common.activity.TaskActivityManager;
import com.evolveum.midpoint.repo.common.task.work.BucketingManager;
import com.evolveum.midpoint.schema.statistics.*;
import com.evolveum.midpoint.schema.util.task.TaskProgressInformation;
Expand Down Expand Up @@ -163,6 +164,7 @@ public abstract class AbstractModelIntegrationTest extends AbstractIntegrationTe
protected static final String LOG_PREFIX_DENY = "SSSSS=- ";
protected static final String LOG_PREFIX_ALLOW = "SSSSS=+ ";

@Autowired protected TaskActivityManager activityManager;
@Autowired protected ModelService modelService;
@Autowired protected ModelInteractionService modelInteractionService;
@Autowired protected ModelDiagnosticService modelDiagnosticService;
Expand Down Expand Up @@ -6459,4 +6461,18 @@ protected void modifyResourceMaintenance(String resourceOid, AdministrativeAvail
provisioningService.modifyObject(ResourceType.class, objectDelta.getOid(),
objectDelta.getModifications(), null, null, task, result);
}

protected ActivityProgressInformationAsserter<Void> assertProgress(String rootOid, String message)
throws SchemaException, ObjectNotFoundException {
return assertProgress(
activityManager.getProgressInformation(rootOid, getTestOperationResult()),
message);
}

protected ActivityPerformanceInformationAsserter<Void> assertPerformance(String rootOid, String message)
throws SchemaException, ObjectNotFoundException {
return assertPerformance(
activityManager.getPerformanceInformation(rootOid, getTestOperationResult()),
message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private void treatOperationResultAfterOperation() {
}
}

private int getWorkerThreadsCount() {
private int getWorkerThreadsCount() { // TODO use distribution definition!
PrismProperty<Integer> workerThreadsPrismProperty = coordinatorTask
.getExtensionPropertyOrClone(SchemaConstants.MODEL_EXTENSION_WORKER_THREADS);
if (workerThreadsPrismProperty != null && workerThreadsPrismProperty.getRealValue() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
repoAdd(USER_ADMINISTRATOR, initResult);
}

// TODO deduplicate with model integration test
protected ActivityProgressInformationAsserter<Void> assertProgress(String rootOid, String message)
throws SchemaException, ObjectNotFoundException {
return assertProgress(
activityManager.getProgressInformation(rootOid, getTestOperationResult()),
message);
}

// TODO deduplicate with model integration test
protected ActivityPerformanceInformationAsserter<Void> assertPerformance(String rootOid, String message)
throws SchemaException, ObjectNotFoundException {
return assertPerformance(
Expand Down

0 comments on commit 6389cf8

Please sign in to comment.