internal RuntimeController( AppConfig appConfig, ILogger logger, IMessageBox messageBox, IOperationSequence bootstrapSequence, IRepeatableOperationSequence sessionSequence, IRuntimeHost runtimeHost, IRuntimeWindow runtimeWindow, IServiceProxy service, SessionContext sessionContext, Action shutdown, ISplashScreen splashScreen, IText text, IUserInterfaceFactory uiFactory) { this.appConfig = appConfig; this.bootstrapSequence = bootstrapSequence; this.logger = logger; this.messageBox = messageBox; this.runtimeHost = runtimeHost; this.runtimeWindow = runtimeWindow; this.sessionSequence = sessionSequence; this.service = service; this.sessionContext = sessionContext; this.shutdown = shutdown; this.splashScreen = splashScreen; this.text = text; this.uiFactory = uiFactory; }
/// <summary> /// Constructs an instance of this class by using passed test site and given marshaling configuration. /// </summary> /// <param name="host">The message runtime host</param> /// <param name="config">The marshaling configuration</param> public MessageUtils(IRuntimeHost host, MarshalingConfiguration config) { this.marshaler = new Marshaler(host, config); this.host = host; disableValidation = IsDisableValidation(); InitMethodTable(initializers, typeof(InitializerAttribute), true); InitMethodTable(validators, typeof(ValidatorAttribute), false); }
public ClientTerminationOperation( ILogger logger, IProcessFactory processFactory, IProxyFactory proxyFactory, IRuntimeHost runtimeHost, SessionContext sessionContext, int timeout_ms) : base(logger, processFactory, proxyFactory, runtimeHost, sessionContext, timeout_ms) { }
public SessionInitializationOperation( IConfigurationRepository configuration, ILogger logger, IRuntimeHost runtimeHost, SessionContext sessionContext) : base(sessionContext) { this.configuration = configuration; this.logger = logger; this.runtimeHost = runtimeHost; }
public ServiceOperation( ILogger logger, IRuntimeHost runtimeHost, IServiceProxy service, SessionContext sessionContext, int timeout_ms) : base(sessionContext) { this.logger = logger; this.runtimeHost = runtimeHost; this.service = service; this.timeout_ms = timeout_ms; }
public ClientOperation( ILogger logger, IProcessFactory processFactory, IProxyFactory proxyFactory, IRuntimeHost runtimeHost, SessionContext sessionContext, int timeout_ms) : base(sessionContext) { this.logger = logger; this.processFactory = processFactory; this.proxyFactory = proxyFactory; this.runtimeHost = runtimeHost; this.timeout_ms = timeout_ms; }
/// <summary> /// Constructs an instance of this class by using passed test site and message type. /// </summary> /// <param name="host">The message runtime host</param> /// <param name="type">The message type, rpc or block</param> public MessageUtils(IRuntimeHost host, MessageType type) { if (type == MessageType.Block) { this.marshaler = new Marshaler(host, BlockMarshalingConfiguration.Configuration); } else if (type == MessageType.Rpc) { this.marshaler = new Marshaler(host, NativeMarshalingConfiguration.Configuration); } else { throw new NotSupportedException("Current constructor does not support this message type, need fix"); } this.host = host; disableValidation = IsDisableValidation(); InitMethodTable(initializers, typeof(InitializerAttribute), true); InitMethodTable(validators, typeof(ValidatorAttribute), false); }
/// <summary> /// Gets the runtime host. /// </summary> /// <param name="site">The test site</param> /// <returns>Returns the instance of the runtime host</returns> public static IRuntimeHost GetRuntimeHost(ITestSite site) { if (site == null) { return(null); } bool marshallerTrace = site != null ? site.Properties["Marshaler.trace"] == "true" : false; bool disablevalidation = site != null ? site.Properties["disablevalidation"] == "true" : false; RuntimeHostProvider.Initialize(marshallerTrace, disablevalidation); IRuntimeHost host = RuntimeHostProvider.RuntimeHost; //only register once if (string.IsNullOrEmpty(site.Properties["IsRuntimeHostRegistered"])) { RegisterRuntimeHost(site, host); site.Properties["IsRuntimeHostRegistered"] = "true"; } return(host); }
/// <summary> /// Constructs a channel which uses underlying stream and the given marshaler configuration. /// </summary> /// <param name="host">The message runtime host.</param> /// <param name="stream">The general stream object.</param> /// <param name="marshalingConfig">The marshaling configuration.</param> public Channel( IRuntimeHost host, Stream stream, MarshalingConfiguration marshalingConfig) { if (stream == null) { throw new ArgumentNullException("stream"); } this.readerMarshaler = new Marshaler(host, marshalingConfig); this.writerMarshaler = new Marshaler(host, marshalingConfig); this.stream = stream; this.readerLock = new object(); this.writerLock = new object(); if (stream.CanSeek) { readOffset = writeOffset = stream.Position; } }
public int Run(string[] commandLineArgs = null) { try { _logger.Info("Processing command line switches"); processCommandLine(commandLineArgs); _logger.Info("Command line switches were processed"); } catch (Exception exc) { Environment.ExitCode = -1; Console.WriteLine("During processing command line exception happened: {0}", exc.ToString()); return(Environment.ExitCode); } if (!_donotStartService) { bool running = false; try { _logger.Info("Service host is being constructed"); using (IRuntimeHost host = constructServiceHost()) { _logger.Info("Service host was constructed"); running = true; _logger.Info("Service host is being started"); host.Run(_testMode, commandLineArgs); _logger.Info("Service host was finished"); } } catch (Exception ex) { Environment.ExitCode = -2; _logger.Exception(running ? "Starting host":"Constructing host", ex); if (_testMode) { Console.WriteLine("{0}: {1}", running ? "Starting host":"Constructing host", ex); } } } return(Environment.ExitCode); }
/// <summary> /// Constructs an instance of this class by using passed test site and default marshaling /// configuration for block protocols. /// </summary> /// <param name="host">The message runtime host</param> public MessageUtils(IRuntimeHost host) : this(host, BlockMarshalingConfiguration.Configuration) { }
/// <summary> /// Constructs a typed stream which uses underlying stream and the default marshaling configuration /// for block protocols. /// </summary> /// <param name="host">The message runtime host.</param> /// <param name="stream">The NetworkStream object.</param> public Channel(IRuntimeHost host, Stream stream) : this(host, stream, BlockMarshalingConfiguration.Configuration) { }
/// <summary> /// Constructs a channel which uses underlying stream and given marshaler configuration. /// </summary> /// <param name="host">The message runtime host.</param> /// <param name="stream">The general stream object.</param> /// <param name="marshalingConfig">The marshaling configuration.</param> public ValidationChannel(IRuntimeHost host, Stream stream, MarshalingConfiguration marshalingConfig) : base(host, stream, marshalingConfig) { messageUtil = new MessageUtils(host); }
/// <summary> /// Binding PTF logger checker to Message Runtime Host. /// </summary> static void RegisterRuntimeHost(ITestSite site, IRuntimeHost host) { host.AssertChecker += new EventHandler <MessageLogEventArgs>( delegate(object sender, MessageLogEventArgs e) { if (e == null) { throw new ArgumentNullException("MessageLogEventArgs"); } if (e.Condition) { site.Assert.Pass(e.Message, e.Parameters); } else { site.Assert.Fail(e.Message, e.Parameters); } }); host.AssumeChecker += new EventHandler <MessageLogEventArgs>( delegate(object sender, MessageLogEventArgs e) { if (e == null) { throw new ArgumentNullException("MessageLogEventArgs"); } if (e.Condition) { site.Assume.Pass(e.Message, e.Parameters); } else { site.Assume.Fail(e.Message, e.Parameters); } }); host.DebugChecker += new EventHandler <MessageLogEventArgs>( delegate(object sender, MessageLogEventArgs e) { if (e == null) { throw new ArgumentNullException("MessageLogEventArgs"); } if (e.Condition) { site.Debug.Pass(e.Message, e.Parameters); } else { site.Debug.Fail(e.Message, e.Parameters); } }); host.MessageLogger += new EventHandler <MessageLogEventArgs>( delegate(object sender, MessageLogEventArgs e) { if (e == null) { throw new ArgumentNullException("MessageLogEventArgs"); } site.Log.Add( LogKindToLogEntryKind(e.LogEntryKind), e.Message, e.Parameters); }); host.RequirementLogger += new EventHandler <RequirementCaptureEventArgs>( delegate(object sender, RequirementCaptureEventArgs e) { if (e == null) { throw new ArgumentNullException("RequirementCaptureEventArgs"); } site.CaptureRequirement( e.ProtocolName, e.RequirementId, e.RequirementDescription); }); }
/// <summary> /// Initializes event queue for the given test site. /// </summary> /// <param name="host">The message runtime host.</param> /// <param name="maxSize">The max queue size</param> public EventQueue(IRuntimeHost host, int maxSize) { this.host = host; this.queue = new ObservationQueue <AvailableEvent>(maxSize); }
/// <summary> /// Initializes event queue for the given test site. /// The default max queue size is 200. /// </summary> /// <param name="host">The message runtime host.</param> public EventQueue(IRuntimeHost host) : this(host, defaultMaxSize) { }
/// <summary> /// Constructs the marshaler based on test site and marshaling configuration. /// </summary> /// <param name="host">The message runtime host</param> /// <param name="configuration">The marshaling configuration</param> public Marshaler(IRuntimeHost host, MarshalingConfiguration configuration) { this.host = host; this.config = configuration; this.tracing = host != null ? host.MarshallerTrace : false; }
/// <summary> /// Constructs an identifier binding instance. /// A test site must be passed so that the binding can generate assertions and log entries. /// </summary> /// <param name="host">The message runtime host.</param> public IdentifierBinding(IRuntimeHost host) { this.host = host; }
private Program(IRuntimeHost host) { this.host = host ?? throw new ArgumentNullException(nameof(host)); }