Пример #1
0
 public void SetUp()
 {
     _messageDispatcher = new MessageDispatcher();
     _channel           = new MockDuplexChannel();
     _subject           = new RemoteExecutor(_channel, _messageDispatcher, new DefaultMessageFactory());
     _calculator        = _subject.Create <ICalculator>();
 }
Пример #2
0
 private void AbortProxy()
 {
     if (_executorProxy != null)
     {
         ClientChannel.Abort();
         ClientChannel.Close();
         _executorProxy = null;
     }
 }
Пример #3
0
        /// <summary>
        /// Connect to the Executor Service and subscribe for state change events.
        /// Register also event handlers for the communication state changes.
        /// </summary>
        public void Connect()
        {
            _executorProxy = _channelFactory.CreateChannel();

            ClientChannel.Opened  += clientCommunication_Opened;
            ClientChannel.Faulted += clientCommunication_Faulted;
            ClientChannel.Closed  += clientCommunication_Closed;

            _executorProxy.ConnectClient();
        }
Пример #4
0
        public void BaseSetUp()
        {
            MessageDispatcher     = MockRepository.GenerateMock <IMessageDispatcher>();
            OperationDispatcher   = MockRepository.GenerateMock <IOperationDispatcher>();
            RemoteExecutorFactory = MockRepository.GenerateMock <IRemoteExecutorFactory>();
            Channel        = MockRepository.GenerateMock <TChannel>();
            RemoteExecutor = MockRepository.GenerateMock <IRemoteExecutor>();
            Scheduler      = MockRepository.GenerateMock <ITaskScheduler>();

            Scheduler.Stub(s => s.Execute(Arg <Action> .Is.Anything)).WhenCalled(a => ((Action)a.Arguments[0]).Invoke());
            OperationDispatcher.Stub(d => d.MessageDispatcher).Return(MessageDispatcher);
            RemoteExecutorFactory.Stub(f => f.CreateRemoteExecutor(Arg <IDuplexChannel> .Is.Anything, Arg <IMessageDispatcher> .Is.Anything)).Return(RemoteExecutor);
            Subject = CreateSubject();
        }
Пример #5
0
        public static void RegisterRemoteExecutor(IRemoteExecutor executor)
        {
            var sourcePort = RemoteExecutorService.GetPortNumberFromRequest();

            if (executor.Eid == default(Guid))
            {
                throw new ArgumentException("Remote executor needs to be initialized first.", "executor");
            }

            do
            {
                // TODO: It would be good to have some way of checking that before calling Register...
                if (RemoteExecutors.ContainsKey(executor.Eid))
                {
                    throw new ArgumentException("Given remote executor already exists.", "executor");
                }
            }
            while (!RemoteExecutors.TryAdd(executor.Eid, executor));
        }
Пример #6
0
 private void AbortProxy()
 {
     if (_executorProxy != null)
     {
         ClientChannel.Abort();
         ClientChannel.Close();
         _executorProxy = null;
     }
 }
Пример #7
0
        /// <summary>
        /// Connect to the Executor Service and subscribe for state change events.
        /// Register also event handlers for the communication state changes.
        /// </summary>
        public void Connect()
        {
            _executorProxy = _channelFactory.CreateChannel();

            ClientChannel.Opened += clientCommunication_Opened;
            ClientChannel.Faulted += clientCommunication_Faulted;
            ClientChannel.Closed += clientCommunication_Closed;

            _executorProxy.ConnectClient();
        }