use of org.hisp.dhis.tracker.domain.Enrollment in project dhis2-core by dhis2.
the class AssignValueImplementerTest method getEnrollmentWithAttributeSet.
private Enrollment getEnrollmentWithAttributeSet() {
Enrollment enrollment = new Enrollment();
enrollment.setEnrollment(FIRST_ENROLLMENT_ID);
enrollment.setStatus(EnrollmentStatus.ACTIVE);
enrollment.setAttributes(getAttributes());
return enrollment;
}
use of org.hisp.dhis.tracker.domain.Enrollment in project dhis2-core by dhis2.
the class StrategyPreProcessorTest method setUp.
@BeforeEach
void setUp() {
tei = new TrackedEntityInstance();
tei.setUid(TEI_UID);
trackedEntity = new TrackedEntity();
trackedEntity.setTrackedEntity(TEI_UID);
newTrackedEntity = new TrackedEntity();
newTrackedEntity.setTrackedEntity(NEW_TEI_UID);
pi = new ProgramInstance();
pi.setUid(ENROLLMENT_UID);
enrollment = new Enrollment();
enrollment.setEnrollment(ENROLLMENT_UID);
newEnrollment = new Enrollment();
newEnrollment.setEnrollment(NEW_ENROLLMENT_UID);
psi = new ProgramStageInstance();
psi.setUid(EVENT_UID);
event = new Event();
event.setEvent(EVENT_UID);
newEvent = new Event();
newEvent.setEvent(NEW_EVENT_UID);
relationship = new Relationship();
relationship.setUid(RELATIONSHIP_UID);
payloadRelationship = new org.hisp.dhis.tracker.domain.Relationship();
payloadRelationship.setRelationship(RELATIONSHIP_UID);
newPayloadRelationship = new org.hisp.dhis.tracker.domain.Relationship();
newPayloadRelationship.setRelationship(NEW_RELATIONSHIP_UID);
Mockito.when(preheat.getTrackedEntity(TrackerIdScheme.UID, TEI_UID)).thenReturn(tei);
Mockito.when(preheat.getEnrollment(TrackerIdScheme.UID, ENROLLMENT_UID)).thenReturn(pi);
Mockito.when(preheat.getEvent(TrackerIdScheme.UID, EVENT_UID)).thenReturn(psi);
Mockito.when(preheat.getRelationship(TrackerIdScheme.UID, payloadRelationship)).thenReturn(relationship);
}
use of org.hisp.dhis.tracker.domain.Enrollment in project dhis2-core by dhis2.
the class FileResourceSupplierTest method getEnrollment.
private Enrollment getEnrollment() {
Attribute attribute = new Attribute();
attribute.setAttribute(FILE_RESOURCE_ATTRIBUTE_UID);
attribute.setValueType(ValueType.FILE_RESOURCE);
attribute.setValue(ANOTHER_FILE_RESOURCE_UID);
Enrollment enrollment = new Enrollment();
enrollment.setAttributes(Lists.newArrayList(attribute));
return enrollment;
}
use of org.hisp.dhis.tracker.domain.Enrollment in project dhis2-core by dhis2.
the class ShowErrorWarningImplementerTest method getEnrollments.
private List<Enrollment> getEnrollments() {
Enrollment activeEnrollment = new Enrollment();
activeEnrollment.setEnrollment(ACTIVE_ENROLLMENT_ID);
activeEnrollment.setStatus(EnrollmentStatus.ACTIVE);
Enrollment completedEnrollment = new Enrollment();
completedEnrollment.setEnrollment(COMPLETED_ENROLLMENT_ID);
completedEnrollment.setStatus(EnrollmentStatus.COMPLETED);
return Lists.newArrayList(activeEnrollment, completedEnrollment);
}
use of org.hisp.dhis.tracker.domain.Enrollment in project dhis2-core by dhis2.
the class TrackerSideEffectDataBundleTest method testSideEffectDataBundleForEnrollment.
@Test
void testSideEffectDataBundleForEnrollment() {
Enrollment enrollment = new Enrollment();
enrollment.setEnrollment("test-enrollment");
Map<String, List<TrackerRuleEngineSideEffect>> enrollmentRuleEffects = new HashMap<>();
enrollmentRuleEffects.put(enrollment.getEnrollment(), Lists.newArrayList());
ProgramInstance programInstance = new ProgramInstance();
programInstance.setAutoFields();
TrackerSideEffectDataBundle bundle = TrackerSideEffectDataBundle.builder().enrollmentRuleEffects(enrollmentRuleEffects).accessedBy("testUser").importStrategy(TrackerImportStrategy.CREATE).object(programInstance.getUid()).klass(ProgramInstance.class).build();
assertEquals(programInstance.getUid(), bundle.getObject());
assertEquals(ProgramInstance.class, bundle.getKlass());
assertTrue(bundle.getEnrollmentRuleEffects().containsKey("test-enrollment"));
assertTrue(bundle.getEventRuleEffects().isEmpty());
assertEquals(TrackerImportStrategy.CREATE, bundle.getImportStrategy());
assertEquals(MessageType.TRACKER_SIDE_EFFECT, bundle.getMessageType());
}
Aggregations