public void Setup() { TestApplicationContext.TestAssembly = typeof(TestRelatedPersonResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); this.m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); var testConfiguration = new FhirServiceConfigurationSection { Resources = new List <string> { "Patient" }, OperationHandlers = new List <TypeReferenceConfiguration>(), ExtensionHandlers = new List <TypeReferenceConfiguration>(), ProfileHandlers = new List <TypeReferenceConfiguration>(), MessageHandlers = new List <TypeReferenceConfiguration> { new TypeReferenceConfiguration(typeof(BirthPlaceExtension)) } }; using (AuthenticationContext.EnterSystemContext()) { FhirResourceHandlerUtil.Initialize(testConfiguration, this.m_serviceManager); ExtensionUtil.Initialize(testConfiguration); } }
public void Setup() { TestApplicationContext.TestAssembly = typeof(TestOrganizationResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); TestApplicationContext.Current.AddBusinessRule <Core.Model.Roles.Patient>(typeof(SamplePatientBusinessRulesService)); var testConfiguration = new FhirServiceConfigurationSection { Resources = new List <string> { "Patient" }, MessageHandlers = new List <TypeReferenceConfiguration> { new TypeReferenceConfiguration(typeof(PatientResourceHandler)) } }; using (AuthenticationContext.EnterSystemContext()) { FhirResourceHandlerUtil.Initialize(testConfiguration, m_serviceManager); ExtensionUtil.Initialize(testConfiguration); } }
public void Setup() { // Force load of the DLL var p = FbCharset.Ascii; TestApplicationContext.TestAssembly = typeof(TestRelatedPersonResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); this.m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); var testConfiguration = new FhirServiceConfigurationSection { Resources = new List <string> { "Encounter", "Bundle", "Patient", "Organization" }, OperationHandlers = new List <TypeReferenceConfiguration>(), ExtensionHandlers = new List <TypeReferenceConfiguration>(), ProfileHandlers = new List <TypeReferenceConfiguration>(), MessageHandlers = new List <TypeReferenceConfiguration> { new TypeReferenceConfiguration(typeof(EncounterResourceHandler)), new TypeReferenceConfiguration(typeof(BundleResourceHandler)), new TypeReferenceConfiguration(typeof(PatientResourceHandler)) } }; using (AuthenticationContext.EnterSystemContext()) { FhirResourceHandlerUtil.Initialize(testConfiguration, this.m_serviceManager); ExtensionUtil.Initialize(testConfiguration); } }
public void Setup() { // Force load of the DLL var p = FbCharset.Ascii; TestApplicationContext.TestAssembly = typeof(TestOrganizationResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); var testConfiguration = new FhirServiceConfigurationSection { Resources = new List <string> { "Immunization", "Patient", "Encounter", "Practitioner" }, MessageHandlers = new List <TypeReferenceConfiguration> { new TypeReferenceConfiguration(typeof(ImmunizationResourceHandler)) } }; using (AuthenticationContext.EnterSystemContext()) { FhirResourceHandlerUtil.Initialize(testConfiguration, m_serviceManager); ExtensionUtil.Initialize(testConfiguration); } }
public void Setup() { TestApplicationContext.TestAssembly = typeof(TestRelatedPersonResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); this.m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); var testConfiguration = new FhirServiceConfigurationSection { Resources = new List <string> { "Patient", "Practitioner", "Observation" } }; TestUtil.CreateAuthority("TEST", "1.2.3.4", "http://santedb.org/fhir/test", "TEST_HARNESS", this.AUTH); using (AuthenticationContext.EnterSystemContext()) { FhirResourceHandlerUtil.Initialize(testConfiguration, this.m_serviceManager); ExtensionUtil.Initialize(testConfiguration); //add practitioner to be used as performer var practitioner = TestUtil.GetFhirMessage("ObservationPerformer") as Practitioner; var practitionerResourceHandler = FhirResourceHandlerUtil.GetResourceHandler(ResourceType.Practitioner); // create the practitioner using the resource handler this.m_practitioner = (Practitioner)practitionerResourceHandler.Create(practitioner, TransactionMode.Commit); //add patient to be used subject var patient = TestUtil.GetFhirMessage("ObservationSubject") as Patient; var patientResourceHandler = FhirResourceHandlerUtil.GetResourceHandler(ResourceType.Patient); // create the patient using the resource handler this.m_patient = (Patient)patientResourceHandler.Create(patient, TransactionMode.Commit); //add a general observation to be used for multiple tests var observation = TestUtil.GetFhirMessage("SetupObservation") as Observation; observation.Subject = new ResourceReference($"urn:uuid:{this.m_patient.Id}"); observation.Performer.Add(new ResourceReference($"urn:uuid:{this.m_practitioner.Id}")); var observationResourceHandler = FhirResourceHandlerUtil.GetResourceHandler(ResourceType.Observation); this.m_observation = (Observation)observationResourceHandler.Create(observation, TransactionMode.Commit); } }
/// <summary> /// Start the FHIR message handler /// </summary> public bool Start() { this.Starting?.Invoke(this, EventArgs.Empty); // This service relies on other services so let's wait until the entire context starts ApplicationServiceContext.Current.Started += (o, evt) => { try { using (AuthenticationContext.EnterSystemContext()) { this.m_webHost = ApplicationServiceContext.Current.GetService <IRestServiceFactory>().CreateService(typeof(FhirServiceBehavior)); this.m_webHost.AddServiceBehavior(new FhirErrorEndpointBehavior()); foreach (var endpoint in this.m_webHost.Endpoints) { endpoint.AddEndpointBehavior(new FhirMessageDispatchFormatterEndpointBehavior()); this.m_traceSource.TraceInfo("Starting FHIR on {0}...", endpoint.Description.ListenUri); } MessageUtil.SetBaseLocation(this.m_configuration.ResourceBaseUri ?? this.m_webHost.Endpoints.First().Description.ListenUri.ToString()); FhirResourceHandlerUtil.Initialize(this.m_configuration, this.m_serviceManager); ExtensionUtil.Initialize(this.m_configuration); // Start the web host this.m_webHost.Start(); this.m_traceSource.TraceInfo("FHIR On: {0}", this.m_webHost.Endpoints.First().Description.ListenUri); } } catch (Exception e) { this.m_traceSource.TraceEvent(EventLevel.Error, e.ToString()); throw; } }; this.Started?.Invoke(this, EventArgs.Empty); return(true); }
public void Setup() { TestApplicationContext.TestAssembly = typeof(TestOrganizationResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); this.m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); var testConfiguration = new FhirServiceConfigurationSection { Resources = new List <string> { "Medication" }, MessageHandlers = new List <TypeReferenceConfiguration> { new TypeReferenceConfiguration(typeof(MedicationResourceHandler)) } }; using (AuthenticationContext.EnterSystemContext()) { FhirResourceHandlerUtil.Initialize(testConfiguration, m_serviceManager); ExtensionUtil.Initialize(testConfiguration); } }
public void Setup() { // Force load of the DLL var p = FbCharset.Ascii; TestApplicationContext.TestAssembly = typeof(TestRelatedPersonResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); this.m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); var testConfiguration = new FhirServiceConfigurationSection { Resources = new List <string> { "Practitioner" } }; using (AuthenticationContext.EnterSystemContext()) { FhirResourceHandlerUtil.Initialize(testConfiguration, this.m_serviceManager); ExtensionUtil.Initialize(testConfiguration); } }