/// <summary>
        /// Sets up this instance using the specified client controller host name.
        /// </summary>
        /// <param name="clientControllerHostName">Name of the client controller host.</param>
        public static OfficeWorkerActivityController Create(string clientControllerHostName, string instanceId)
        {
            // The office worker is a separate process, so it must make a call up to the client controller to obtain
            // the manifest that will be used for the test.
            SystemManifest manifest = null;

            using (var serviceConnection = ClientControllerServiceConnection.Create(clientControllerHostName))
            {
                var data = serviceConnection.Channel.GetManifest(instanceId);
                manifest = SystemManifest.Deserialize(data);
                manifest.PushToGlobalDataStore(instanceId);
                manifest.PushToGlobalSettings();
                _sessionId    = manifest.SessionId;
                _statusLogger = new VirtualResourceInstanceStatusLogger(_sessionId, Environment.UserName, 0, Enum.GetName(typeof(RuntimeState), 6), false, GlobalDataStore.ResourceInstanceId);
            }


            TraceFactory.Logger.Debug("Resource type: {0}".FormatWith(manifest.ResourceType));
            TraceFactory.Logger.Debug("InstanceId: {0}".FormatWith(GlobalDataStore.ResourceInstanceId));
            TraceFactory.Logger.Debug("UserName: {0}".FormatWith(GlobalDataStore.Credential.UserName));

            FrameworkServicesInitializer.InitializeExecution();

            return(ObjectFactory.Create <OfficeWorkerActivityController>(manifest.ResourceType, clientControllerHostName));
        }
Exemplo n.º 2
0
        private void ExecuteSTB(string scenarioName)
        {
            string[] args = new string[8];

            args[0] = "-dispatcher";
            args[1] = Environment.MachineName;
            args[2] = "-database";
            args[3] = _currentDatabase;
            args[4] = "-scenario";
            args[5] = scenarioName;
            args[6] = "-owner";
            args[7] = UserManager.CurrentUser;

            WriteLine("Starting session...");
            using (CommandLineExec commandLine = new CommandLineExec(args))
            {
                try
                {
                    _ticket = commandLine.Ticket;
                    commandLine.HandleSessionClientEvents = false;
                    commandLine.StatusChanged            += CommandLine_StatusChanged;
                    FrameworkServicesInitializer.InitializeExecution();
                    commandLine.StartSession();
                }
                catch (Exception ex)
                {
                    UpdateStatus($"Error: {ex.Message}");
                    WriteLine(ex.ToString());
                }
            }
        }
Exemplo n.º 3
0
 public KellyTest()
 {
     //Load Dev settings
     //Prod: 15.86.232.53
     //STBServer: 15.86.232.90
     GlobalSettings.Load("15.86.232.90");
     GlobalSettings.IsDistributedSystem = false;
     FrameworkServicesInitializer.InitializeExecution();
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            NameValueCollection _args = new NameValueCollection();

            GlobalSettings.IsDistributedSystem = false;

            if (args != null && args.Length > 0)
            {
                CommandLineMessage();
                Console.ReadLine();
            }
            else
            {
                if (ConfigurationManager.GetSection("UnattendedExecutionConfig") != null)
                {
                    _args.Add(ConfigurationManager.GetSection("UnattendedExecutionConfig") as NameValueCollection);
                }

                if (CommandLineExec.GetAppConfigCount(_args) > 0)
                {
                    SetDispatcherArg(ref _args);
                    using (CommandLineExec commandLine = new CommandLineExec(_args))
                    {
                        try
                        {
                            commandLine.StatusChanged += CommandLine_StatusChanged;
                            FrameworkServicesInitializer.InitializeExecution();
                            commandLine.StartSession();
                        }
                        catch (Exception ex)
                        {
                            TraceFactory.Logger.Debug(ex.ToString());
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
                else
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    TraceFactory.Logger.Debug("Starting STB User Console UI.");

                    using (Form mainForm = new MainForm())
                    {
                        Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
                        ApplicationExceptionHandler.Attach(mainForm);
                        Application.Run(mainForm);
                    }
                }
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            if (args != null && args.Length > 0)
            {
                CommandLineMessage();
                Console.ReadLine();
            }
            else
            {
                NameValueCollection appConfig = ConfigurationManager.GetSection("UnattendedExecutionConfig") as NameValueCollection;
                if (CommandLineExec.GetAppConfigCount(appConfig) > 0)
                {
                    using (CommandLineExec commandLine = new CommandLineExec(appConfig))
                    {
                        try
                        {
                            commandLine.StatusChanged += CommandLine_StatusChanged;
                            FrameworkServicesInitializer.InitializeExecution();
                            commandLine.StartSession();
                        }
                        catch (Exception ex)
                        {
                            TraceFactory.Logger.Debug(ex.ToString());
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
                else
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    try
                    {
                        using (Form mainForm = new MainForm())
                        {
                            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
                            ApplicationExceptionHandler.Attach(mainForm);
                            Application.Run(mainForm);
                        }
                    }
                    catch (Exception ex)
                    {
                        TraceFactory.Logger.Error(ex);
                        Application.Exit();
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SessionProxyController"/> class.
        /// </summary>
        /// <param name="sessionId">The session unique identifier.</param>
        public SessionProxyController(string sessionId)
        {
            _sessionId = sessionId;

            string extension = "{0}-{1}".FormatWith(sessionId, Guid.NewGuid().ToShortString());

            _endpoint = WcfService.SessionProxy.GetLocalHttpUri(extension);

            // Instatiate the proxy and start the backend service for STF Lite
            if (GlobalSettings.IsDistributedSystem == false)
            {
                FrameworkServicesInitializer.InitializeExecution();
                _sessionProxy = new SessionProxy(sessionId);
                _sessionProxy.StartBackendService();
            }
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            var database = args[0];
            _sessionId = args[1];
            var proxyServiceUri = new Uri(args[2]);

            TraceFactory.SetThreadContextProperty("PID", Process.GetCurrentProcess().Id.ToString());
            TraceFactory.SetSessionContext(_sessionId);
            TraceFactory.Logger.Debug(string.Join(", ", args));

            UnhandledExceptionHandler.Attach();

            GlobalSettings.Load(database);
            FrameworkServicesInitializer.InitializeExecution();

            try
            {
                using (var sessionProxy = new SessionProxy(_sessionId))
                {
                    sessionProxy.OnExit += _sessionProxy_OnExit;
                    sessionProxy.StartFrontendService(proxyServiceUri);
                    sessionProxy.StartBackendService();

                    TraceFactory.Logger.Debug("Notify Dispatcher process is up...");
                    Retry.WhileThrowing
                        (
                            () =>
                            {
                                using (var connection = SessionDispatcherConnection.Create("localhost"))
                                {
                                    connection.Channel.NotifyProxyStarted(_sessionId);
                                }
                            },
                            10,
                            TimeSpan.FromSeconds(2),
                            new List<Type>() { typeof(EndpointNotFoundException) }
                        );
                    TraceFactory.Logger.Debug("Notify Dispatcher process is up...Done");

                    _mainThreadBlock.WaitOne();
                }
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error(ex);
            }
        }