Search in sources :

Example 1 with TracingProfileType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType in project midpoint by Evolveum.

the class TestModelServiceContract method test103GetAccountRaw.

/**
 * MID-6716
 */
@Test
public void test103GetAccountRaw() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult parentResult = task.getResult();
    preTestCleanup(AssignmentPolicyEnforcementType.POSITIVE);
    Collection<SelectorOptions<GetOperationOptions>> options = schemaService.getOperationOptionsBuilder().raw().build();
    when();
    // Just to avoid result pruning.
    CompiledTracingProfile tracingProfile = tracer.compileProfile(new TracingProfileType(prismContext).createTraceFile(false), parentResult);
    OperationResult result = parentResult.subresult("get").tracingProfile(tracingProfile).build();
    PrismObject<ShadowType> account = modelService.getObject(ShadowType.class, accountJackOid, options, task, result);
    then();
    display("Account", account);
    displayDumpable("Account def", account.getDefinition());
    assertCounterIncrement(InternalCounters.SHADOW_FETCH_OPERATION_COUNT, 0);
    PrismContainer<Containerable> accountContainer = account.findContainer(ShadowType.F_ATTRIBUTES);
    displayDumpable("Account attributes def", accountContainer.getDefinition());
    displayDumpable("Account attributes def complex type def", accountContainer.getDefinition().getComplexTypeDefinition());
    assertDummyAccountShadowRepo(account, accountJackOid, "jack");
    assertSuccess("getObject result", result);
    assertSteadyResources();
    displayDumpable("result", result);
    List<String> provisioningOperations = result.getResultStream().map(OperationResult::getOperation).filter(operation -> operation.startsWith(ProvisioningService.class.getName())).collect(Collectors.toList());
    assertThat(provisioningOperations).as("provisioning operations").isEmpty();
}
Also used : DirtiesContext(org.springframework.test.annotation.DirtiesContext) StringUtils(org.apache.commons.lang.StringUtils) OperationsPerformanceMonitor(com.evolveum.midpoint.util.statistics.OperationsPerformanceMonitor) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) BreakMode(com.evolveum.icf.dummy.resource.BreakMode) Test(org.testng.annotations.Test) com.evolveum.midpoint.util.exception(com.evolveum.midpoint.util.exception) OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) DOMUtil(com.evolveum.midpoint.util.DOMUtil) Collections.singleton(java.util.Collections.singleton) PrismTestUtil(com.evolveum.midpoint.prism.util.PrismTestUtil) AbstractStatisticsPrinter(com.evolveum.midpoint.schema.statistics.AbstractStatisticsPrinter) MiscSchemaUtil(com.evolveum.midpoint.schema.util.MiscSchemaUtil) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) com.evolveum.midpoint.prism(com.evolveum.midpoint.prism) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) Channel(com.evolveum.midpoint.schema.constants.Channel) PrismAsserts(com.evolveum.midpoint.prism.util.PrismAsserts) Collection(java.util.Collection) TEXT(com.evolveum.midpoint.schema.statistics.AbstractStatisticsPrinter.Format.TEXT) MiscUtil(com.evolveum.midpoint.util.MiscUtil) Task(com.evolveum.midpoint.task.api.Task) Collectors(java.util.stream.Collectors) List(java.util.List) ProvisioningService(com.evolveum.midpoint.provisioning.api.ProvisioningService) com.evolveum.midpoint.prism.delta(com.evolveum.midpoint.prism.delta) QName(javax.xml.namespace.QName) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) RawType(com.evolveum.prism.xml.ns._public.types_3.RawType) CompiledTracingProfile(com.evolveum.midpoint.schema.result.CompiledTracingProfile) AssertJUnit(org.testng.AssertJUnit) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) StaticExpressionUtil(com.evolveum.midpoint.common.StaticExpressionUtil) OperationsPerformanceInformationUtil(com.evolveum.midpoint.schema.statistics.OperationsPerformanceInformationUtil) SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyResourceContoller(com.evolveum.midpoint.test.DummyResourceContoller) AuditEventStage(com.evolveum.midpoint.audit.api.AuditEventStage) ArrayList(java.util.ArrayList) IntegrationTestTools(com.evolveum.midpoint.test.IntegrationTestTools) TestUtil(com.evolveum.midpoint.test.util.TestUtil) ModelExecuteOptions(com.evolveum.midpoint.model.api.ModelExecuteOptions) ObjectFactory(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) InternalCounters(com.evolveum.midpoint.schema.internals.InternalCounters) ProvisioningScriptSpec(com.evolveum.midpoint.test.ProvisioningScriptSpec) ClassMode(org.springframework.test.annotation.DirtiesContext.ClassMode) JAXBElement(javax.xml.bind.JAXBElement) InternalMonitor(com.evolveum.midpoint.schema.internals.InternalMonitor) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) File(java.io.File) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Message(com.evolveum.midpoint.notifications.api.transports.Message) ItemName(com.evolveum.midpoint.prism.path.ItemName) com.evolveum.midpoint.schema.processor(com.evolveum.midpoint.schema.processor) ShadowUtil(com.evolveum.midpoint.schema.util.ShadowUtil) ContextConfiguration(org.springframework.test.context.ContextConfiguration) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) ObjectDeltaOperation(com.evolveum.midpoint.schema.ObjectDeltaOperation) TIME(com.evolveum.midpoint.schema.statistics.AbstractStatisticsPrinter.SortBy.TIME) Collections(java.util.Collections) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) CompiledTracingProfile(com.evolveum.midpoint.schema.result.CompiledTracingProfile) ProvisioningService(com.evolveum.midpoint.provisioning.api.ProvisioningService) Test(org.testng.annotations.Test)

