private List<Element> Process(string sectionName, string bundleName, IProcessor processor) { var deps = LoadDeps(); var section = deps[sectionName] as IList<dynamic>; if (section == null) { throw new InvalidOperationException($"The section {sectionName} doesn't exist."); } var bundle = section .FirstOrDefault(b => string.Equals(bundleName, b.name, StringComparison.OrdinalIgnoreCase)); if (bundle == null) { throw new InvalidOperationException($"The bundle {bundleName} doesn't exist."); } NormalizeBundle(bundle); var strongBundle = ExtractBundle(bundle); var output = new OutputHelper(); var context = new ProcessingContext() { Bundle = strongBundle, Original = bundle, HostingEnvironment = _env, FileProvider = _env.WebRootFileProvider, FileVersionProvider = _fileVersionProvider, }; processor.Process(context, output); return output.Elements; }
public static ProcessorResult CreateOutput(IProcessor pro, IImage output) { ProcessorResult r = new ProcessorResult(); r.Result = output == null ? null : output.ToBitmap(); r.Name = "输出图像"; return r; }
public static ProcessorResult CreateInput(IProcessor pro, IImage src) { ProcessorResult r = new ProcessorResult(); r.Result = src == null ? null : src.ToBitmap(); r.Name = "输入图像"; return r; }
protected PackageBase(string name, IList<IAsset> assets, IProcessor processor, IDebugState debugState) { this.Name = name; this.assets = assets; this.processor = processor; this.debugState = debugState; }
public static ProcessorResult CreateTempResult(IProcessor pro, String name, Bitmap map) { ProcessorResult r = new ProcessorResult(); r.Result = map; r.Name = name; return r; }
public void ShouldRespondToRequests() { var mockProcessor = new Mock<IProcessor>(); mockProcessor.Setup(p => p.Process(It.IsAny<Request>())).Returns(() => new SuccessResponse()); processor = mockProcessor.Object; var stepServer = new StepServer(IPAddress.Any, arguments, processor); stepServer.Init(); client = new TcpClient(); client.ReceiveTimeout = 1000; client.Connect(new IPEndPoint(IPAddress.Loopback, 54321)); Assert.IsTrue(client.Connected); stream = client.GetStream(); var strRequest = "[\"begin_scenario\"]\n"; var buffer = new byte[65535]; var length = Encoding.ASCII.GetBytes(strRequest, 0, strRequest.Length, buffer, 0); stream.Write(buffer, 0, length); length = stream.Read(buffer, 0, buffer.Length); var strReply = Encoding.ASCII.GetString(buffer, 0, length); Assert.AreEqual("[\"success\"]\n", strReply); stepServer.Stop(); }
public LicencePlateRecognition() { switch (DETECTIONQUALITY) { case QUALITY.LOW: { quality = 0.5; break; } case QUALITY.MEDIUM: { quality = 0.75; break; } default: { quality = 0.9; break; } } string sCountry = "South Africa"; _lpr = SimpleLPR.Setup(); //use product key //_lpr.set_productKey("key_nmmu.xml"); _lpr.set_countryWeight(sCountry, 1.0f); _lpr.realizeCountryWeights(); _proc = _lpr.createProcessor(); }
public void ExecuteMicroStep(IProcessor processor) { using (var session = processor.CreateSession()) { ExecuteMicroStep(processor, session); } }
/// <summary> /// Creates the specified processor. /// </summary> /// <param name="processor">The processor.</param> /// <param name="controller">The controller.</param> /// <param name="errorHandlingController">The error handling controller.</param> /// <returns></returns> public static IService Create(IProcessor processor, IController controller, IErrorHandlingController errorHandlingController) { var service = new Service(processor, controller, errorHandlingController); InjectDependencies(service); return service; }
public WikipediaAgent(string name, string host) { this.name = name; this.host = host; this.uri = new Uri(string.Format("http://{0}{1}", host, WIKIPEDIA_URL)); this.articleCreationRate = new EpochProcessor(); }
public override async void Run(IProcessor processor) { _processor = processor; ParseRawIrc(); foreach (var message in _messageList) { processor.Process(message); await Task.Run(() => Task.Delay(100)); } }
public StepServer(IPAddress addr, CommandLineArguments commandLineArguments, IProcessor processor) : base(addr, commandLineArguments.Port) { this.processor = processor; this.verbose = commandLineArguments.Verbose; this.terminateOnDisconnect = commandLineArguments.TerminateOnDisconnect; Console.CancelKeyPress += Console_CancelKeyPress; }
public DispatcherItem(Guid guid, IProcessor processor, bool running, TimeSpan runDelay, SimulationStepSize stepSize) { this.Guid = guid; this.Processor = processor; this.Running = running; this.RunDelay = runDelay; this.StepSize = stepSize; }
public object ProcessContent(string filePath, object content, IResourceContext context, IProcessor processor = null) { if (processor == null) processor = GetDefaultProcessor(content.GetType()); processor.ResourcePath = filePath; return processor.Process(content, context); }
public GitHubController( IProcessor<GitHubMessage> processor, ITracer tracer, IActionContextService actionService) { _processor = processor; _tracer = tracer; _actionService = actionService; }
public BitBucketController( IProcessor<BitBucketMessage> processor, ITracer tracer, IActionContextService actionService) { _processor = processor; _tracer = tracer; _actionService = actionService; }
public CucumberClient(Socket socket, IProcessor processor, bool verbose) { this.socket = socket; this.processor = processor; this.verbose = verbose; // Start waiting for data this.socket.BeginReceive(readBuffer, 0, readBuffer.Length, SocketFlags.None, DoReceive, this.socket); }
public void PushPerspective(IProcessor i,Perspective Perspective) { lock (Verwerkers) { lock(Verwerkers.Find(i).Next.Value){ Verwerkers.Find(i).Next.Value.push(Perspective); } } }
public async Task<IList<string>> Run(IProcessor processor, IEnumerable<PublicMessage> testInput) { _processor = processor; _log = new List<string>(); foreach (var message in testInput) { processor.Process(message); await Task.Run(() => Task.Delay(100)); } return _log; }
/// <summary> /// Initializes a new instance of the <see cref="Service" /> class. /// </summary> /// <param name="processor">The processor.</param> /// <param name="controller">The controller.</param> /// <param name="errorHandlingController">The error handling controller.</param> public Service(IProcessor processor, IController controller, IErrorHandlingController errorHandlingController) { _processor = processor; _controller = controller; _errorHandlingController = errorHandlingController; ConfigureErrorHandling(); _controller.Processor = _processor; ConfigureStateMachine(); }
public override async void Run(IProcessor processor) { _processor = processor; long i = -1; while (true) { processor.Process(new PublicMessage("notBot", i.ToString())); await Task.Run(() => Thread.Sleep(0)); i++; } }
public byte AddDevice(IProcessor processor, IDevice device, IDeviceView view, byte slot) { if (devices.ContainsKey(slot)) { return AddDevice(processor, device, view); } else { devices[slot] = device; device.Attached(GetInterruptDelegate(processor), view); return slot; } }
public void ExecuteMacroStep(IProcessor processor) { using (var session = processor.CreateSession()) { do { ExecuteMicroStep(processor, session); } while (processor.Registers[Registers.MIP].Value % 8 != 0 && !processor.IsHalted); } }
public void Write(AnalysisResult r, IProcessor<KeyValuePair<string,int>> cutoffPolicy, int topRecords) { if (r.FileChurn.Any() == false) return; IEnumerable<KeyValuePair<string, int>> fileChurns = cutoffPolicy.Apply(r.FileChurn).Take(topRecords); WriteImpl(fileChurns); _out.Flush(); }
public override void Process(IProcessor processor) { try { OnSuccess(new EventArgs()); } catch (Exception ex) { OnError(new ErrorEventArgs(ex)); } }
public Sensor(String name, IProcessor processor, IInput input) { this.name = name; this.input = input; this.processor = processor; IsStarted = false; IsDisposed = false; return; }
public void BindTo(IProcessor processor) { if(this.processor != null) { Unbind(); } this.processor = processor; processor.RegisterChanged += RegisterChanged; processor.Ram.RamChanged += RamChanged; processor.Halted += Halted; ramChanges.Clear(); registerChanges.Clear(); IsHalted = false; }
public ProcessorWorker(IProcessor fileProcessor) : this() { this.FileProcessor = fileProcessor; var processor = fileProcessor as IThreadProcessor; if (processor != null) { processor.Progress = new WorkerProgressCallback() { Worker = this }; } }
public void CreateIntegrationRequestQueue() { queue = new ProcessorQueue(); processorMock1 = new DynamicMock(typeof(IProcessor)); processorMock1.SetReturnValue("get_Name", "Processor1"); processor1 = (IProcessor)processorMock1.MockInstance; processorMock2 = new DynamicMock(typeof(IProcessor)); processorMock2.SetReturnValue("get_Name", "Processor2"); processor2 = (IProcessor)processorMock2.MockInstance; }
public void Process(dynamic color1, dynamic color2, IProcessor processor) { try { processor.Process(color1, color2); } catch (RuntimeBinderException) { throw new ArgumentException("Cant't process this combination of colors!"); } }
public MSMQNotifierEngine(string queueName, IProcessor notifierProcessor) { _messageQueue = new MessageQueue(queueName); _notifierProcessor = notifierProcessor; _messageQueue.Formatter = new BinaryMessageFormatter(); }
public Application(IProcessor <Options, Object> processor, ILogger <Application> logger) { this.processor = processor ?? throw new ArgumentNullException(nameof(processor)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
//Sets the next link in the chain. public void SetNext(IProcessor next) { this.next = next; }
private void BuildSourceNode(IDictionary <string, IProcessor> sources, ISourceNodeFactory factory, IProcessor processor) { sources.Add(factory.Name, processor); }
public TestController(IProcessor processor) { _processor = processor; }
protected TeleprinterInstructionsBase(IProcessor processor) : base(processor) { }
public Listener(IProcessor processor, int port) { _processor = processor; _port = port; }
/// <summary> /// Initializes a new instance of the <see cref="ProcessorDecoratorBase{TContext}"/> class. /// </summary> /// <param name="processor">The processor context.</param> protected ProcessorDecoratorBase(IProcessor <TContext> processor) { this.processor = processor ?? throw new ArgumentNullException(nameof(processor)); }
public static void Main(string[] args) { try { Parser.Default.ParseArguments <TidalOptions>(args) .WithParsed <TidalOptions>(tidalOptions => { bool proceed = tidalOptions.BuildFromArguments(args); if (proceed == true) { Shared.Verbose = tidalOptions.Verbose; Shared.Info("Starting Tidal " + DateTime.Now); Shared.Info("looking for password"); if (tidalOptions.PasswordPrompt == true) { Console.Write("Password:"******"creating processor"); IProcessor processor = null; switch (tidalOptions.DatabaseType) { case DatabaseTypeEnum.mssql: processor = new MicrosoftSQLProcessor(); break; case DatabaseTypeEnum.mysql: processor = new MySQLProcessor(); break; } Shared.Info("creating connection string"); DbConnection conn = null; string databaseName = null; if (tidalOptions.ConnectionString != null) { DbConnectionStringBuilder dbcs = new DbConnectionStringBuilder(); dbcs.ConnectionString = tidalOptions.ConnectionString; Shared.Info("checking for database name"); if (dbcs.ContainsKey("database")) { databaseName = (string)dbcs["database"]; } else { if (dbcs.ContainsKey("Initial Catalog")) { databaseName = (string)dbcs["Initial Catalog"]; } else { throw new ApplicationException("A database name is required in the connection string. Please use either Database=VALUE or Initial Catalog=VALUE."); } } Shared.Info("making connection"); conn = processor.GetConnection(tidalOptions.ConnectionString, tidalOptions.Password); } Shared.Info("***" + tidalOptions.TranslationFileName); List <TableMapping> tableMappingList = null; if (tidalOptions.TranslationFileName != null) { tableMappingList = MappingFileReader.ReadFromFile(tidalOptions.TranslationFileName); } using (conn) { if (conn != null) { Shared.Info("opening connection"); conn.Open(); } List <TableDef> tableDefList = null; TableDefMap tableDefMap = null; if (tidalOptions.ShouldMakeTableDefMap == true) { Shared.Info("getting table extractor"); ITableExtractor extractor = processor.GetTableExtractor(); if (tidalOptions.ShouldMakeTableDefMap == true) { Shared.Info("extracting table data with " + extractor.GetType()); tableDefMap = extractor.ExtractTableData(tableMappingList, tidalOptions.CleanOracle); if (tidalOptions.TableDefFileNameOut != null) { Shared.Info("writing table def file"); File.WriteAllText(tidalOptions.TableDefFileNameOut, tableDefMap.ToJSONString()); } } tableDefList = tableDefMap.Values.ToList <TableDef>(); if (tidalOptions.TableCreateScriptFileName != null) { Shared.Info("writing create table script"); ITableScriptWriter creationWriter = processor.GetTableScriptWriter(); string tableCreationScriptText = creationWriter.GetTableCreateScriptText(databaseName, tableDefList); File.WriteAllText(tidalOptions.TableCreateScriptFileName, tableCreationScriptText); } if (tidalOptions.TableDropScriptFileName != null) { Shared.Info("writing drop table script"); ITableScriptWriter dropWriter = processor.GetTableScriptWriter(); string tableCreationScriptText = dropWriter.GetTableDropScriptText(databaseName, tableDefList); File.WriteAllText(tidalOptions.TableDropScriptFileName, tableCreationScriptText); } if (tidalOptions.ModelsPathOut != null) { Shared.Info("making models"); ModelCreator.MakeModels(tableDefList, tidalOptions.ModelsNamespace, tidalOptions.ModelsPathOut, tableMappingList, tidalOptions.CleanOracle); } } Dictionary <string, ModelDef> modelDefMap = null; /* TODO: allow create model by only reading database */ if (tidalOptions.ModelsAssemblyFileNameList.Count > 0) { modelDefMap = new Dictionary <string, ModelDef> (); foreach (string fileName in tidalOptions.ModelsAssemblyFileNameList) { Shared.Info("reading models from assembly " + fileName); /* read object model */ ModelReader.AddToFromFile(modelDefMap, fileName, tidalOptions.ModelsNamespace); } } if (tidalOptions.ModelDefFileNameOut != null) { Shared.Info("Writing model defs to file..."); ModelWriter.WriteDefsToFile(modelDefMap.Values.ToList(), tidalOptions.ModelDefFileNameOut); Shared.Info("Model defs written."); } /* if we will create stored procs */ if (tidalOptions.ModuleName != null) { string storedProcedureSQLText = ""; if (tidalOptions.SQLScriptFileNameOut != null || tidalOptions.CreateProcedures == true) { Shared.Info("calcing stored proc script"); IProcedureCreator procCreator = processor.GetProcedureCreator(); storedProcedureSQLText = procCreator.GetStoredProcedureScriptText(tidalOptions.ModuleName, tableDefList, 1, tidalOptions.IgnoreTableNameList); } // Shared.Info(storedProcedureSQLText); if (tidalOptions.SQLScriptFileNameOut != null) { Shared.Info("writing stored proc script file"); File.WriteAllText(tidalOptions.SQLScriptFileNameOut, storedProcedureSQLText); } if (tidalOptions.RemoveProcedures == true) { Shared.Info("removing old procedures"); /* remove Tidal generated procedures for this module (in case the tables are gone, e.g.) */ IProcedureRemover procRemover = processor.GetProcedureRemover(); procRemover.RemoveTidalStoredProcs(databaseName, tidalOptions.ModuleName); } if (tidalOptions.CreateProcedures == true) { Shared.Info("executing stored proc script"); /* execute Tidal sql script */ IScriptExecutor scriptExecutor = processor.GetScriptExecutor(); scriptExecutor.ExecuteTidalProcedureScript(storedProcedureSQLText); } } List <ProcedureDef> procedureDefList = null; if (tidalOptions.ShouldMakeProcedureDefList == true) { Shared.Info("absorbing stored proc definitions"); /* read stored procedures and generate stored procedure defs */ IProcedureReader procReader = processor.GetProcedureReader(); procedureDefList = procReader.MakeProcedureDefList(databaseName, tidalOptions.ModuleName, tableDefMap); if (tidalOptions.StoredProcDefFileNameOut != null) { Shared.Info("writing stored proc definition json file"); var sbSPJson = new StringBuilder("["); bool first = true; foreach (var procedureDef in procedureDefList) { if (first == true) { first = false; } else { sbSPJson.AppendLine(","); } sbSPJson.Append(procedureDef.ToJSONString()); } sbSPJson.Append("]"); File.WriteAllText(tidalOptions.StoredProcDefFileNameOut, sbSPJson.ToString()); } } if (tidalOptions.DataAccessFileNameOut != null) { /* convert the procedures, parameters, and outputs into function calls and arguments */ List <ModelDef> modelDefList = FunctionCreator.CreateModelDefList( tidalOptions.ModelsNamespace, tidalOptions.ModuleName, modelDefMap, procedureDefList, tidalOptions.IgnoreTableNameList, tableMappingList, tidalOptions.CleanOracle); /* combine with stored proc defs to create DataAccess class */ ClassCreatorBase classCreator = processor.GetClassCreator(); string allText = classCreator.GetAllText(tidalOptions.ProjectNamespace, modelDefList); File.WriteAllText(tidalOptions.DataAccessFileNameOut, allText); } if (conn != null) { conn.Close(); } } } }); } catch (SqlException ex) { Shared.Info("SQL Error: " + ex.ToString()); Shared.Info("Line number: " + ex.LineNumber); throw; } }
public CustomerController(IProcessor processor) { _processor = processor; }
private IProcessor InfiniteRetry(IProcessor inner) { return(new InfiniteRetryProcessor(inner, _loggerFactory)); }
public ShowCallDataAction(IRazorEngineService razor, IProcessor processor) { _razor = razor; _processor = processor; }
public Crawler(IProcessor processor) { this._processor = processor; }
public ProcessController(IProcessor processor) { _processor = processor; }
public RotationMatrixData(IProcessor source, string key, Matrix <double> rotationMatrix) : base(source, key) { RotationMatrix = rotationMatrix; }
public SaveFeatures(IRazorEngineService razor, IProcessor processor) { _razor = razor; _processor = processor; }
public async Task ProcessAsyncTest() { Core.IMessageConverter <IRoutingMessage> routingMessageConverter = new RoutingMessageConverter(); string cloudEndpointId = Guid.NewGuid().ToString(); var cloudProxyMock = new Mock <ICloudProxy>(); cloudProxyMock.Setup(c => c.SendMessageAsync(It.IsAny <IMessage>())) .Callback <IMessage>( msg => { if (msg.Properties.ContainsKey("Delay")) { Task.Delay(TimeSpan.FromSeconds(10)).Wait(); } }) .Returns(Task.CompletedTask); cloudProxyMock.SetupGet(p => p.IsActive).Returns(true); string device1Id = "device1"; string device2Id = "device2"; byte[] messageBody = Encoding.UTF8.GetBytes("Message body"); var properties = new Dictionary <string, string>() { { "Prop1", "Val1" }, { "Prop2", "Val2" } }; var device1SystemProperties = new Dictionary <string, string> { { SystemProperties.DeviceId, device1Id } }; var device2SystemProperties = new Dictionary <string, string> { { SystemProperties.DeviceId, device2Id } }; var cancelProperties = new Dictionary <string, string>() { { "Delay", "true" }, { "Prop2", "Val2" } }; var message1 = new RoutingMessage(TelemetryMessageSource.Instance, messageBody, properties, device1SystemProperties); var message2 = new RoutingMessage(TelemetryMessageSource.Instance, messageBody, properties, device2SystemProperties); var message3 = new RoutingMessage(TelemetryMessageSource.Instance, messageBody, cancelProperties, device1SystemProperties); Task <Option <ICloudProxy> > GetCloudProxy(string id) { return(Task.FromResult( id.Equals(device1Id) ? Option.Some(cloudProxyMock.Object) : Option.None <ICloudProxy>())); } var cloudEndpoint = new CloudEndpoint(cloudEndpointId, GetCloudProxy, routingMessageConverter); IProcessor cloudMessageProcessor = cloudEndpoint.CreateProcessor(); ISinkResult <IRoutingMessage> result1 = await cloudMessageProcessor.ProcessAsync(message1, CancellationToken.None); Assert.NotNull(result1); Assert.NotEmpty(result1.Succeeded); Assert.Empty(result1.Failed); Assert.Empty(result1.InvalidDetailsList); Assert.False(result1.SendFailureDetails.HasValue); ISinkResult <IRoutingMessage> result2 = await cloudMessageProcessor.ProcessAsync(message2, CancellationToken.None); Assert.NotNull(result2); Assert.Empty(result2.InvalidDetailsList); Assert.NotEmpty(result2.Failed); Assert.Empty(result2.Succeeded); Assert.True(result2.SendFailureDetails.HasValue); ISinkResult <IRoutingMessage> resultBatch = await cloudMessageProcessor.ProcessAsync(new[] { message1, message2 }, CancellationToken.None); Assert.NotNull(resultBatch); Assert.Equal(1, resultBatch.Succeeded.Count); Assert.Equal(1, resultBatch.Failed.Count); Assert.Empty(resultBatch.InvalidDetailsList); Assert.True(resultBatch.SendFailureDetails.HasValue); ISinkResult <IRoutingMessage> resultBatchCancelled = await cloudMessageProcessor.ProcessAsync(new[] { message1, message2 }, new CancellationToken(true)); Assert.NotNull(resultBatchCancelled); Assert.Empty(resultBatchCancelled.Succeeded); Assert.NotEmpty(resultBatchCancelled.Failed); Assert.Empty(resultBatchCancelled.InvalidDetailsList); Assert.True(resultBatchCancelled.SendFailureDetails.HasValue); var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); ISinkResult <IRoutingMessage> resultBatchCancelled2 = await cloudMessageProcessor.ProcessAsync(new[] { message1, message3, message1 }, cts.Token); Assert.NotNull(resultBatchCancelled2); Assert.Equal(2, resultBatchCancelled2.Succeeded.Count); Assert.Equal(1, resultBatchCancelled2.Failed.Count); Assert.Empty(resultBatchCancelled2.InvalidDetailsList); Assert.True(resultBatchCancelled2.SendFailureDetails.HasValue); }
protected override void EntryForProcessorType(IProcessor processor) { throw new NotImplementedException(); }
public void VerifyHamlCommentRemovalForEachClauseNoEmbedding() { string originalValue = @"Start -#-#if (IF) -# content: if -#-# Comment: if -# content: if part 2 -#-# Comment: if part 2 -#-#elseif (ELSEIF) -#-# Comment: elseif -# content: elseif -#-# Comment: elseif part 2 -# content: elseif part 2 -#-#else -# content: else -#-# Comment: else -#-# Comment: else 2 -# content: else 2 -#-#endif -# end comment -#-# end quad comment End"; string ifExpectedValue = @"Start content: if -# Comment: if content: if part 2 -# Comment: if part 2 -# end comment -#-# end quad comment End"; VariableCollection vc = new VariableCollection { ["IF"] = true, }; IProcessor processor = SetupHamlLineCommentsProcessor(vc); RunAndVerify(originalValue, ifExpectedValue, processor, 9999); string elseIfExpectedValue = @"Start -# Comment: elseif content: elseif -# Comment: elseif part 2 content: elseif part 2 -# end comment -#-# end quad comment End"; vc = new VariableCollection { ["IF"] = false, ["ELSEIF"] = true }; processor = SetupHamlLineCommentsProcessor(vc); RunAndVerify(originalValue, elseIfExpectedValue, processor, 9999); string elseExpectedValue = @"Start content: else -# Comment: else -# Comment: else 2 content: else 2 -# end comment -#-# end quad comment End"; vc = new VariableCollection { ["IF"] = false, ["ELSEIF"] = false }; processor = SetupHamlLineCommentsProcessor(vc); RunAndVerify(originalValue, elseExpectedValue, processor, 9999); }
private void BuildSinkNode(IDictionary <string, IProcessor> processors, IDictionary <string, IProcessor> sinks, ISinkNodeFactory factory, IProcessor processor) { foreach (var predecessor in factory.Previous) { processors[predecessor].AddNextProcessor(processor); } sinks.Add(factory.Name, processor); }
public async Task ProcessAsync_SendThrows_Test() { Core.IMessageConverter <IRoutingMessage> routingMessageConverter = new RoutingMessageConverter(); string cloudEndpointId = Guid.NewGuid().ToString(); var cloudProxyMock = new Mock <ICloudProxy>(); cloudProxyMock.Setup(c => c.SendMessageAsync(It.IsAny <IMessage>())) .Throws <TimeoutException>(); cloudProxyMock.SetupGet(p => p.IsActive).Returns(true); string device1Id = "device1"; string device2Id = "device2"; byte[] messageBody = Encoding.UTF8.GetBytes("Message body"); var properties = new Dictionary <string, string>() { { "Prop1", "Val1" }, { "Prop2", "Val2" } }; var device1SystemProperties = new Dictionary <string, string> { { SystemProperties.DeviceId, device1Id } }; var device2SystemProperties = new Dictionary <string, string> { { SystemProperties.DeviceId, device2Id } }; var message1 = new RoutingMessage(TelemetryMessageSource.Instance, messageBody, properties, device1SystemProperties); var message2 = new RoutingMessage(TelemetryMessageSource.Instance, messageBody, properties, device2SystemProperties); Task <Option <ICloudProxy> > GetCloudProxy(string id) { return(Task.FromResult(Option.Some(cloudProxyMock.Object))); } var cloudEndpoint = new CloudEndpoint(cloudEndpointId, GetCloudProxy, routingMessageConverter); IProcessor cloudMessageProcessor = cloudEndpoint.CreateProcessor(); ISinkResult <IRoutingMessage> result = await cloudMessageProcessor.ProcessAsync(new[] { message1, message2 }, CancellationToken.None); Assert.NotNull(result); Assert.Empty(result.Succeeded); Assert.Equal(2, result.Failed.Count); Assert.Empty(result.InvalidDetailsList); Assert.True(result.SendFailureDetails.HasValue); // throw non-retryable cloudProxyMock.Setup(c => c.SendMessageAsync(It.IsAny <IMessage>())) .Throws <Exception>(); ISinkResult <IRoutingMessage> result1 = await cloudMessageProcessor.ProcessAsync(new[] { message1, message2 }, CancellationToken.None); Assert.NotNull(result1); Assert.Empty(result1.Succeeded); Assert.Empty(result1.Failed); Assert.Equal(2, result1.InvalidDetailsList.Count); Assert.True(result1.SendFailureDetails.HasValue); }
public ProcessStep(IProcessor processor) { _processor = processor; }
public void SetUp() { _numberToRoman = new NumberToRoman(); _inputValidator = new InputValidator(); _processor = new Processor(_numberToRoman, _inputValidator); }
public void Apply(IProcessor processor) { processor.WriteMemory(_storeIndex, processor.ReadMemory(_operand1) < processor.ReadMemory(_operand2) ? 1 : 0); processor.AdjustOpPointer(4); }
public override void ExecuteWith(IProcessor processor) { processor.Process(this); }
public Pipeline AddProcessor(IProcessor processor) { _processors.Add(processor); return(this); }
private void BuildProcessorNode(IDictionary <string, IProcessor> processors, IDictionary <string, IStateStore> stateStores, IProcessorNodeFactory factory, IProcessor processor, TaskId taskId) { foreach (string predecessor in factory.Previous) { IProcessor predecessorNode = processors[predecessor]; predecessorNode.AddNextProcessor(processor); } foreach (string stateStoreName in factory.StateStores) { if (!stateStores.ContainsKey(stateStoreName)) { if (stateFactories.ContainsKey(stateStoreName)) { StateStoreFactory stateStoreFactory = stateFactories[stateStoreName]; // TODO : changelog topic (remember the changelog topic if this state store is change-logging enabled) stateStores.Add(stateStoreName, stateStoreFactory.Build(taskId)); } else { stateStores.Add(stateStoreName, GlobalStateStores[stateStoreName]); } } } }
public SupportController(IProcessor processor) { _processor = processor; }
public string ShowProcessor(IProcessor processor) { return($"In Sony mainboard({processor.Description()})"); }
public virtual void RegisterProcessor(IProcessor processor) { this.processors.Add(processor); }