Source:
private Long createProgramEnrollmentTestTask() { TaskTriggerInformation triggerInformation = new TaskTriggerInformation("CREATE SettingsRecord", "data-services", MDS_CHANNEL_NAME, VERSION, TRIGGER_SUBJECT, TRIGGER_SUBJECT); TaskActionInformation actionInformation = new TaskActionInformation("Create Program Enrollment [" + DEFAULT_CONFIG_NAME + "]", OPENMRS_CHANNEL_NAME, OPENMRS_CHANNEL_NAME, VERSION, TEST_INTERFACE, "createProgramEnrollment"); actionInformation.setSubject(String.format("createProgramEnrollment.%s", DEFAULT_CONFIG_NAME)); SortedSet<TaskConfigStep> taskConfigStepSortedSet = new TreeSet<>(); taskConfigStepSortedSet.add(createProgramEnrollmentDataSource()); TaskConfig taskConfig = new TaskConfig(); taskConfig.addAll(taskConfigStepSortedSet); Map<String, String> values = new HashMap<>(); values.put(Keys.PATIENT_UUID, "{{ad.openMRS.ProgramEnrollment-" + DEFAULT_CONFIG_NAME + "#0.patient.uuid}}"); values.put(Keys.PROGRAM_UUID, "{{ad.openMRS.ProgramEnrollment-" + DEFAULT_CONFIG_NAME + "#0.program.uuid}}"); values.put(Keys.DATE_ENROLLED, new DateTime("2010-01-16T00:00:00Z").toString()); values.put(Keys.DATE_COMPLETED, new DateTime("2016-01-16T00:00:00Z").toString()); values.put(Keys.LOCATION_NAME, locationService.getLocations(DEFAULT_CONFIG_NAME, DEFAULT_LOCATION_NAME).get(0).toString()); values.put(Keys.CONFIG_NAME, DEFAULT_CONFIG_NAME); actionInformation.setValues(values); Task task = new Task("OpenMRSProgramEnrollmentTestTask", triggerInformation, Arrays.asList(actionInformation), taskConfig, true, true); getTaskService().save(task); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); return task.getId(); }

Target:
private Long createProgramEnrollmentTestTask() { TaskTriggerInformation triggerInformation = new TaskTriggerInformation("CREATE SettingsRecord", "data-services", MDS_CHANNEL_NAME, VERSION, TRIGGER_SUBJECT, TRIGGER_SUBJECT); TaskActionInformation actionInformation = new TaskActionInformation("Create Program Enrollment [" + DEFAULT_CONFIG_NAME + "]", OPENMRS_CHANNEL_NAME, OPENMRS_CHANNEL_NAME, VERSION, TEST_INTERFACE, "createProgramEnrollment"); actionInformation.setSubject(String.format("createProgramEnrollment.%s", DEFAULT_CONFIG_NAME)); SortedSet<TaskConfigStep> taskConfigStepSortedSet = new TreeSet<>(); taskConfigStepSortedSet.add(createProgramEnrollmentDataSource()); TaskConfig taskConfig = new TaskConfig(); taskConfig.addAll(taskConfigStepSortedSet); Map<String, String> values = new HashMap<>(); values.put(Keys.PATIENT_UUID, "{{ad.openMRS.ProgramEnrollment-" + DEFAULT_CONFIG_NAME + "#0.patient.uuid}}"); values.put(Keys.PROGRAM_UUID, "{{ad.openMRS.ProgramEnrollment-" + DEFAULT_CONFIG_NAME + "#0.program.uuid}}"); values.put(Keys.DATE_ENROLLED, new DateTime("2010-01-16T00:00:00Z").toString()); values.put(Keys.DATE_COMPLETED, new DateTime("2016-01-16T00:00:00Z").toString()); values.put(Keys.LOCATION_NAME, locationService.getLocations(DEFAULT_CONFIG_NAME, DEFAULT_LOCATION_NAME).get(0).toString()); values.put(Keys.CONFIG_NAME, DEFAULT_CONFIG_NAME); actionInformation.setValues(values); Task task = new Task("OpenMRSProgramEnrollmentTestTask", triggerInformation, Collections.singletonList(actionInformation), taskConfig, true, true); getTaskService().save(task); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); return task.getId(); }