Ejemplo n.º 1
0
        private void RecursiveProcessTask(FacadeTask task)
        {
            ProcessTask(task);

            foreach (FacadeTask child in task.Children)
                RecursiveProcessTask(child);
        }
Ejemplo n.º 2
0
        public FacadeTaskWrapper(XmlElement element)
            : base(element)
        {
            string typeName = element.GetAttribute("facadeTaskType");

            facadeTask = (FacadeTask)Activator.CreateInstance(typeof(FacadeTask).Assembly.GetType(typeName), new object[] { element });
        }
        /// <summary>
        /// Gets the remote task that corresponds to a particular facade task.
        /// </summary>
        /// <param name="task">The facade task.</param>
        /// <returns>The corresponding remote task.</returns>
        public RemoteTask GetRemoteTask(FacadeTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            return(remoteTasks[task.RemoteTaskHandle]);
        }
 /// <inheritdoc />
 public void TaskExplain(FacadeTask task, string explanation)
 {
     try
     {
         server.TaskExplain(GetRemoteTask(task), explanation);
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
 /// <inheritdoc />
 public void TaskFinished(FacadeTask task, string message, FacadeTaskResult result)
 {
     try
     {
         server.TaskFinished(GetRemoteTask(task), message, FacadeUtils.ToTaskResult(result));
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
 /// <inheritdoc />
 public void TaskOutput(FacadeTask task, string text, FacadeTaskOutputType outputType)
 {
     try
     {
         server.TaskOutput(GetRemoteTask(task), text, FacadeUtils.ToTaskOutputType(outputType));
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
 /// <inheritdoc />
 public void TaskProgress(FacadeTask task, string message)
 {
     try
     {
         server.TaskProgress(GetRemoteTask(task), message);
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
 /// <inheritdoc />
 public void TaskStarting(FacadeTask task)
 {
     try
     {
         server.TaskStarting(GetRemoteTask(task));
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
Ejemplo n.º 9
0
        private static RemoteTask CreateTestTask(GallioTestElement element, FacadeTask facadeTask)
        {
#if RESHARPER_51
            if (element.IsTestCase)
            {
                return(new UnitTestFacadeTaskWrapper(facadeTask));
            }
            return(new TestContainerFacadeTaskWrapper(facadeTask));
#else
            return(new FacadeTaskWrapper(facadeTask));
#endif
        }
 /// <inheritdoc />
 public void TaskException(FacadeTask task, FacadeTaskException[] exceptions)
 {
     try
     {
         TaskException[] nativeExceptions = Array.ConvertAll <FacadeTaskException, TaskException>(exceptions, FacadeUtils.ToTaskException);
         server.TaskException(GetRemoteTask(task), nativeExceptions);
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
Ejemplo n.º 11
0
        private static RemoteTask CreateTestTask(GallioTestElement element, FacadeTask facadeTask)
        {
#if RESHARPER_51
            if (element.IsTestCase)
            {
                return new UnitTestFacadeTaskWrapper(facadeTask);
            }
            return new TestContainerFacadeTaskWrapper(facadeTask);
#else
            return new FacadeTaskWrapper(facadeTask);
#endif
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Adds a child task.
        /// </summary>
        /// <param name="child">The child task.</param>
        public void AddChild(FacadeTask child)
        {
            if (child == null)
            {
                throw new ArgumentNullException("child");
            }

            if (children == null)
            {
                children = new List <FacadeTask>();
            }
            children.Add(child);
        }
        public FacadeTaskResult Execute(IFacadeTaskServer facadeTaskServer, IFacadeLogger facadeLogger, FacadeTask facadeTask, FacadeTaskExecutorConfiguration facadeTaskExecutorConfiguration)
        {
            ILogger logger = new FacadeLoggerWrapper(facadeLogger);
            try
            {
                RuntimeAccessor.Instance.AddLogListener(logger);

                return facadeTask.Execute(facadeTaskServer, facadeLogger, facadeTaskExecutorConfiguration);
            }
            finally
            {
                RuntimeAccessor.Instance.RemoveLogListener(logger);
            }
        }
Ejemplo n.º 14
0
        sealed public override void ExecuteRecursive(TaskExecutionNode node)
        {
            AdapterFacadeTaskServer facadeTaskServer = new AdapterFacadeTaskServer(Server);
            AdapterFacadeLogger     facadeLogger     = new AdapterFacadeLogger();

            FacadeTaskExecutorConfiguration facadeTaskExecutorConfiguration = new FacadeTaskExecutorConfiguration()
            {
                ShadowCopy     = TaskExecutor.Configuration.ShadowCopy,
                AssemblyFolder = TaskExecutor.Configuration.AssemblyFolder
            };

            FacadeTask facadeTask = facadeTaskServer.MapTasks(node);

            executeResult = FacadeUtils.ToTaskResult(Execute(facadeTaskServer, facadeLogger, facadeTask, facadeTaskExecutorConfiguration));
        }
Ejemplo n.º 15
0
        private void ProcessTask(FacadeTask task)
        {
            var itemTask = task as GallioTestItemTask;
            if (itemTask != null)
            {
                testTasks[itemTask.TestId] = itemTask;
                return;
            }

            var assemblyTask = task as GallioTestAssemblyTask;
            if (assemblyTask != null)
            {
                assemblyLocations.Add(assemblyTask.AssemblyLocation);
                return;
            }

            var explicitTask = task as GallioTestExplicitTask;
            if (explicitTask != null)
            {
                explicitTestIds.Add(explicitTask.TestId);
                return;
            }
        }
Ejemplo n.º 16
0
        protected virtual FacadeTaskResult Execute(IFacadeTaskServer facadeTaskServer, IFacadeLogger facadeLogger, FacadeTask facadeTask, FacadeTaskExecutorConfiguration facadeTaskExecutorConfiguration)
        {
            IIsolatedEnvironment environment = SharedEnvironmentManager.GetSharedEnvironment();

            Type taskRunnerType = typeof(RemoteFacadeTaskRunner);
            IRemoteFacadeTaskRunner taskRunner = (IRemoteFacadeTaskRunner)environment.AppDomain.CreateInstanceAndUnwrap(
                taskRunnerType.Assembly.FullName, taskRunnerType.FullName);

            return(taskRunner.Execute(facadeTaskServer, facadeLogger, facadeTask, facadeTaskExecutorConfiguration));
        }
Ejemplo n.º 17
0
        protected virtual FacadeTaskResult Execute(IFacadeTaskServer facadeTaskServer, IFacadeLogger facadeLogger, FacadeTask facadeTask, FacadeTaskExecutorConfiguration facadeTaskExecutorConfiguration)
        {
            IIsolatedEnvironment environment = SharedEnvironmentManager.GetSharedEnvironment();

            Type taskRunnerType = typeof(RemoteFacadeTaskRunner);
            IRemoteFacadeTaskRunner taskRunner = (IRemoteFacadeTaskRunner)environment.AppDomain.CreateInstanceAndUnwrap(
                taskRunnerType.Assembly.FullName, taskRunnerType.FullName);

            return taskRunner.Execute(facadeTaskServer, facadeLogger, facadeTask, facadeTaskExecutorConfiguration);
        }
        /// <summary>
        /// Gets the remote task that corresponds to a particular facade task.
        /// </summary>
        /// <param name="task">The facade task.</param>
        /// <returns>The corresponding remote task.</returns>
        public RemoteTask GetRemoteTask(FacadeTask task)
        {
            if (task == null)
                throw new ArgumentNullException("task");

            return remoteTasks[task.RemoteTaskHandle];
        }
        public FacadeTaskResult Execute(IFacadeTaskServer facadeTaskServer, IFacadeLogger facadeLogger, FacadeTask facadeTask, FacadeTaskExecutorConfiguration facadeTaskExecutorConfiguration)
        {
            ILogger logger = new FacadeLoggerWrapper(facadeLogger);

            try
            {
                RuntimeAccessor.Instance.AddLogListener(logger);

                return(facadeTask.Execute(facadeTaskServer, facadeLogger, facadeTaskExecutorConfiguration));
            }
            finally
            {
                RuntimeAccessor.Instance.RemoveLogListener(logger);
            }
        }
 /// <inheritdoc />
 public void TaskExplain(FacadeTask task, string explanation)
 {
     try
     {
         server.TaskExplain(GetRemoteTask(task), explanation);
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
Ejemplo n.º 21
0
 internal FacadeTaskWrapper(FacadeTask facadeTask)
     : base(GallioTestProvider.ProviderId)
 {
     this.facadeTask = facadeTask;
 }
 internal TestContainerFacadeTaskWrapper(FacadeTask facadeTask) : base(facadeTask) { }
 /// <inheritdoc />
 public void TaskFinished(FacadeTask task, string message, FacadeTaskResult result)
 {
     try
     {
         server.TaskFinished(GetRemoteTask(task), message, FacadeUtils.ToTaskResult(result));
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
 /// <inheritdoc />
 public void TaskOutput(FacadeTask task, string text, FacadeTaskOutputType outputType)
 {
     try
     {
         server.TaskOutput(GetRemoteTask(task), text, FacadeUtils.ToTaskOutputType(outputType));
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
 /// <inheritdoc />
 public void TaskProgress(FacadeTask task, string message)
 {
     try
     {
         server.TaskProgress(GetRemoteTask(task), message);
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
 internal TestContainerFacadeTaskWrapper(FacadeTask facadeTask) : base(facadeTask)
 {
 }
 internal UnitTestFacadeTaskWrapper(FacadeTask facadeTask) : base(facadeTask) { }
 /// <inheritdoc />
 public void TaskException(FacadeTask task, FacadeTaskException[] exceptions)
 {
     try
     {
         TaskException[] nativeExceptions = Array.ConvertAll<FacadeTaskException, TaskException>(exceptions, FacadeUtils.ToTaskException);
         server.TaskException(GetRemoteTask(task), nativeExceptions);
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Adds a child task.
        /// </summary>
        /// <param name="child">The child task.</param>
        public void AddChild(FacadeTask child)
        {
            if (child == null)
                throw new ArgumentNullException("child");

            if (children == null)
                children = new List<FacadeTask>();
            children.Add(child);
        }
Ejemplo n.º 30
0
 internal UnitTestFacadeTaskWrapper(FacadeTask facadeTask) : base(facadeTask)
 {
 }
Ejemplo n.º 31
0
 public FacadeTaskResult Run(FacadeTask facadeTask)
 {
     RecursiveProcessTask(facadeTask);
     return RunTests();
 }
 /// <inheritdoc />
 public void TaskStarting(FacadeTask task)
 {
     try
     {
         server.TaskStarting(GetRemoteTask(task));
     }
     catch (Exception ex)
     {
         throw ServerExceptionUtils.Wrap(ex);
     }
 }