use of org.hisp.dhis.actions.tracker.RelationshipActions in project dhis2-core by dhis2.
the class RelationshipsTest method before.
@BeforeAll
public void before() throws Exception {
relationshipActions = new RelationshipActions();
trackedEntityInstanceActions = new RestApiActions("/trackedEntityInstances");
metadataActions = new MetadataActions();
eventActions = new EventActions();
new LoginActions().loginAsSuperUser();
metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/relationshipTypes.json"));
JsonObject teiObject = new FileReaderUtils().read(new File("src/test/resources/tracker/teis/teis.json")).replacePropertyValuesWithIds("trackedEntityInstance").get(JsonObject.class);
teis = trackedEntityInstanceActions.post(teiObject).extractUids();
JsonObject eventObject = new FileReaderUtils().read(new File("src/test/resources/tracker/events/events.json")).replacePropertyValuesWithIds("event").get(JsonObject.class);
ApiResponse response = eventActions.post(eventObject).validateStatus(200);
events = response.extractUids();
}
use of org.hisp.dhis.actions.tracker.RelationshipActions in project dhis2-core by dhis2.
the class PotentialDuplicatesRelationshipTests method shouldRemoveDuplicateRelationshipWhenAutoMerging.
@Test
public void shouldRemoveDuplicateRelationshipWhenAutoMerging() {
String teiA = createTei();
String teiB = createTei();
String relationship = createRelationship(teiA, teiB).extractImportedRelationships().get(0);
String potentialDuplicate = potentialDuplicatesActions.createAndValidatePotentialDuplicate(teiA, teiB, "OPEN");
potentialDuplicatesActions.autoMergePotentialDuplicate(potentialDuplicate).validate().statusCode(200);
trackerActions.getTrackedEntity(teiA + "?fields=*").validate().statusCode(200).body("relationships", hasSize(0));
new RelationshipActions().get(relationship).validateStatus(404);
}
Aggregations