Example #1
0
    public override void PostExecute()
    {
        //deleting recording from planner

        LogCommentInfo(CL, "Delete the recording");
        res = CL.EA.PVR.DeleteRecordFromArchive(futureEventRecording);
        if (!res.CommandSucceeded)
        {
            LogCommentInfo(CL, "Failed to Delete recording because" + res.FailureReason);
        }

        res = CL.EA.PVR.DeleteRecordFromArchive(eventToBeRecorded);
        if (!res.CommandSucceeded)
        {
            LogCommentInfo(CL, "Failed to Delete recording because" + res.FailureReason);
        }

        //deleting any future recordings from planner
        LogCommentInfo(CL, "Delete future recordings from planner");
        res = CL.EA.PVR.CancelAllBookingsFromPlanner();
        if (!res.CommandSucceeded)
        {
            CL.IEX.FailStep("Failed to cancel bookings from planner" + res.FailureReason);
        }
    }
        /// <summary>
        ///   EA Execute
        /// </summary>
        protected override void Execute()
        {
            string eventName = "";

            try
            {
                eventName = this._manager.GetEventInfo(_EventKeyName, EnumEventInfo.EventName);
            }
            catch
            {
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.EventNotExistsFailure, "Event With Key Name - " + this._EventKeyName + " Does Not Exists On Collection"));
            }


            EPG.PlannerBase.NavigateToFailedEventScreen();

            EPG.PlannerBase.FindFailedRecordedEvent(eventName, "", "", "");

            EPG.FutureRecordings.SelectEvent();

            EPG.FutureRecordings.DeleteEvent();

            if (this._VerifyDeleteInPcat)
            {
                res = this._manager.PCAT.VerifyEventDeleted(_EventKeyName, EnumPCATtables.FromBookings);
                if (!res.CommandSucceeded)
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.PCATFailure, res.FailureReason));
                }
            }
        }
Example #3
0
    // Record current event on the given channel
    private static void recordEvent(Service service, string eventKeyName, _Step step)
    {
        // Tune to the given channel
        IEXGateway._IEXResult res = CL.EA.ChannelSurf(EnumSurfIn.Live, service.LCN);
        if (!res.CommandSucceeded)
        {
            step.FailStep(CL, res, "Failed to tune to channel " + service.LCN);
        }

        // Record the current event
        res = CL.EA.PVR.RecordCurrentEventFromBanner(eventKeyName, Constants.minDurationInEvent, false, false);
        if (!res.CommandSucceeded)
        {
            step.FailStep(CL, res, "Failed to record current event on service " + service.LCN);
        }

        // Wait for some time for event to record
        res = CL.IEX.Wait(Constants.minDurationInEvent * 60);

        // Stop recording
        res = CL.EA.PVR.StopRecordingFromArchive(eventKeyName);
        if (!res.CommandSucceeded)
        {
            step.FailStep(CL, res, "Failed to stop recording " + eventKeyName + " from archive");
        }
    }
Example #4
0
        /// <summary>
        /// Navigate to a VOD asset and buy it
        /// </summary>
        protected override void Execute()
        {
            // Navigate and select the asset if required
            if (_vodAsset != null)
            {
                IEXGateway._IEXResult res = _manager.VOD.NavigateToVODAsset(_vodAsset, true);
                if (!res.CommandSucceeded)
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.NavigationFailure, "Failed to navigate to asset: " + _vodAsset.Title));
                }

                // add some delay after selecting the asset ("BUY"/"PLAY"/"RESUME" options take longer time to be displayed)
                const double MIN_DELAY = 3;
                _iex.Wait(MIN_DELAY);
            }

            // Buy it
            EPG.Vod.Buy(_purchaseProtection, _parentalProtection);
        }
        protected override void Execute()
        {
            IEXGateway._IEXResult res = null;
            // Validate input parameters
            if (_Content.Equals(null))
            {
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.NoValidParameters, "Media Content object is null!"));
            }
            if ((_PlaybackMode.Equals(null)) && !String.IsNullOrEmpty(_PlaybackSetting))
            {
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.NoValidParameters, "Cannot pass playback setting without specifying the play mode!"));
            }

            switch (_Content.Type.ToUpper())
            {
            case "MUSIC":
                EPG.MediaCentre.PlayAudioContent(_Content);
                res = _manager.CheckForAudio(true, 10);
                if (!res.CommandSucceeded)
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.AudioNotPresent, res.FailureReason));
                }

                break;

            case "VIDEOS":
                EPG.MediaCentre.PlayVideoContent(_Content);
                res = _manager.CheckForVideo(true, true, 10);
                if (!res.CommandSucceeded)
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.VideoNotPresent, res.FailureReason));
                }
                break;

            case "PICTURES":
                EPG.MediaCentre.PlayPictureContent(_Content, _PlaybackMode, _PlaybackSetting);
                break;

            default:
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.NoValidParameters, "Param EventKeyName Is Empty"));
                break;
            }
        }
    static private bool enterWrongPIN(string nextState)
    {
        //Get default PIN code
        string defaultPIN = CL.EA.UI.Utils.GetValueFromEnvironment("DefaultPIN");

        //Produce a random PIN code different from default PIN code
        string wrongPIN;
        Random rnd = new Random();

        do
        {
            wrongPIN = rnd.Next(0, 10000).ToString("0000");
        }while (wrongPIN == defaultPIN);

        //Enter wrong PIN code and check state
        IEXGateway._IEXResult res = CL.EA.EnterPIN(wrongPIN, nextState);
        if (!res.CommandSucceeded)
        {
            return(false);
        }
        return(true);
    }
