public DotqApi(ConnectionMultiplexer redis = null) { _redis = redis ?? LocalRedis.Instance; _taskQueue = new RedisTaskQueue(_redis); _resultStore = new SimpleRedisTaskResultStore(_redis); _taskRegistry = TaskRegistry.TaskRegistry.Instance; _redisPromiseClient = PromiseClientProvider.GetInstance(_redis); _redisPromiseServer = PromiseServerProvider.GetInstance(); }
public SimpleWorker(IDotQueue <ITask> q, ITaskResultStore <string> r) { queue = q; resultStore = r; deserializer = new DefaultTaskDeserializer(); promiseResolver = new RedisPromiseServer(); _taskRegistry = TaskRegistry.TaskRegistry.Instance; _taskRegistry.DiscoverTasks(); }
public void InteractionIsDisposed() { IArgumentProvider arguments = Substitute.For <IArgumentProvider>(); ITaskRegistry taskRegistry = Substitute.For <ITaskRegistry>(); TestTaskInteraction interaction = new TestTaskInteraction { Arguments = arguments }; TestTaskExecution execution = new TestTaskExecution(arguments, taskRegistry, interaction); execution.ExecuteTask(); interaction.DisposeCount.Should().Be(1); }
public void ExecutionGetsSpecifiedCommand() { IArgumentProvider arguments = Substitute.For <IArgumentProvider>(); ITaskRegistry taskRegistry = Substitute.For <ITaskRegistry>(); ITask task = Substitute.For <ITask>(); arguments.Command.Returns("ExecutionGetsSpecifiedCommand"); taskRegistry["ExecutionGetsSpecifiedCommand"].Returns(task); TaskExecution execution = Substitute.ForPartsOf <TaskExecution>(arguments, taskRegistry, null); execution.ExecuteTask(); task.Received(1).Execute(Arg.Any <ITaskInteraction>()); }
public void NoParameters() { ITaskRegistry registry = Substitute.For <ITaskRegistry>(); UnknownTask task = new UnknownTask(registry, "GeneralHelp"); ITaskInteraction interaction = Substitute.For <ITaskInteraction>(); ILoggers loggers = Substitute.For <ILoggers>(); interaction.Loggers.Returns(loggers); ILogger logger = Substitute.For <ILogger>(); loggers[LoggerType.Status].Returns(logger); task.Execute(interaction).Should().Be(ExitCode.InvalidArgument); logger.Received().WriteLine(WriteStyle.Error, XTaskStrings.ErrorNoParametersSpecified); }
public TaskService( ILogger <TaskService> logger, IServiceProvider serviceProvider, IOptions <QueueTServiceOptions> appOptions, IOptions <TaskServiceOptions> taskOptions, ITaskRegistry taskRegistry, IMessageDispatcher messageDispatcher) { _logger = logger; _serviceProvider = serviceProvider; _appOptions = appOptions.Value; _taskOptions = taskOptions.Value; Registry = taskRegistry; _messageDispatcher = messageDispatcher; }
public void UnknownTaskLogsHelp() { ITaskRegistry registry = Substitute.For <ITaskRegistry>(); UnknownTask task = new UnknownTask(registry, "GeneralHelp"); ITaskInteraction interaction = Substitute.For <ITaskInteraction>(); ILoggers loggers = Substitute.For <ILoggers>(); interaction.Loggers.Returns(loggers); ILogger logger = Substitute.For <ILogger>(); loggers[LoggerType.Result].Returns(logger); task.Execute(interaction).Should().Be(ExitCode.InvalidArgument); logger.Received().WriteLine(WriteStyle.Fixed, "GeneralHelp"); }
public void HelpOutputsUsage() { IArgumentProvider arguments = Substitute.For <IArgumentProvider>(); ITaskRegistry taskRegistry = Substitute.For <ITaskRegistry>(); ITaskDocumentation docs = Substitute.For <ITaskDocumentation>(); ITask task = Substitute.For <ITask>(); task.GetService <ITaskDocumentation>().Returns(docs); arguments.Command.Returns("HelpOutputsUsage"); arguments.HelpRequested.Returns(true); taskRegistry["HelpOutputsUsage"].Returns(task); TaskExecution execution = Substitute.ForPartsOf <TaskExecution>(arguments, taskRegistry, null); execution.ExecuteTask(); docs.Received(1).GetUsage(Arg.Any <ITaskInteraction>()); }
public NotificationRegistry( ILogger <NotificationRegistry> logger, ITaskRegistry taskRegistry, IOptions <NotificationOptions> options) { _logger = logger; _taskRegistry = taskRegistry; foreach (var notifications in options.Value.Notifications) { RegisteryNotification(notifications); } foreach (var subscription in options.Value.NotificationSubscriptions) { RegisterSubscription(subscription); } }
public void UnkownCommand() { ITaskRegistry registry = Substitute.For <ITaskRegistry>(); UnknownTask task = new UnknownTask(registry, "GeneralHelp"); ITaskInteraction interaction = Substitute.For <ITaskInteraction>(); IArgumentProvider arguments = Substitute.For <IArgumentProvider>(); string commandName = "Foo"; interaction.Arguments.Returns(arguments); interaction.Arguments.Command.Returns(commandName); ILoggers loggers = Substitute.For <ILoggers>(); interaction.Loggers.Returns(loggers); ILogger logger = Substitute.For <ILogger>(); loggers[LoggerType.Status].Returns(logger); task.Execute(interaction).Should().Be(ExitCode.InvalidArgument); logger.Received().WriteLine(WriteStyle.Error, XTaskStrings.UnknownCommand, commandName); }
public InteractiveTask(string prompt, ITaskRegistry registry, IConsoleService consoleService = null) { this.prompt = prompt; this.registry = registry; this.consoleService = consoleService ?? ConsoleHelper.Console; }
/// <summary> /// Execution handler for tasks running under MSBuild. /// </summary> /// <param name="services">Override services, can be null. Used to get services before falling back on defaults.</param> public BuildTaskExecution(MSBuildFramework.IBuildEngine buildEngine, ITaskOutputHandler outputHandler, IArgumentProvider argumentProvider, ITaskRegistry taskRegistry, ITypedServiceProvider services = null) : base(argumentProvider, taskRegistry, services) { _outputHandler = outputHandler; _buildEngine = buildEngine; }
protected TaskExecution(IArgumentProvider argumentProvider, ITaskRegistry taskRegistry, ITypedServiceProvider services) { ArgumentProvider = argumentProvider; _taskRegistry = taskRegistry; Services = services; }
public HelpTask(ITaskRegistry registry, string generalHelp) { _registry = registry; _generalHelp = generalHelp; }
protected TaskExecution(IArgumentProvider argumentProvider, ITaskRegistry taskRegistry, ITypedServiceProvider services) { this.ArgumentProvider = argumentProvider; this.taskRegistry = taskRegistry; this.Services = services; }
/// <summary> /// Execution handler for tasks running under MSBuild. /// </summary> /// <param name="services">Override services, can be null. Used to get services before falling back on defaults.</param> public BuildTaskExecution(MSBuildFramework.IBuildEngine buildEngine, ITaskOutputHandler outputHandler, IArgumentProvider argumentProvider, ITaskRegistry taskRegistry, ITypedServiceProvider services = null) : base(argumentProvider, taskRegistry, services) { this.outputHandler = outputHandler; this.buildEngine = buildEngine; }
public HelpTask(ITaskRegistry registry, string generalHelp) { this.registry = registry; this.generalHelp = generalHelp; }
/// <summary> /// Sets the default task registry to the provided value. /// </summary> /// <param name="taskRegistry"></param> internal void SetTaskRegistry(ITaskRegistry taskRegistry) { ErrorUtilities.VerifyThrowArgumentNull(taskRegistry, "taskRegistry"); defaultTasksRegistrationAttempted = true; defaultTaskRegistry = taskRegistry; }
/// <summary> /// Execution handler for tasks running under the console. /// </summary> /// <param name="services">Override services, can be null. Used to get services before falling back on defaults.</param> public ConsoleTaskExecution(IArgumentProvider argumentProvider, ITaskRegistry taskRegistry, ITypedServiceProvider services = null) : base(argumentProvider, taskRegistry, services) { }
public UnknownTask(ITaskRegistry registry, string generalHelp) : base(registry, generalHelp) { }
/// <summary> /// Sets the default task registry to the provided value. /// </summary> /// <param name="taskRegistry"></param> internal void SetTaskRegistry(ITaskRegistry taskRegistry) { ErrorUtilities.VerifyThrowArgumentNull(taskRegistry, nameof(taskRegistry)); defaultTasksRegistrationAttempted = true; defaultTaskRegistry = taskRegistry; }
/// <summary> /// Creates an instance of this class for the given engine, specifying a tools version to /// use during builds of this project. /// </summary> /// <owner>RGoel</owner> /// <param name="engine">Engine that will build this project. May be null if the global engine is expected.</param> /// <param name="toolsVersion">Tools version to use during builds of this project instance. May be null, /// in which case we will use the value in the Project's ToolsVersion attribute, or else the engine /// default value.</param> public Project ( Engine engine, string toolsVersion ) { #if MSBUILDENABLEVSPROFILING try { DataCollection.CommentMarkProfile(8808, "Construct Project Using Old OM - Start"); #endif #if (!STANDALONEBUILD) using (new CodeMarkerStartEnd(CodeMarkerEvent.perfMSBuildProjectConstructBegin, CodeMarkerEvent.perfMSBuildProjectConstructEnd)) #endif { if (engine == null) { engine = Engine.GlobalEngine; } this.parentEngine = engine; this.projectId = parentEngine.GetNextProjectId(); this.projectBuildEventContext = new BuildEventContext(parentEngine.NodeId, BuildEventContext.InvalidTargetId, parentEngine.GetNextProjectId(), BuildEventContext.InvalidTaskId); this.isLoadedByHost = true; this.buildEnabled = BuildEnabledSetting.UseParentEngineSetting; this.isValidated = false; // Create a new XML document and add a <Project> element. This way, the // project is always in a valid state from the beginning, and now somebody // can start programmatically adding stuff to the <Project>. this.mainProjectEntireContents = new XmlDocument(); this.mainProjectElement = mainProjectEntireContents.CreateElement(XMakeElements.project, XMakeAttributes.defaultXmlNamespace); this.mainProjectEntireContents.AppendChild(mainProjectElement); // initialize all case-insensitive hash-tables this.conditionedPropertiesTable = new Hashtable(StringComparer.OrdinalIgnoreCase); this.evaluatedItemsByName = new Hashtable(StringComparer.OrdinalIgnoreCase); this.evaluatedItemsByNameIgnoringCondition = new Hashtable(StringComparer.OrdinalIgnoreCase); // Create the group collection. All collection elements are stored here. this.rawGroups = new GroupingCollection(null /* null parent means this is the master collection */); // Initialize all property-related objects. // (see above for initialization of this.conditionedPropertiesTable) this.globalProperties = null; this.environmentProperties = null; this.reservedProperties = null; // We still create the rawPropertyGroups collection, but // it's just a facade over rawGroups this.rawPropertyGroups = new BuildPropertyGroupCollection(this.rawGroups); this.evaluatedProperties = new BuildPropertyGroup(); // Initialize all item-related objects. // (see above for initialization of this.evaluatedItemsByName and this.evaluatedItemsByNameIgnoringCondition // We still create the rawItemGroups collection, but it's just a facade over rawGroups this.rawItemGroups = new BuildItemGroupCollection(this.rawGroups); this.evaluatedItems = new BuildItemGroup(); this.evaluatedItemsIgnoringCondition = new BuildItemGroup(); this.itemDefinitionLibrary = new ItemDefinitionLibrary(this); // Initialize all target- and task-related objects. this.usingTasks = new UsingTaskCollection(); this.imports = new ImportCollection(this); this.taskRegistry = new TaskRegistry(); this.targets = new TargetCollection(this); // Initialize the default targets, initial targets, and project file name. this.defaultTargetNames = new string[0]; this.initialTargetNamesInMainProject = new ArrayList(); this.initialTargetNamesInImportedProjects = new ArrayList(); this.FullFileName = String.Empty; this.projectDirectory = String.Empty; this.projectExtensionsNode = null; // If the toolsVersion is null, we will use the value specified in // the Project element's ToolsVersion attribute, or else the default if that // attribute is not present. if (null != toolsVersion) { this.ToolsVersion = toolsVersion; } this.MarkProjectAsDirtyForReprocessXml(); // The project doesn't really need to be saved yet; there's nothing in it! this.dirtyNeedToSaveProjectFile = false; this.IsReset = false; // Grab some initial properties from the Engine. // Global properties and reserved properties need to be cloned, because // different projects may have different sets of properties or values // for these. Environment properties don't have to be cloned, because // the environment is captured once at engine instantiation, and // shared by all projects thereafter. this.GlobalProperties = this.parentEngine.GlobalProperties; this.EnvironmentProperties = this.parentEngine.EnvironmentProperties; } #if MSBUILDENABLEVSPROFILING } finally { DataCollection.CommentMarkProfile(8809, "Construct Project Using Old OM - End"); } #endif }
public TestTaskExecution(IArgumentProvider argumentProvider, ITaskRegistry taskRegistry, ITaskInteraction interaction) : base(argumentProvider, taskRegistry, null) { this.interaction = interaction; }
public InteractiveTask(string prompt, ITaskRegistry registry, IConsoleService consoleService = null) { _prompt = prompt; _registry = registry; _consoleService = consoleService ?? ConsoleHelper.Console; }
public TaskManager(ITaskRegistry taskRegistry) { _taskRegistry = taskRegistry; }
/// <summary> /// Background tasks registry /// </summary> public FluentApplicationBootstrapConfiguration AddTaskRegistry(ITaskRegistry taskRegistry) { TaskRegistry = taskRegistry; return(this); }