Ejemplo n.º 1
0
        /// <summary>
        /// Sets up the copy job.
        /// </summary>
        /// <param name="device">The device.</param>
        protected override void SetupJob(IDevice device)
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }

            InitializeAuthenticator(_data.AuthProvider, device, ExecutionData);

            // Load the copy application
            _copyApp = CopyAppFactory.Create(device);

            _copyApp.WorkflowLogger = Authenticator.WorkflowLogger = WorkflowLogger;
            _copyApp.Pacekeeper     = Authenticator.Pacekeeper = new Pacekeeper(_data.AutomationPause);

            AuthenticationMode am = (_data.ApplicationAuthentication == false) ? AuthenticationMode.Eager : AuthenticationMode.Lazy;

            //Checking whether to launch from Quickset or Not.
            if (_data.UseQuickset)
            {
                if (!_data.LaunchQuicksetFromApp)
                {
                    _copyApp.LaunchFromQuickSet(Authenticator, am, _data.QuickSetName);
                }
                else
                {
                    _copyApp.Launch(Authenticator, am);
                    _copyApp.SelectQuickSet(_data.QuickSetName);
                }
            }
            else
            {
                UpdateStatus("Starting execution of Launch()...");
                _copyApp.Launch(Authenticator, am);
                Type optionsType = _copyApp.Options.GetType();

                if (optionsType.BaseType.Equals(typeof(HP.ScalableTest.DeviceAutomation.Helpers.JediOmni.JediOmniJobOptionsManager)))
                {
                    SetOptions();
                }
                else
                {
                    SetOptionsWindjammer();
                }
            }

            // Set job build
            _copyApp.Options.SetJobBuildState(this.UseJobBuild);
        }
        /// <summary>
        /// Copies via the lazy authentication.
        /// </summary>
        /// <param name="authenticator">The authenticator.</param>
        /// <param name="device">The device.</param>
        protected void CopyLazyAuth(IAuthenticator authenticator, IDevice device)
        {
            ICopyApp copyApp = CopyAppFactory.Create(device);

            copyApp.Launch(authenticator, AuthenticationMode.Lazy);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Performs Copy job on Control Panel
        /// </summary>
        /// <param name="device"></param>
        /// <param name="controlPanelData"></param>
        /// <returns></returns>
        private PluginExecutionResult ExecuteCopy(IDevice device, object controlPanelData, IAuthenticator authenticator)
        {
            var result = new PluginExecutionResult(PluginResult.Failed);

            CopyActivityData copyData = controlPanelData as CopyActivityData;

            // Make sure the device is in a good state
            UpdateStatus($"Setting up device at address {device.Address} for user {ExecutionData.Credential.UserName}");
            var devicePrepManager = DevicePreparationManagerFactory.Create(device);

            devicePrepManager.WorkflowLogger = WorkflowLogger;
            devicePrepManager.InitializeDevice(true);

            // Load the copy application
            ICopyApp contentionCopyApp = CopyAppFactory.Create(device);

            //Launch the Copy application
            UpdateStatus("Copy Activity: Launching the Copy application...");
            contentionCopyApp.Launch(authenticator, AuthenticationMode.Lazy);

            //set number of copies
            contentionCopyApp.Options.SetNumCopies(copyData.Copies);
            UpdateStatus("Copy Activity: Number of Copies has been set...");

            try
            {
                ScanExecutionOptions options = new ScanExecutionOptions();
                options.ValidateJobExecution = false;
                if (copyData.PageCount > 1)
                {
                    options.JobBuildSegments = copyData.PageCount;
                }

                //Finish the job
                UpdateStatus("Copy Activity: Finishing the activity...");
                if (contentionCopyApp.ExecuteJob(options))
                {
                    result = new PluginExecutionResult(PluginResult.Passed);
                }

                // Clean up
                try
                {
                    devicePrepManager.NavigateHome();
                    if (devicePrepManager.SignOutRequired())
                    {
                        UpdateStatus("Copy Activity: Signing Out...");
                        devicePrepManager.SignOut();
                    }
                    UpdateStatus("Copy Activity: Activity finished");
                }
                catch (Exception ex) when(ex is DeviceCommunicationException || ex is DeviceInvalidOperationException)
                {
                    // Don't fail the activity if there is an exception here.
                    ExecutionServices.SystemTrace.LogWarn($"Device could not return to home screen: {ex.ToString()}");
                }
            }
            finally
            {
                // End of Copy activity
                ExecutionServices.SystemTrace.LogDebug("Copy Activity Completed");
            }

            return(result);
        }