Пример #1
0
 public ToDoListPresenter(IToDoListView view, ITaskList taskList, IExecutor executor)
 {
     this.view = view;
     this.executor = executor;
     this.taskList = taskList;
     WireUpEvents();
 }
Пример #2
0
 public Toolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor)
 {
     Name = name;
     Generator = generator;
     Builder = builder;
     Executor = executor;
 }
        public void LoadConnectionStringInto(string xpathExpression, IExecutor executor)
        {
            var r = Extract(xpathExpression);

            if (r.IntegratedSecurity)
            {
                executor.Username = string.Empty;
                executor.Password = string.Empty;
            }

            if (!string.IsNullOrEmpty(r.DataSource))
            {
                executor.Host = r.DataSource;
            }

            if (!string.IsNullOrEmpty(r.UserID))
            {
                executor.Username = r.UserID;
            }

            if (!string.IsNullOrEmpty(r.Password))
            {
                executor.Password = r.Password;
            }

            if (!string.IsNullOrEmpty(r.InitialCatalog))
            {
                executor.Database = r.InitialCatalog;
            }
        }
 public void SetUp()
 {
     executor = Stub<IExecutor>();
     runData = new RunData();
     ender = Stub<IThreadEnder>();
     target = new ExecutorThreadImpl(executor, runData);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="receiver"></param>
 /// <param name="timeOut"></param>
 /// <param name="requestMessage"></param>
 public ExecutionEntity(IExecutor executor, ArbiterClientId receiverID, TimeSpan timeOut, Message message)
     : base(timeOut)
 {
     _executor = executor;
     _receiverID = receiverID;
     _message = message;
 }
Пример #6
0
 internal Backgrounding(CuratorFrameworkImpl client, 
                         IBackgroundCallback callback, 
                         Object context, 
                         IExecutor executor)
     : this(wrapCallback(client, callback, executor), context)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandCallControlFlow"/> class.
 /// </summary>
 public CommandCallControlFlow(Command command, IExecutor executor)
 {
     Assume.NotNull(command, nameof(command));
     Assume.NotNull(executor, nameof(executor));
     Command = command;
     Executor = executor;
 }
 /// <summary>
 /// create a new <see cref="ErrorHandlingTaskExecutor"/> with <paramref name="taskExecutor"/> and
 /// <paramref name="errorHandler"/>
 /// </summary>
 /// <param name="taskExecutor">the task executor</param>
 /// <param name="errorHandler">the error handler in case of an exception</param>
 public ErrorHandlingTaskExecutor(IExecutor taskExecutor, IErrorHandler errorHandler)
 {
     AssertUtils.ArgumentNotNull(taskExecutor, "taskExecutor must not be null");
     AssertUtils.ArgumentNotNull(errorHandler, "errorHandler must not be null");
     _taskExecutor = taskExecutor;
     _errorHandler = errorHandler;
 }
Пример #9
0
 //TODO:  add Queue
 /// <summary>
 /// Helper to create and start an IFiber by type
 /// </summary>
 /// <param name="type"></param>
 /// <param name="executor"></param>
 /// <returns></returns>
 public static IFiber StartNew(FiberType type, IExecutor executor = null)
 {
     if (executor == null) executor = new Executor();
     IFiber fiber = GetFromTyoe(type, executor);
     fiber.Start();
     return fiber;
 }
        protected ExecutionResult CompileExecuteAndCheck(ExecutionContext executionContext, Func<CompilerType, string> getCompilerPathFunc, IExecutor executor)
        {
            var result = new ExecutionResult();

            // Compile the file
            var compilerPath = getCompilerPathFunc(executionContext.CompilerType);
            var compilerResult = this.Compile(executionContext.CompilerType, compilerPath, executionContext.AdditionalCompilerArguments, executionContext.Code);
            result.IsCompiledSuccessfully = compilerResult.IsCompiledSuccessfully;
            result.CompilerComment = compilerResult.CompilerComment;
            if (!compilerResult.IsCompiledSuccessfully)
            {
                return result;
            }

            var outputFile = compilerResult.OutputFile;

            // Execute and check each test
            IChecker checker = Checker.CreateChecker(executionContext.CheckerAssemblyName, executionContext.CheckerTypeName, executionContext.CheckerParameter);
            foreach (var test in executionContext.Tests)
            {
                var processExecutionResult = executor.Execute(outputFile, test.Input, executionContext.TimeLimit, executionContext.MemoryLimit);
                var testResult = this.ExecuteAndCheckTest(test, processExecutionResult, checker, processExecutionResult.ReceivedOutput);
                result.TestResults.Add(testResult);
            }

            // Clean our mess
            File.Delete(outputFile);

            return result;
        }
 public ArtifactPublisherExecutorDecorator(string artifactsPath, string reportName, IExecutor inner, IServiceMessages serviceMessages)
 {
     this.artifactsPath = artifactsPath;
     this.reportName = reportName;
     this.inner = inner;
     this.serviceMessages = serviceMessages;
 }
 private DeferredExecutionContext(VectorExecutionOptions options, IList<NArray> independentVarables)
 {
     _executor = new DeferringExecutor(independentVarables);
     _previousExecutor = ExecutionContext.Executor;
     _options = options;
     ExecutionContext.Executor = _executor;
 }
Пример #13
0
 /// <summary>
 /// Создать экземпляр планировщика
 /// </summary>
 /// <param name="sett">Настройки</param>
 /// <param name="action">Действие</param>
 /// <param name="Executor">Менеджер исполнения</param>
 protected MySchedular(SchedularSettings sett, Action action, IExecutor Executor = null)
 {
     this.sett = sett;
     executor = Executor ?? new Executor();
     this.action = action;
     if (sett.Interval != default(TimeSpan))
         new Thread(DoWork) { IsBackground = true }.Start();
 }
Пример #14
0
        public bool createConnection()
        {
            if (!tryInitConnection())
                return false;

            executer = new LinuxExecutor(sshConn, sftpConn, scpClient);
            return true;
        }
Пример #15
0
 public DedicatedThreadPoolFiber(IExecutor executor, int numThreads)
 {
     Executor = executor ?? new BasicExecutor();
     numThreads.NotNegative();
     numThreads.NotLessThan(1);
     _numThreads = numThreads;
     _threadPool = new DedicatedThreadPool(new DedicatedThreadPoolSettings(numThreads));
     Running = true;
 }
Пример #16
0
        public void Execute_ShouldExecuteSyntaxWithExtensions(IExecutor<IExtension> testee)
        {
            this.SetupSyntaxReturnsExecutables();

            testee.Execute(this.syntax.Object, this.extensions, this.executionContext.Object);

            this.firstExecutable.Verify(e => e.Execute(this.extensions, It.IsAny<IExecutableContext>()));
            this.secondExecutable.Verify(e => e.Execute(this.extensions, It.IsAny<IExecutableContext>()));
        }
Пример #17
0
        public LuaParser(IExecutor executor, string file)
        {
            this.file_name = Path.GetFileName (file);
            this.input = File.OpenText (file);
            this.row = 1;
            this.col = 1;

            this.CurrentExecutor = executor;
        }
Пример #18
0
 public SocketClient(IExecutor executor)
 {
     this.connectedTcs = new TaskCompletionSource<int>();
     this.executor = executor;
     this.socket = new Socket(AddressFamily.InterNetwork,
                              SocketType.Stream,
                              ProtocolType.Tcp);
     this.wasConnected = false;
 }
Пример #19
0
        public void Execute_ShouldCreateExecutableContextForExecutables(IExecutor<IExtension> testee)
        {
            this.SetupSyntaxReturnsExecutables();

            testee.Execute(this.syntax.Object, this.extensions, this.executionContext.Object);

            this.executionContext.Verify(e => e.CreateExecutableContext(this.firstExecutable.Object));
            this.executionContext.Verify(e => e.CreateExecutableContext(this.secondExecutable.Object));
        }
Пример #20
0
        public MesosExecutorDriver(IExecutor executor)
        {
            if (executor == null) throw new ArgumentNullException(nameof(executor));

            Executor = executor;
            Id = DriverRegistry.Register(this);
            _bridge = new ExecutorDriverBridge();
            _bridge.Initialize (Id);
        }
 /// <summary>
 /// Constracor
 /// </summary>
 public Processor()
 {
     ProcessorQueue = new ProcessorQueue();
     impersonate = new Impersonation();
     impersonate.ImpersonationLogonType = WorkflowEngine.Common.Security.ImpersonationLogonType.LOGON32_LOGON_NEW_CREDENTIALS;
     if (Utils.PROCESSOR_COUNT > 1 && EngineConfiguration.UsePipelinedOnMulticore)
         executor = new PipelinedExecutor();
     else
         executor = new SequentialExecutor();
 }
Пример #22
0
 /// <summary>
 ///   Creates a thread fiber.
 /// </summary>
 /// <param name="executor"></param>
 /// <param name = "queue"></param>
 /// <param name = "threadName"></param>
 /// <param name = "isBackground"></param>
 /// <param name = "priority"></param>
 public ThreadFiber(IExecutor executor,
     IFiberScheduler fiberScheduler,
     IQueue queue,
     string threadName,
     bool isBackground = true,
     ThreadPriority priority = ThreadPriority.Normal)
     : base(executor, fiberScheduler)
 {
     _queue = queue;
     _thread = new Thread(RunThread) { Name = threadName, IsBackground = isBackground, Priority = priority };
 }
Пример #23
0
 private static void AtachEventMethod(IExecutor executor)
 {
     executor.Starting += executor_Starting;
     executor.Stopping += executor_Stopping;
     executor.Stoped += executor_Stoped;
     executor.Executing += executor_Executing;
     executor.Executed += executor_Executed;
     executor.Sleepping += executor_Sleepping;
     executor.Waked += executor_Waked;
     executor.Error += executor_Error;
 }
		public ExecutionContext(IExecutor executor, object parameter = null, IDictionary<string, object> extendedProperties = null)
		{
			if(executor == null)
				throw new ArgumentNullException("executor");

			_executor = executor;
			_parameter = parameter;

			if(extendedProperties != null && extendedProperties.Count > 0)
				_extendedProperties = new Dictionary<string, object>(extendedProperties);
		}
Пример #25
0
        /// <summary>
        /// Create new socket client using given executor and already connected socket.
        /// This method will fail, if socket is not already connected.
        /// </summary>
        public SocketClient(IExecutor executor, Socket socket)
        {
            InitialiseCommon(executor);

            this.socket = socket;
            this.wasConnected = true;

            EnsureSocketIsConnected();

            InitialiseConnectedSocket();
        }
Пример #26
0
        public SocketClient(IExecutor executor, Socket socket)
        {
            this.connectedTcs = new TaskCompletionSource<int>();
            this.executor = executor;
            this.socket = socket;
            this.wasConnected = true;

            EnsureSocketIsConnected();

            InitialiseConnectedSocket();
            executor.Enqueue(StartReceiving);
        }
Пример #27
0
		public static void ProcessReceive(IExecutor executor, ReceivedEventArgs args)
		{
			if(args == null)
				throw new ArgumentNullException("args");

			//如果执行器参数为空,不抛出异常,直接退出
			if(executor == null)
				return;

			//通过执行器执行当前请求
			executor.Execute(args);
		}
        /// <summary>
        /// Mockable Constructor
        /// </summary>
        public SchemaReader(IExecutor executor, IStatements statements)
        {
            if (null == executor)
            {
                throw new ArgumentNullException("executor");
            }
            if (null == statements)
            {
                throw new ArgumentNullException("statements");
            }

            this.executor = executor;
            this.statements = statements;
        }
Пример #29
0
 private static IFiber GetFromTyoe(FiberType type, IExecutor executor)
 {
     switch (type)
     {
         case FiberType.Thread:
             return new ThreadFiber(executor);
         case FiberType.Pool:
             return new PoolFiber(executor);
         case FiberType.Stub:
             return new StubFiber(executor);
         default:
             throw new ArgumentOutOfRangeException("type");
     }
 }
Пример #30
0
 public static IFiber CreateFiber(IExecutor executor, FiberMode mode = FiberMode.SingleThreaded)
 {
     switch (mode)
     {
         case FiberMode.MultiThreaded:
             return new DedicatedThreadPoolFiber(executor, DefaultLimitedThreadPoolSize);
         case FiberMode.SingleThreaded:
             return new DedicatedThreadPoolFiber(executor, 1);
         case FiberMode.MaximumConcurrency:
             return new ThreadPoolFiber(executor);
         case FiberMode.Synchronous:
         default:
             return new SynchronousFiber(executor);
     }
 }
Пример #31
0
 public Template435(IExecutor executor, ITemplateFieldValueFactory templateFieldValueFactory,
                    IFileConverter fileConverter, IDocxTemplateHelper docxTemplateHelper) : base(executor,
                                                                                                 templateFieldValueFactory, fileConverter, docxTemplateHelper)
 {
     QrCodePosition = QrCodePosition.Header;
 }