Search in sources :

Example 1 with ExportEvent

use of org.opendatakit.briefcase.export.ExportEvent in project briefcase by opendatakit.

the class ExportPanelUnitTest method saves_to_user_preferences_the_last_successful_export_date_for_a_form.

@Test
public void saves_to_user_preferences_the_last_successful_export_date_for_a_form() {
    List<FormStatus> formsList = FormStatusBuilder.buildFormStatusList(10);
    BriefcasePreferences inMemoryPrefs = new BriefcasePreferences(InMemoryPreferences.empty());
    initialDefaultConf = empty().build();
    ExportForms forms = load(initialDefaultConf, formsList, inMemoryPrefs);
    ExportPanelForm exportPanelForm = ExportPanelForm.from(forms, inMemoryPrefs, inMemoryPrefs, initialDefaultConf);
    new ExportPanel(forms, exportPanelForm, inMemoryPrefs, inMemoryPrefs, inMemoryPrefs, new NoOpAnalytics(), FormCache.empty(), new FakeHttp(), new InMemoryFormMetadataAdapter());
    FormStatus form = formsList.get(0);
    String formId = form.getFormDefinition().getFormId();
    assertThat(inMemoryPrefs.nullSafeGet(buildExportDateTimePrefix(formId)), isEmpty());
    FormDefinition formDef = FormDefinition.from((BriefcaseFormDefinition) form.getFormDefinition());
    ExportEvent event = ExportEvent.successForm(formDef, 10);
    forms.appendStatus(event);
    assertThat(inMemoryPrefs.nullSafeGet(buildExportDateTimePrefix(formId)), isPresent());
}
Also used : ExportForms(org.opendatakit.briefcase.export.ExportForms) NoOpAnalytics(org.opendatakit.briefcase.ui.reused.NoOpAnalytics) BriefcasePreferences(org.opendatakit.briefcase.model.BriefcasePreferences) InMemoryFormMetadataAdapter(org.opendatakit.briefcase.model.form.InMemoryFormMetadataAdapter) ExportEvent(org.opendatakit.briefcase.export.ExportEvent) FormStatus(org.opendatakit.briefcase.model.FormStatus) FakeHttp(org.opendatakit.briefcase.reused.http.FakeHttp) FormDefinition(org.opendatakit.briefcase.export.FormDefinition) BriefcaseFormDefinition(org.opendatakit.briefcase.model.BriefcaseFormDefinition) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ExportEvent (org.opendatakit.briefcase.export.ExportEvent)1 ExportForms (org.opendatakit.briefcase.export.ExportForms)1 FormDefinition (org.opendatakit.briefcase.export.FormDefinition)1 BriefcaseFormDefinition (org.opendatakit.briefcase.model.BriefcaseFormDefinition)1 BriefcasePreferences (org.opendatakit.briefcase.model.BriefcasePreferences)1 FormStatus (org.opendatakit.briefcase.model.FormStatus)1 InMemoryFormMetadataAdapter (org.opendatakit.briefcase.model.form.InMemoryFormMetadataAdapter)1 FakeHttp (org.opendatakit.briefcase.reused.http.FakeHttp)1 NoOpAnalytics (org.opendatakit.briefcase.ui.reused.NoOpAnalytics)1