Example #7
0
        internal void Init(string server, string testName, string project)
        {
            string[] ServerAddress = server.Split(':');
            string   ip            = ServerAddress[0];
            string   ServerNum     = ServerAddress[1];

            IEXGateway._IEXResult res = _iex.Connect(ip, Convert.ToInt16(ServerNum));
            if (!res.CommandSucceeded)
            {
                throw new Exception("Failed to connect to IEX server: " + res.FailureReason);
            }
            _iex.LogFileName = testName + ".iexlog";

            string errorMsg = null;

            _ea.TestName = testName;
            _ea.Init(ref _iex, project, ref errorMsg);
            if (errorMsg != null)
            {
                throw new Exception("Failed to initialized EA object: " + errorMsg);
            }
        }
    static private bool checkPlayback(VODAsset vodAsset, string videoFormat, ref string errorMsg)
    {
        // Play the VOD asset
        IEXGateway._IEXResult res = CL.EA.VOD.PlayAsset(vodAsset);
        if (!res.CommandSucceeded)
        {
            errorMsg = "Failed to play a " + videoFormat + " VOD asset";
            return(false);
        }

        const int PLAYBACK_TIMEOUT = 10;

        CL.IEX.Wait(PLAYBACK_TIMEOUT);

        // Stop playback
        res = CL.EA.VOD.StopAssetPlayback();
        if (!res.CommandSucceeded)
        {
            errorMsg = "Failed to stop playback";
            return(false);
        }
        return(true);
    }
Example #9
0
        internal static List <KeyValuePair <string, MilestoneError> > Finish(State stateToListen, _Platform platform, IEXGateway._IEXResult resFromNav, string tag)
        {
            string logPart = null;

            platform.IEX.Debug.InsertTagIntoLog(IEXGateway.Engine.Commands.NewDebug.TagAction.End, tag, IEXGateway.DebugDevice.Udp);
            platform.IEX.Debug.ImportLogPart(tag, out logPart, IEXGateway.DebugDevice.Udp);
            List <KeyValuePair <string, MilestoneError> > notFound = new List <KeyValuePair <string, MilestoneError> >();

            if (!resFromNav.CommandSucceeded)
            {
                //navigation failed -> check only navigation MS .....
            }

            bool           foundKey   = false;
            bool           matchValue = false;
            MilestoneError error;

            foreach (string key in stateToListen.ExpectedMS.Keys)
            {
                foundKey = false;
                if (!logPart.Contains(key + SEPARATOR_AS_IS))
                {
                    if (!resFromNav.CommandSucceeded)
                    {
                        error = new MilestoneError("Check Your Configuration File", ErrorType.Milestone_Not_Found);
                    }
                    else
                    {
                        error = new MilestoneError("Milestone Key Might Have Changed", ErrorType.Milestone_Not_Found);
                    }
                    notFound.Add(new KeyValuePair <string, MilestoneError>(key, error));
                    continue;
                }
                string expectedVal = stateToListen.ExpectedMS[key];
                string searchPlace = logPart.Substring(logPart.IndexOf(key + SEPARATOR_AS_IS));
                string foundVal    = null;

                int valStart = 0;
                int valLen   = 0;
                while (searchPlace.Contains(key + SEPARATOR_AS_IS))
                {
                    foundKey   = true;
                    matchValue = false;
                    valStart   = searchPlace.IndexOf(key + SEPARATOR_AS_IS) + key.Length + SEPARATOR_AS_IS.Length;
                    valLen     = expectedVal.Length;
                    if (valLen == 0)
                    {
                        // handle valLen = 0  !!
                        int valEnd = searchPlace.IndexOf(SEPARATOR_AS_IS, valStart);
                        if (valEnd < valStart)
                        {
                            valEnd = valStart + 1;
                        }
                        valLen = valEnd - valStart;
                    }
                    try
                    {
                        if (searchPlace.Length > valStart + valLen - 1)
                        {
                            foundVal = searchPlace.Substring(valStart, valLen);
                        }
                        else
                        {
                            foundVal = "";
                        }
                    }
                    catch (Exception e)
                    {
                        System.Console.WriteLine(e.Message);
                    }
                    if (foundVal.Equals(expectedVal) || (expectedVal.Length == 0 && foundVal.Length > 0))
                    {
                        matchValue = true;
                        break;
                    }
                    searchPlace = searchPlace.Substring(valStart);
                }

                //using found key found value and matchValue we can write the result
                if (!foundKey)
                {
                    error = new MilestoneError("Search Engine Has Failed", ErrorType.Execution_Error);
                    notFound.Add(new KeyValuePair <string, MilestoneError>(key, error));
                    continue;
                }
                if (!matchValue)
                {
                    error             = new MilestoneError("Milestone Value Mismatch", ErrorType.Wrong_Milestone);
                    error.ActualValue = foundVal;
                    notFound.Add(new KeyValuePair <string, MilestoneError>(key, error));
                }
            }
            return(notFound);
        }
