use of org.opendatakit.briefcase.model.form.InMemoryFormMetadataAdapter in project briefcase by opendatakit.
the class PullFromAggregateIntegrationTest method setUp.
@Before
public void setUp() throws IOException {
Files.createDirectories(briefcaseDir);
prefs = new BriefcasePreferences(InMemoryPreferences.empty());
prefs.setStorageDir(tmpDir);
server = httpServer(serverPort);
tracker = new PullFromAggregateTracker(form, e -> {
});
formMetadataPort = new InMemoryFormMetadataAdapter();
pullOp = new PullFromAggregate(CommonsHttp.of(1), aggregateServer, briefcaseDir, true, e -> {
}, formMetadataPort);
runnerStatus = new TestRunnerStatus(false);
}
use of org.opendatakit.briefcase.model.form.InMemoryFormMetadataAdapter in project briefcase by opendatakit.
the class PullFromCentralIntegrationTest method setUp.
@Before
public void setUp() {
server = httpServer(serverPort);
formMetadataPort = new InMemoryFormMetadataAdapter();
pullOp = new PullFromCentral(CommonsHttp.of(1), centralServer, briefcaseDir, token, e -> {
}, formMetadataPort);
}
use of org.opendatakit.briefcase.model.form.InMemoryFormMetadataAdapter in project briefcase by opendatakit.
the class PushToCentralTest method setUp.
@Before
public void setUp() throws IOException {
http = new FakeHttp();
briefcaseDir = createTempDirectory("briefcase-test-");
pushOp = new PushToCentral(http, server, briefcaseDir, token, this::onEvent);
events = new ArrayList<>();
runnerStatus = new TestRunnerStatus(false);
tracker = new PushToCentralTracker(formStatus, this::onEvent);
form = installForm(formStatus, getResourcePath("/org/opendatakit/briefcase/push/aggregate/push-form-test.xml"), briefcaseDir);
formAttachment = installFormAttachment(formStatus, getResourcePath("/org/opendatakit/briefcase/push/aggregate/sparrow.png"), briefcaseDir);
submission = installSubmission(formStatus, getResourcePath("/org/opendatakit/briefcase/push/aggregate/submission.xml"), briefcaseDir);
submissionAttachment = installSubmissionAttachment(formStatus, getResourcePath("/org/opendatakit/briefcase/push/aggregate/1556532531101.jpg"), briefcaseDir, instanceId);
formMetadataPort = new InMemoryFormMetadataAdapter();
FormKey key = FormKey.from(formStatus);
FormMetadata metadata = FormMetadata.of(key, formStatus.getFormDir(briefcaseDir), briefcaseDir);
formMetadataPort.persist(metadata);
}
use of org.opendatakit.briefcase.model.form.InMemoryFormMetadataAdapter 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 {
List<FormStatus> formsList = new ArrayList<>();
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());
exportPanelForm.setDefaultConf(empty().setExportDir(Paths.get(Files.createTempDirectory("briefcase_test").toUri())).build());
assertThat(load(inMemoryPrefs).getExportDir(), notNullValue());
}
use of org.opendatakit.briefcase.model.form.InMemoryFormMetadataAdapter in project briefcase by opendatakit.
the class ExportToCsvScenario method runExport.
void runExport(boolean overwrite, boolean exportMedia, LocalDate startDate, LocalDate endDate, Path pemFile, boolean splitSelectMultiples) {
ExportConfiguration configuration = ExportConfiguration.Builder.empty().setExportDir(outputDir.resolve("new")).setPemFile(pemFile).setStartDate(startDate).setEndDate(endDate).setOverwriteFiles(overwrite).setExportMedia(exportMedia).setSplitSelectMultiples(splitSelectMultiples).build();
FormKey formKey = FormKey.of(formDef.getFormName(), formDef.getFormId());
FormMetadata formMetadata = new FormMetadata(formKey, briefcaseDir, formDef.getFormDir().resolve(stripIllegalChars(formDef.getFormName()) + ".xml"), true, Cursor.empty(), Optional.empty(), Collections.emptySet());
ExportToCsv.export(new InMemoryFormMetadataAdapter(), formMetadata, formStatus, formDef, briefcaseDir, configuration);
}
Aggregations