public static void ClassSetup(TestContext context) { TestApplicationContext.TestAssembly = typeof(AdoIdentityProviderTest).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); AuthenticationContext.Current = new AuthenticationContext(AuthenticationContext.SystemPrincipal); IIdentityProviderService identityProvider = ApplicationServiceContext.Current.GetService <IIdentityProviderService>(); var identity = identityProvider.CreateIdentity(nameof(SecurityRolePersistenceServiceTest), "password", AuthenticationContext.Current.Principal); // Give this identity the administrative functions group IRoleProviderService roleProvider = ApplicationServiceContext.Current.GetService <IRoleProviderService>(); roleProvider.AddUsersToRoles(new string[] { identity.Name }, new string[] { "ADMINISTRATORS" }, AuthenticationContext.Current.Principal); // Authorize s_authorization = identityProvider.Authenticate(nameof(SecurityRolePersistenceServiceTest), "password"); IDataPersistenceService <SecurityPolicy> policyService = ApplicationServiceContext.Current.GetService <IDataPersistenceService <SecurityPolicy> >(); s_chickenCostumePolicy = new SecurityPolicy() { Name = "Allow wearing of chicken costume", Oid = "2.3.23.543.25.2" }; s_chickenCostumePolicy = policyService.Insert(s_chickenCostumePolicy, TransactionMode.Commit, s_authorization); }
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 TestBooleanValueInjected() { var context = new TestApplicationContext(); var configuration = context.Environment.Configuration; configuration.Set("test.simpleBool", "True"); configuration.Set("test.simpleBoolNegative", "False"); configuration.Set("test.simpleBool2", "true"); configuration.Set("test.simpleBoolNegative2", "false"); configuration.Set("test.simpleBoolOpt", "true"); configuration.Set("test.simpleBoolNegativeOpt", "false"); context.Start(); var valueService = context.Container.Resolve<TestValueService>(); Assert.AreEqual(false, valueService.BoolUnset); Assert.AreEqual(true, valueService.SimpleBool); Assert.AreEqual(true, valueService.SimpleBool2); Assert.AreEqual(false, valueService.SimpleBoolNegative); Assert.AreEqual(false, valueService.SimpleBoolNegative2); Assert.AreEqual(true, valueService.SimpleBoolOpt); Assert.AreEqual(false, valueService.SimpleBoolNegativeOpt); Assert.AreEqual(null, valueService.BoolUnsetOpt); }
public void ClassSetup() { TestApplicationContext.TestAssembly = typeof(AdoIdentityProviderTest).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); AuthenticationContext.EnterSystemContext(); }
public static TestApplicationContext CreateTestApplicationContext() { TestApplicationContext context = new TestApplicationContext(); RegisterObject(IntegrationContextUtils.TaskSchedulerObjectName, CreateTaskScheduler(10), context); return(context); }
public static void ClassSetup(TestContext context) { TestApplicationContext.TestAssembly = typeof(AdoIdentityProviderTest).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); AuthenticationContext.Current = new AuthenticationContext(AuthenticationContext.SystemPrincipal); }
public void TestBooleanValueInjected() { var context = new TestApplicationContext(); var configuration = context.Environment.Configuration; configuration.Set("test.simpleBool", "True"); configuration.Set("test.simpleBoolNegative", "False"); configuration.Set("test.simpleBool2", "true"); configuration.Set("test.simpleBoolNegative2", "false"); configuration.Set("test.simpleBoolOpt", "true"); configuration.Set("test.simpleBoolNegativeOpt", "false"); context.Start(); var valueService = context.Container.Resolve <TestValueService>(); Assert.AreEqual(false, valueService.BoolUnset); Assert.AreEqual(true, valueService.SimpleBool); Assert.AreEqual(true, valueService.SimpleBool2); Assert.AreEqual(false, valueService.SimpleBoolNegative); Assert.AreEqual(false, valueService.SimpleBoolNegative2); Assert.AreEqual(true, valueService.SimpleBoolOpt); Assert.AreEqual(false, valueService.SimpleBoolNegativeOpt); Assert.AreEqual(null, valueService.BoolUnsetOpt); }
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(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() { // 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 ClassInitialize() { AppDomain.CurrentDomain.SetData( "DataDirectory", Path.Combine(TestContext.CurrentContext.TestDirectory, string.Empty)); EntitySource.Current = new EntitySource(new PersistenceEntitySource()); // Register the AuditAdoPersistenceService TestApplicationContext.TestAssembly = typeof(MatcherTest).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); ApplicationServiceContext.Current.GetService <IServiceManager>().AddServiceProvider(typeof(DummyMatchConfigurationProvider)); // Sec repo service is for get user name implementation ApplicationServiceContext.Current.GetService <IServiceManager>().AddServiceProvider(typeof(DummyConceptRepositoryService)); ApplicationServiceContext.Current.GetService <IServiceManager>().AddServiceProvider(typeof(DummyPatientDataPersistenceService)); ApplicationServiceContext.Current.GetService <IServiceManager>().AddServiceProvider(typeof(WeightedRecordMatchingService)); // Start the daemon services if (!ApplicationServiceContext.Current.IsRunning) { //adoPersistenceService.Start(); TestApplicationContext.Current.Start(); ApplicationServiceContext.Current = ApplicationServiceContext.Current; } }
public static void Initialize(TestContext context) { // Force load of the DLL var p = FirebirdSql.Data.FirebirdClient.FbCharset.Ascii; TestApplicationContext.TestAssembly = typeof(TestMessageParsing).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); // Create the test harness device / application var securityDevService = ApplicationServiceContext.Current.GetService <IRepositoryService <SecurityDevice> >(); var securityAppService = ApplicationServiceContext.Current.GetService <IRepositoryService <SecurityApplication> >(); var metadataService = ApplicationServiceContext.Current.GetService <IAssigningAuthorityRepositoryService>(); AuthenticationContext.Current = new AuthenticationContext(AuthenticationContext.SystemPrincipal); // Create device var dev = new SecurityDevice() { DeviceSecret = "DEVICESECRET", Name = "TEST_HARNESS|TEST" }; dev.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); dev = securityDevService.Insert(dev); var app = new SecurityApplication() { Name = "TEST_HARNESS", ApplicationSecret = "APPLICATIONSECRET" }; app.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); app.AddPolicy(PermissionPolicyIdentifiers.UnrestrictedClinicalData); app.AddPolicy(PermissionPolicyIdentifiers.ReadMetadata); app = securityAppService.Insert(app); metadataService.Insert(new Core.Model.DataTypes.AssigningAuthority("TEST", "TEST", "1.2.3.4.5.6.7") { IsUnique = true, AssigningApplicationKey = app.Key }); // Add another application for security checks dev = new SecurityDevice() { DeviceSecret = "DEVICESECRET2", Name = "TEST_HARNESS2|TEST" }; dev.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); dev = securityDevService.Insert(dev); app = new SecurityApplication() { Name = "TEST_HARNESS2", ApplicationSecret = "APPLICATIONSECRET2" }; app.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); app.AddPolicy(PermissionPolicyIdentifiers.UnrestrictedClinicalData); app.AddPolicy(PermissionPolicyIdentifiers.ReadMetadata); app = securityAppService.Insert(app); }
public static void Initialize(TestContext context) { if (ApplicationServiceContext.Current == null) { TestApplicationContext.TestAssembly = typeof(TestOpenHIE).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); } }
public static void AssemblyInitialize(TestContext context) { InitialiseContainer(); TestApplicationContext.SetupApplications(WebSite.LinkMe); MemberSearchHost.Start(); JobAdSearchHost.Start(); JobAdSortHost.Start(); }
public void Setup() { // Force load of the DLL var p = FbCharset.Ascii; TestApplicationContext.TestAssembly = typeof(TestFhirResourceHandlerUtil).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); }
public void Setup() { TestApplicationContext.TestAssembly = typeof(TestRelatedPersonResourceHandler).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); this.m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); this.m_extension = this.m_serviceManager.CreateInjected <ReligionExtension>(); }
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>(); this.m_extension = this.m_serviceManager.CreateInjected <NationalityExtension>(); }
public void ClassInitialize() { typeof(MemoryCacheConfigurationSection).Equals((null)); // Force load typeof(MdmDataManagementService).Equals(null); // Trick - Force test context to load TestApplicationContext.TestAssembly = typeof(MdmAssociationTest).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); ApplicationServiceContext.Current.AddBusinessRule(typeof(BundleBusinessRule)); ApplicationServiceContext.Current.AddBusinessRule(typeof(NationalHealthIdRule)); this.m_patientRepository = ApplicationServiceContext.Current.GetService <IRepositoryService <Patient> >(); this.m_personRepository = ApplicationServiceContext.Current.GetService <IRepositoryService <Person> >(); this.m_patientMerge = ApplicationServiceContext.Current.GetService <IRecordMergingService <Patient> >(); this.m_entityRepository = ApplicationServiceContext.Current.GetService <IRepositoryService <Entity> >(); }
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 test context /// </summary> public static void SetContextVars(TestContext context) { if (m_started) { return; } // Init test context if needed if (ApplicationServiceContext.Current == null) { // Initialize TestApplicationContext.TestAssembly = typeof(TestBase).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); } AppDomain.CurrentDomain.SetData( "DataDirectory", Path.Combine(context.TestDeploymentDir, string.Empty)); EntitySource.Current = new EntitySource(new RepositoryEntitySource()); var f = typeof(FirebirdSql.Data.FirebirdClient.FirebirdClientFactory).AssemblyQualifiedName; // Register the AuditAdoPersistenceService var adoPersistenceService = ApplicationServiceContext.Current.GetService <IDataPersistenceService <Audit> >(); var smgr = ApplicationServiceContext.Current.GetService <IServiceManager>(); if (adoPersistenceService == null) { smgr.AddServiceProvider(typeof(AdoAuditPersistenceService)); } smgr.AddServiceProvider(typeof(DummySecurityRepositoryService)); // Sec repo service is for get user name implementation smgr.AddServiceProvider(typeof(DummyPolicyDecisionService)); // Start the daemon services if (!TestApplicationContext.Current.IsRunning) { //adoPersistenceService.Start(); TestApplicationContext.Current.Start(); } m_started = true; }
public static void ClassSetup(TestContext context) { TestApplicationContext.TestAssembly = typeof(AdoIdentityProviderTest).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); IPasswordHashingService hashingService = ApplicationServiceContext.Current.GetService <IPasswordHashingService>(); AuthenticationContext.Current = new AuthenticationContext(AuthenticationContext.SystemPrincipal); var dataService = ApplicationServiceContext.Current.GetService <IIdentityProviderService>(); if (dataService.GetIdentity("*****@*****.**") == null) { dataService.CreateIdentity("*****@*****.**", "password", AuthenticationContext.Current.Principal); } if (dataService.GetIdentity("*****@*****.**") == null) { dataService.CreateIdentity("*****@*****.**", "password", AuthenticationContext.Current.Principal); } IRoleProviderService roleService = ApplicationServiceContext.Current.GetService <IRoleProviderService>(); roleService.AddUsersToRoles(new string[] { "*****@*****.**", "*****@*****.**" }, new string[] { "USERS" }, AuthenticationContext.Current.Principal); roleService.AddUsersToRoles(new string[] { "*****@*****.**" }, new string[] { "ADMINISTRATORS" }, AuthenticationContext.Current.Principal); }
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); } }
public static void ClassInitialize(TestContext context) { typeof(MemoryCacheService).Equals(null); TestApplicationContext.TestAssembly = typeof(MemoryCacheTests).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); }
public void Setup() { TestApplicationContext.TestAssembly = typeof(TestFhirResourceHandlerUtil).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); }
public static void ClassSetup(TestContext context) { TestApplicationContext.TestAssembly = typeof(AdoIdentityProviderTest).Assembly; TestApplicationContext.Initialize(context.DeploymentDirectory); }
public void Initialize() { // Force load of the DLL var p = FirebirdSql.Data.FirebirdClient.FbCharset.Ascii; TestApplicationContext.TestAssembly = typeof(TestMessageParsing).Assembly; TestApplicationContext.Initialize(TestContext.CurrentContext.TestDirectory); // Create the test harness device / application var securityDevService = ApplicationServiceContext.Current.GetService <IRepositoryService <SecurityDevice> >(); var securityAppService = ApplicationServiceContext.Current.GetService <IRepositoryService <SecurityApplication> >(); var metadataService = ApplicationServiceContext.Current.GetService <IAssigningAuthorityRepositoryService>(); this.m_serviceManager = ApplicationServiceContext.Current.GetService <IServiceManager>(); AuthenticationContext.EnterSystemContext(); // Create device var dev = new SecurityDevice() { DeviceSecret = "DEVICESECRET", Name = "TEST_HARNESS|TEST" }; dev.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); securityDevService.Insert(dev); // Create device dev = new SecurityDevice() { DeviceSecret = "DEVICESECRET", Name = "TEST_HARNESS|MASTER" }; dev.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); dev.AddPolicy("1.3.6.1.4.1.33349.3.1.5.9.2.6"); securityDevService.Insert(dev); var app = new SecurityApplication() { Name = "TEST_HARNESS", ApplicationSecret = "APPLICATIONSECRET" }; app.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); app.AddPolicy(PermissionPolicyIdentifiers.UnrestrictedClinicalData); app.AddPolicy(PermissionPolicyIdentifiers.ReadMetadata); app = securityAppService.Insert(app); metadataService.Insert(new Core.Model.DataTypes.AssigningAuthority("TEST", "TEST", "1.2.3.4.5.6.7") { IsUnique = true, AssigningApplicationKey = app.Key }); metadataService.Insert(new Core.Model.DataTypes.AssigningAuthority("SSN", "US Social Security Number", "2.16.840.1.113883.4.1") { IsUnique = false, Url = "http://hl7.org/fhir/sid/us-ssn", AssigningApplicationKey = app.Key }); // Add another application for security checks dev = new SecurityDevice() { DeviceSecret = "DEVICESECRET2", Name = "TEST_HARNESS2|TEST" }; dev.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); securityDevService.Insert(dev); app = new SecurityApplication() { Name = "TEST_HARNESS2", ApplicationSecret = "APPLICATIONSECRET2" }; app.AddPolicy(PermissionPolicyIdentifiers.LoginAsService); app.AddPolicy(PermissionPolicyIdentifiers.UnrestrictedClinicalData); app.AddPolicy(PermissionPolicyIdentifiers.ReadMetadata); securityAppService.Insert(app); }