use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.
the class EventFiltersTest method beforeAll.
@BeforeAll
public void beforeAll() {
eventFiltersActions = new RestApiActions("/eventFilters");
new LoginActions().loginAsSuperUser();
}
use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.
the class RelationshipsTests method beforeAll.
@BeforeAll
public void beforeAll() throws Exception {
teiActions = new TEIActions();
metadataActions = new MetadataActions();
relationshipTypeActions = new RestApiActions("/relationshipTypes");
loginActions.loginAsSuperUser();
metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/relationshipTypes.json"));
teis = importTeis();
events = importEvents();
}
use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.
the class ProgramRemovalTest method beforeEach.
@BeforeEach
public void beforeEach() throws Exception {
programActions = new ProgramActions();
relationshipTypeActions = new RestApiActions("/relationshipTypes");
new LoginActions().loginAsSuperUser();
setupData();
}
use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.
the class DataGenerator method generateObjectMatchingSchema.
public static JsonObject generateObjectMatchingSchema(List<SchemaProperty> schemaProperties) {
JsonObject objectBody = new JsonObject();
for (SchemaProperty prop : schemaProperties) {
JsonElement element;
if (prop.getPropertyType() == PropertyType.REFERENCE) {
List<SchemaProperty> referenceProperties = new SchemasActions().getRequiredProperties(prop.getName());
JsonObject referenceObject = generateObjectMatchingSchema(referenceProperties);
String uid = new RestApiActions(prop.getRelativeApiEndpoint()).post(referenceObject).extractUid();
referenceObject.addProperty("id", uid);
element = referenceObject;
} else if (prop.getPropertyType() == PropertyType.IDENTIFIER) {
if (!StringUtils.containsAny(prop.getName(), "id", "uid", "code")) {
Schema schema = new SchemasActions().getSchema(prop.getName());
JsonObject referenceObject = generateObjectMatchingSchema(schema.getRequiredProperties());
String uid = new RestApiActions(schema.getPlural()).post(referenceObject).extractUid();
element = new JsonPrimitive(uid);
} else {
element = new JsonPrimitive(new IdGenerator().generateUniqueId());
}
} else {
element = generateRandomValueMatchingSchema(prop);
}
objectBody.add(prop.getName(), element);
}
return objectBody;
}
use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.
the class LoginTests method preconditions.
@BeforeAll
public void preconditions() {
oauth2Clients = new RestApiActions("/oAuth2Clients");
uaaActions = new UaaActions();
loginActions = new LoginActions();
userActions = new UserActions();
loginActions.loginAsSuperUser();
addOAuthClient();
userActions.addUser(userName, password);
}
Aggregations