use of net.geoprism.registry.etl.export.ExportHistory in project geoprism-registry by terraframe.
the class DHIS2ServiceTest method testExportGeoObjects.
@Request
@Test
public void testExportGeoObjects() throws InterruptedException {
SynchronizationConfig config = createSyncConfig(this.system, null);
SynchronizationConfigService service = new SynchronizationConfigService();
JsonObject joHist = service.run(testData.clientSession.getSessionId(), config.getOid());
ExportHistory hist = ExportHistory.get(joHist.get("historyId").getAsString());
SchedulerTestUtils.waitUntilStatus(hist.getOid(), AllJobStatus.SUCCESS);
hist = ExportHistory.get(hist.getOid());
Assert.assertEquals(new Long(1), hist.getWorkTotal());
Assert.assertEquals(new Long(1), hist.getWorkProgress());
Assert.assertEquals(ImportStage.COMPLETE.name(), hist.getStage().get(0).name());
LinkedList<Dhis2Payload> payloads = this.dhis2.getPayloads();
Assert.assertEquals(1, payloads.size());
Dhis2Payload payload = payloads.get(0);
JsonObject data = JsonParser.parseString(payload.getData()).getAsJsonObject();
JsonArray orgUnits = data.get("organisationUnits").getAsJsonArray();
Assert.assertEquals(1, orgUnits.size());
JsonObject orgUnit = orgUnits.get(0).getAsJsonObject();
Assert.assertEquals("AllAttrGO_ALL", orgUnit.get("code").getAsString());
}
Aggregations