Search in sources :

Example 1 with SynchronizationConfigService

use of net.geoprism.registry.service.SynchronizationConfigService in project geoprism-registry by terraframe.

the class FhirImportTest method setUp.

@Before
public void setUp() {
    testData.setUpInstanceData();
    syncService = new SynchronizationConfigService();
    testData.logIn(USATestData.USER_NPS_RA);
}
Also used : SynchronizationConfigService(net.geoprism.registry.service.SynchronizationConfigService) Before(org.junit.Before)

Example 2 with SynchronizationConfigService

use of net.geoprism.registry.service.SynchronizationConfigService in project geoprism-registry by terraframe.

the class DHIS2ServiceTest method testApplySyncConfig.

@Request
@Test
public void testApplySyncConfig() throws Exception {
    SynchronizationConfig config = createSyncConfig(this.system, null, false);
    SynchronizationConfigService service = new SynchronizationConfigService();
    JsonObject json = config.toJSON();
    json.remove("oid");
    JsonObject configToJson = service.apply(testData.clientSession.getSessionId(), json.toString());
    String oid = configToJson.get(SynchronizationConfig.OID).getAsString();
    SynchronizationConfig.get(oid);
}
Also used : SynchronizationConfigService(net.geoprism.registry.service.SynchronizationConfigService) JsonObject(com.google.gson.JsonObject) SynchronizationConfig(net.geoprism.registry.SynchronizationConfig) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 3 with SynchronizationConfigService

use of net.geoprism.registry.service.SynchronizationConfigService 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());
}
Also used : JsonArray(com.google.gson.JsonArray) ExportHistory(net.geoprism.registry.etl.export.ExportHistory) SynchronizationConfigService(net.geoprism.registry.service.SynchronizationConfigService) JsonObject(com.google.gson.JsonObject) SynchronizationConfig(net.geoprism.registry.SynchronizationConfig) Dhis2Payload(net.geoprism.registry.etl.DHIS2TestService.Dhis2Payload) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

SynchronizationConfigService (net.geoprism.registry.service.SynchronizationConfigService)3 JsonObject (com.google.gson.JsonObject)2 Request (com.runwaysdk.session.Request)2 SynchronizationConfig (net.geoprism.registry.SynchronizationConfig)2 Test (org.junit.Test)2 JsonArray (com.google.gson.JsonArray)1 Dhis2Payload (net.geoprism.registry.etl.DHIS2TestService.Dhis2Payload)1 ExportHistory (net.geoprism.registry.etl.export.ExportHistory)1 Before (org.junit.Before)1