Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainPage"/> class.
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();

            StressType[] stressOpts = { StressType.Default, StressType.Service, StressType.Client };
            StressTypeComboBox.DataContext = stressOpts;
            StressTypeComboBox.SelectedIndex = 0;

            this.stressManager = new StressManager(this);
            this.stressManager.CurrentlyRunning = false;
        }
Esempio n. 2
0
        /// <summary>
        /// Run the stress operation by setting up alljoyn, running the specified stress
        /// operation then tearing down alljoyn.
        /// </summary>
        /// <param name="stressType">Type of stress operation to run</param>
        /// <param name="manager">Stress manager which is managing this task</param>
        /// <param name="isMultipoint">True if operation uses multipoint sessions</param>
        public void Start(StressType stressType, StressManager manager, bool isMultipoint)
        {
            this.stressManager = manager;

            try
            {
                // Set up alljoyn
                this.DebugPrint("Creating and Starting the bus attachment");
                this.busAtt = new BusAttachment("BusStress", true, 4);
                this.busAtt.Start();
                this.busAtt.ConnectAsync(ConnectSpecs).AsTask().Wait();
                this.DebugPrint("Successfully connected to the bundled daemon");

                // Run the stress operation
                if (stressType == StressType.Default)
                {
                    this.RunDefault();
                }
                else if (stressType == StressType.Service)
                {
                    this.RunService(isMultipoint);
                }
                else
                {
                    this.foundName = new AutoResetEvent(false);
                    this.RunClient(isMultipoint);
                }

                // Tear down alljoyn
                this.DebugPrint("Disconnecting and stopping the bus attachment");
                this.busAtt.DisconnectAsync(ConnectSpecs).AsTask().Wait();
                this.busAtt.StopAsync().AsTask().Wait();
                this.DebugPrint("Successfully disconnected and stopped the bus attachment");
            }
            catch (Exception ex)
            {
                var errMsg = AllJoynException.GetErrorMessage(ex.HResult);
                this.DebugPrint(">>>> BusAttachment Error >>>> : " + errMsg);
            }

            this.busAtt = null;
        }
Esempio n. 3
0
        /// <summary>
        /// Run the stress operation by setting up alljoyn, running the specified stress 
        /// operation then tearing down alljoyn.
        /// </summary>
        /// <param name="stressType">Type of stress operation to run</param>
        /// <param name="manager">Stress manager which is managing this task</param>
        /// <param name="isMultipoint">True if operation uses multipoint sessions</param>
        public void Start(StressType stressType, StressManager manager, bool isMultipoint)
        {
            this.stressManager = manager;

            try
            {
                // Set up alljoyn
                this.DebugPrint("Creating and Starting the bus attachment");
                this.busAtt = new BusAttachment("BusStress", true, 4);
                this.busAtt.Start();
                this.busAtt.ConnectAsync(ConnectSpecs).AsTask().Wait();
                this.DebugPrint("Successfully connected to the bundled daemon");

                // Run the stress operation
                if (stressType == StressType.Default)
                {
                    this.RunDefault();
                }
                else if (stressType == StressType.Service)
                {
                    this.RunService(isMultipoint);
                }
                else
                {
                    this.foundName = new AutoResetEvent(false);
                    this.RunClient(isMultipoint);
                }

                // Tear down alljoyn
                this.DebugPrint("Disconnecting and stopping the bus attachment");
                this.busAtt.DisconnectAsync(ConnectSpecs).AsTask().Wait();
                this.busAtt.StopAsync().AsTask().Wait();
                this.DebugPrint("Successfully disconnected and stopped the bus attachment");
            }
            catch (Exception ex)
            {
                var errMsg = AllJoynException.GetErrorMessage(ex.HResult);
                this.DebugPrint(">>>> BusAttachment Error >>>> : " + errMsg);
            }

            this.busAtt = null;
        }