Search in sources :

Example 1 with SchemaCsvWriter

use of org.activityinfo.server.endpoint.rest.SchemaCsvWriter in project activityinfo by bedatadriven.

the class GetSchemaTest method toCSV.

@Test
public void toCSV() throws IOException {
    int databaseId = 1;
    SchemaCsvWriter writer = new SchemaCsvWriter(getDispatcherSync());
    writer.write(databaseId);
    System.out.println(writer.toString());
}
Also used : SchemaCsvWriter(org.activityinfo.server.endpoint.rest.SchemaCsvWriter) Test(org.junit.Test)

Example 2 with SchemaCsvWriter

use of org.activityinfo.server.endpoint.rest.SchemaCsvWriter in project activityinfo by bedatadriven.

the class SchemaImporterV2Test method syria.

@Test
public void syria() throws IOException {
    UserDatabaseDTO syria = doImport("schema_1064.csv");
    int activityId = syria.getActivities().get(0).getId();
    ActivityFormDTO cash = execute(new GetActivityForm(activityId));
    for (AttributeGroupDTO group : cash.getAttributeGroups()) {
        System.out.println(group.getName());
    }
    assertThat(cash.getName(), equalTo("1.Provision of urgent cash assistance"));
    assertThat(cash.getAttributeGroups().size(), equalTo(3));
    SchemaCsvWriter writer = new SchemaCsvWriter(getDispatcherSync());
    writer.write(syria.getId());
    Files.write(writer.toString(), TestOutput.getFile(getClass(), "syria", ".csv"), Charsets.UTF_8);
}
Also used : AttributeGroupDTO(org.activityinfo.legacy.shared.model.AttributeGroupDTO) SchemaCsvWriter(org.activityinfo.server.endpoint.rest.SchemaCsvWriter) ActivityFormDTO(org.activityinfo.legacy.shared.model.ActivityFormDTO) UserDatabaseDTO(org.activityinfo.legacy.shared.model.UserDatabaseDTO) GetActivityForm(org.activityinfo.legacy.shared.command.GetActivityForm) Test(org.junit.Test)

Aggregations

SchemaCsvWriter (org.activityinfo.server.endpoint.rest.SchemaCsvWriter)2 Test (org.junit.Test)2 GetActivityForm (org.activityinfo.legacy.shared.command.GetActivityForm)1 ActivityFormDTO (org.activityinfo.legacy.shared.model.ActivityFormDTO)1 AttributeGroupDTO (org.activityinfo.legacy.shared.model.AttributeGroupDTO)1 UserDatabaseDTO (org.activityinfo.legacy.shared.model.UserDatabaseDTO)1