public void CreateTest() { Assert.ThrowsException <NullReferenceException>(() => new TaskSession(null)); var ses = new TaskSession(new VersionPayload() { Capabilities = new NodeCapability[] { new FullNodeCapability(123) } }); Assert.IsTrue(ses.IsFullNode); Assert.AreEqual((uint)123, ses.LastBlockIndex); Assert.AreEqual(0, ses.IndexTasks.Count); Assert.AreEqual(0, ses.InvTasks.Count); Assert.AreEqual((uint)0, ses.TimeoutTimes); Assert.AreEqual((uint)0, ses.InvalidBlockCount); ses = new TaskSession(new VersionPayload() { Capabilities = new NodeCapability[0] }); Assert.IsFalse(ses.IsFullNode); Assert.AreEqual((uint)0, ses.LastBlockIndex); Assert.AreEqual(0, ses.IndexTasks.Count); Assert.AreEqual(0, ses.InvTasks.Count); Assert.AreEqual((uint)0, ses.TimeoutTimes); Assert.AreEqual((uint)0, ses.InvalidBlockCount); }
public DefaultTaskExecutionContext(TaskSession session, MazeTask mazeTask, IServiceProvider services, Func <CommandProcessDto, Task> updateStatus) { Session = session; MazeTask = mazeTask; Services = services; _statusUpdate = new MessageThrottleService <CommandProcessDto>(updateStatus); }
protected override void ConfigureBuildProperties(TaskSession session) { session.Properties.Set(BuildProps.MSBuildToolsVersion, "4.0"); session.Properties.Set(BuildProps.ProductId, "Todo"); session.Properties.Set(BuildProps.ProductName, "Todo"); session.Properties.Set(BuildProps.SolutionFileName, "..\\Todo.sln"); session.Properties.Set(BuildProps.ProjectVersionFileName, "..\\Todo.ProjectVersion.txt"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Subversion); }
public async Task CreateAsync(TaskSession taskSession) { using (var connection = await OpenConnection()) { await connection.ExecuteAsync( "INSERT INTO TaskSession (TaskSessionId, TaskReferenceId, Description, CreatedOn) VALUES (@TaskSessionId, @TaskReferenceId, @Description, @CreatedOn)", taskSession); } }
protected override void ConfigureBuildProperties(TaskSession session) { session.Properties.Set(BuildProps.CompanyName, "Igor Brejc"); session.Properties.Set(BuildProps.CompanyCopyright, "Copyright (C) 2014-2019 Igor Brejc"); session.Properties.Set(BuildProps.ProductId, "Syborg"); session.Properties.Set(BuildProps.ProductName, "Syborg"); session.Properties.Set(BuildProps.SolutionFileName, "Syborg.sln"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Mercurial); }
private static void ConfigureBuildProperties(TaskSession session) { session.Properties.Set(BuildProps.CompanyName, "Igor Brejc"); session.Properties.Set(BuildProps.CompanyCopyright, "Copyright (C) 2015-2016 Igor Brejc"); session.Properties.Set(BuildProps.ProductId, "Freude"); session.Properties.Set(BuildProps.ProductName, "Freude"); session.Properties.Set(BuildProps.SolutionFileName, "Freude.sln"); session.Properties.Set(BuildProps.TargetDotNetVersion, FlubuEnvironment.Net40VersionNumber); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Mercurial); }
protected override void ConfigureBuildProperties(TaskSession session) { session.Properties.Set( BuildProps.MSBuildPath, @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\msbuild.exe"); session.Properties.Set(BuildProps.ProductId, "Todo"); session.Properties.Set(BuildProps.ProductName, "Todo"); session.Properties.Set(BuildProps.SolutionFileName, "..\\Todo.sln"); session.Properties.Set(BuildProps.ProjectVersionFileName, "..\\Todo.ProjectVersion.txt"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Subversion); }
protected override void ConfigureBuildProperties(TaskSession session) { session.Properties.Set(BuildProps.CompanyName, "Igor Brejc"); session.Properties.Set(BuildProps.CompanyCopyright, "Copyright (C) 2010-2018 Igor Brejc"); session.Properties.Set(BuildProps.ProductId, "LibroLib"); session.Properties.Set(BuildProps.ProductName, "LibroLib"); session.Properties.Set(BuildProps.SolutionFileName, "LibroLib.sln"); session.Properties.Set(BuildProps.MSBuildToolsVersion, "15.0"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Mercurial); session.Properties.Set(BuildProps.BuildConfiguration, "Release-4.0"); }
protected override void ConfigureBuildProperties(TaskSession session) { session.Properties.Set( BuildProps.MSBuildPath, @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\msbuild"); session.Properties.Set(BuildProps.NUnitConsolePath, @"packages\NUnit.Runners.2.6.2\tools\nunit-console.exe"); session.Properties.Set(BuildProps.ProductId, "Flubu"); session.Properties.Set(BuildProps.ProductName, "Flubu"); session.Properties.Set(BuildProps.SolutionFileName, "Flubu.sln"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Mercurial); }
public TaskExecutor(MazeTask mazeTask, TaskSession taskSession, ITaskResultStorage taskResultStorage, IServiceProvider services) { _mazeTask = mazeTask; _taskSession = taskSession; _taskResultStorage = taskResultStorage; _services = services; _logger = services.GetRequiredService <ILogger <TaskExecutor> >(); _activeTasksManager = services.GetRequiredService <ActiveTasksManager>(); _hubContext = services.GetRequiredService <IHubContext <AdministrationHub> >(); _executorTypes = _mazeTask.Commands.ToDictionary(x => x, commandInfo => typeof(ITaskExecutor <>).MakeGenericType(commandInfo.GetType())); _executionMethods = _executorTypes.Values.ToDictionary(x => x, executorType => executorType.GetMethod("InvokeAsync")); }
private int RunBuild(ICollection <string> args, TargetTree targetTree) { if (targetTree == null) { throw new ArgumentNullException("targetTree"); } using (TaskSession session = new TaskSession(new SimpleTaskContextProperties(), args, targetTree)) { session.IsInteractive = InteractiveSessionDetectionFunc(); BuildTargets.FillDefaultProperties(session); session.Start(BuildTargets.OnBuildFinished); session.AddLogger(new MulticoloredConsoleLogger(Console.Out)); ConfigureBuildProperties(session); bool targetFoundInTargetTree; string targetToRun = ParseCmdLineArgs(args.ToList(), session, targetTree, out targetFoundInTargetTree); if (targetToRun == null) { ITarget defaultTarget = targetTree.DefaultTarget; if (defaultTarget == null) { throw new InvalidOperationException("The default build target is not defined"); } targetTree.RunTarget(session, defaultTarget.TargetName); } else { if (!targetFoundInTargetTree) { session.WriteError("ERROR: The specified target does not exist"); targetTree.RunTarget(session, targetToRun); return(2); } targetTree.RunTarget(session, targetToRun); } session.Complete(); return(0); } }
public void ResettingSessionMeansTargetsCanBeReexecuted() { using (ITaskSession session = new TaskSession(properties, args, targetTree)) { session.Start(x => Assert.IsFalse(x.HasFailed)); targetTree.RunTarget(session, "build"); session.Reset(); targetTree.RunTarget(session, "build"); session.Complete(); } Assert.AreEqual(2, compilesCount); Assert.AreEqual(2, compilesCount); Assert.AreEqual(2, buildsCount); }
public void Test() { TargetTree targetTree = new TargetTree(); targetTree.AddTarget("compile") .SetDescription("Compiles the VS solution and runs FxCop analysis on it") .Do(TargetCompile).DependsOn("load.solution"); ITarget target = targetTree.GetTarget("compile"); using (ITaskSession session = new TaskSession(new SimpleTaskContextProperties(), new string[0])) { session.Start(OnBuildFinished); NotifyUserTask task = new NotifyUserTask("message"); task.Execute(session); } }
public async Task StartExecution(MazeTask mazeTask, TaskSession taskSession, TaskExecution taskExecution) { using (await _readerWriterLock.WriterLockAsync()) { var file = _fileSystem.FileInfo.FromFileName(GetTaskDbFilename(mazeTask)); file.Directory.Create(); var transmitterQueue = new TaskQueue(); try { using (var dbStream = file.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite)) using (var db = new LiteDatabase(dbStream)) { var sessions = db.GetCollection <TaskSession>(nameof(TaskSession)); sessions.EnsureIndex(x => x.TaskSessionId, unique: true); var taskSessionEntity = sessions.FindById(taskSession.TaskSessionId); if (taskSessionEntity == null) { taskSessionEntity = new TaskSession { TaskSessionId = taskSession.TaskSessionId, TaskReferenceId = mazeTask.Id, Description = taskSession.Description, CreatedOn = DateTimeOffset.UtcNow }; sessions.Insert(taskSessionEntity); transmitterQueue.Enqueue(() => _requestTransmitter.Transmit(TaskSessionsResource.CreateSessionRequest(taskSessionEntity))).Forget(); } taskExecution.TaskSessionId = taskSessionEntity.TaskSessionId; var executions = db.GetCollection <TaskExecution>(nameof(TaskExecution)); taskExecution.TaskExecutionId = executions.Insert(taskExecution); transmitterQueue.Enqueue(() => _requestTransmitter.Transmit(TaskExecutionsResource.CreateExecutionRequest(taskExecution))).Forget(); } } finally { await transmitterQueue.DisposeAsync(); } } }
public void ResettingSessionMeansPropertiesAreCleared() { using (ITaskSession session = new TaskSession(properties, args, targetTree)) { session.Start(x => Assert.IsFalse(x.Properties.Has("somekey"))); properties.Set("somekey", "somevalue"); targetTree.RunTarget(session, "build"); session.Reset(); targetTree.RunTarget(session, "build"); session.Complete(); } Assert.AreEqual(2, compilesCount); Assert.AreEqual(2, compilesCount); Assert.AreEqual(2, buildsCount); }
public Task StartExecution(MazeTask mazeTask, TaskSession taskSession, TaskExecution taskExecution) { taskExecution.TaskExecutionId = Guid.NewGuid(); taskExecution.TaskSessionId = taskSession.TaskSessionId; lock (_executionsLock) lock (_sessionsLock) { if (!Sessions.Any(x => x.TaskSessionId == taskSession.TaskSessionId && x.TaskReferenceId == mazeTask.Id)) { Sessions.Add(taskSession); } Executions.Add(taskExecution); } return(Task.CompletedTask); }
public void CreateTest() { var ses = new TaskSession(new VersionPayload() { Capabilities = new NodeCapability[] { new FullNodeCapability(123) } }); Assert.IsFalse(ses.HasTooManyTasks); Assert.AreEqual((uint)123, ses.LastBlockIndex); Assert.AreEqual(0, ses.IndexTasks.Count); Assert.IsTrue(ses.IsFullNode); ses = new TaskSession(new VersionPayload() { Capabilities = Array.Empty <NodeCapability>() }); Assert.IsFalse(ses.HasTooManyTasks); Assert.AreEqual((uint)0, ses.LastBlockIndex); Assert.AreEqual(0, ses.IndexTasks.Count); Assert.IsFalse(ses.IsFullNode); }
public static HttpRequestMessage CreateSessionRequest(TaskSession taskSession) => CreateRequest(HttpVerb.Post, null, taskSession).Build();
public SessionEditor() { _session = new TaskSession(VisualElements); InitializeComponent(); rtbxLogBox = rtbxLog; }
protected abstract void ConfigureBuildProperties(TaskSession session);
public ElemWhile(TaskSession CurrentSession) { InitializeComponent(); Task = new TSWhile(CurrentSession); }
public ElemFindSingleNode(TaskSession ts) { InitializeComponent(); Task = new TSFindSingleNode(ts); }
public TaskSessionTriggerService(MazeTaskService taskService, TaskSession taskSession) { _taskService = taskService; Info = taskSession; }
public ElemParameterTap(TaskSession CurrentSession) { InitializeComponent(); Task = new TSParameterTap(CurrentSession); }
public ElemVariableReadLoaded(TaskSession ts) { InitializeComponent(); Task = new TSVariableReadLoaded(ts); }
public ElemBase(TaskSession _sess, TSBase task) { _task = task; }
public static int Main(string[] args) { TargetTree targetTree = new TargetTree(); BuildTargets.FillBuildTargets(targetTree); int testsRunCounter = 0; targetTree.AddTarget("rebuild") .SetAsDefault() .SetDescription("Rebuilds the whole project") .DependsOn("compile", "fxcop", "tests", "package"); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); targetTree.AddTarget("tests") .SetDescription("Runs unit tests") .Do(r => { BuildTargets.TargetRunTests(r, "Detergent.Tests", null, ref testsRunCounter); }).DependsOn("load.solution"); targetTree.AddTarget("package") .SetDescription("Packages the build") .Do(TargetPackage).DependsOn("load.solution", "fetch.build.version"); targetTree.AddTarget("nuget") .SetDescription("Produces NuGet packages for reusable components and publishes them to the NuGet server") .Do(c => { TargetNuGet(c, "Detergent"); }).DependsOn("fetch.build.version"); using (TaskSession session = new TaskSession(new SimpleTaskContextProperties(), args, targetTree)) { BuildTargets.FillDefaultProperties(session); session.Start(BuildTargets.OnBuildFinished); session.AddLogger(new MulticoloredConsoleLogger(Console.Out)); //session.Properties.Set(BuildProps.TargetDotNetVersion, "v4.0.30319"); //session.Properties.Set(BuildProps.TargetDotNetVersionForGallio, "v4.0.30319"); session.Properties.Set(BuildProps.CompanyName, CompanyName); session.Properties.Set(BuildProps.CompanyCopyright, CompanyCopyright); session.Properties.Set(BuildProps.GallioEchoPath, "lib/Gallio-3.2.750/bin/Gallio.Echo.exe"); session.Properties.Set(BuildProps.ProductId, "Detergent"); session.Properties.Set(BuildProps.ProductName, "Detergent"); session.Properties.Set(BuildProps.SolutionFileName, "Detergent.2010.sln"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Subversion); try { // actual run if (args.Length == 0) targetTree.RunTarget(session, targetTree.DefaultTarget.TargetName); else { string targetName = args[0]; if (false == targetTree.HasTarget(targetName)) { session.WriteError("ERROR: The target '{0}' does not exist", targetName); targetTree.RunTarget(session, "help"); return 2; } targetTree.RunTarget(session, args[0]); } session.Complete(); return 0; } catch (TaskExecutionException) { return 1; } catch (Exception ex) { Console.WriteLine(ex); return 1; } } }
public ElemRestart(TaskSession CurrentSession) { InitializeComponent(); Task = new TSRestart(CurrentSession); }
public ElemLoadURL(TaskSession ts) { InitializeComponent(); Task = new TSLoadUrl(ts); }
public ElemTextInput(TaskSession ts) { InitializeComponent(); Task = new TSTextInput(ts); }
public ElemSaveSingleVariable(TaskSession ts) { InitializeComponent(); Task = new TSSaveSingleVariable(ts); }