use of org.opendatakit.briefcase.ui.reused.NoOpAnalytics in project briefcase by opendatakit.
the class ExportPanelUnitTest method saves_to_user_preferences_changes_on_the_default_configuration.
@Test
public void saves_to_user_preferences_changes_on_the_default_configuration() throws IOException {
BriefcasePreferences exportPreferences = new BriefcasePreferences(InMemoryPreferences.empty());
BriefcasePreferences appPreferences = new BriefcasePreferences(InMemoryPreferences.empty());
initialDefaultConf = ExportConfiguration.empty();
ExportForms forms = load(initialDefaultConf, new ArrayList<>(), exportPreferences, appPreferences);
ConfigurationPanel confPanel = ConfigurationPanel.defaultPanel(initialDefaultConf, false, true);
new ExportPanel(new TerminationFuture(), forms, ExportPanelForm.from(forms, confPanel), exportPreferences, Runnable::run, new NoOpAnalytics());
assertThat(ExportConfiguration.load(exportPreferences).getExportDir(), isEmpty());
confPanel.getForm().setExportDir(Paths.get(Files.createTempDirectory("briefcase_test").toUri()));
assertThat(ExportConfiguration.load(exportPreferences).getExportDir(), isPresent());
}
use of org.opendatakit.briefcase.ui.reused.NoOpAnalytics in project briefcase by opendatakit.
the class ExportPanelPageObject method setUp.
static ExportPanelPageObject setUp(Robot robot) {
ExportPanel exportPanel = GuiActionRunner.execute(() -> {
ExportPanel ep = ExportPanel.from(new TerminationFuture(), new BriefcasePreferences(InMemoryPreferences.empty()), new BriefcasePreferences(InMemoryPreferences.empty()), Runnable::run, new NoOpAnalytics());
ep.updateForms();
return ep;
});
JFrame testFrame = GuiActionRunner.execute(() -> {
JFrame f = new JFrame();
f.add(exportPanel.getForm().getContainer());
return f;
});
FrameFixture window = new FrameFixture(robot, testFrame);
return new ExportPanelPageObject(exportPanel, window);
}
use of org.opendatakit.briefcase.ui.reused.NoOpAnalytics 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() {
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);
new ExportPanel(new TerminationFuture(), forms, ExportPanelForm.from(forms, confPanel), exportPreferences, Runnable::run, new NoOpAnalytics());
FormStatus form = formsList.get(0);
String formId = form.getFormDefinition().getFormId();
assertThat(exportPreferences.nullSafeGet(buildExportDateTimePrefix(formId)), isEmpty());
forms.appendStatus(form.getFormDefinition(), "some status update", true);
assertThat(exportPreferences.nullSafeGet(buildExportDateTimePrefix(formId)), isPresent());
}
use of org.opendatakit.briefcase.ui.reused.NoOpAnalytics 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());
}
Aggregations