private void Proxy_ProcessorAttached(OperationProxy proxy, OperationProcessor processor) { if (processor is EntityProcessor) { (processor as EntityProcessor).Connection = this; } }
public JsonResult GetSummary(Models.FlightPlan plan) { var chartTypes = DataConnector.GetChartTypes(); var response = OperationProcessor.GetFlightPlanSummary(plan); return(Json(response, JsonRequestBehavior.AllowGet)); }
public Test() { TestOp testOp = new TestOp { Value = 5 }; OperationProcessor operationProcessor = testOp.RequestProcessor(); OperationProcessor operationProcessor2 = new TestOpProcessor(7, testOp); Queue <object> reqq = new Queue <object>(); Queue <object> procq = new Queue <object>(); operationProcessor.OnSend += delegate(object msg) { procq.Enqueue(msg); }; operationProcessor2.OnSend += delegate(object msg) { reqq.Enqueue(msg); }; operationProcessor.Start(); operationProcessor2.Start(); do { if (reqq.Count > 0) { operationProcessor.ProcessFeedback(reqq.Dequeue()); } if (procq.Count > 0) { operationProcessor2.ProcessFeedback(procq.Dequeue()); } }while (!operationProcessor2.Finished || !operationProcessor.Finished); }
// GET: Admin/Create public ActionResult Create() { var chartTypes = OperationProcessor.GetChartTypes(); ViewData["ChartTypes"] = chartTypes; return(View()); }
public void TestSetup() { this.mockedMetaInfoProvider = new Mock <IMetaInfoProvider>(); this.transactionManager = new Mock <ICdp4TransactionManager>(); this.requestUtils.MetaInfoProvider = this.mockedMetaInfoProvider.Object; this.operationProcessor = new OperationProcessor(); this.operationProcessor.RequestUtils = this.requestUtils; this.operationProcessor.OperationSideEffectProcessor = this.operationSideEffectProcessor; this.serviceProvider = new Mock <API.Services.IServiceProvider>(); this.resolveService = new Mock <IResolveService>(); var copyservice = new CopySourceService(); copyservice.TransactionManager = this.transactionManager.Object; copyservice.ServiceProvider = this.serviceProvider.Object; this.operationProcessor.CopySourceService = copyservice; this.operationProcessor.ServiceProvider = this.serviceProvider.Object; this.operationProcessor.ResolveService = this.resolveService.Object; this.permissionService = new Mock <IPermissionService>(); this.permissionService.Setup(x => x.CanRead(It.IsAny <string>(), It.IsAny <ISecurityContext>(), It.IsAny <string>())).Returns(true); this.permissionService.Setup(x => x.CanRead(It.IsAny <NpgsqlTransaction>(), It.IsAny <Thing>(), It.IsAny <string>())).Returns(true); }
public void TestSetup() { this.mockedMetaInfoProvider = new Mock <IMetaInfoProvider>(); this.requestUtils.MetaInfoProvider = this.mockedMetaInfoProvider.Object; this.operationProcessor = new OperationProcessor(); this.operationProcessor.RequestUtils = this.requestUtils; this.operationProcessor.OperationSideEffectProcessor = this.operationSideEffectProcessor; }
public ActionResult CreateFlightPlan() { var icaoCodes = OperationProcessor.GetICaoCodes(); ViewData["departureIcao"] = icaoCodes; ViewData["destinationIcao"] = icaoCodes; return(View()); }
public void Setup() { _processor = new OperationProcessor(); _processor.LoggingService = new Mock <ILoggingService>().Object; var schedule = new Mock <ISchedule>(); _processor.Start(schedule.Object); var operationScheduleMock = new Mock <OperationScheduleBase>(); var propertiesMock = new OperationProperties(operationScheduleMock.Object); var protocolMock = new Mock <IProtocol>(); var operationMock = new Operation(protocolMock.Object, propertiesMock, 1); //TODO: Operation is dependent of protocol - wrong architecture _operation = operationMock; }
public void SetupTests() { SettingsService = new SettingsService(); DependencyConfig config = new DependencyConfig(); Parameters parameters = new Parameters(); config.Define(typeof(IUserPreferences), typeof(UserPreferences)); config.Define(typeof(ISettingsService), typeof(SettingsService)); DependencyContainer container = new DependencyContainer(config); container.ResolveDependencies(SettingsService, parameters); OperationProcessor op = OperationProcessor.Instance; op.DepedencyContainer = container; }
public StaticMetricServer() { _metricProcessor = new OperationProcessor(); _totalRequests = 0; //"rpm" = requests per minute _metricProcessor.AddOperation("rpm", httpListenerContext => (_totalRequests / (DateTime.Now - _startTime).TotalMinutes) .ToString(CultureInfo.InvariantCulture)); //"rps" = requests per second _metricProcessor.AddOperation("rps", httpListenerContext => (_totalRequests / (DateTime.Now - _startTime).TotalSeconds) .ToString(CultureInfo.InvariantCulture)); }
public void ExecuteOperation_Test() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary<string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock<IGoToWebinarClient>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); var entity = BuildEntity(); webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Joe", "Josephs", "*****@*****.**")).Returns(entity); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(2, operationResult.Success.Where(result => result == true).Count()); Assert.IsTrue(operationResult.Output.Any(data => data.ObjectDefinitionFullName == "Registrant")); }
partial void PushLoginButton(UIButton sender) { DependencyConfig config = new DependencyConfig(); config.Define(typeof(IServiceAuthenticator), typeof(OnlineModeAuthenticator)); OperationProcessor processor = OperationProcessor.Instance; processor.DepedencyContainer.Config = config; Parameters parameters = new Parameters(); parameters ["Credentials"] = new List <string> () { LoginTextField.Text, PasswordTextField.Text }; processor.PerformOperation(typeof(LoginOperation), parameters, (Parameters result) => { InvokeOnMainThread(() => { NavigationViewController navigationController = (NavigationViewController)NavigationController; navigationController.PushLandingViewController(); }); }, null); }
public void ExecuteOperation_TestFailure() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary<string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock<IGoToWebinarClient>(); //have 'bob' throw an exception: webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Bob", "Roberts", "*****@*****.**")).Throws<System.Net.WebException>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(1, operationResult.Success.Where(result => result == true).Count()); Assert.AreEqual(1, operationResult.Success.Where(result => result == false).Count()); }
public static string GenerateProcessorName(OperationProcessor proc, Operation op, bool requesting) { if (proc == null) { return(""); } string text = proc.GetType().ToString(); if (text.IndexOf('+') != -1) { char[] separator = new char[] { '.' }; string[] array = text.Split(separator); return(array[array.Length - 1]); } if (op != null) { return(proc.GetType().Name + "+" + op.GetType().Name); } return(proc.GetType().Name); }
public void TestInitializationOperation() { Setting setting1 = new Setting("setting1", typeof(int), 42); Setting setting2 = new Setting("setting2", typeof(string), "fortytwo"); List <Setting> settings = new List <Setting> (); settings.Add(setting1); settings.Add(setting2); Parameters parameters = new Parameters(); parameters ["Settings"] = settings; var settingsIntializationExpectation = new AutoResetEvent(false); OperationProcessor op = OperationProcessor.Instance; op.PerformOperation(typeof(InitializeSettingsOperation), parameters, (Parameters result) => { settingsIntializationExpectation.Set(); }); Assert.True(settingsIntializationExpectation.WaitOne(TimeSpan.FromSeconds(10))); }
public void ExecuteOperation_Test() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary <string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock <IGoToWebinarClient>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); var entity = BuildEntity(); webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Joe", "Josephs", "*****@*****.**")).Returns(entity); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(2, operationResult.Success.Where(result => result == true).Count()); Assert.IsTrue(operationResult.Output.Any(data => data.ObjectDefinitionFullName == "Registrant")); }
public void ExecuteOperation_TestFailure() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary <string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock <IGoToWebinarClient>(); //have 'bob' throw an exception: webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Bob", "Roberts", "*****@*****.**")).Throws <System.Net.WebException>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(1, operationResult.Success.Where(result => result == true).Count()); Assert.AreEqual(1, operationResult.Success.Where(result => result == false).Count()); }
public JsonResult GetCharts(int chartType) { var charts = OperationProcessor.GetCharts(chartType); return(Json(charts, JsonRequestBehavior.AllowGet)); }
public DataAccessService(DbContext context) { _readEntitiesImplementation = new ReadEntities(context); _writeEntitiesImplementation = new WriteEntities(context); _operationProcessor = new OperationProcessor(); }
public ActionResult CreateFlightPlan(Models.FlightPlan plan) { OperationProcessor.UploadFlightPlan(plan); return(RedirectToAction("CreateFlightPlan")); }
public ActionResult ViewPlan(FlightPlan plan) { Response.AppendHeader("Content-Disposition", "inline; filename=FATW_AERODROME CHART_AD-01 _04 FEB 2016.pdf"); return(new FileContentResult(OperationProcessor.GetFlightPlan(Server.MapPath("~/App_Data/FATW_AERODROME CHART_AD-01 _04 FEB 2016.pdf")), "application/pdf")); }
public FileResult GetChart(int chart) { var selectedChart = OperationProcessor.GetFlightPlan(chart, HttpContext); return(new FileContentResult(selectedChart, "application/pdf")); }
public ActionResult Delete(int chartId) { OperationProcessor.DeleteChart(chartId); return(RedirectToAction("Index")); }
public ActionResult Create(int chartType, HttpPostedFileBase[] files) { var result = OperationProcessor.UploadChart(chartType, files); return(result ? RedirectToAction("Index") : null); }