Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Oct 1, 2017
2 parents 68476c1 + 2814088 commit 2435ca1
Show file tree
Hide file tree
Showing 78 changed files with 3,085 additions and 1,138 deletions.
44 changes: 37 additions & 7 deletions infra/common/src/main/java/com/evolveum/midpoint/common/Clock.java
@@ -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
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
Expand Up @@ -494,7 +494,7 @@ private static JAXBElement<String> copyOfStringElement(final JAXBElement<String>
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((any == null) ? 0 : any.hashCode());
result = prime * result + ((any == null || any.isEmpty()) ? 0 : any.hashCode());
result = prime * result + ((norm == null) ? 0 : norm.hashCode());
result = prime * result + ((orig == null) ? 0 : orig.hashCode());
return result;
Expand Down
114 changes: 114 additions & 0 deletions infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd
Expand Up @@ -923,6 +923,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 @@ -1771,6 +1795,13 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="secondaryGroup" type="tns:TaskExecutionGroupConstraintType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
TODO
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="allowedNode" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -1805,6 +1836,37 @@
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="TaskExecutionGroupConstraintType"> <!-- TODO type name -->
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="group" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
TODO
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="groupTaskLimit" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Number of tasks within the group that can be executed at once (clusterwide). Default is "unlimited".
This parameter will be moved into separate task group object in a later version of midPoint.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="OperationStatsType">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -11825,6 +11887,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 @@ -11839,6 +11902,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 @@ -11877,6 +11941,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 @@ -11900,6 +11965,28 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="error">
<xsd:annotation>
<xsd:documentation>
Operation should be end with an error.
This is a recoverable error (precondition failed).
TODO: align with "fail"
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="ERROR"/>
</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 @@ -11910,11 +11997,23 @@
</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>
The whole operation should fail. This is to be used mainly for testing purposes,
to check if conflict detection algorithm does not yield false positive results.
This fails with a system error. This is a definitive, non-recoverable fauilure.
TODO: align with "error"
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="FAIL"/>
Expand Down Expand Up @@ -14353,6 +14452,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
Expand Up @@ -635,12 +635,92 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="executionTasks" minOccurs="0" type="tns:WfExecutionTasksConfigurationType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:experimental>true</a:experimental>
<a:since>3.6.1</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="primaryChangeProcessor" minOccurs="0" type="tns:PrimaryChangeProcessorConfigurationType" />
<xsd:element name="generalChangeProcessor" minOccurs="0" type="tns:GeneralChangeProcessorConfigurationType" />
</xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="LegacyApproversSpecificationUsageType">
<xsd:complexType name="WfExecutionTasksConfigurationType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:experimental>true</a:experimental>
<a:since>3.6.1</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="serialization" type="tns:WfExecutionTasksSerializationType" minOccurs="0" >
<xsd:annotation>
<xsd:documentation>
TODO
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="executionConstraints" type="tns:TaskExecutionConstraintsType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
TODO
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="WfExecutionTasksSerializationType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:experimental>true</a:experimental>
<a:since>3.6.1</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="enabled" type="xsd:boolean" minOccurs="0" default="true">
<xsd:annotation>
<xsd:documentation>
Whether this feature is enabled. Default is true if "serialization" element is present; false otherwise.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="retryAfter" type="xsd:duration" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Interval after which the execution task is to be rescheduled in case of conflict. Default is 10 seconds.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="groupPrefix" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
TODO
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="LegacyApproversSpecificationUsageType">
<xsd:annotation>
<xsd:documentation>
How to deal with legacy approvers specifications, i.e. approvalRef, approvalExpression, approvalSchema,
Expand Down
Expand Up @@ -101,7 +101,7 @@ public static void assertFocusDefinition(ComplexTypeDefinition complexTypeDefini
assertFalse("Metadata is runtime", metadataContainer.isRuntimeSchema());
assertFalse("Metadata is dynamic", metadataContainer.isDynamic());
assertTrue("Metadata is NOT operational", metadataContainer.isOperational());
assertEquals("Metadata size", 12, metadataContainer.getDefinitions().size());
assertEquals("Metadata size", 13, metadataContainer.getDefinitions().size());

PrismReferenceDefinition tenantRefDef = complexTypeDefinition.findItemDefinition(UserType.F_TENANT_REF, PrismReferenceDefinition.class);
PrismAsserts.assertDefinition(tenantRefDef, UserType.F_TENANT_REF, ObjectReferenceType.COMPLEX_TYPE, 0, 1);
Expand Down
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

0 comments on commit 2435ca1

Please sign in to comment.