Index: Application/Application.Ringtoets/app.config
===================================================================
diff -u -rb13a656f78f98541b955433ea4074da47b57f8bc -re62cceb52b0c086a17e685690a44ec02185bac86
--- Application/Application.Ringtoets/app.config (.../app.config) (revision b13a656f78f98541b955433ea4074da47b57f8bc)
+++ Application/Application.Ringtoets/app.config (.../app.config) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -36,27 +36,23 @@
-
+
-
+
-
+
-
+
-
-
-
-
Index: Core/Common/src/Core.Common.Base/Core.Common.Base.csproj
===================================================================
diff -u -r2afad189e942019ef3da47d72e134f3a4c6c7884 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision 2afad189e942019ef3da47d72e134f3a4c6c7884)
+++ Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -110,19 +110,13 @@
True
Resources.resx
-
+
-
-
-
- Component
-
-
Index: Core/Common/src/Core.Common.Base/RunReportLogAppender.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.Base/RunReportLogAppender.cs (revision 0)
+++ Core/Common/src/Core.Common.Base/RunReportLogAppender.cs (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -0,0 +1,26 @@
+using System;
+using log4net.Appender;
+using log4net.Core;
+
+namespace Core.Common.Base
+{
+ public class RunReportLogAppender : AppenderSkeleton
+ {
+ public RunReportLogAppender()
+ {
+ Instance = this;
+ }
+
+ public static RunReportLogAppender Instance { get; set; }
+
+ public Action AppendMessageLineAction { get; set; }
+
+ protected override void Append(LoggingEvent loggingEvent)
+ {
+ if (AppendMessageLineAction != null)
+ {
+ AppendMessageLineAction(loggingEvent.RenderedMessage);
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/RunningActivityLogAppender.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/src/Core.Common.Base/Workflow/Activity.cs
===================================================================
diff -u -r622c20f6fc0b693b67a3e57b2ece939823002c62 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/src/Core.Common.Base/Workflow/Activity.cs (.../Activity.cs) (revision 622c20f6fc0b693b67a3e57b2ece939823002c62)
+++ Core/Common/src/Core.Common.Base/Workflow/Activity.cs (.../Activity.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -10,13 +10,16 @@
{
public virtual event EventHandler StatusChanged;
+ public string Log { get; set; }
+
public event EventHandler ProgressChanged;
private static readonly ILog log = LogManager.GetLogger(typeof(Activity));
private string progressText;
private ActivityStatus status;
protected Activity()
{
+ Log = "";
DependsOn = new EventedList();
}
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/Workflow/ActivityEventArgs.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/src/Core.Common.Base/Workflow/ActivityRunner.cs
===================================================================
diff -u -r8937feb11c47e5e3a2ad02b3d03f630fd10bf6d8 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/src/Core.Common.Base/Workflow/ActivityRunner.cs (.../ActivityRunner.cs) (revision 8937feb11c47e5e3a2ad02b3d03f630fd10bf6d8)
+++ Core/Common/src/Core.Common.Base/Workflow/ActivityRunner.cs (.../ActivityRunner.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -1,256 +1,13 @@
using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading;
using Core.Common.Base.Properties;
-using Core.Common.Utils.Collections;
-using Core.Common.Utils.Collections.Generic;
using log4net;
namespace Core.Common.Base.Workflow
{
- ///
- /// Class fires activities asynch and generates state changed
- ///
- //TODO: increase coverage and simplity this class. It is on the verge of unmanagable
- //TODO: make this stuff (lists) threadsafe damnit!
- public class ActivityRunner : IActivityRunner
+ public class ActivityRunner
{
- public event EventHandler IsRunningChanged;
-
- public event EventHandler ActivitiesCollectionChanged;
-
- private const int maxRunningTaskCount = 1;
private static readonly ILog log = LogManager.GetLogger(typeof(ActivityRunner));
- private readonly IList runningTasks = new List();
- private readonly IList todoTasks = new List();
- private readonly IEventedList activities;
-
- private bool running; // synchronization flag
-
- private bool wasRunning;
-
- public ActivityRunner()
- {
- activities = new EventedList();
- activities.CollectionChanged += HandleActivitiesCollectionChanged;
- }
-
- ///
- /// Provides a summary of the current activities (running and todo).
- /// DO NOT ADD TO THIS LIST useEnqueue instead
- ///
- public IEnumerable Activities
- {
- get
- {
- return activities;
- }
- }
-
- private void HandleActivitiesCollectionChanged(object sender, NotifyCollectionChangingEventArgs e)
- {
- //only local changes...get this in the EventedList...
- if (sender != activities)
- {
- return;
- }
-
- if (e.Action == NotifyCollectionChangeAction.Add)
- {
- ((IActivity) e.Item).StatusChanged += HandleActivityStatusChanged;
- }
- else if (e.Action == NotifyCollectionChangeAction.Remove)
- {
- ((IActivity) e.Item).StatusChanged -= HandleActivityStatusChanged;
- }
- }
-
- private void HandleActivityStatusChanged(object sender, ActivityStatusChangedEventArgs e)
- {
- if (e.NewStatus == ActivityStatus.Cancelled)
- {
- var task = GetRunningTasksThreadSafe().First(t => Equals(t.Activity, sender));
-
- if (ActivityStatusChanged != null)
- {
- //bubble the activity status change..
- ActivityStatusChanged(sender, e);
- }
-
- running = true;
-
- //done running,
- using (new TryLock(runningTasks))
- {
- runningTasks.Remove(task);
- CleanUp(task);
- activities.Remove(task.Activity);
- }
-
- OnIsRunningChanged();
-
- return;
- }
-
- if (ActivityStatusChanged != null)
- {
- //bubble the activity status change..
- ActivityStatusChanged(sender, e);
- }
-
- OnIsRunningChanged();
- }
-
- private void StartTaskIfPossible(Action beforeActualRun = null)
- {
- //we can run if we are not busy and have something todo ;)
- while (true)
- {
- AsyncActivityRunner taskToRun;
-
- using (new TryLock(runningTasks))
- {
- if (runningTasks.Count >= maxRunningTaskCount || (todoTasks.Count <= 0))
- {
- break;
- }
-
- taskToRun = todoTasks[0];
- runningTasks.Add(taskToRun);
- todoTasks.RemoveAt(0);
- }
-
- Debug.WriteLine(Resources.ActivityRunner_StartTaskIfPossible_Run_activity_0_, (taskToRun.Activity.Name));
-
- if (beforeActualRun != null)
- {
- beforeActualRun();
- }
- taskToRun.Run();
- //'pop' the first task (FIFO)
- }
- }
-
- private void Completed(object sender, EventArgs e)
- {
- var task = (AsyncActivityRunner) sender;
-
- Debug.WriteLine(task.Activity.Status == ActivityStatus.Cancelled
- ? string.Format(Resources.ActivityRunner_Completed_Cancelled_activity_0_, task.Activity.Name)
- : string.Format(Resources.ActivityRunner_Completed_Finished_activity_0_, task.Activity.Name));
-
- try
- {
- OnTaskCompleted(task);
- }
- finally
- {
- running = true;
-
- using (new TryLock(runningTasks))
- {
- runningTasks.Remove(task);
- CleanUp(task);
- }
-
- // continue with the next activity
- StartTaskIfPossible();
-
- OnIsRunningChanged();
- }
- }
-
- private void CleanUp(AsyncActivityRunner task)
- {
- task.Completed -= Completed;
- activities.Remove(task.Activity);
- }
-
- private void OnIsRunningChanged()
- {
- running = false;
-
- var isRunning = IsRunning;
- if (wasRunning != isRunning)
- {
- //TODO: get some logic to determine whether it really changed. (P.Changed?)
- if (IsRunningChanged != null)
- {
- IsRunningChanged(this, EventArgs.Empty);
- }
- }
- wasRunning = isRunning;
- }
-
- private void OnTaskCompleted(AsyncActivityRunner sender)
- {
- if (!sender.CompletedSuccesfully)
- {
- log.Error(String.IsNullOrEmpty(sender.Activity.Name)
- ? Resources.ActivityRunner_OnTaskCompleted_An_error_occured_while_running_a_background_activity
- : String.Format(Resources.ActivityRunner_OnTaskCompleted_An_error_occured_while_running_activity_0_, sender.Activity.Name), sender.Exception);
- }
-
- if (ActivityCompleted != null)
- {
- ActivityCompleted(this, new ActivityEventArgs(sender.Activity));
- }
-
- OnIsRunningChanged();
- }
-
- #region IActivityRunner Members
-
- public bool IsRunning
- {
- get
- {
- using (new TryLock(runningTasks)) //prevent deadlock
- {
- return runningTasks.Count > 0 || activities.Count > 0 || running;
- }
- }
- }
-
- public bool IsRunningActivity(IActivity activity)
- {
- if (activity == null)
- {
- return false;
- }
-
- return GetRunningTasksThreadSafe().Any(task => task.Activity == activity) && !running;
- }
-
- private IEnumerable GetRunningTasksThreadSafe()
- {
- using (new TryLock(runningTasks)) // lock modifications
- {
- return runningTasks.ToList(); // return a local copy
- }
- }
-
- public void Enqueue(IActivity activity)
- {
- var task = new AsyncActivityRunner(activity, RunActivity);
- task.Completed += Completed;
-
- using (new TryLock(runningTasks))
- {
- todoTasks.Add(task);
- activities.Add(activity);
- }
-
- Debug.WriteLine(string.Format(Resources.ActivityRunner_Enqueue_Enqueued_activity_0_, activity.Name));
-
- //TODO: it might already be running so running would not be changed.
- //fix and review
- StartTaskIfPossible(OnIsRunningChanged);
- }
-
public static void RunActivity(IActivity activity)
{
try
@@ -318,90 +75,5 @@
}
}
}
-
- public void Cancel(IActivity activity)
- {
- var task = GetRunningTasksThreadSafe().FirstOrDefault(t => t.Activity == activity);
-
- if (task != null)
- {
- //TODO: let the task cancel and complete.cleanup should be in Completed
- task.Cancel();
- running = true;
- return;
- }
-
- //or remove it from todo
- using (new TryLock(runningTasks))
- {
- task = todoTasks.ToList().FirstOrDefault(t => t.Activity == activity);
- if (task != null)
- {
- todoTasks.Remove(task);
- CleanUp(task);
- }
- }
-
- OnIsRunningChanged();
- }
-
- //TODO: make cancelAll use cancel for each activity.
- public void CancelAll()
- {
- foreach (var task in GetRunningTasksThreadSafe())
- {
- running = true;
- task.Cancel();
- }
-
- //empty the todo on a cancel
- using (new TryLock(runningTasks))
- {
- var currentTodoTasks = todoTasks.ToList();
- foreach (var task in currentTodoTasks)
- {
- CleanUp(task);
-
- if (activities.Contains(task.Activity))
- {
- activities.Remove(task.Activity);
- }
- }
-
- todoTasks.Clear();
- }
-
- OnIsRunningChanged();
- }
-
- public event EventHandler ActivityCompleted;
-
- public event EventHandler ActivityStatusChanged;
-
- #endregion
}
-
- ///
- /// Poor man's locking mechanism under danger of deadlock due to invokes & events :-(
- ///
- public class TryLock : IDisposable
- {
- private readonly bool hasLock;
- private object lockObject;
-
- public TryLock(object lockObject, int timeOut = 100)
- {
- this.lockObject = lockObject;
- hasLock = Monitor.TryEnter(lockObject, timeOut);
- }
-
- public void Dispose()
- {
- if (hasLock)
- {
- Monitor.Exit(lockObject);
- }
- lockObject = null;
- }
- }
}
\ No newline at end of file
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/Workflow/AsyncActivityRunner.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/Workflow/BackgroundWorker.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/src/Core.Common.Base/Workflow/IActivity.cs
===================================================================
diff -u -rd0124959699182372b6df54ce85704a7d1dce4db -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/src/Core.Common.Base/Workflow/IActivity.cs (.../IActivity.cs) (revision d0124959699182372b6df54ce85704a7d1dce4db)
+++ Core/Common/src/Core.Common.Base/Workflow/IActivity.cs (.../IActivity.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -17,6 +17,8 @@
///
string Name { get; set; }
+ string Log { get; set; }
+
///
/// Event to be fired when we want to publish changes in .
///
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/Workflow/IActivityRunner.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ActivityProgressDialog.cs
===================================================================
diff -u -r1851d762f53ff74b4051a25bc08d439ee50c1b88 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ActivityProgressDialog.cs (.../ActivityProgressDialog.cs) (revision 1851d762f53ff74b4051a25bc08d439ee50c1b88)
+++ Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ActivityProgressDialog.cs (.../ActivityProgressDialog.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -4,6 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
+using Core.Common.Base;
using Core.Common.Base.Workflow;
using Core.Common.Gui.Properties;
@@ -56,13 +57,23 @@
try
{
+ if (RunReportLogAppender.Instance != null)
+ {
+ RunReportLogAppender.Instance.AppendMessageLineAction = message => runningActivity.Log += message;
+ }
+
runningActivity.ProgressChanged += ActivityOnProgressChanged;
// Run the activity
ActivityRunner.RunActivity(runningActivity);
}
finally
{
+ if (RunReportLogAppender.Instance != null)
+ {
+ RunReportLogAppender.Instance.AppendMessageLineAction = null;
+ }
+
runningActivity.ProgressChanged -= ActivityOnProgressChanged;
}
Index: Core/Common/src/Core.Common.Gui/IGui.cs
===================================================================
diff -u -reb7f8fe1e85f00faf16a1cddef014728d60a2b19 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision eb7f8fe1e85f00faf16a1cddef014728d60a2b19)
+++ Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -9,7 +9,6 @@
using System.Collections.Generic;
using System.Configuration;
using Core.Common.Base;
-using Core.Common.Base.Workflow;
using Core.Common.Gui.Forms.MainWindow;
namespace Core.Common.Gui
@@ -34,11 +33,6 @@
ApplicationCore ApplicationCore { get; }
///
- /// Gets the of the .
- ///
- IActivityRunner ActivityRunner { get; }
-
- ///
/// Gets or sets the project of the .
///
Project Project { get; set; }
Index: Core/Common/src/Core.Common.Gui/RingtoetsGui.cs
===================================================================
diff -u -r7fa9d1d4bd2b726adab382355d0e3adaf6d8d150 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 7fa9d1d4bd2b726adab382355d0e3adaf6d8d150)
+++ Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -15,12 +15,10 @@
using Core.Common.Gui.ContextMenu;
using Core.Common.Gui.Forms.MainWindow;
using Core.Common.Gui.Forms.MessageWindow;
-using Core.Common.Gui.Forms.ProgressDialog;
using Core.Common.Gui.Forms.SplashScreen;
using Core.Common.Gui.Forms.ViewManager;
using Core.Common.Gui.Properties;
using Core.Common.Utils;
-using Core.Common.Utils.Aop;
using Core.Common.Utils.Collections;
using Core.Common.Utils.Reflection;
using Core.GIS.SharpMap.UI.Helpers;
@@ -33,7 +31,7 @@
///
/// Gui class provides graphical user functionality for a given IApplication.
///
- public class RingtoetsGui : IGui, IContextMenuBuilderProvider, IDisposable
+ public class RingtoetsGui : IGui, IContextMenuBuilderProvider
{
public event EventHandler SelectionChanged; // TODO: make it weak
@@ -61,7 +59,6 @@
private bool runFinished;
private bool isExiting;
private Project project;
- private IActivityRunner activityRunner;
private bool userSettingsDirty;
private ApplicationSettingsBase userSettings;
@@ -92,8 +89,6 @@
ProjectClosing += ApplicationProjectClosing;
ProjectOpened += ApplicationProjectOpened;
-
- ActivityRunner = new ActivityRunner();
}
public bool SkipDialogsOnExit { get; set; }
@@ -104,23 +99,6 @@
public ApplicationCore ApplicationCore { get; private set; }
- public IActivityRunner ActivityRunner
- {
- get
- {
- return activityRunner;
- }
- private set
- {
- activityRunner = value;
-
- if (RunningActivityLogAppender.Instance != null)
- {
- RunningActivityLogAppender.Instance.ActivityRunner = value;
- }
- }
- }
-
public Project Project
{
get
Index: Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj
===================================================================
diff -u -r40c530ce4087ef0accbddb31c74b38905beee0e0 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 40c530ce4087ef0accbddb31c74b38905beee0e0)
+++ Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -127,13 +127,10 @@
-
-
-
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Base.Test/Shell/Core/WorkFlow/ActivityRunnerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Base.Test/Shell/Core/WorkFlow/AsyncActivityRunnerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e62cceb52b0c086a17e685690a44ec02185bac86 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Base.Test/Shell/Core/WorkFlow/BackgroundWorkerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs
===================================================================
diff -u -r41c77f9f36ae74a406fd382187426cc06d2b0200 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision 41c77f9f36ae74a406fd382187426cc06d2b0200)
+++ Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -43,63 +43,6 @@
}
[Test]
- public void ProgressDialogIsModal()
- {
- if (!Environment.UserInteractive)
- {
- return; //progress dialog stuff isn't processed on non-interactive environment (see RingtoetsGui::UpdateProgressDialog)
- }
-
- if (GuiTestHelper.IsBuildServer)
- {
- return; // bleh (fails if users log in etc..)
- }
-
- using (var gui = new RingtoetsGui())
- {
- var applicationCore = gui.ApplicationCore;
-
- applicationCore.AddPlugin(new CommonToolsApplicationPlugin());
- applicationCore.AddPlugin(new SharpMapGisApplicationPlugin());
- gui.Plugins.Add(new ProjectExplorerGuiPlugin());
- gui.Run();
-
- var mainWindow = (Control) gui.MainWindow;
- Action onShown = delegate
- {
- var testActivity = new TestActivity();
- gui.ActivityRunner.Enqueue(testActivity);
- try
- {
- while (!gui.ActivityRunner.IsRunningActivity(testActivity))
- {
- Thread.Sleep(0);
- }
-
- System.Windows.Forms.Application.DoEvents();
-
- Assert.IsFalse(mainWindow.IsEnabled);
- }
- finally
- {
- testActivity.Done = true;
- }
-
- while (gui.ActivityRunner.IsRunningActivity(testActivity))
- {
- Thread.Sleep(0);
- }
-
- System.Windows.Forms.Application.DoEvents();
-
- Assert.IsTrue(mainWindow.IsEnabled);
- };
-
- WpfTestHelper.ShowModal(mainWindow, onShown);
- }
- }
-
- [Test]
public void ClosingEmptyProjectShouldNotGiveException()
{
using (var gui = new RingtoetsGui())
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingCalculationContextNodePresenterTest.cs
===================================================================
diff -u -reff8c57b5a5243e2c723f117b46bf8b4094ca4c6 -re62cceb52b0c086a17e685690a44ec02185bac86
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingCalculationContextNodePresenterTest.cs (.../PipingCalculationContextNodePresenterTest.cs) (revision eff8c57b5a5243e2c723f117b46bf8b4094ca4c6)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingCalculationContextNodePresenterTest.cs (.../PipingCalculationContextNodePresenterTest.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -8,8 +8,6 @@
using System.Windows.Forms;
using Core.Common.Base;
using Core.Common.Base.Workflow;
-using Core.Common.Gui;
-using Core.Common.Gui.ContextMenu;
using Core.Common.Gui.TestUtils;
using NUnit.Framework;
using Rhino.Mocks;
@@ -647,14 +645,12 @@
var calculateContextMenuItemIndex = 1;
var calculation = new PipingCalculation();
calculation.Attach(observer);
-
- var activityRunner = new ActivityRunner();
ITreeNode treeNodeMock = mockRepository.StrictMock();
var nodePresenter = new PipingCalculationContextNodePresenter
{
- RunActivityAction = activity => activityRunner.Enqueue(activity),
+ RunActivityAction = ActivityRunner.RunActivity,
ContextMenuBuilderProvider = TestContextMenuBuilderProvider.Create(mockRepository, treeNodeMock, true)
};
@@ -669,11 +665,6 @@
Action action = () =>
{
contextMenuAdapter.Items[calculateContextMenuItemIndex].PerformClick();
- while (activityRunner.IsRunning)
- {
- // Do something useful while waiting for calculation to finish...
- Application.DoEvents();
- }
};
// Then
@@ -773,22 +764,15 @@
mockRepository.ReplayAll();
- var activityRunner = new ActivityRunner();
-
var contextMenuAdapter = nodePresenter.GetContextMenu(treeNodeMock, new PipingCalculationContext(calculation,
Enumerable.Empty(),
Enumerable.Empty()));
- nodePresenter.RunActivityAction = activity => activityRunner.Enqueue(activity);
+ nodePresenter.RunActivityAction = ActivityRunner.RunActivity;
// When
Action action = () =>
{
contextMenuAdapter.Items[calculateContextMenuItemIndex].PerformClick();
- while (activityRunner.IsRunning)
- {
- // Do something useful while waiting for calculation to finish...
- Application.DoEvents();
- }
};
// Then
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs
===================================================================
diff -u -r495647ee1c652fecc15eea7fefeab29ae01347fe -re62cceb52b0c086a17e685690a44ec02185bac86
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 495647ee1c652fecc15eea7fefeab29ae01347fe)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision e62cceb52b0c086a17e685690a44ec02185bac86)
@@ -86,12 +86,10 @@
// setup
var mocks = new MockRepository();
var applicationCore = new ApplicationCore();
- var activityRunner = new ActivityRunner();
var guiStub = mocks.Stub();
guiStub.CommandHandler = mocks.Stub();
Expect.Call(guiStub.ApplicationCore).Return(applicationCore).Repeat.Any();
- Expect.Call(guiStub.ActivityRunner).Return(activityRunner).Repeat.Any();
mocks.ReplayAll();