/// <summary> /// Initializes a new instance of the <see cref="LocalDatasetDistributor"/> class. /// </summary> /// <param name="localDistributor">The object that handles distribution proposals for the local machine.</param> /// <param name="loader">The object that handles the actual starting of the dataset application.</param> /// <param name="commandHub">The object that sends commands to remote endpoints.</param> /// <param name="notificationHub">The object that receives notifications from remote endpoints.</param> /// <param name="uploads">The object that stores all the uploads waiting to be started.</param> /// <param name="datasetInformationBuilder">The function that builds <see cref="DatasetOnlineInformation"/> objects.</param> /// <param name="communicationLayer">The object that handles the communication for the application.</param> /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the system.</param> /// <param name="scheduler">The scheduler that is used to run the tasks on.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="localDistributor"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="loader"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commandHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notificationHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="datasetInformationBuilder"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="communicationLayer"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />. /// </exception> public LocalDatasetDistributor( ICalculateDistributionParameters localDistributor, IDatasetActivator loader, ISendCommandsToRemoteEndpoints commandHub, INotifyOfRemoteEndpointEvents notificationHub, IStoreUploads uploads, Func <DatasetId, EndpointId, NetworkIdentifier, DatasetOnlineInformation> datasetInformationBuilder, ICommunicationLayer communicationLayer, SystemDiagnostics systemDiagnostics, TaskScheduler scheduler = null) { { Enforce.Argument(() => localDistributor); Enforce.Argument(() => loader); Enforce.Argument(() => commandHub); Enforce.Argument(() => notificationHub); Enforce.Argument(() => datasetInformationBuilder); Enforce.Argument(() => communicationLayer); Enforce.Argument(() => systemDiagnostics); } m_LocalDistributor = localDistributor; m_Loader = loader; m_CommandHub = commandHub; m_NotificationHub = notificationHub; m_Uploads = uploads; m_DatasetInformationBuilder = datasetInformationBuilder; m_CommunicationLayer = communicationLayer; m_Diagnostics = systemDiagnostics; m_Scheduler = scheduler ?? TaskScheduler.Default; }
/// <summary> /// Initializes a new instance of the <see cref="CommunicationEntryPoint"/> class. /// </summary> /// <param name="endpointStorage">The collection that stores information about all known endpoints.</param> /// <param name="commands">The collection that stores information about all the known remote commands.</param> /// <param name="notifications">The collection that stores information about all the known remote notifications.</param> /// <param name="verifyConnectionTo">The function that is used to verify connections to remote endpoints.</param> /// <param name="configuration">The object that stores the configuration for the application.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="endpointStorage"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commands"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notifications"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="verifyConnectionTo"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="configuration"/> is <see langword="null" />. /// </exception> public CommunicationEntryPoint( IStoreInformationAboutEndpoints endpointStorage, ISendCommandsToRemoteEndpoints commands, INotifyOfRemoteEndpointEvents notifications, VerifyEndpointConnectionStatus verifyConnectionTo, IConfiguration configuration) { { Lokad.Enforce.Argument(() => endpointStorage); Lokad.Enforce.Argument(() => commands); Lokad.Enforce.Argument(() => notifications); Lokad.Enforce.Argument(() => verifyConnectionTo); } m_MessageSendTimeout = configuration.HasValueFor(CommunicationConfigurationKeys.WaitForResponseTimeoutInMilliSeconds) ? TimeSpan.FromMilliseconds(configuration.Value <int>(CommunicationConfigurationKeys.WaitForResponseTimeoutInMilliSeconds)) : TimeSpan.FromMilliseconds(CommunicationConstants.DefaultWaitForResponseTimeoutInMilliSeconds); m_EndpointStorage = endpointStorage; m_EndpointStorage.OnEndpointConnected += HandleOnEndpointConnected; m_EndpointStorage.OnEndpointDisconnected += HandleOnEndpointDisconnected; m_Commands = commands; m_Commands.OnEndpointConnected += HandleOnEndpointConnected; m_Commands.OnEndpointDisconnected += HandleOnEndpointDisconnected; m_Notifications = notifications; m_Notifications.OnEndpointConnected += HandleOnEndpointConnected; m_Notifications.OnEndpointDisconnected += HandleOnEndpointDisconnected; m_VerifyConnectionTo = verifyConnectionTo; }
/// <summary> /// Initializes a new instance of the <see cref="CommunicationPassThrough"/> class. /// </summary> /// <param name="commands">The object that sends commands to the remote endpoints.</param> /// <param name="uploads">The object that tracks files registered for upload.</param> /// <param name="localNotifications">The object that holds the notifications.</param> public CommunicationPassThrough( ISendCommandsToRemoteEndpoints commands, IStoreUploads uploads, TestNotifications localNotifications) { m_Commands = commands; m_Uploads = uploads; m_LocalNotifications = localNotifications; }
/// <summary> /// Initializes a new instance of the <see cref="PhysicalMachineEnvironmentActivator"/> class. /// </summary> /// <param name="configuration">The object that stores all the configuration values for the application.</param> /// <param name="commands">The object that stores all the command sets that were received from remote endpoints.</param> /// <param name="notifications">The object that provides notifications from remote endpoints.</param> /// <param name="disconnection">The delegate used to notify the communication system of the disconnection of an endpoint.</param> /// <param name="uploads">The object that tracks the files available for upload.</param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="configuration"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commands"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notifications"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="disconnection"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="diagnostics"/> is <see langword="null" />. /// </exception> public PhysicalMachineEnvironmentActivator( IConfiguration configuration, ISendCommandsToRemoteEndpoints commands, INotifyOfRemoteEndpointEvents notifications, ManualEndpointDisconnection disconnection, IStoreUploads uploads, SystemDiagnostics diagnostics) : base(configuration, commands, notifications, disconnection, uploads, diagnostics) { }
/// <summary> /// Initializes a new instance of the <see cref="DatasetOnlineInformation"/> class. /// </summary> /// <param name="id">The ID number of the dataset.</param> /// <param name="endpoint">The ID number of the endpoint that has the actual dataset loaded.</param> /// <param name="networkId">The network identifier of the machine on which the dataset runs.</param> /// <param name="commandHub">The object that handles sending commands to the remote endpoint.</param> /// <param name="notificationHub">The object that handles the event notifications for remote endpoints.</param> /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the system.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="id"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="endpoint"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="networkId"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commandHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notificationHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />. /// </exception> public DatasetOnlineInformation( DatasetId id, EndpointId endpoint, NetworkIdentifier networkId, ISendCommandsToRemoteEndpoints commandHub, INotifyOfRemoteEndpointEvents notificationHub, SystemDiagnostics systemDiagnostics) { { Enforce.Argument(() => id); Enforce.Argument(() => endpoint); Enforce.Argument(() => networkId); Enforce.Argument(() => commandHub); Enforce.Argument(() => notificationHub); Enforce.Argument(() => systemDiagnostics); } Id = id; Endpoint = endpoint; RunsOn = networkId; m_CommandHub = commandHub; m_Diagnostics = systemDiagnostics; m_NotificationHub = notificationHub; { Debug.Assert( m_NotificationHub.HasNotificationFor(Endpoint, typeof(IDatasetApplicationNotifications)), "Missing essential notification set."); var notifications = m_NotificationHub.NotificationsFor <IDatasetApplicationNotifications>(Endpoint); notifications.OnSwitchToEditingMode += (s, e) => { m_IsEditMode = true; RaiseOnSwitchToEditMode(); }; notifications.OnSwitchToExecutingMode += (s, e) => { m_IsEditMode = false; RaiseOnSwitchToExecutingMode(); }; notifications.OnTimelineUpdate += (s, e) => { RaiseOnTimelineUpdate(); }; } }
/// <summary> /// Initializes a new instance of the <see cref="HypervEnvironmentActivator"/> class. /// </summary> /// <param name="configuration">The object that stores all the configuration values for the application.</param> /// <param name="commands">The object that stores all the command sets that were received from remote endpoints.</param> /// <param name="notifications">The object that provides notifications from remote endpoints.</param> /// <param name="disconnection">The delegate used to notify the communication system of the disconnection of an endpoint.</param> /// <param name="uploads">The object that tracks the files available for upload.</param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> /// <param name="environmentById">The function that is used to find environments based on their ID.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="configuration"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commands"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notifications"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="disconnection"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="diagnostics"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="environmentById"/> is <see langword="null" />. /// </exception> public HypervEnvironmentActivator( IConfiguration configuration, ISendCommandsToRemoteEndpoints commands, INotifyOfRemoteEndpointEvents notifications, ManualEndpointDisconnection disconnection, IStoreUploads uploads, SystemDiagnostics diagnostics, Func<string, MachineDescription> environmentById) : base(configuration, commands, notifications, disconnection, uploads, diagnostics) { { Lokad.Enforce.Argument(() => environmentById); } m_EnvironmentById = environmentById; }
/// <summary> /// Initializes a new instance of the <see cref="PluginLoadingAssemblyResolver"/> class. /// </summary> /// <param name="hostCommands">The object that provides the commands registered with the application.</param> /// <param name="layer">The object that handles the communication with the remote host.</param> /// <param name="fileSystem">The object that virtualizes the file system.</param> /// <param name="hostId">The ID of the host endpoint.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="hostCommands"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="layer"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="hostId"/> is <see langword="null" />. /// </exception> public PluginLoadingAssemblyResolver( ISendCommandsToRemoteEndpoints hostCommands, DownloadDataFromRemoteEndpoints layer, IFileSystem fileSystem, EndpointId hostId) { { Lokad.Enforce.Argument(() => hostCommands); Lokad.Enforce.Argument(() => layer); Lokad.Enforce.Argument(() => fileSystem); Lokad.Enforce.Argument(() => hostId); } m_HostCommands = hostCommands; m_Layer = layer; m_FileSystem = fileSystem; m_HostId = hostId; }
/// <summary> /// Initializes a new instance of the <see cref="RemoteDatasetDistributor"/> class. /// </summary> /// <param name="configuration">The application specific configuration.</param> /// <param name="commandHub">The object that manages the remote command proxies.</param> /// <param name="notificationHub">The object that receives notifications from remote endpoints.</param> /// <param name="uploads">The object that stores all the uploads waiting to be started.</param> /// <param name="datasetInformationBuilder">The function that builds <see cref="DatasetOnlineInformation"/> objects.</param> /// <param name="communicationLayer">The object that handles the communication for the application.</param> /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the system.</param> /// <param name="scheduler">The scheduler that is used to run the tasks.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commandHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notificationHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="configuration"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="datasetInformationBuilder"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="communicationLayer"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />. /// </exception> public RemoteDatasetDistributor( IConfiguration configuration, ISendCommandsToRemoteEndpoints commandHub, INotifyOfRemoteEndpointEvents notificationHub, IStoreUploads uploads, Func <DatasetId, EndpointId, NetworkIdentifier, DatasetOnlineInformation> datasetInformationBuilder, ICommunicationLayer communicationLayer, SystemDiagnostics systemDiagnostics, TaskScheduler scheduler = null) { { Lokad.Enforce.Argument(() => commandHub); Lokad.Enforce.Argument(() => notificationHub); Lokad.Enforce.Argument(() => configuration); Lokad.Enforce.Argument(() => datasetInformationBuilder); Lokad.Enforce.Argument(() => communicationLayer); Lokad.Enforce.Argument(() => systemDiagnostics); } m_Configuration = configuration; m_Uploads = uploads; m_DatasetInformationBuilder = datasetInformationBuilder; m_CommunicationLayer = communicationLayer; m_Diagnostics = systemDiagnostics; m_Scheduler = scheduler ?? TaskScheduler.Default; m_CommandHub = commandHub; { // Set up the events so that we can see the loaders come online. // // Note that the events may come in on a different thread than the one // we're normally accessed on. This is because adding an enpoint is usually // a result of a WCF message being received, on the WCF message thread. m_CommandHub.OnEndpointSignedIn += (s, e) => AddNewEndpoint(e.Endpoint, e.Commands); m_CommandHub.OnEndpointSignedOff += (s, e) => RemoveEndpoint(e.Endpoint); var knownCommands = m_CommandHub.AvailableCommands(); foreach (var command in knownCommands) { AddNewEndpoint(command.Endpoint, command.RegisteredCommands); } } m_NotificationHub = notificationHub; }
/// <summary> /// Initializes a new instance of the <see cref="MachineEnvironmentActivator"/> class. /// </summary> /// <param name="configuration">The object that stores all the configuration values for the application.</param> /// <param name="commands">The object that stores all the command sets that were received from remote endpoints.</param> /// <param name="notifications">The object that provides notifications from remote endpoints.</param> /// <param name="disconnection">The delegate used to notify the communication system of the disconnection of an endpoint.</param> /// <param name="uploads">The object that tracks the files available for upload.</param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="configuration"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commands"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notifications"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="disconnection"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="diagnostics"/> is <see langword="null" />. /// </exception> protected MachineEnvironmentActivator( IConfiguration configuration, ISendCommandsToRemoteEndpoints commands, INotifyOfRemoteEndpointEvents notifications, ManualEndpointDisconnection disconnection, IStoreUploads uploads, SystemDiagnostics diagnostics) { { Lokad.Enforce.Argument(() => configuration); Lokad.Enforce.Argument(() => commands); Lokad.Enforce.Argument(() => notifications); Lokad.Enforce.Argument(() => disconnection); Lokad.Enforce.Argument(() => uploads); Lokad.Enforce.Argument(() => diagnostics); } m_Configuration = configuration; m_Commands = commands; m_Notifications = notifications; m_Disconnection = disconnection; m_Uploads = uploads; m_Diagnostics = diagnostics; }
/// <summary> /// Initializes a new instance of the <see cref="TransferTestReportDataCommands"/> class. /// </summary> /// <param name="fileSystem">The object that provides access to the file system.</param> /// <param name="dataDownload">The function that handles the download of data from a remote endpoint.</param> /// <param name="remoteCommands">The object that sends commands to remote endpoints.</param> /// <param name="uploads">The object that stores links to all the files that should be uploaded.</param> /// <param name="testInformation">The object that stores information about the currently active test.</param> /// <param name="hostInformation">The object that stores information about the host.</param> /// <param name="storageDirectory">The directory in which all the report files are stored.</param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="fileSystem"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="dataDownload"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="remoteCommands"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="testInformation"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="hostInformation"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="storageDirectory"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="diagnostics"/> is <see langword="null" />. /// </exception> public TransferTestReportDataCommands( IFileSystem fileSystem, DownloadDataFromRemoteEndpoints dataDownload, ISendCommandsToRemoteEndpoints remoteCommands, IStoreUploads uploads, ActiveTestInformation testInformation, HostInformationStorage hostInformation, string storageDirectory, SystemDiagnostics diagnostics) { { Lokad.Enforce.Argument(() => fileSystem); Lokad.Enforce.Argument(() => dataDownload); Lokad.Enforce.Argument(() => remoteCommands); Lokad.Enforce.Argument(() => uploads); Lokad.Enforce.Argument(() => testInformation); Lokad.Enforce.Argument(() => hostInformation); Lokad.Enforce.Argument(() => storageDirectory); Lokad.Enforce.Argument(() => diagnostics); } m_FileSystem = fileSystem; m_DataDownload = dataDownload; m_RemoteCommands = remoteCommands; m_Uploads = uploads; m_TestInformation = testInformation; m_HostInformation = hostInformation; m_StorageDirectory = storageDirectory; m_Diagnostics = diagnostics; }
/// <summary> /// Initializes a new instance of the <see cref="TestStepExecutionCommands"/> class. /// </summary> /// <param name="fileSystem">The object that provides access to the file system.</param> /// <param name="layer">The object that provides methods for sending and receiving data from remote endpoints.</param> /// <param name="remoteCommands">The object that sends commands to remote endpoints.</param> /// <param name="remoteNotifications">The object that provides notifications from remote endpoints.</param> /// <param name="dataDownload">The function that is used to download data streams from remote endpoints.</param> /// <param name="executionEvents">The object that handles sending test execution events to the Sherlock master.</param> /// <param name="sectionBuilders">The function that returns a new test section builder.</param> /// <param name="configuration">The configuration object.</param> /// <param name="testInformation">The object that stores information about the currently active test.</param> /// <param name="hostInformation">The object that stores information about the host.</param> /// <param name="storageDirectory">The directory in which all the report files are stored.</param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="fileSystem"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="layer"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="remoteCommands"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="remoteNotifications"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="dataDownload"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="executionEvents"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="sectionBuilders"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="configuration"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="testInformation"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="hostInformation"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="storageDirectory"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="diagnostics"/> is <see langword="null" />. /// </exception> public TestStepExecutionCommands( IFileSystem fileSystem, ICommunicationLayer layer, ISendCommandsToRemoteEndpoints remoteCommands, INotifyOfRemoteEndpointEvents remoteNotifications, DownloadDataFromRemoteEndpoints dataDownload, ITestExecutionNotificationsInvoker executionEvents, Func<string, ITestSectionBuilder> sectionBuilders, IConfiguration configuration, ActiveTestInformation testInformation, HostInformationStorage hostInformation, string storageDirectory, SystemDiagnostics diagnostics) { { Lokad.Enforce.Argument(() => fileSystem); Lokad.Enforce.Argument(() => layer); Lokad.Enforce.Argument(() => remoteCommands); Lokad.Enforce.Argument(() => remoteNotifications); Lokad.Enforce.Argument(() => dataDownload); Lokad.Enforce.Argument(() => executionEvents); Lokad.Enforce.Argument(() => sectionBuilders); Lokad.Enforce.Argument(() => configuration); Lokad.Enforce.Argument(() => testInformation); Lokad.Enforce.Argument(() => hostInformation); Lokad.Enforce.Argument(() => storageDirectory); Lokad.Enforce.Argument(() => diagnostics); } m_FileSystem = fileSystem; m_Layer = layer; m_RemoteCommands = remoteCommands; m_RemoteNotifications = remoteNotifications; m_DataDownload = dataDownload; m_TestExecutionEvents = executionEvents; m_SectionBuilders = sectionBuilders; m_Configuration = configuration; m_TestInformation = testInformation; m_HostInformation = hostInformation; m_StorageDirectory = storageDirectory; m_Diagnostics = diagnostics; }
/// <summary> /// Initializes a new instance of the <see cref="LocalDatasetDistributor"/> class. /// </summary> /// <param name="localDistributor">The object that handles distribution proposals for the local machine.</param> /// <param name="loader">The object that handles the actual starting of the dataset application.</param> /// <param name="commandHub">The object that sends commands to remote endpoints.</param> /// <param name="notificationHub">The object that receives notifications from remote endpoints.</param> /// <param name="uploads">The object that stores all the uploads waiting to be started.</param> /// <param name="datasetInformationBuilder">The function that builds <see cref="DatasetOnlineInformation"/> objects.</param> /// <param name="communicationLayer">The object that handles the communication for the application.</param> /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the system.</param> /// <param name="scheduler">The scheduler that is used to run the tasks on.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="localDistributor"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="loader"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commandHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notificationHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="datasetInformationBuilder"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="communicationLayer"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />. /// </exception> public LocalDatasetDistributor( ICalculateDistributionParameters localDistributor, IDatasetActivator loader, ISendCommandsToRemoteEndpoints commandHub, INotifyOfRemoteEndpointEvents notificationHub, IStoreUploads uploads, Func<DatasetId, EndpointId, NetworkIdentifier, DatasetOnlineInformation> datasetInformationBuilder, ICommunicationLayer communicationLayer, SystemDiagnostics systemDiagnostics, TaskScheduler scheduler = null) { { Enforce.Argument(() => localDistributor); Enforce.Argument(() => loader); Enforce.Argument(() => commandHub); Enforce.Argument(() => notificationHub); Enforce.Argument(() => datasetInformationBuilder); Enforce.Argument(() => communicationLayer); Enforce.Argument(() => systemDiagnostics); } m_LocalDistributor = localDistributor; m_Loader = loader; m_CommandHub = commandHub; m_NotificationHub = notificationHub; m_Uploads = uploads; m_DatasetInformationBuilder = datasetInformationBuilder; m_CommunicationLayer = communicationLayer; m_Diagnostics = systemDiagnostics; m_Scheduler = scheduler ?? TaskScheduler.Default; }
/// <summary> /// Initializes a new instance of the <see cref="RemoteDatasetDistributor"/> class. /// </summary> /// <param name="configuration">The application specific configuration.</param> /// <param name="commandHub">The object that manages the remote command proxies.</param> /// <param name="notificationHub">The object that receives notifications from remote endpoints.</param> /// <param name="uploads">The object that stores all the uploads waiting to be started.</param> /// <param name="datasetInformationBuilder">The function that builds <see cref="DatasetOnlineInformation"/> objects.</param> /// <param name="communicationLayer">The object that handles the communication for the application.</param> /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the system.</param> /// <param name="scheduler">The scheduler that is used to run the tasks.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="commandHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="notificationHub"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="configuration"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="uploads"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="datasetInformationBuilder"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="communicationLayer"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />. /// </exception> public RemoteDatasetDistributor( IConfiguration configuration, ISendCommandsToRemoteEndpoints commandHub, INotifyOfRemoteEndpointEvents notificationHub, IStoreUploads uploads, Func<DatasetId, EndpointId, NetworkIdentifier, DatasetOnlineInformation> datasetInformationBuilder, ICommunicationLayer communicationLayer, SystemDiagnostics systemDiagnostics, TaskScheduler scheduler = null) { { Lokad.Enforce.Argument(() => commandHub); Lokad.Enforce.Argument(() => notificationHub); Lokad.Enforce.Argument(() => configuration); Lokad.Enforce.Argument(() => datasetInformationBuilder); Lokad.Enforce.Argument(() => communicationLayer); Lokad.Enforce.Argument(() => systemDiagnostics); } m_Configuration = configuration; m_Uploads = uploads; m_DatasetInformationBuilder = datasetInformationBuilder; m_CommunicationLayer = communicationLayer; m_Diagnostics = systemDiagnostics; m_Scheduler = scheduler ?? TaskScheduler.Default; m_CommandHub = commandHub; { // Set up the events so that we can see the loaders come online. // // Note that the events may come in on a different thread than the one // we're normally accessed on. This is because adding an enpoint is usually // a result of a WCF message being received, on the WCF message thread. m_CommandHub.OnEndpointSignedIn += (s, e) => AddNewEndpoint(e.Endpoint, e.Commands); m_CommandHub.OnEndpointSignedOff += (s, e) => RemoveEndpoint(e.Endpoint); var knownCommands = m_CommandHub.AvailableCommands(); foreach (var command in knownCommands) { AddNewEndpoint(command.Endpoint, command.RegisteredCommands); } } m_NotificationHub = notificationHub; }