Example 2 with TracingProfileType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType in project midpoint by Evolveum.

the class ExecuteChangeOptionsPanel method createTracingRadioChoicesFragment.

private Fragment createTracingRadioChoicesFragment(String componentId) {
    Fragment fragment = new Fragment(componentId, ID_TRACING_CONTAINER, ExecuteChangeOptionsPanel.this);
    RadioChoice<TracingProfileType> tracingProfile = new RadioChoice<>(ID_TRACING, PropertyModel.of(ExecuteChangeOptionsPanel.this.getModel(), ExecuteChangeOptionsDto.F_TRACING), PropertyModel.of(ExecuteChangeOptionsPanel.this.getModel(), ExecuteChangeOptionsDto.F_TRACING_CHOICES), createTracinnChoiceRenderer());
    fragment.add(tracingProfile);
    AjaxLink<Void> resetChoices = new AjaxLink<>(ID_RESET_CHOICES) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            ExecuteChangeOptionsPanel.this.getModelObject().setTracing(null);
            target.add(ExecuteChangeOptionsPanel.this);
        }
    };
    fragment.add(resetChoices);
    return fragment;
}
Also used : TracingProfileType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) Fragment(org.apache.wicket.markup.html.panel.Fragment) RadioChoice(org.apache.wicket.markup.html.form.RadioChoice)

Example 3 with TracingProfileType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType in project midpoint by Evolveum.

the class ExecuteChangeOptionsPanel method initLayout.

