Search in sources :

Example 6 with ExportConfiguration

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

the class ExportPanelUnitTest method saves_to_user_preferences_changes_on_a_custom_configuration.

@Test
public void saves_to_user_preferences_changes_on_a_custom_configuration() throws IOException {
    BriefcasePreferences exportPreferences = new BriefcasePreferences(InMemoryPreferences.empty());
    BriefcasePreferences appPreferences = new BriefcasePreferences(InMemoryPreferences.empty());
    List<FormStatus> formsList = FormStatusBuilder.buildFormStatusList(10);
    initialDefaultConf = ExportConfiguration.empty();
    ExportForms forms = load(initialDefaultConf, formsList, exportPreferences, appPreferences);
    ConfigurationPanel confPanel = ConfigurationPanel.defaultPanel(initialDefaultConf, true, true);
    ExportPanelForm exportPanelForm = ExportPanelForm.from(forms, confPanel);
    new ExportPanel(new TerminationFuture(), forms, exportPanelForm, exportPreferences, Runnable::run, new NoOpAnalytics());
    FormStatus form = formsList.get(0);
    String formId = form.getFormDefinition().getFormId();
    ExportConfiguration conf = ExportConfiguration.empty();
    conf.setExportDir(Paths.get(Files.createTempDirectory("briefcase_test").toUri()));
    assertThat(ExportConfiguration.load(exportPreferences, buildCustomConfPrefix(formId)).getExportDir(), isEmpty());
    forms.putConfiguration(form, conf);
    exportPanelForm.getFormsTable().getViewModel().triggerChange();
    assertThat(ExportConfiguration.load(exportPreferences, buildCustomConfPrefix(formId)).getExportDir(), isPresent());
}
Also used : ExportForms(org.opendatakit.briefcase.export.ExportForms) NoOpAnalytics(org.opendatakit.briefcase.ui.reused.NoOpAnalytics) BriefcasePreferences(org.opendatakit.briefcase.model.BriefcasePreferences) FormStatus(org.opendatakit.briefcase.model.FormStatus) ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration) ConfigurationPanel(org.opendatakit.briefcase.ui.export.components.ConfigurationPanel) TerminationFuture(org.opendatakit.briefcase.model.TerminationFuture) Test(org.junit.Test)

Example 7 with ExportConfiguration

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

the class ConfigurationPanelTest method default_panel_wires_UI_fields_to_the_model.

@Test
public void default_panel_wires_UI_fields_to_the_model() {
    component = ConfigurationPanelPageObject.setUpDefaultPanel(robot(), ExportConfiguration.empty(), true, true);
    component.show();
    component.setSomePemFile();
    component.setSomeExportDir();
    component.setSomeStartDate();
    component.setSomeEndDate();
    component.setPullBefore(true);
    ExportConfiguration conf = component.getConfiguration();
    assertThat(conf.getExportDir(), isPresent());
    assertThat(conf.getPemFile(), isPresent());
    assertThat(conf.getStartDate(), isPresent());
    assertThat(conf.getEndDate(), isPresent());
    assertThat(conf.getPullBefore(), isPresent());
}
Also used : ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration) Test(org.junit.Test)

Aggregations

ExportConfiguration (org.opendatakit.briefcase.export.ExportConfiguration)7 Test (org.junit.Test)5 ExportForms (org.opendatakit.briefcase.export.ExportForms)3 ConfigurationPanel (org.opendatakit.briefcase.ui.export.components.ConfigurationPanel)3 BriefcasePreferences (org.opendatakit.briefcase.model.BriefcasePreferences)2 FormStatus (org.opendatakit.briefcase.model.FormStatus)2 TerminationFuture (org.opendatakit.briefcase.model.TerminationFuture)2 LocalDateTime (java.time.LocalDateTime)1 ISO_DATE_TIME (java.time.format.DateTimeFormatter.ISO_DATE_TIME)1 Collections (java.util.Collections)1 List (java.util.List)1 Executor (java.util.concurrent.Executor)1 Collectors.joining (java.util.stream.Collectors.joining)1 Collectors.toList (java.util.stream.Collectors.toList)1 Stream (java.util.stream.Stream)1 AnnotationProcessor (org.bushe.swing.event.annotation.AnnotationProcessor)1 EventSubscriber (org.bushe.swing.event.annotation.EventSubscriber)1 ExportAction (org.opendatakit.briefcase.export.ExportAction)1 ExportForms.buildCustomConfPrefix (org.opendatakit.briefcase.export.ExportForms.buildCustomConfPrefix)1 BriefcaseFormDefinition (org.opendatakit.briefcase.model.BriefcaseFormDefinition)1