Skip to content

Commit

Permalink
Many fixes to activation, parallelism, test improvements. Work in pro…
Browse files Browse the repository at this point in the history
…gress. (MID-4154)
  • Loading branch information
semancik committed Sep 27, 2017
1 parent eeec5d9 commit 56489a8
Show file tree
Hide file tree
Showing 28 changed files with 1,606 additions and 463 deletions.
44 changes: 37 additions & 7 deletions infra/common/src/main/java/com/evolveum/midpoint/common/Clock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2014 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,13 +37,19 @@ public class Clock {
private static final Trace LOGGER = TraceManager.getTrace(Clock.class);

private Long override = null;
// TODO: more sophisticated functions
private Long overrideOffset = null;

public long currentTimeMillis() {
if (override != null) {
return override;
long time;
if (override == null) {
time = System.currentTimeMillis();
} else {
time = override;
}
return System.currentTimeMillis();
if (overrideOffset != null) {
time = time + overrideOffset;
}
return time;
}

public XMLGregorianCalendar currentTimeXMLGregorianCalendar() {
Expand Down Expand Up @@ -80,19 +86,43 @@ public void override(XMLGregorianCalendar overrideTimestamp) {
override(XmlTypeConverter.toMillis(overrideTimestamp));
}

/**
* Extends offset on top of existing offset.
*/
public void overrideDuration(String durationString) {
overrideDuration(XmlTypeConverter.createDuration(durationString));
}

/**
* Extends offset on top of existing offset.
*/
public void overrideDuration(Duration duration) {
XMLGregorianCalendar time = currentTimeXMLGregorianCalendar();
long millis = currentTimeMillis();
XMLGregorianCalendar time = XmlTypeConverter.createXMLGregorianCalendar(millis);
time.add(duration);
override(time);
long offset = XmlTypeConverter.toMillis(time) - millis;
overrideDuration(offset);
}

/**
* Extends offset on top of existing offset.
*/
public void overrideDuration(Long offsetMillis) {
if (overrideOffset == null) {
overrideOffset = offsetMillis;
} else {
overrideOffset = overrideOffset + offsetMillis;
}
}

public void overrideOffset(Long offsetMillis) {
this.overrideOffset = offsetMillis;
}

public void resetOverride() {
LOGGER.info("Clock override reset");
this.override = null;
this.overrideOffset = null;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Clock current time: {}", currentTimeXMLGregorianCalendar());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ public static void applyTo(Collection<? extends ItemDelta> deltas, PrismContaine
delta.applyTo(propertyContainerValue);
}
}

public static void applyToMatchingPath(Collection<? extends ItemDelta> deltas, PrismContainer propertyContainer)
throws SchemaException {
for (ItemDelta delta : deltas) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,30 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="lastProvisioningTimestamp" type="xsd:dateTime" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<p>
The timestamp last provisioning operation that was based on this object.
E.g. the timestamp of last modificaiton od any account based on the
data from the user. This valus is only updated if there was any
real change in the resource.
</p>
<p>
This meta-datum is used as an informational property that tells when
the data were last synchronized in outbound direction. But it has another
imporatant role. It is used indirectly to trigger optimistic locking
conflicts that are used to detect a "clean" recompute (i.e. recompute
that is processing data without any outside interaction).
</p>
</xsd:documentation>
<xsd:appinfo>
<a:operational>true</a:operational>
<a:since>3.6.1</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>

<!-- The following certification-related items might be enabled in the future.

<xsd:element name="certificationStartedTimestamp" type="xsd:dateTime" minOccurs="0">
Expand Down Expand Up @@ -11778,6 +11802,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6.1</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
Expand All @@ -11792,6 +11817,7 @@
<xsd:appinfo>
<a:container/>
<a:since>3.6.1</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
Expand Down Expand Up @@ -11830,6 +11856,7 @@
<xsd:appinfo>
<jaxb:typesafeEnumClass/>
<a:since>3.6.1</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
Expand All @@ -11853,6 +11880,16 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="restart">
<xsd:annotation>
<xsd:documentation>
Operation should be restarted.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="RESTART"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="recompute">
<xsd:annotation>
<xsd:documentation>
Expand All @@ -11863,6 +11900,16 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="reconcile">
<xsd:annotation>
<xsd:documentation>
The focus object should be recomputed and all projections reconciled.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="RECONCILE"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="fail">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -14306,6 +14353,21 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="focusConflictResolution" type="tns:ConflictResolutionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
A method to resolve conflicts on focus objects. This specifies how will the
processors handle optimistic locking conflicts - and whether they even try
to detect them. The default value is null, which means that there is no reaction
to conflicts and that the conflicts are not even detected.
Note that different default conflict resolution may be specified in system configuration.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6.1</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="modelExecuteOptions" type="tns:ModelExecuteOptionsType"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ public static void displayCleanup(String testName) {
System.out.println(TEST_OUT_SECTION_PREFIX + " CLEANUP " + testName + TEST_OUT_SECTION_SUFFIX);
LOGGER.info(TEST_LOG_SECTION_PREFIX + " CLEANUP " + testName + TEST_LOG_SECTION_SUFFIX);
}

public static void displaySkip(String testName) {
System.out.println(TEST_OUT_SECTION_PREFIX + " SKIP " + testName + TEST_OUT_SECTION_SUFFIX);
LOGGER.info(TEST_LOG_SECTION_PREFIX + " SKIP " + testName + TEST_LOG_SECTION_SUFFIX);
}

public static void info(String message) {
System.out.println(TEST_OUT_SECTION_PREFIX + message + TEST_OUT_SECTION_SUFFIX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


import com.evolveum.midpoint.schema.AbstractOptions;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ConflictResolutionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationBusinessContextType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PartialProcessingOptionsType;
Expand Down Expand Up @@ -134,6 +135,18 @@ public class ModelExecuteOptions extends AbstractOptions implements Serializable
* this option only if there is reasonable assumption that the request will stop after INITIAL phase.
*/
private PartialProcessingOptionsType initialPartialProcessing;

/**
* A method to resolve conflicts on focus objects. This specifies how will the processors handle
* optimistic locking conflicts - and whether they even try to detect them. The default value is
* null, which means that there is no reaction to conflicts and that the conflicts are not even
* detected.
*
* Note that different default conflict resolution may be specified in system configuration.
*
* EXPERIMENTAL
*/
private ConflictResolutionType focusConflictResolution;

public Boolean getForce() {
return force;
Expand Down Expand Up @@ -536,6 +549,28 @@ public static ModelExecuteOptions createInitialPartialProcessing(PartialProcessi
return opts;
}

public ConflictResolutionType getFocusConflictResolution() {
return focusConflictResolution;
}

public void setFocusConflictResolution(ConflictResolutionType focusConflictResolution) {
this.focusConflictResolution = focusConflictResolution;
}

public static ConflictResolutionType getFocusConflictResolution(ModelExecuteOptions options) {
if (options == null) {
return null;
}
return options.getFocusConflictResolution();
}

public static ModelExecuteOptions createFocusConflictResolution(ConflictResolutionType focusConflictResolution) {
ModelExecuteOptions opts = new ModelExecuteOptions();
opts.setFocusConflictResolution(focusConflictResolution);
return opts;
}


public ModelExecuteOptionsType toModelExecutionOptionsType() {
ModelExecuteOptionsType retval = new ModelExecuteOptionsType();
retval.setForce(force);
Expand All @@ -551,6 +586,7 @@ public ModelExecuteOptionsType toModelExecutionOptionsType() {
// preAuthorized is purposefully omitted (security reasons)
retval.setRequestBusinessContext(requestBusinessContext);
retval.setPartialProcessing(partialProcessing);
retval.setFocusConflictResolution(focusConflictResolution);
return retval;
}

Expand All @@ -572,6 +608,7 @@ public static ModelExecuteOptions fromModelExecutionOptionsType(ModelExecuteOpti
// preAuthorized is purposefully omitted (security reasons)
retval.setRequestBusinessContext(type.getRequestBusinessContext());
retval.setPartialProcessing(type.getPartialProcessing());
retval.setFocusConflictResolution(type.getFocusConflictResolution());
return retval;
}

Expand Down Expand Up @@ -633,6 +670,7 @@ public String toString() {
appendFlag(sb, "requestBusinessContext", requestBusinessContext == null ? null : true);
appendVal(sb, "partialProcessing", format(partialProcessing));
appendVal(sb, "initialPartialProcessing", format(initialPartialProcessing));
appendVal(sb, "focusConflictResolution", focusConflictResolution);
removeLastComma(sb);
sb.append(")");
return sb.toString();
Expand Down
Loading

0 comments on commit 56489a8

Please sign in to comment.