private void initLayout() {
    setOutputMarkupId(true);
    createContainer(ID_FORCE_CONTAINER, new PropertyModel<>(getModel(), ExecuteChangeOptionsDto.F_FORCE), FORCE_LABEL, FORCE_HELP, true);
    createContainer(ID_RECONCILE_CONTAINER, new PropertyModel<>(getModel(), ExecuteChangeOptionsDto.F_RECONCILE), RECONCILE_LABEL, RECONCILE_HELP, showReconcile);
    createContainer(ID_RECONCILE_AFFECTED_CONTAINER, new PropertyModel<>(getModel(), ExecuteChangeOptionsDto.F_RECONCILE_AFFECTED), RECONCILE_AFFECTED_LABEL, RECONCILE_AFFECTED_HELP, showReconcileAffected);
    createContainer(ID_EXECUTE_AFTER_ALL_APPROVALS_CONTAINER, new PropertyModel<>(getModel(), ExecuteChangeOptionsDto.F_EXECUTE_AFTER_ALL_APPROVALS), EXECUTE_AFTER_ALL_APPROVALS_LABEL, EXECUTE_AFTER_ALL_APPROVALS_HELP, true);
    createContainer(ID_KEEP_DISPLAYING_RESULTS_CONTAINER, new PropertyModel<>(getModel(), ExecuteChangeOptionsDto.F_KEEP_DISPLAYING_RESULTS), KEEP_DISPLAYING_RESULTS_LABEL, KEEP_DISPLAYING_RESULTS_HELP, showKeepDisplayingResults, true);
    createContainer(ID_SAVE_IN_BACKGROUND_CONTAINER, new PropertyModel<>(getModel(), ExecuteChangeOptionsDto.F_SAVE_IN_BACKGROUND), SAVE_IN_BACKGROUND_LABEL, SAVE_IN_BACKGROUND_HELP, showKeepDisplayingResults, true);
    boolean canRecordTrace;
    try {
        canRecordTrace = getPageBase().isAuthorized(ModelAuthorizationAction.RECORD_TRACE.getUrl());
    } catch (Throwable t) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't check trace recording authorization", t);
        canRecordTrace = false;
    }
    WebMarkupContainer tracingContainer = new WebMarkupContainer(ID_TRACING_CONTAINER);
    tracingContainer.setVisible(canRecordTrace && WebModelServiceUtils.isEnableExperimentalFeature(getPageBase()));
    add(tracingContainer);
    DropDownChoice tracing = new DropDownChoice<>(ID_TRACING, PropertyModel.of(getModel(), ExecuteChangeOptionsDto.F_TRACING), PropertyModel.of(getModel(), ExecuteChangeOptionsDto.F_TRACING_CHOICES), new IChoiceRenderer<TracingProfileType>() {

        private static final long serialVersionUID = 1L;

        @Override
        public Object getDisplayValue(TracingProfileType profile) {
            if (profile == null) {
                return "(none)";
            } else if (profile.getDisplayName() != null) {
                return profile.getDisplayName();
            } else if (profile.getName() != null) {
                return profile.getName();
            } else {
                return "(unnamed profile)";
            }
        }

        @Override
        public String getIdValue(TracingProfileType object, int index) {
            return String.valueOf(index);
        }

        @Override
        public TracingProfileType getObject(String id, IModel<? extends List<? extends TracingProfileType>> choices) {
            return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null;
        }
    });
    tracing.setNullValid(true);
    tracingContainer.add(tracing);
}
Also used : TracingProfileType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice)

Example 4 with TracingProfileType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType in project midpoint by Evolveum.

the class ItemProcessingMonitor method startTracing.

private void startTracing(@NotNull ActivityTracingDefinitionType tracingDefinition) {
    tracingDefinitionUsed = tracingDefinition;
    // This is on debug level because we may start tracing "just for sure" (with low overhead)
    // and write trace only if after-condition is true.
    LOGGER.debug("Starting tracing for object number {}", activityRun.getItemsProcessed());
    TracingProfileType configuredProfile = tracingDefinition.getTracingProfile();
    List<TracingRootType> configuredPoints = tracingDefinition.getTracingPoint();
    TracingProfileType profile = configuredProfile != null ? configuredProfile : activityRun.getBeans().tracer.getDefaultProfile();
    Collection<TracingRootType> points = !configuredPoints.isEmpty() ? configuredPoints : List.of(TracingRootType.ACTIVITY_ITEM_PROCESSING);
    points.forEach(workerTask::addTracingRequest);
    workerTask.setTracingProfile(profile);
}
Also used : TracingProfileType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType) TracingRootType(com.evolveum.midpoint.xml.ns._public.common.common_3.TracingRootType)

Aggregations

TracingProfileType (com.evolveum.midpoint.xml.ns._public.common.common_3.TracingProfileType)2 BreakMode (com.evolveum.icf.dummy.resource.BreakMode)1 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)1 AuditEventStage (com.evolveum.midpoint.audit.api.AuditEventStage)1 StaticExpressionUtil (com.evolveum.midpoint.common.StaticExpressionUtil)1 ModelExecuteOptions (com.evolveum.midpoint.model.api.ModelExecuteOptions)1 Message (com.evolveum.midpoint.notifications.api.transports.Message)1 com.evolveum.midpoint.prism (com.evolveum.midpoint.prism)1 com.evolveum.midpoint.prism.delta (com.evolveum.midpoint.prism.delta)1 ItemName (com.evolveum.midpoint.prism.path.ItemName)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)1 PrismAsserts (com.evolveum.midpoint.prism.util.PrismAsserts)1 PrismTestUtil (com.evolveum.midpoint.prism.util.PrismTestUtil)1 ProvisioningService (com.evolveum.midpoint.provisioning.api.ProvisioningService)1 GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)1 ObjectDeltaOperation (com.evolveum.midpoint.schema.ObjectDeltaOperation)1 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)1 Channel (com.evolveum.midpoint.schema.constants.Channel)1