use of org.opendatakit.briefcase.reused.http.FakeHttp 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.reused.http.FakeHttp 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.reused.http.FakeHttp in project briefcase by opendatakit.
the class BriefcaseVersionManagerTest method knows_if_we_are_up_to_date.
@Test
public void knows_if_we_are_up_to_date() {
FakeHttp http = new FakeHttp();
http.stub(get(url("https://api.github.com/repos/getodk/briefcase/releases/latest")).build(), ResponseHelpers.ok("{\"tag_name\":\"v2.0.0\"}"));
BriefcaseVersionManager versionManager = new BriefcaseVersionManager(http, "v2.0.0");
assertThat(versionManager.isUpToDate(), is(true));
}
use of org.opendatakit.briefcase.reused.http.FakeHttp in project briefcase by opendatakit.
the class BriefcaseVersionManagerTest method knows_if_we_are_not_up_to_date.
@Test
public void knows_if_we_are_not_up_to_date() {
FakeHttp http = new FakeHttp();
http.stub(get(url("https://api.github.com/repos/getodk/briefcase/releases/latest")).build(), ResponseHelpers.ok("{\"tag_name\":\"v2.0.0\"}"));
BriefcaseVersionManager versionManager = new BriefcaseVersionManager(http, "v1.6.0");
assertThat(versionManager.isUpToDate(), is(false));
}
use of org.opendatakit.briefcase.reused.http.FakeHttp in project briefcase by opendatakit.
the class PullFromAggregateTest method init.
@Before
public void init() throws IOException {
Files.createDirectories(briefcaseDir);
prefs = new BriefcasePreferences(InMemoryPreferences.empty());
prefs.setStorageDir(tmpDir);
http = new FakeHttp();
events = new ArrayList<>();
tracker = new PullFromAggregateTracker(form, e -> events.add(e.getStatusString()));
pullOp = new PullFromAggregate(http, server, briefcaseDir, includeIncomplete, e -> {
}, new InMemoryFormMetadataAdapter());
runnerStatus = new TestRunnerStatus(false);
}
Aggregations