Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Mar 3, 2023
2 parents 6b94906 + 4d8c924 commit b38b83e
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import java.util.stream.Collectors;
import javax.xml.datatype.XMLGregorianCalendar;

import org.apache.commons.lang3.BooleanUtils;
import com.evolveum.midpoint.schema.util.ConfigurationSpecificationTypeUtil;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.apache.wicket.AttributeModifier;
Expand Down Expand Up @@ -162,7 +163,7 @@ public Component createValueComponent(String id) {
list.add(new DetailsTableItem(createStringResource("PageSimulationResult.productionConfiguration"), () -> {

ConfigurationSpecificationType specification = resultModel.getObject().getConfigurationUsed();
if (specification == null || BooleanUtils.isNotFalse(specification.isProductionConfiguration())) {
if (ConfigurationSpecificationTypeUtil.isProductionConfiguration(specification)) {
return getString("PageSimulationResult.production");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import com.evolveum.midpoint.xml.ns._public.common.common_3.ConfigurationSpecificationType;

import com.evolveum.midpoint.xml.ns._public.common.common_3.PredefinedConfigurationType;

import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
Expand Down Expand Up @@ -89,7 +91,8 @@ public String toString() {

public @NotNull ConfigurationSpecificationType toConfigurationSpecification() {
return new ConfigurationSpecificationType()
.productionConfiguration(productionConfiguration);
.predefined(productionConfiguration ?
PredefinedConfigurationType.PRODUCTION : PredefinedConfigurationType.DEVELOPMENT);
}

enum TaskPersistenceMode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@

import com.evolveum.midpoint.xml.ns._public.common.common_3.ConfigurationSpecificationType;

import com.evolveum.midpoint.xml.ns._public.common.common_3.PredefinedConfigurationType;

import org.jetbrains.annotations.Nullable;

public class ConfigurationSpecificationTypeUtil {

public static boolean isProductionConfiguration(@Nullable ConfigurationSpecificationType configuration) {
return configuration == null
|| !Boolean.FALSE.equals(configuration.isProductionConfiguration());
|| configuration.getPredefined() == null
|| configuration.getPredefined() == PredefinedConfigurationType.PRODUCTION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@
<xsd:complexType name="SimulationResultType">
<xsd:annotation>
<xsd:documentation>
Result of a simulation run. The simulation may have run either on foreground or on background (within a task).
Result of a simulation run. The simulation may run either on foreground or on background, i.e. within a task.
In the latter case, the task run can be suspended and resumed, but the simulation result object stays the same.

(However, note that suspension and resuming is not fully supported now. There can be duplicate information
about objects being processed.)
</xsd:documentation>
<xsd:appinfo>
<a:object/>
Expand All @@ -54,8 +51,6 @@
<xsd:annotation>
<xsd:documentation>
(Expanded) definition of this simulation.

TODO decide about this item
</xsd:documentation>
</xsd:annotation>
</xsd:element>
Expand Down Expand Up @@ -100,7 +95,7 @@
<xsd:element name="configurationUsed" type="tns:ConfigurationSpecificationType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
What (system) configuration was used to run the simulation? E.g. whas that production
What (system) configuration was used to run the simulation? E.g. was that production
or development one?
</xsd:documentation>
</xsd:annotation>
Expand Down Expand Up @@ -1189,31 +1184,62 @@
(For example, just ignoring some parts of it, e.g. some resources.)

For the time being, only rudimentary options are here.

TODO better name
</xsd:documentation>
<xsd:appinfo>
<a:container/>
<a:since>4.7</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="productionConfiguration" type="xsd:boolean" minOccurs="0" default="true">
<xsd:element name="predefined" type="tns:PredefinedConfigurationType" minOccurs="0" default="production">
<xsd:annotation>
<xsd:documentation>
What configuration is used to run the simulation? Production or development one?

- Production usually means `active` and `deprecated` lifecycle states.
- Development usually means `active` and `proposed` states.
Predefined configuration set that we want to use.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>ConfigurationSpecificationType.productionConfiguration</a:displayName>
<a:displayName>ConfigurationSpecificationType.predefined</a:displayName>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="PredefinedConfigurationType">
<xsd:annotation>
<xsd:documentation>
Predefined configuration sets.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumClass/>
<a:since>4.7</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="production">
<xsd:annotation>
<xsd:documentation>
The production configuration set.
It (usually) comprises elements with `active` and `deprecated` lifecycle states.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="PRODUCTION"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="development">
<xsd:annotation>
<xsd:documentation>
The development configuration set.
It (usually) comprises elements with `active` and `proposed` lifecycle states.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="DEVELOPMENT"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="EventMarkDomainType">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1749,8 +1749,22 @@
<xsd:annotation>
<xsd:documentation>
Execution mode for this activity: full, preview, dryRun, none, bucketAnalysis.
TODO move this into "execution" item.
Deprecated. Please use execution/mode instead.
</xsd:documentation>
<xsd:appinfo>
<a:deprecated>true</a:deprecated>
<a:deprecatedSince>4.7</a:deprecatedSince>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="execution" type="tns:ActivityExecutionModeDefinitionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Detailed definition of the execution mode.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.7</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="controlFlow" type="tns:ActivityControlFlowDefinitionType" minOccurs="0">
Expand All @@ -1776,17 +1790,6 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="execution" type="tns:ActivityExecutionDefinitionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Detailed definition of the execution.
TODO better name
</xsd:documentation>
<xsd:appinfo>
<a:since>4.7</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="tailoring" type="tns:ActivitiesTailoringType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -2669,40 +2672,29 @@
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="ActivityExecutionDefinitionType">
<!-- TODO better term should be found; "execution mode" is just too vague. -->
<xsd:complexType name="ActivityExecutionModeDefinitionType">
<xsd:annotation>
<xsd:documentation>
Detailed definition of the execution.
Detailed definition of the execution mode.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.7</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<!-- TODO "mode" will be here. -->
<xsd:element name="configurationToUse" type="tns:ConfigurationSpecificationType" minOccurs="0">
<xsd:element name="mode" type="tns:ExecutionModeType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
What configuration should be used to run the simulation?
Execution mode for this activity: full, preview, dryRun, none, bucketAnalysis, ...
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="createSimulationResult" type="xsd:boolean" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Should we create a simulation result for this activity?

The default value is "true" if simulation definition is present, and "false" otherwise.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="simulationDefinition" type="tns:SimulationDefinitionType" minOccurs="0">
<xsd:element name="configurationToUse" type="tns:ConfigurationSpecificationType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Definition (configuration) of the simulation. May refer to one of global definitions.
If "createSimulationResult" is true and this definition is unspecified, the system default definition
is used.
What configuration should be used? Currently, this is to be used only when simulation (preview) mode is selected.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
Expand Down Expand Up @@ -5900,7 +5892,6 @@
How should the task report its various aspects?
</xsd:documentation>
<xsd:appinfo>
<a:experimentaL>true</a:experimentaL>
<a:container>true</a:container>
<a:since>4.3</a:since>
</xsd:appinfo>
Expand Down Expand Up @@ -5965,6 +5956,16 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="simulationResult" type="tns:ActivitySimulationResultDefinitionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Should the simulation result be created for the activity? If so, how?
</xsd:documentation>
<xsd:appinfo>
<a:since>4.7</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:long"/>
</xsd:complexType>
Expand Down Expand Up @@ -6687,6 +6688,28 @@
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="ActivitySimulationResultDefinitionType">
<xsd:annotation>
<xsd:documentation>
Should the simulation result be created for the activity? If so, how?
</xsd:documentation>
<xsd:appinfo>
<a:since>4.7</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="definition" type="tns:SimulationDefinitionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Definition (configuration) of the simulation result. May refer to one of global definitions.
If none is specified, the system default definition is used.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ObjectSetType">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
</objects>
</recomputation>
</work>
<executionMode>preview</executionMode>e
<execution>
<createSimulationResult>true</createSimulationResult>
<mode>preview</mode>
</execution>
<reporting>
<simulationResult/>
</reporting>
</activity>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import static com.evolveum.midpoint.model.test.util.SynchronizationRequest.SynchronizationStyle.RECONCILIATION;
import static com.evolveum.midpoint.schema.constants.SchemaConstants.ICFS_NAME;
import static com.evolveum.midpoint.test.AbstractIntegrationTest.DEFAULT_SHORT_TASK_WAIT_TIMEOUT;
import static com.evolveum.midpoint.test.IntegrationTestTools.displayXml;

import java.io.IOException;
import java.util.Collection;
Expand Down Expand Up @@ -110,16 +109,18 @@ public String execute(OperationResult result) throws CommonException, IOExceptio
.reconciliation(new ReconciliationWorkDefinitionType()
.resourceObjects(resourceObjectSet));
}
var reporting = new ActivityReportingDefinitionType();
ActivityDefinitionType activityDefinition = new ActivityDefinitionType()
.work(work)
.executionMode(
getBackgroundTaskExecutionMode())
.execution(new ActivityExecutionDefinitionType()
.configurationToUse(new ConfigurationSpecificationType()
.productionConfiguration(
taskExecutionMode.isProductionConfiguration()))
.createSimulationResult(
test.isNativeRepository() && !taskExecutionMode.isFullyPersistent()));
.execution(new ActivityExecutionModeDefinitionType()
.configurationToUse(
taskExecutionMode.toConfigurationSpecification()))
.reporting(reporting);
if (test.isNativeRepository() && !taskExecutionMode.isFullyPersistent()) {
reporting.simulationResult(new ActivitySimulationResultDefinitionType());
}
if (tracingProfile != null) {
ActivityTracingDefinitionType tracing = new ActivityTracingDefinitionType()
.tracingProfile(tracingProfile);
Expand All @@ -132,8 +133,7 @@ public String execute(OperationResult result) throws CommonException, IOExceptio
tracing.getBeforeItemCondition().add(new BeforeItemConditionType()
.expression(ExpressionUtil.forGroovyCode(script)));
}
activityDefinition.reporting(new ActivityReportingDefinitionType()
.tracing(tracing));
reporting.tracing(tracing);
}
TaskType syncTask = new TaskType()
.name(synchronizationStyle.taskName)
Expand Down

0 comments on commit b38b83e

Please sign in to comment.