Exemple #1
0
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteReceiver class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to receive messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="readLoopTimeout">The time to wait between attempts to read the file in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 /// <param name="messageFile">A test (mock) message file.</param>
 /// <param name="fileSystem">A test (mock) file system.</param>
 public FileRemoteReceiver(string messageFilePath, string lockFilePath, int readLoopTimeout, IApplicationLogger logger, IMetricLogger metricLogger, IFile messageFile, IFileSystem fileSystem)
     : this(messageFilePath, lockFilePath, readLoopTimeout)
 {
     this.messageFile = messageFile;
     this.fileSystem  = fileSystem;
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteSender class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="ipAddress">The remote IP address to connect to.</param>
 /// <param name="port">The remote port to connect to.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteReceiver.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="acknowledgementReceiveTimeout">The maximum time to wait for an acknowledgement of a message in milliseconds.</param>
 /// <param name="acknowledgementReceiveRetryInterval">The time between retries to check for an acknowledgement in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 /// <param name="client">A test (mock) TCP client.</param>
 public TcpRemoteSender(string ipAddress, int port, int connectRetryCount, int connectRetryInterval, int acknowledgementReceiveTimeout, int acknowledgementReceiveRetryInterval, IApplicationLogger logger, IMetricLogger metricLogger, ITcpClient client)
     : this(ipAddress, port, connectRetryCount, connectRetryInterval, acknowledgementReceiveTimeout, acknowledgementReceiveRetryInterval, logger, metricLogger)
 {
     this.client.Dispose();
     this.client = client;
 }
Exemple #3
0
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteReceiver class.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to receive messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="readLoopTimeout">The time to wait between attempts to read the file in milliseconds.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public FileRemoteReceiver(string messageFilePath, string lockFilePath, int readLoopTimeout, IMetricLogger metricLogger)
     : this(messageFilePath, lockFilePath, readLoopTimeout)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteSender class.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to send messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public FileRemoteSender(string messageFilePath, string lockFilePath, IMetricLogger metricLogger)
     : this(messageFilePath, lockFilePath)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteSender class.
 /// </summary>
 /// <param name="ipAddress">The remote IP address to connect to.</param>
 /// <param name="port">The remote port to connect to.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteReceiver.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="acknowledgementReceiveTimeout">The maximum time to wait for an acknowledgement of a message in milliseconds.</param>
 /// <param name="acknowledgementReceiveRetryInterval">The time between retries to check for an acknowledgement in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteSender(string ipAddress, int port, int connectRetryCount, int connectRetryInterval, int acknowledgementReceiveTimeout, int acknowledgementReceiveRetryInterval, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(System.Net.IPAddress.Parse("0.0.0.0"), port, connectRetryCount, connectRetryInterval, acknowledgementReceiveTimeout, acknowledgementReceiveRetryInterval)
 {
     this.ipAddress   = System.Net.IPAddress.Parse(ipAddress);
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: MethodInvocationRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.MethodInvocationRemoteReceiver class.
 /// </summary>
 /// <param name="serializer">Object to use to deserialize method invocations.</param>
 /// <param name="sender">Object to use to send serialized method invocation return values.</param>
 /// <param name="receiver">Object to use to receive serialized method invocations.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public MethodInvocationRemoteReceiver(IMethodInvocationSerializer serializer, IRemoteSender sender, IRemoteReceiver receiver, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(serializer, sender, receiver)
 {
     this.logger = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: RemoteSenderCompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteSenderCompressor class.
 /// </summary>
 /// <param name="underlyingRemoteSender">The remote sender to send the message to after compressing.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteSenderCompressor(IRemoteSender underlyingRemoteSender, IMetricLogger metricLogger)
     : this(underlyingRemoteSender)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemple #8
0
 //------------------------------------------------------------------------------
 //
 // Method: RemoteReceiverDecompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteReceiverDecompressor class.
 /// </summary>
 /// <param name="underlyingRemoteReceiver">The remote receiver to receive the message from before compressing.</param>
 /// <param name="decompressionBufferSize">The size of the buffer to use when decompressing the message in bytes.  Denotes how much data will be read from the internal stream decompressor class in each read operation.  Should be set to match the expected decompressed message size as closely as possible.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteReceiverDecompressor(IRemoteReceiver underlyingRemoteReceiver, int decompressionBufferSize, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(underlyingRemoteReceiver, decompressionBufferSize)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteReceiver class.
 /// </summary>
 /// <param name="port">The port to listen for incoming connections on.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteSender.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="receiveRetryInterval">The time to wait between attempts to receive a message in milliseconds.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteReceiver(int port, int connectRetryCount, int connectRetryInterval, int receiveRetryInterval, IMetricLogger metricLogger)
     : this(port, connectRetryCount, connectRetryInterval, receiveRetryInterval)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 protected void SetUp()
 {
     mocks            = new Mockery();
     mockMetricLogger = mocks.NewMock <IMetricLogger>();
     testSoapMethodInvocationSerializer = new SoapMethodInvocationSerializer(mockMetricLogger);
 }
Exemple #11
0
 //------------------------------------------------------------------------------
 //
 // Method: RemoteReceiverDecompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteReceiverDecompressor class.
 /// </summary>
 /// <param name="underlyingRemoteReceiver">The remote receiver to receive the message from before compressing.</param>
 /// <param name="decompressionBufferSize">The size of the buffer to use when decompressing the message in bytes.  Denotes how much data will be read from the internal stream decompressor class in each read operation.  Should be set to match the expected decompressed message size as closely as possible.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteReceiverDecompressor(IRemoteReceiver underlyingRemoteReceiver, int decompressionBufferSize, IMetricLogger metricLogger)
     : this(underlyingRemoteReceiver, decompressionBufferSize)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: AddLogger
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Adds a IMetricLogger to the distribution list.
 /// </summary>
 /// <param name="logger">The logger to add.</param>
 public void AddLogger(IMetricLogger logger)
 {
     loggerList.Add(logger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteSender class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to send messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 /// <param name="messageFile">A test (mock) message file.</param>
 /// <param name="lockFile">A test (mock) lock file.</param>
 /// <param name="fileSystem">A test (mock) file system.</param>
 public FileRemoteSender(string messageFilePath, string lockFilePath, IApplicationLogger logger, IMetricLogger metricLogger, IFile messageFile, IFile lockFile, IFileSystem fileSystem)
     : this(messageFilePath, lockFilePath)
 {
     this.messageFile = messageFile;
     this.lockFile    = lockFile;
     this.fileSystem  = fileSystem;
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteSender class.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to send messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public FileRemoteSender(string messageFilePath, string lockFilePath, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(messageFilePath, lockFilePath)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemple #15
0
 /// <summary>
 /// Create metric logger
 /// </summary>
 /// <param name="watchName"> Watch name eg. method name.</param>
 /// <param name="metrics"> Metrics Logger.</param>
 public TimeLogger(string watchName, IMetricLogger metrics)
 {
     _stopWatch = Stopwatch.StartNew();
     _watchName = watchName;
     _metrics   = metrics;
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteReceiver class.
 /// </summary>
 /// <param name="port">The port to listen for incoming connections on.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteSender.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="receiveRetryInterval">The time to wait between attempts to receive a message in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteReceiver(int port, int connectRetryCount, int connectRetryInterval, int receiveRetryInterval, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(port, connectRetryCount, connectRetryInterval, receiveRetryInterval)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: MethodInvocationRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.MethodInvocationRemoteReceiver class.
 /// </summary>
 /// <param name="serializer">Object to use to deserialize method invocations.</param>
 /// <param name="sender">Object to use to send serialized method invocation return values.</param>
 /// <param name="receiver">Object to use to receive serialized method invocations.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public MethodInvocationRemoteReceiver(IMethodInvocationSerializer serializer, IRemoteSender sender, IRemoteReceiver receiver, IMetricLogger metricLogger)
     : this(serializer, sender, receiver)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteReceiver class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="port">The port to listen for incoming connections on.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteSender.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="receiveRetryInterval">The time to wait between attempts to receive a message in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 /// <param name="listener">A test (mock) TCP listener.</param>
 public TcpRemoteReceiver(int port, int connectRetryCount, int connectRetryInterval, int receiveRetryInterval, IApplicationLogger logger, IMetricLogger metricLogger, ITcpListener listener)
     : this(port, connectRetryCount, connectRetryInterval, receiveRetryInterval, logger, metricLogger)
 {
     this.listener.Dispose();
     this.listener = listener;
 }
 //------------------------------------------------------------------------------
 //
 // Method: RemoteSenderCompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteSenderCompressor class.
 /// </summary>
 /// <param name="underlyingRemoteSender">The remote sender to send the message to after compressing.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteSenderCompressor(IRemoteSender underlyingRemoteSender, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(underlyingRemoteSender)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteSender class.
 /// </summary>
 /// <param name="ipAddress">The remote IP address to connect to.</param>
 /// <param name="port">The remote port to connect to.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteReceiver.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="acknowledgementReceiveTimeout">The maximum time to wait for an acknowledgement of a message in milliseconds.</param>
 /// <param name="acknowledgementReceiveRetryInterval">The time between retries to check for an acknowledgement in milliseconds.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteSender(System.Net.IPAddress ipAddress, int port, int connectRetryCount, int connectRetryInterval, int acknowledgementReceiveTimeout, int acknowledgementReceiveRetryInterval, IMetricLogger metricLogger)
     : this(ipAddress, port, connectRetryCount, connectRetryInterval, acknowledgementReceiveTimeout, acknowledgementReceiveRetryInterval)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemple #21
0
 //------------------------------------------------------------------------------
 //
 // Method: SoapMethodInvocationSerializer (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.SoapMethodInvocationSerializer class.
 /// </summary>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public SoapMethodInvocationSerializer(IApplicationLogger logger, IMetricLogger metricLogger)
     : this()
 {
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemple #22
0
 protected void SetUp()
 {
     mocks            = new Mockery();
     mockMetricLogger = mocks.NewMock <IMetricLogger>();
     testMethodInvocationSerializer = new MethodInvocationSerializer(new SerializerOperationMap(), new ConsoleApplicationLogger(LogLevel.Critical, '|', "  "), mockMetricLogger);
 }