@@ -1150,21 +1150,16 @@ public void should_set_title_to_existing_value_if_dmn_evaluates_to_empty_when_ex
11501150
11511151 @ Test
11521152 public void should_reconfigure_camunda_task_attributes_after_validation_reconfigure_flag () {
1153+
1154+ int numberOfAttempts = 2 ;
11531155 String roleAssignmentId = UUID .randomUUID ().toString ();
11541156 Map <String , String > additionalProperties = Map .of (
11551157 "roleAssignmentId" , roleAssignmentId
11561158 );
1157- TestVariables taskVariables = taskFunctionalTestsApiUtils .getCommon ()
1158- .setupWATaskWithAdditionalPropertiesAndRetrieveIds (
1159- additionalProperties ,
1160- "requests/ccd/wa_case_data_fixed_hearing_date.json" ,
1161- "reconfigTaskAttributesTask"
1162- );
1159+ TestVariables taskVariables = initiateTaskUntilProcessCategoryProtectionIsTrue (additionalProperties ,
1160+ numberOfAttempts );
11631161 String taskId = taskVariables .getTaskId ();
11641162
1165- taskFunctionalTestsInitiationUtils .initiateTask (
1166- taskVariables , userWithCaseManagerRole .getHeaders (), additionalProperties );
1167-
11681163 await ().untilAsserted (() -> {
11691164 Response result = taskFunctionalTestsApiUtils .getRestApiActions ().get (
11701165 "/task/{task-id}" ,
@@ -1182,6 +1177,7 @@ public void should_reconfigure_camunda_task_attributes_after_validation_reconfig
11821177 "task.additional_properties" , equalTo (Map .of (
11831178 "key1" , "value1" ,
11841179 "key2" , "value1" ,
1180+ "processCategoryProtection" , "true" ,
11851181 "roleAssignmentId" , roleAssignmentId
11861182 ))
11871183 );
@@ -1259,13 +1255,62 @@ public void should_reconfigure_camunda_task_attributes_after_validation_reconfig
12591255 "task.additional_properties" , equalTo (Map .of (
12601256 "key1" , "value1" ,
12611257 "key2" , "reconfigValue2" ,
1258+ "processCategoryProtection" , "true" ,
12621259 "roleAssignmentId" , roleAssignmentId
12631260 ))
12641261 );
12651262 });
12661263 taskFunctionalTestsApiUtils .getCommon ().cleanUpTask (taskId );
12671264 }
12681265
1266+ private TestVariables initiateTaskUntilProcessCategoryProtectionIsTrue (Map <String , String > additionalProperties ,
1267+ int numberOfAttempts ) {
1268+ for (int attempt = 1 ; attempt <= numberOfAttempts ; attempt ++) {
1269+ TestVariables taskVariables = taskFunctionalTestsApiUtils .getCommon ()
1270+ .setupWATaskWithAdditionalPropertiesAndRetrieveIds (
1271+ additionalProperties ,
1272+ "requests/ccd/wa_case_data_fixed_hearing_date.json" ,
1273+ "reconfigTaskAttributesTask"
1274+ );
1275+
1276+ taskFunctionalTestsInitiationUtils .initiateTask (
1277+ taskVariables , userWithCaseManagerRole .getHeaders (), additionalProperties );
1278+
1279+ Response result = taskFunctionalTestsApiUtils .getRestApiActions ().get (
1280+ "/task/{task-id}" ,
1281+ taskVariables .getTaskId (),
1282+ userWithCaseManagerRole .getHeaders ()
1283+ );
1284+
1285+ result .then ().assertThat ()
1286+ .statusCode (HttpStatus .OK .value ())
1287+ .and ().contentType (MediaType .APPLICATION_JSON_VALUE )
1288+ .and ().body ("task.id" , equalTo (taskVariables .getTaskId ()));
1289+
1290+ Map <String , String > taskAdditionalProperties = result .then ().extract ().path ("task.additional_properties" );
1291+ String processCategoryProtection = taskAdditionalProperties == null
1292+ ? null
1293+ : taskAdditionalProperties .get ("processCategoryProtection" );
1294+
1295+ if ("true" .equals (processCategoryProtection )) {
1296+ return taskVariables ;
1297+ }
1298+
1299+ log .info (
1300+ "Retrying setup for task {} because additional_properties.{} was '{}'" ,
1301+ taskVariables .getTaskId (),
1302+ "processCategoryProtection" ,
1303+ processCategoryProtection
1304+ );
1305+ taskFunctionalTestsApiUtils .getCommon ().cleanUpTask (taskVariables .getTaskId ());
1306+ }
1307+
1308+ throw new AssertionError (
1309+ "Unable to initiate task with additional_properties. processCategoryProtection = true after "
1310+ + numberOfAttempts + " attempts"
1311+ );
1312+ }
1313+
12691314 @ Test
12701315 public void should_set_additional_properties_to_null_if_dmn_evaluates_to_empty_when_executed_for_reconfigure () {
12711316
@@ -1567,4 +1612,3 @@ private static String formatDate(int year, int month, int day, int hour) {
15671612 }
15681613
15691614}
1570-
0 commit comments