Skip to content

Commit

Permalink
Remove deprecated styles of error handling spec
Browse files Browse the repository at this point in the history
Error handling in tasks evolved substantially in 4.0-4.4 period,
and got its current for in new "activity framework" in 4.4. The
previous forms were deprecated, and now are removed.
  • Loading branch information
mederly committed May 25, 2023
1 parent 1adf09d commit c0508aa
Show file tree
Hide file tree
Showing 28 changed files with 30 additions and 706 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ public abstract class SchemaConstants {
public static final ItemName MODEL_EXTENSION_UPDATE_ID_MATCH = new ItemName(NS_MODEL_EXTENSION, "updateIdMatch");

public static final ItemName MODEL_EXTENSION_RETRY_LIVE_SYNC_ERRORS = new ItemName(NS_MODEL_EXTENSION, "retryLiveSyncErrors");
public static final ItemName MODEL_EXTENSION_LIVE_SYNC_ERROR_HANDLING_STRATEGY = new ItemName(NS_MODEL_EXTENSION, "liveSyncErrorHandlingStrategy");
public static final ItemName MODEL_EXTENSION_UPDATE_LIVE_SYNC_TOKEN_IN_DRY_RUN = new ItemName(NS_MODEL_EXTENSION, "updateLiveSyncTokenInDryRun");
public static final ItemName MODEL_EXTENSION_LIVE_SYNC_BATCH_SIZE = new ItemName(NS_MODEL_EXTENSION, "liveSyncBatchSize");
public static final ItemName MODEL_EXTENSION_KIND = new ItemName(NS_MODEL_EXTENSION, "kind");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
<a:operation>moved</a:operation>
<a:replacement>tns:executionState</a:replacement>
</a:schemaMigration>
<a:schemaMigration>
<a:element>tns:errorHandlingStrategy</a:element>
<a:version>4.8</a:version>
<a:operation>removed</a:operation>
</a:schemaMigration>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand Down Expand Up @@ -502,20 +507,6 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="errorHandlingStrategy" type="tns:ActivityErrorHandlingStrategyType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Error handling strategy for this task. EXPERIMENTAL.
DEPRECATED. Set error handling strategy in activity instead.
</xsd:documentation>
<xsd:appinfo>
<a:experimental>true</a:experimental>
<a:since>4.3</a:since>
<a:deprecated>true</a:deprecated>
<a:deprecatedSince>4.4</a:deprecatedSince>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="autoScaling" type="tns:TaskAutoScalingType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@
<xsd:annotation>
<xsd:appinfo>
<a:extension ref="c:TaskType"/>
<a:schemaMigration>
<a:element>tns:liveSyncErrorHandlingStrategy</a:element>
<a:version>4.8</a:version>
<a:operation>removed</a:operation>
</a:schemaMigration>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element ref="tns:freshnessInterval" minOccurs="0"/>
<xsd:element ref="tns:dryRun" minOccurs="0"/>
<xsd:element ref="tns:retryLiveSyncErrors" minOccurs="0"/>
<xsd:element ref="tns:liveSyncErrorHandlingStrategy" minOccurs="0"/>
<xsd:element ref="tns:updateLiveSyncTokenInDryRun" minOccurs="0"/>
<xsd:element ref="tns:lastScanTimestamp" minOccurs="0"/>
<xsd:element ref="tns:lastReconciliationStartTimestamp" minOccurs="0"/>
Expand Down Expand Up @@ -166,23 +170,6 @@
</xsd:annotation>
</xsd:element>

<xsd:element name="liveSyncErrorHandlingStrategy" type="c:ActivityErrorHandlingStrategyType">
<xsd:annotation>
<xsd:documentation>
Specifies a strategy for handling errors during Live Synchronization.
DEPRECATED. Use task.errorHandlingStrategy instead.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>TaskExtension.liveSyncErrorHandlingStrategy</a:displayName>
<a:displayOrder>801</a:displayOrder>
<a:minOccurs>0</a:minOccurs>
<a:maxOccurs>1</a:maxOccurs>
<a:deprecated>true</a:deprecated>
<a:deprecatedSince>4.3</a:deprecatedSince>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>

<xsd:element name="updateLiveSyncTokenInDryRun" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void iterateOverItemsInBucket(OperationResult result) {
}

@Override
public ErrorHandlingStrategyExecutor.@NotNull FollowUpAction getDefaultErrorAction() {
public @NotNull ErrorHandlingStrategyExecutor.FollowUpAction getDefaultErrorAction() {
return ErrorHandlingStrategyExecutor.FollowUpAction.CONTINUE;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.testng.SkipException;
import org.testng.annotations.Test;

import com.evolveum.icf.dummy.resource.*;
Expand Down Expand Up @@ -181,7 +180,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
initLiveSyncTask(TASK_SLOW_MODEL_IMPRECISE, initTask, initResult);
initLiveSyncTask(TASK_BATCHED, initTask, initResult);

addObject(applyLegacyFlag(TASK_BATCHED_IMPRECISE.getFile()), initTask, initResult,
addObject(TASK_BATCHED_IMPRECISE.getFile(), initTask, initResult,
workerThreadsCustomizer(getWorkerThreads()));
// Starting this task results in (expected) exception

Expand All @@ -190,12 +189,10 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
initLiveSyncTask(TASK_DRY_RUN, initTask, initResult);
initLiveSyncTask(TASK_DRY_RUN_WITH_UPDATE, initTask, initResult);

if (!isLegacy()) {
initLiveSyncTask(TASK_NO_POLICY, initTask, initResult);
initLiveSyncTask(TASK_XFER1, initTask, initResult);
initLiveSyncTask(TASK_XFER2, initTask, initResult);
initLiveSyncTask(TASK_MULTI_CHANGES, initTask, initResult);
}
initLiveSyncTask(TASK_NO_POLICY, initTask, initResult);
initLiveSyncTask(TASK_XFER1, initTask, initResult);
initLiveSyncTask(TASK_XFER2, initTask, initResult);
initLiveSyncTask(TASK_MULTI_CHANGES, initTask, initResult);

initLiveSyncTask(TASK_ERRORS_PRECISE_IGNORE, initTask, initResult);
initLiveSyncTask(TASK_ERRORS_PRECISE_IGNORE_PARTIAL_STOP_ON_FATAL, initTask, initResult);
Expand Down Expand Up @@ -225,7 +222,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti

private void initLiveSyncTask(TestResource<TaskType> testResource, Task initTask, OperationResult initResult)
throws java.io.IOException, CommonException {
File taskFile = applyLegacyFlag(testResource.getFile());
File taskFile = testResource.getFile();
PrismObject<TaskType> task = addObject(taskFile, initTask, initResult, workerThreadsCustomizer(getWorkerThreads()));
if (!TaskTypeUtil.isTaskRecurring(task.asObjectable())) {
waitForTaskFinish(testResource.oid, false);
Expand All @@ -234,14 +231,6 @@ private void initLiveSyncTask(TestResource<TaskType> testResource, Task initTask
}
}

private File applyLegacyFlag(File original) {
if (isLegacy()) {
return new File(original.getParent(), "legacy-" + original.getName());
} else {
return original;
}
}

int getWorkerThreads() {
return 0;
}
Expand Down Expand Up @@ -710,9 +699,6 @@ public void test150DryRunWithUpdate() throws Exception {
*/
@Test
public void test200NoPolicy() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}

given();
Task task = getTestTask();
Expand Down Expand Up @@ -763,9 +749,6 @@ public void test200NoPolicy() throws Exception {
*/
@Test
public void test210Xfer1InitialSync() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}
RESOURCE_DUMMY_XFER1_TARGET_DELETABLE.controller.getDummyResource().setOperationDelayOffset(500);
doXferInitialSync(1, TASK_XFER1, RESOURCE_DUMMY_XFER1_SOURCE);
}
Expand All @@ -775,9 +758,6 @@ public void test210Xfer1InitialSync() throws Exception {
*/
@Test
public void test215Xfer2InitialSync() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}
doXferInitialSync(2, TASK_XFER2, RESOURCE_DUMMY_XFER2_SOURCE);
}

Expand Down Expand Up @@ -853,9 +833,6 @@ private void doXferInitialSync(int index, TestResource<TaskType> xferTask, Dummy
*/
@Test
public void test220Xfer1RenameAccounts() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}
TaskAsserter<Void> asserter = doXferRenameAndSync(TASK_XFER1, RESOURCE_DUMMY_XFER1_SOURCE);
assertXfer1StateAfterRename(asserter);
}
Expand Down Expand Up @@ -897,9 +874,6 @@ private void assertXfer1StateAfterRename(TaskAsserter<Void> asserter) {
*/
@Test
public void test225Xfer2RenameAccounts() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}
int t = getWorkerThreads() > 0 ? getWorkerThreads() : 1;
// @formatter:off
doXferRenameAndSync(TASK_XFER2, RESOURCE_DUMMY_XFER2_SOURCE)
Expand Down Expand Up @@ -970,9 +944,6 @@ private TaskAsserter<Void> doXferRenameAndSync(TestResource<TaskType> xferTask,
*/
@Test
public void test230Xfer1RepeatedLiveSync() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}
TaskAsserter<Void> asserter = doXferLiveSync(TASK_XFER1);
assertXfer1StateAfterRename(asserter); // the state is exactly the same as after previous live sync
}
Expand All @@ -984,9 +955,6 @@ public void test230Xfer1RepeatedLiveSync() throws Exception {
*/
@Test
public void test235Xfer2RepeatedLiveSync() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}
// @formatter:off
if (getWorkerThreads() > 0) {
doXferLiveSync(TASK_XFER2)
Expand Down Expand Up @@ -1036,9 +1004,6 @@ public void test235Xfer2RepeatedLiveSync() throws Exception {
*/
@Test
public void test240TestAffinityController() throws Exception {
if (isLegacy()) {
throw new SkipException("Not in legacy");
}
given();
Task task = getTestTask();
OperationResult result = task.getResult();
Expand Down Expand Up @@ -1437,11 +1402,7 @@ private void deleteShadows(ObjectQuery query, OperationResult result) throws Sch
}
}

protected boolean isLegacy() {
return false;
}

private Consumer<PrismObject<TaskType>> workerThreadsCustomizer(int threads) {
return rootActivityWorkerThreadsCustomizer(threads, isLegacy());
return rootActivityWorkerThreadsCustomizer(threads, false);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit c0508aa

Please sign in to comment.