public BrokerOperationResult TestServerConnection(string serverName, string serverPort) { BrokerOperationResult returnResult = new BrokerOperationResult(); int port = 0; if (int.TryParse(serverPort, out port)) { //using (RpcBroker broker = new RpcBroker(serverName, port)) ServerConfig config = new ServerConfig() { ServerName = serverName, ListenerPort = port }; IRpcBroker broker = RpcBrokerUtility.GetNewConnectedRpcBroker(config); if (broker != null) { returnResult.SetResult(true, ""); broker.Disconnect(); } } return(returnResult); }
public void TestChangeVerifyCodePost_NoUser() { string testUrl = "/lskfj"; IRpcBroker broker = MockRpcBrokerFactory.GetChangeVerifyCodePostBroker(true, false); AccountController controller = new AccountController(broker); ChangeVerifyCode cvc = new ChangeVerifyCode() { OriginalVerifyCode = "", NewVerifyCode = "", ConfirmVerifyCode = "", RequestedUrl = testUrl }; int timeout = 0; string authorizedUser = ""; ActionResult result = controller.ProcessChangeVerifyCodePost(cvc, true, true, out timeout, out authorizedUser); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult)); RedirectToRouteResult routeResult = (RedirectToRouteResult)result; Assert.AreEqual("Home", routeResult.RouteValues["controller"]); Assert.AreEqual("Index", routeResult.RouteValues["action"]); Assert.IsTrue(timeout > 0); Assert.IsTrue(string.IsNullOrWhiteSpace(authorizedUser)); }
protected bool CloseBroker() { // *** Close and cleanup an rpc broker *** bool returnVal = false; // *** First get it from the store *** GetBrokerFromStore(); // *** If we have one *** if (this.rpcBroker != null) { // *** Delete from store *** BrokerStore.Delete(this.BrokerKey); // *** Close the broker ** RpcBrokerUtility.CloseBroker(this.rpcBroker); // *** Remove reference *** this.rpcBroker = null; // *** Indicate success *** returnVal = true; } // *** Remove unneeded key name *** if (Session != null) { Session[RpcBrokerUtility.BrokerKeyName] = ""; } return(returnVal); }
public void SetRpcBroker(IRpcBroker broker) { this.rpcBroker = broker; this.Accounts = new AccountRepository(rpcBroker); this.Divisions = new DivisionRepository(rpcBroker); this.Patients = new PatientRepository(rpcBroker); this.SelectLists = new SelectListRepository(rpcBroker); this.TrackingHistory = new TrackingHistoryRepository(rpcBroker); this.Notes = new NoteRepository(rpcBroker); this.NonVACare = new NonVACareRepository(rpcBroker); this.CdaDocuments = new CdaRepository(rpcBroker); this.Vpr = new VprRepository(rpcBroker); this.Pregnancy = new PregnancyRepository(rpcBroker); this.Orders = new OrdersRepository(rpcBroker); this.Observations = new ObservationsRepository(rpcBroker); this.Reminders = new RemindersRepository(rpcBroker); this.Alerts = new AlertsRepository(rpcBroker); if (!string.IsNullOrWhiteSpace(this.prenatalLabFile)) this.Labs = new LabsRepository(rpcBroker, this.prenatalLabFile); this.Education = new EducationRepository(rpcBroker); this.Checklist = new ChecklistRepository(rpcBroker); this.Consults = new ConsultsRepository(rpcBroker); this.Radiology = new RadiologyRepository(rpcBroker); }
public void TestMockSuccessfulGetUserInfo_GoodData() { IRpcBroker broker = MockRpcBrokerFactory.GetXusGetUserInfoBroker(true); XusGetUserInfoCommand userInfoCommand = new XusGetUserInfoCommand(broker); RpcResponse response = userInfoCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.DUZ), "DUZ is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Division.Name), "Division is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.DTime), "DTime is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Name), "Name is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.ServiceSection), "ServiceSection is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.StandardName), "StandardName is empty"); Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Title), "Title is empty"); // TODO: Do we care about this? //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Language), "Language is empty"); //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.UserClass), "UserClass is empty"); //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.Vpid), "Vpid is empty"); //Assert.IsFalse(string.IsNullOrWhiteSpace(userInfoCommand.UserInfo.DefaultLocation), "DefaultLocation is empty"); }
public void TestChangeVerifyCodePost_FailedChange() { string testUrl = "/lskfj"; IRpcBroker broker = MockRpcBrokerFactory.GetChangeVerifyCodePostBroker(false); AccountController controller = new AccountController(broker); ChangeVerifyCode cvc = new ChangeVerifyCode() { OriginalVerifyCode = "", NewVerifyCode = "", ConfirmVerifyCode = "", RequestedUrl = testUrl }; int timeout = 0; string authorizedUser = ""; ActionResult result = controller.ProcessChangeVerifyCodePost(cvc, true, false, out timeout, out authorizedUser); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(ViewResult)); ViewResult viewResult = (ViewResult)result; Assert.IsInstanceOfType(viewResult.Model, typeof(ChangeVerifyCode)); }
public void TestMockHasKeyCommand_False() { IRpcBroker broker = MockRpcBrokerFactory.GetOrwuHasKeyBroker(false); bool result = TestHasSecurityKeyCommand(broker, "WEBM ADMIN"); Assert.IsFalse(result); }
public void TestMockHasKeyCommand_True() { IRpcBroker broker = MockRpcBrokerFactory.GetOrwuHasKeyBroker(true); bool result = TestHasSecurityKeyCommand(broker, "DSIO ADMIN"); Assert.IsTrue(result); }
public void TestPatientRepositorySearch() { IRpcBroker broker = MockRpcBrokerFactory.GetDsioFemalePatientSearchBroker(); PatientRepository repository = new PatientRepository(broker); PatientSearchResult result = repository.Search("C", 1, 10); Assert.IsTrue(result.Success); }
public void TestMockDivisionGet_BadData() { IRpcBroker mockBroker = MockRpcBrokerFactory.GetXusDivisionGetBroker(false); XusDivisionGetCommand divCommand = new XusDivisionGetCommand(mockBroker); RpcResponse response = divCommand.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Fail, response.Status); }
public DsioPregnancy GetOrCreatePregnancy(IRpcBroker broker, string patientDfn) { DsioPregnancy returnVal = this.GetAnyPregnancy(broker, patientDfn); if (returnVal == null) { returnVal = this.AddCurrentPregnancy(broker, patientDfn); } return(returnVal); }
public void TestMockChangeVerifyCode_BadData() { IRpcBroker broker = MockRpcBrokerFactory.GetXusChangeVerifyCodeBroker(false); XusCvcCommand cvcCommand = new XusCvcCommand(broker); RpcResponse response = cvcCommand.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Fail, response.Status, response.InformationalMessage); }
private void TestDivisionSet(bool goodData, RpcResponseStatus expectedResponse) { IRpcBroker broker = MockRpcBrokerFactory.GetXusDivisionSetBroker(goodData); XusDivisionSetCommand divCommand = new XusDivisionSetCommand(broker, ""); RpcResponse response = divCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); Assert.AreEqual(expectedResponse, response.Status); }
public void TestMockDivisionGet_GoodData() { IRpcBroker mockBroker = MockRpcBrokerFactory.GetXusDivisionGetBroker(true); XusDivisionGetCommand divCommand = new XusDivisionGetCommand(mockBroker); RpcResponse response = divCommand.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(divCommand.Divisions, "No divisions found"); }
public void TestMockSuccessfulGetUserInfo_BadData() { IRpcBroker broker = MockRpcBrokerFactory.GetXusGetUserInfoBroker(false); XusGetUserInfoCommand userInfoCommand = new XusGetUserInfoCommand(broker); RpcResponse response = userInfoCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Fail, response.Status); }
public void TestMockIntroMsg_BadData() { IRpcBroker broker = MockRpcBrokerFactory.GetXusIntroMsgBroker(false); XusIntroMsgCommand testCommand = new XusIntroMsgCommand(broker); RpcResponse response = testCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Fail, response.Status); }
public void TestCreateANote() { IRpcBroker broker = MockRpcBrokerFactory.GetCreateANoteBroker(); DsioCreateANoteCommand command = new DsioCreateANoteCommand(broker); command.AddCommandArguments("740", "MCC DASHBOARD NOTE", "Note text for Friday", "test subject", new DsioNoteData(), ""); RpcResponse response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); }
protected bool CreateBroker() { // *** Create the broker to use for data calls *** bool returnVal = false; if (this.rpcBroker == null) { // *** Get server settings *** ServerConfigResult opResult = this.DashboardRepository.Settings.GetServerData(); if (opResult.Success) { // *** Get connected broker *** this.rpcBroker = RpcBrokerUtility.GetNewConnectedRpcBroker(opResult.ServerConfig); // *** Check for broker *** if (this.rpcBroker != null) { // *** Add broker to store *** this.BrokerKey = BrokerStore.Add(this.rpcBroker); returnVal = true; } else { ErrorLogger.Log("Could not get a connected broker"); } } } else // *** We already have a broker *** { returnVal = true; } // *** Add Prenatal Lab File Name to repository *** this.DashboardRepository.PrenatalLabFileName = this.Request.MapPath("~/Content/PrenatalLabs.csv"); // *** Add Content Path to Checklist Repository *** if (this.DashboardRepository.Checklist != null) { this.DashboardRepository.Checklist.ContentPath = this.Request.MapPath("~/Content/"); } // *** Add broker to DashboardBroker *** if (this.rpcBroker != null) { this.DashboardRepository.SetRpcBroker(this.rpcBroker); } return(returnVal); }
public void TestMockIntroMsg_GoodData() { IRpcBroker broker = MockRpcBrokerFactory.GetXusIntroMsgBroker(true); XusIntroMsgCommand testCommand = new XusIntroMsgCommand(broker); RpcResponse response = testCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsFalse(string.IsNullOrWhiteSpace(response.Data)); }
private RpcResponse TestMockUserInfoCommand(bool goodData) { IRpcBroker broker = MockRpcBrokerFactory.GetOrwuUserInfoBroker(goodData); OrwuUserInfoCommand testCommand = new OrwuUserInfoCommand(broker); RpcResponse response = testCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); return(response); }
private List <DsioSearchPatient> TestMockPatientSearch(string searchParam) { IRpcBroker broker = MockRpcBrokerFactory.GetDsioFemalePatientSearchBroker(); //DsioPatientSearchCommand patSearchCommand = new DsioPatientSearchCommand(broker); //DsioFemalePatientSearchCommand patSearchCommand = new DsioFemalePatientSearchCommand(broker); DsioPatientListCommand patSearchCommand = new DsioPatientListCommand(broker); RpcResponse response = patSearchCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); return(patSearchCommand.MatchingPatients); }
private bool TestHasSecurityKeyCommand(IRpcBroker broker, string key) { Assert.IsNotNull(broker); OrwuHasKeyCommand command = new OrwuHasKeyCommand(broker); command.AddCommandArguments("WEBM ADMIN"); RpcResponse response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); return(command.HasKeyResult); }
public static IRpcBroker Get(string key) { IRpcBroker returnVal = null; if (!string.IsNullOrWhiteSpace(key)) { lock (brokerStore) brokerStore.TryGetValue(key, out returnVal); } TraceLogger.Log(string.Format("BrokerStore.Get - Broker retrieved from broker store [Count: {0}]", BrokerStore.brokerStore.Count)); return(returnVal); }
private void TestHasSecurityKeyCommand(IRpcBroker broker, string key) { Assert.IsNotNull(broker); this.SignonToBroker(broker, 2); OrwuHasKeyCommand command = new OrwuHasKeyCommand(broker); command.AddCommandArguments("WEBM ADMIN"); RpcResponse response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); }
private string SavePerson(IRpcBroker broker) { DsioSavePersonCommand command = new DsioSavePersonCommand(broker); DsioLinkedPerson fof = new DsioLinkedPerson(); fof.PatientDfn = TestConfiguration.DefaultPatientDfn; DsioAddress addr = new DsioAddress(); addr.StreetLine1 = "1234 Five Street"; addr.StreetLine2 = "#3"; addr.City = "Seven"; addr.State = "SC"; addr.ZipCode = "90099"; fof.Address = addr; List <DsioTelephone> telList = new List <DsioTelephone>(); telList.Add(new DsioTelephone() { Number = "800-800-8000", Usage = DsioTelephone.HomePhoneUsage }); telList.Add(new DsioTelephone() { Number = "900-900-9000", Usage = DsioTelephone.WorkPhoneUsage }); telList.Add(new DsioTelephone() { Number = "700-700-7000", Usage = DsioTelephone.MobilePhoneUsage }); fof.TelephoneList.AddRange(telList); string temp = Guid.NewGuid().ToString(); // TODO: Need random name generator to test this successfully repeatedly... fof.Name = "Test,NamedOB";// +Guid.NewGuid().ToString(); fof.DOB = DateTime.Now.Subtract(new TimeSpan(10000, 0, 0, 0)).ToShortDateString(); fof.YearsSchool = "18"; command.AddCommandArguments(fof); RpcResponse response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); return(command.Ien); }
public void TestPatientRepositorySearch() { IRpcBroker broker = MockRpcBrokerFactory.GetDsioFemalePatientSearchBroker(); PatientRepository repository = new PatientRepository(broker); PatientSearchResult result = repository.Search("C", 1, 10); //List<SearchPatient> patients = repository.Search("CPR"); Assert.IsTrue(result.Success); //Assert.IsNotNull(result.Patients); //Assert.IsTrue(patients.Count > 0); }
private void TestAvCode(bool goodData, RpcResponseStatus expectedStatus) { IRpcBroker broker = MockRpcBrokerFactory.GetXusAvCodeBroker(goodData); XusAvCodeCommand testCommand = new XusAvCodeCommand(broker); testCommand.AddCommandArguments("", ""); RpcResponse response = testCommand.Execute(); // *** Check results *** Assert.IsNotNull(response); Assert.AreEqual(expectedStatus, response.Status, response.InformationalMessage); }
protected void SignonToBroker(IRpcBroker broker, int avCodeIndex) { XusSignonSetupCommand signonSetupCommand = new XusSignonSetupCommand(broker); RpcResponse response = signonSetupCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); XusAvCodeCommand avCodeCommand = new XusAvCodeCommand(broker); avCodeCommand.AddCommandArguments(TestConfiguration.ValidAccessCodes[avCodeIndex], TestConfiguration.ValidVerifyCodes[avCodeIndex]); response = avCodeCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); }
public static IRpcBroker GetNewConnectedRpcBroker(ServerConfig serverConfig) { // *** Creates a new broker, connects and returns it *** IRpcBroker returnBroker = null; returnBroker = new RpcBroker(serverConfig.ServerName, serverConfig.ListenerPort); // *** Connect *** if (!returnBroker.Connect()) { returnBroker = null; } return(returnBroker); }
public static string Add(IRpcBroker rpcBroker) { string returnVal = ""; if (rpcBroker != null) { returnVal = Guid.NewGuid().ToString(); lock (brokerStore) brokerStore.Add(returnVal, rpcBroker); TraceLogger.Log(string.Format("BrokerStore.Add - Broker added to broker store [Count: {0}]", BrokerStore.brokerStore.Count)); } return(returnVal); }