public void DoRemove_CommandExecuter(ICommandExecuter pCommandExecuter) { if (_listCommandExecuter.Contains(pCommandExecuter)) { _listCommandExecuter.Remove(pCommandExecuter); } }
public CommandExecuter_Test() { _smartSqlOptions = new SmartSqlOptions(); _smartSqlOptions.Setup(); _sessionStore = _smartSqlOptions.DbSessionStore; _commandExecuter = new CommandExecuter(LoggerFactory.CreateLogger <CommandExecuter>(), _smartSqlOptions.PreparedCommand); }
protected override void GivenThat() { base.GivenThat(); _webClientFactory = GenerateMock <IWebClientFactory>(); _webClient = GenerateMock <IWebClient>(); _directoryInfoProvider = GenerateMock <IDirectoryInfoProvider>(); _directoryInfo = GenerateMock <IDirectoryInfo>(); _fileUtilities = GenerateMock <IFileUtilities>(); _stateProvider = GenerateMock <IStateProvider>(); _counterFactory = GenerateMock <ICounterFactory>(); _averageCounterTime = GenerateMock <IAverageCounter>(); _averageCounterSize = GenerateMock <IAverageCounter>(); _state = GenerateMock <IState>(); _commandExecuter = GenerateMock <ICommandExecuter>(); _syncItem = new SyncItem(); _exception = null; SetupData(); SetupStubs(); _downloader = new EpisodeDownloader(_webClientFactory, _directoryInfoProvider, _fileUtilities, _stateProvider, _counterFactory, _commandExecuter); _downloader.StatusUpdate += new EventHandler <StatusUpdateEventArgs>(DownloaderStatusUpdate); _downloader.ProgressUpdate += new EventHandler <ProgressEventArgs>(DownloaderProgressUpdate); }
public void Initialize() { parsedInput = ""; parsedCommands = new List <string>(); executedCommands1 = new List <Command>(); executedCommands2 = new List <Command>(); executedCommands3 = new List <Command>(); commands = new Command[3] { new Command(), new Command(), new Command() }; client = new StubClient(); IInputParser fakeInputParser = new StubIInputParser() { ParseString = (input) => { parsedInput = input; List <string> commandStrings = new List <string>(); for (int i = 0; i < input.Split(';').Length - 1; i++) { commandStrings.Add("commandString" + i); } return(commandStrings); } }; ICommandParser fakeCommandParser = new StubICommandParser() { ParseCommandString = (command) => { parsedCommands.Add(command); return(commands[parsedCommands.Count - 1]); } }; ICommandExecuter[] fakeCommandExecuters = new ICommandExecuter[3]; fakeCommandExecuters[0] = new StubICommandExecuter() { TryToExecuteCommandCommand = (command) => { executedCommands1.Add(command); return(false); } }; fakeCommandExecuters[1] = new StubICommandExecuter() { TryToExecuteCommandCommand = (command) => { executedCommands2.Add(command); return(true); } }; fakeCommandExecuters[2] = new StubICommandExecuter() { TryToExecuteCommandCommand = (command) => { executedCommands3.Add(command); return(true); } }; inputHandler = new InputHandler(fakeCommandParser, fakeInputParser, fakeCommandExecuters, new StubILogger()); }
public PackageManager(IAvailablePackagesService availablePackagesService, IPackageVersionService packageVersionService, IPackageService packageService, IFileStorageService fileStorageService, ICommandExecuter commandExecuter, ISettingsService settingsService, IInstalledPackagesService installedPackagesService) { _packageVersionService = packageVersionService; _packageService = packageService; _availablePackagesService = availablePackagesService; _fileStorageService = fileStorageService; _commandExecuter = commandExecuter; _settingsService = settingsService; _installedPackagesService = installedPackagesService; _packageVersionService.VersionChanged += VersionChangedHandler; _packageVersionService.RunStarted += PackageVersionServiceStarted; _availablePackagesService.RunFinshed += PackagesServiceRunFinished; _installedPackagesService.RunFinshed += PackagesServiceRunFinished; _packageService.RunFinshed += PackageServiceRunFinished; _packageService.RunStarted += PackageServiceRunStarted; _availablePackagesService.RunFailed += PackagesServiceRunFailed; _installedPackagesService.RunFailed += PackagesServiceRunFailed; _availablePackagesService.RunStarted += PackagesServiceRunStarted; _installedPackagesService.RunStarted += PackagesServiceRunStarted; InitializeComponent(); tabAvailable.ImageIndex = 0; tabInstalled.ImageIndex = 1; _installedPackagesService.ListOfDistinctHighestInstalledPackages(); }
// List<CommandExcuted> _listCommandExcuted = new List<CommandExcuted>(); // ========================================================================== // /* public - [Do] Function * 외부 객체가 호출(For External class call)*/ public void DoAdd_CommandExecuter(ICommandExecuter pCommandExecuter) { if (_listCommandExecuter.Contains(pCommandExecuter) == false) { _listCommandExecuter.Add(pCommandExecuter); } }
public CommandExcuted(ICommandExecuter pManagerCommand, CommandBase pCommandExcuted, SInputValue sInputValue, float fExcuteTime) { this.pManagerCommand = pManagerCommand; this.pCommandExcuted = pCommandExcuted; this.sInputValue = sInputValue; this.fExcuteTime = fExcuteTime; }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { long requestId; string taskId; Common.Protobuf.TaskProgressCommand taskProgressCommand = command.TaskProgressCommand; taskId = taskProgressCommand.taskId; requestId = command.requestID; try { ICommandExecuter tmpVar = clientManager.CmdExecuter; NCache nCache = (NCache)((tmpVar is NCache) ? tmpVar : null); Runtime.MapReduce.TaskStatus taskStatus = nCache.Cache.TaskStatus(taskId); Common.Protobuf.Response reponse = new Common.Protobuf.Response(); reponse.requestId = requestId; reponse.TaskProgressResponse = new Common.Protobuf.TaskProgressResponse(); reponse.TaskProgressResponse.progresses = Serialization.Formatters.CompactBinaryFormatter.ToByteBuffer(taskStatus, nCache.Cache.Name); reponse.responseType = Common.Protobuf.Response.Type.TASK_PROGRESS; reponse.commandID = command.commandID; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(reponse)); } catch (Exception ex) { _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID)); } }
public DapperRepositoryCache( IOptionsMonitor <DbCachedOptions> optionsMonitor, IDistributedCache cache, ICommandExecuter commandExecuter) : base(commandExecuter) { _optionsMonitor = optionsMonitor; _cache = cache; }
public PackageService(IRunAsync powershell, ISourceService sourceService, ICommandExecuter commandExecuter) { _powershellAsync = powershell; _sourceService = sourceService; _commandExecuter = commandExecuter; _powershellAsync.OutputChanged += OnLineChanged; _powershellAsync.RunFinished += OnRunFinished; }
public CommandExecutorProxy(string user, string pwd) { if ("Sandip".Equals(user) && "a$d$in".Equals(pwd)) { IsAdmin = true; } executer = new CommandExecuterImpl(); }
public ServiceBusCommandQueueProcessor(QueueClient queueClient, ICommandQueueProcessorLogger logger, ICommandExecuter commandExecuter, IServiceBusMessageSerializer serializer, int numberOfConcurrentListeners, TimeSpan?maxAutoRenewDuration) : base(queueClient, logger, commandExecuter, serializer, numberOfConcurrentListeners, maxAutoRenewDuration) { }
public ServiceBusCommandQueueProcessorFactory(ICommandQueueProcessorLogger logger, ICommandExecuter commandExecuter, IServiceBusMessageSerializer serviceBusMessageSerializer) { _logger = logger; _commandExecuter = commandExecuter; _serviceBusMessageSerializer = serviceBusMessageSerializer; }
public ProxyCommandExecuter(string user, string pass) { if ("Admin".ToLower().Equals(user) && "1234".Equals(pass)) { isAdmin = true; } executor = new RealCommandExecuter(); }
public InProcCommandBus(ICommandExecuter executer) { if (executer == null) { throw new ArgumentNullException(nameof(executer)); } _executer = executer; }
public CommandExecuteHandler(RequestDelegate next, ILoggerFactory loggerFactory, IOptions <Options.AuthenticationOptions> options, ICommandExecuter commandExecuter) { _next = next; logger = loggerFactory.CreateLogger <CommandExecuteHandler>(); _authenticationOptions = options.Value; _commandExecuter = commandExecuter; }
/// <summary> /// construct the factory /// </summary> public EpisodeDownloaderFactory(IWebClientFactory webClientFactory, IDirectoryInfoProvider directoryInfoProvider, IFileUtilities fileUtilities, IStateProvider stateProvider, ICounterFactory counterFactory, ICommandExecuter commandExecuter) { _webClientFactory = webClientFactory; _commandExecuter = commandExecuter; _counterFactory = counterFactory; _stateProvider = stateProvider; _fileUtilities = fileUtilities; _directoryInfoProvider = directoryInfoProvider; }
public CommandProcessor(ICommandExecuter executer, IProducerConsumerCollection <Envelope <ICommand> > commandCollection) : base(commandCollection) { if (executer == null) { throw new ArgumentNullException(nameof(executer)); } _executer = executer; }
public void Subscribe(ICommandExecuter commandExecuter) { List <string> commands = commandExecuter.GetCommandList(); for (int i = 0; i < commands.Count; i++) { Subscribe(commands[i], commandExecuter); } }
public CommandProcessor(ICommandExecuter executer, Func <IBusContext> busContextFactory, ITextSerializer serializer) : base(busContextFactory, serializer) { if (executer == null) { throw new ArgumentNullException(nameof(executer)); } _executer = executer; }
/// <summary> /// create a task /// </summary> public EpisodeDownloader(IWebClientFactory webClientFactory, IDirectoryInfoProvider directoryInfoProvider, IFileUtilities fileUtilities, IStateProvider stateProvider, ICounterFactory counterFactory, ICommandExecuter commandExecuter) { _webClientFactory = webClientFactory; _commandExecuter = commandExecuter; _counterFactory = counterFactory; _stateProvider = stateProvider; _fileUtilities = fileUtilities; _directoryInfoProvider = directoryInfoProvider; TaskComplete = new ManualResetEvent(false); }
public EmitDataReaderDeserializer_Test() { _deserializerFactory = new EmitDataReaderDeserializerFactory(); _smartSqlOptions = new SmartSqlOptions { DataReaderDeserializerFactory = _deserializerFactory }; _smartSqlOptions.Setup(); _sessionStore = _smartSqlOptions.DbSessionStore; _commandExecuter = new CommandExecuter(LoggerFactory.CreateLogger <CommandExecuter>(), _smartSqlOptions.PreparedCommand); }
protected override void GivenThat() { base.GivenThat(); _counterFactory = GenerateMock <ICounterFactory>(); _stateProvider = GenerateMock <IStateProvider>(); _webClientFactory = new WebClientFactory(); _directoryInfoProvider = GenerateMock <IDirectoryInfoProvider>(); _fileUtilities = GenerateMock <IFileUtilities>(); _commandExecuter = GenerateMock <ICommandExecuter>(); _factory = new EpisodeDownloaderFactory(_webClientFactory, _directoryInfoProvider, _fileUtilities, _stateProvider, _counterFactory, _commandExecuter); }
private void Subscribe(string command, ICommandExecuter commandExecuter) { if (commandSubscribers.ContainsKey(command)) { commandSubscribers[command] = commandExecuter; } else { commandSubscribers.Add(command, commandExecuter); } }
public Settings(ISettingsService settingsService, ICommandExecuter commandExecutor, ISourceService sourceService, IAvailablePackagesService availablePackagesService) { _settingsService = settingsService; _commandExecutor = commandExecutor; _sourceService = sourceService; _availablePackagesService = availablePackagesService; _sourceService.SourcesChanged += _sourceService_SourcesChanged; _sourceService.CurrentSourceChanged += _sourceService_CurrentSourceChanged; _availablePackagesService.RunFinshed += _availablePackagesService_RunFinshed; InitializeComponent(); _sourceService.LoadSources(); }
public CommandDispatcher(ICommandRegistry commandRegistry, ICommandExecuter commandExecuter, ICommandScopeManager commandScopeManager, ICommandAuditPipeline auditPipeline, IOptionsProvider optionsProvider) { _commandRegistry = commandRegistry; _commandScopeManager = commandScopeManager; _auditor = auditPipeline; AssociatedExecuter = commandExecuter; _collectMetrics = optionsProvider.Options.MetricCollectionEnabled; }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { long requestId; int overload; string exception = null; System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); requestId = command.requestID; try { ICommandExecuter tmpVar = clientManager.CmdExecuter; NCache nCache = (NCache)((tmpVar is NCache) ? tmpVar : null); // the Actual Call. ArrayList runningTasks = nCache.Cache.RunningTasks; // Build response Common.Protobuf.Response reponse = new Common.Protobuf.Response(); reponse.requestId = requestId; reponse.commandID = command.commandID; reponse.RunningTasksResponse = new Common.Protobuf.GetRunningTasksResponse(); List <string> list = new List <string>(runningTasks.Count); foreach (string inst in runningTasks) { list.Add(inst); } reponse.RunningTasksResponse.runningTasks.AddRange(list); reponse.responseType = Common.Protobuf.Response.Type.RUNNING_TASKS; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(reponse)); } catch (Exception ex) { exception = ex.ToString(); _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetRunningTasks.ToLower()); log.GenerateGetRunningTasksAPILogItem(1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } }
public CommandExecuter_Test() { _sessionStore = new DbConnectionSessionStore(LoggerFactory, DbProviderFactory); var _configLoader = new LocalFileConfigLoader(SqlMapConfigFilePath, LoggerFactory); var config = _configLoader.Load(); _smartSqlContext = new SmartSqlContext(LoggerFactory.CreateLogger <SmartSqlContext>(), config); _sqlBuilder = new SqlBuilder(LoggerFactory.CreateLogger <SqlBuilder>(), _smartSqlContext, _configLoader); _preparedCommand = new PreparedCommand(LoggerFactory.CreateLogger <PreparedCommand>(), _smartSqlContext); _commandExecuter = new CommandExecuter(LoggerFactory.CreateLogger <CommandExecuter>(), _preparedCommand); }
public FrmMain() { InitializeComponent(); _commandExecuter = new CommandExecuterService(); _commandExecuter.AddUpdateObserver(this); _cacHelper = new GacHelperService(GetTargetDirectory, _commandExecuter); _directoryHelperService = new DirectoryHelperService(GetTargetDirectory, _cacHelper); mylist.ItemChecked += Mylist_ItemChecked; RefreshButtonByCheck(); _MyCOMAdmin = new MyCOMAdmin(); }
public Task <object> ExecuteAsync <TResult>(ICommandExecuter commandExecuter, ICommand <TResult> command) { return(commandExecuter.ExecuteAsync(command).ContinueWith(m => { if (m.IsFaulted) { throw m.Exception; } return (object)m.Result; })); }
public FacebookClient() { this.commandExecuter = new FacebookCommandExecuter(); this.anonymousCommandExecuter = new FacebookAnonymousCommandExecuter(); this.facebookCommands = new FacebookCommands(this.commandExecuter); }
public TwitterCommands(ICommandExecuter<ITwitterCredentials> executer) { this.executer = executer; }
public InProcCommandBus(ICommandExecuter executer) { if (executer == null) throw new ArgumentNullException(nameof(executer)); _executer = executer; }
public LinkedInCommands(ICommandExecuter<ILinkedInCredentials> executer) { this.executer = executer; }
public FacebookCommands(ICommandExecuter<IFacebookCredentials> executer) { this.executer = executer; }
public FacebookAppCredentials(ICommandExecuter<IFacebookEmptyCredentials> commandExecuter, string appId, string appSecret) { this.AppId = appId; this.AppSecret = appSecret; this.commandExecuter = commandExecuter; }
public UserCommands(ICommandExecuter<ILastFmCredentials> executer) { this.executer = executer; }
public CommandInterpreter(IParser parser, ICommandExecuter commandExecuter) { this.parser = parser; this.commandExecuter = commandExecuter; }
/// <summary> /// Dispose client manager and connection objects /// </summary> internal void Dispose(bool disposingIntentionally) { lock (_disposeSync) { _disposed = true; if (_enumerationPointers != null && !_cacheStopped) { foreach (string key in _enumerationPointers.Keys) { _cmdExecuter.DisposeEnumerator(_enumerationPointers[key]); } _enumerationPointers = null; } if (_clientSocket != null) { if (_clientSocket.Connected) { try { _clientSocket.Shutdown(SocketShutdown.Both); } catch (SocketException e) {/* log.Append(e.Message); */} catch (ObjectDisposedException e) { /*log.Append(e.Message);*/ } } if (_clientSocket != null) _clientSocket.Close(); _clientSocket = null; } Buffer = null; BufferPool.CheckinBuffer(PinnedBuffer); BufferPool.CheckinBuffer(sendBuffer); PinnedBuffer = null; sendBuffer = null; try { lock (this) { while (this.PendingSendOperationQueue.Count > 0) { object operation = PendingSendOperationQueue.remove(); SendContext opContext = (SendContext)operation; if (opContext != null) { if (SocketServer.IsServerCounterEnabled) _connectionManager.PerfStatsColl.DecrementResponsesQueueCountStats(); if (SocketServer.IsServerCounterEnabled) _connectionManager.PerfStatsColl.DecrementResponsesQueueSizeStats(opContext.expectedSize); } } } } catch (Exception e) { } ConnectionManager.EventsAndCallbackQueue.UnRegisterSlaveQueue(_slaveId); if (SocketServer.IsServerCounterEnabled) _connectionManager.PerfStatsColl.SetEventQueueCountStats(ConnectionManager.EventsAndCallbackQueue.Count); if (_cmdExecuter != null) { if (!_cacheStopped && _raiseClientDisconnectedEvent) { try { _cmdExecuter.OnClientDisconnected(ClientID, UniqueCacheID); } catch (Exception e) { if (SocketServer.Logger.IsErrorLogsEnabled) SocketServer.Logger.NCacheLog.Error("ClientManager.Dispose", e.ToString()); } } if (_cmdExecuter != null) { _cmdExecuter.Dispose(); _cmdExecuter = null; } } if (!disposingIntentionally) _clientDisposed(this.ClientID); } }