use of org.hisp.dhis.actions.metadata.TrackedEntityTypeActions in project dhis2-core by dhis2.
the class PotentialDuplicatesMergeTests method shouldNotMergeDifferentTypeTeis.
@Test
public void shouldNotMergeDifferentTypeTeis() {
String trackedEntityType = new TrackedEntityTypeActions().create();
String teiA = createTei(Constants.TRACKED_ENTITY_TYPE);
String teiB = createTei(trackedEntityType);
String potentialDuplicate = potentialDuplicatesActions.createAndValidatePotentialDuplicate(teiA, teiB, "OPEN");
potentialDuplicatesActions.autoMergePotentialDuplicate(potentialDuplicate).validate().statusCode(409).body("message", Matchers.containsString("Entities have different Tracked Entity Types"));
}
use of org.hisp.dhis.actions.metadata.TrackedEntityTypeActions in project dhis2-core by dhis2.
the class TeiValidationTests method setupData.
private void setupData() {
TrackedEntityAttributeActions trackedEntityAttributeActions = new TrackedEntityAttributeActions();
ProgramActions programActions = new ProgramActions();
TrackedEntityTypeActions trackedEntityTypeActions = new TrackedEntityTypeActions();
trackedEntityType = trackedEntityTypeActions.create();
// create attributes
uniqueTetAttribute = trackedEntityAttributeActions.create("TEXT", true);
mandatoryTetAttribute = trackedEntityAttributeActions.create("TEXT");
mandatoryProgramAttribute = trackedEntityAttributeActions.create("TEXT");
attributeWithOptionSet = trackedEntityAttributeActions.createOptionSetAttribute("ZGkmoWb77MW");
trackedEntityTypeActions.addAttribute(trackedEntityType, mandatoryTetAttribute, true);
trackedEntityTypeActions.addAttribute(trackedEntityType, attributeWithOptionSet, false);
trackedEntityTypeActions.addAttribute(trackedEntityType, uniqueTetAttribute, false);
// create a program
program = programActions.createTrackerProgram(trackedEntityType, Constants.ORG_UNIT_IDS).extractUid();
programActions.addAttribute(program, mandatoryProgramAttribute, true);
}
use of org.hisp.dhis.actions.metadata.TrackedEntityTypeActions in project dhis2-core by dhis2.
the class TeiUpdateTests method shouldNotUpdateImmutableProperties.
@Test
public void shouldNotUpdateImmutableProperties() throws Exception {
// arrange
String tei = importTei();
String trackedEntityType = new TrackedEntityTypeActions().create();
JsonObject body = trackerActions.getTrackedEntity(tei).getBodyAsJsonBuilder().addProperty("trackedEntity", tei).addProperty("trackedEntityType", trackedEntityType).wrapIntoArray("trackedEntities");
// assert
trackerActions.postAndGetJobReport(body, new QueryParamsBuilder().add("importStrategy=UPDATE")).validateErrorReport().body("errorCode", Matchers.hasItem("E1126")).body("message", Matchers.hasItem(Matchers.containsString("trackedEntityType")));
}
Aggregations