Example #10
0
        public void FailStep(_Platform platform, IEXGateway._IEXResult res, string reason = "", bool exitTest = true)
        {
            string msg = "[" + res.FailureCode + "] " + reason + " " + res.FailureReason;

            this.FailStep(platform, msg, exitTest);
        }
Example #11
0
        /// <summary>
        ///   EA Execution
        /// </summary>
        protected override void Execute()
        {
            string eventName            = "";
            string recordIcon           = "";
            bool   isFailedRecord       = false;
            string evtDate              = "";
            string recordErrDescription = "";
            string eventStartTime       = "";
            string eventEndTime         = "";
            string startTime            = "";
            string endTime              = "";


            try
            {
                eventName = this._manager.GetEventInfo(_EventKeyName, EnumEventInfo.EventName);
            }
            catch
            {
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.EventNotExistsFailure, "Event With Key Name - " + this._EventKeyName + " Does Not Exists On Collection"));
            }

            if (_StartGuardTime != "")
            {
                try
                {
                    eventStartTime = _manager.GetEventInfo(_EventKeyName, EnumEventInfo.EventStartTime);
                    startTime      = TimeSpan.Parse(eventStartTime).Subtract(TimeSpan.Parse("00:" + _StartGuardTime)).ToString("hh\\:mm");
                }
                catch
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.ParsingFailure, "Failed to Get Start Time"));
                }
            }

            if (_EndGuardTime != "")
            {
                try
                {
                    eventEndTime = _manager.GetEventInfo(_EventKeyName, EnumEventInfo.EventEndTime);
                    endTime      = TimeSpan.Parse(eventEndTime).Add(TimeSpan.Parse("00:" + _EndGuardTime)).ToString("hh\\:mm");
                }
                catch
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.ParsingFailure, "Failed to Get Start Time"));
                }
            }

            if (_RecordError.ToString().ToLower().Contains("failed"))
            {
                isFailedRecord = true;
            }


            if (isFailedRecord)
            {
                recordIcon = "failed";

                EPG.PlannerBase.NavigateToFailedEventScreen();

                if (EPG.FutureRecordings.IsEmpty())
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.FindEventFailure, "Failed Event Screen Is Empty"));
                }

                EPG.PlannerBase.FindFailedRecordedEvent(eventName, evtDate, startTime, endTime);

                EPG.PlannerBase.SelectEvent();
            }
            else
            {
                recordIcon = "partial";

                EPG.ArchiveRecordings.Navigate();

                if (EPG.ArchiveRecordings.IsEmpty())
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.FindEventFailure, "Failed Event Screen Is Empty"));
                }

                EPG.ArchiveRecordings.FindEvent(eventName, evtDate, startTime, endTime);

                EPG.ArchiveRecordings.SelectEvent();
            }

            recordErrDescription = this.GetDictValueForRecordStatus();

            EPG.PlannerBase.VerifyErrorInfo(recordIcon, recordErrDescription);


            if (_VerifyInPCAT)
            {
                if (isFailedRecord)
                {
                    res = this._manager.PCAT.VerifyEventStatus(_EventKeyName, EnumPCATtables.FromBookings, "PARTIAL_CONTENT_STATUS", "NONE", true);
                }
                else
                {
                    res = this._manager.PCAT.VerifyEventPartialStatus(_EventKeyName, "PARTIAL");
                }

                if (!res.CommandSucceeded)
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.PCATFailure, "Failed To Verify Record Error Status in PCAT "));
                }
            }
        }