use of net.geoprism.registry.etl.fhir.FhirResourceProcessor in project geoprism-registry by terraframe.
the class FhirImportTest method testBasicImport.
@Request
@Test
public void testBasicImport() throws InterruptedException {
try {
FhirExternalSystem system = createExternalSystem();
SynchronizationConfig config = createSyncConfig(system);
FhirSyncImportConfig iConfig = (FhirSyncImportConfig) config.buildConfiguration();
FhirResourceProcessor processor = FhirFactory.getProcessor(iConfig.getImplementation());
IParser parser = FhirContext.forR4().newJsonParser();
Bundle bundle = new Bundle();
bundle.addEntry(new BundleEntryComponent().setResource((Resource) parser.parseResource(this.getClass().getResourceAsStream("/fhir/organization.json"))));
bundle.addEntry(new BundleEntryComponent().setResource((Resource) parser.parseResource(this.getClass().getResourceAsStream("/fhir/location.json"))));
FhirResourceImporter importer = new FhirResourceImporter(new BasicFhirConnection(system), processor, null, null);
importer.synchronize(bundle);
ServerGeoObjectIF geoobject = new ServerGeoObjectService().getGeoObjectByCode("USATestDataHsTwo", "USATestDataHealthStop");
geoobject.setDate(new Date());
LocalizedValue displayLabel = geoobject.getDisplayLabel();
Assert.assertEquals("USATestDataHsTwo ZZZZZZZ", displayLabel.getValue());
} finally {
TestDataSet.deleteExternalSystems("FHIRImportTest");
}
}
Aggregations