// --------------------------------------------------------[]
        private static void TestReadFeedStatus(
            MipFeedType mipFeedType,
            MipFeedSubmissionOverallStatus mipFeedSubmissionOverallStatus,
            IMipConnector mipConnector)
        {
            var wasTested = false;
            var feed = new MipFeedDescriptor( mipFeedType );

            MipConnectorTestInitializer.TestRequestIds( feed.Type, mipFeedSubmissionOverallStatus )
                .ForEach( reqId => {
                    var request = new MipFeedSubmissionDescriptor( feed, reqId );
                    var response = mipConnector.GetFeedSubmissionOverallStatus( request );
                    var testInfo = "{0}.{1} checking status".SafeFormat( feed.Type, reqId );
                    wasTested = true;

                    Assert.That( response.IsSuccessful, testInfo );
                    Assert.AreEqual( mipFeedSubmissionOverallStatus,
                        response.Result.Status,
                        testInfo );
                } );

            Assert.AreEqual( true,
                wasTested,
                "{0}.{1} was not tested".SafeFormat( mipFeedType, mipFeedSubmissionOverallStatus ) );
        }
Пример #2
0
        // --------------------------------------------------------[]
        private static void ProceedSubmissionTask( EbaySubmissionTask task )
        {
            task.AssertCanBeProceeded();

            Response< MipGetFeedSubmissionOverallStatusResult > statusResponse = null;

            try {
                var args = task.Args;
                var submission = new MipFeedSubmissionDescriptor(
                    args.MipFeedDescriptor,
                    task.EbaySubmissionResponse.Result.MipSubmissionId );

                statusResponse = MipConnector.Instance.GetFeedSubmissionOverallStatus( submission );
                statusResponse.Check();

                task.MipFeedSubmissionOverallStatus = statusResponse.Result.Status;
                task.EbaySubmissionResponse.Result.MipItemId = statusResponse.Result.MipItemId;

                task.AddProceedInfo( GetProceedInfo( statusResponse ) );
            }
            catch {
                task.MipFeedSubmissionOverallStatus = MipFeedSubmissionOverallStatus.Failure;
                task.AddProceedInfo( GetProceedInfo( statusResponse ) );
            }
            task.WasUpdatedNow();
        }
Пример #3
0
        // --------------------------------------------------------[]
        private Response<MipFindRemoteFileResult> FindSubmissionInFolder_Inprocess(
            MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor)
        {
            var remoteDir = RemoteFeedInprocessFolderPath( mipFeedSubmissionDescriptor.MipFeedDescriptor.GetName() );
            var prefix = mipFeedSubmissionDescriptor.FileNamePrefix();

            return SftpHelper.FindRemoteFile( prefix, remoteDir );
        }
Пример #4
0
        // --------------------------------------------------------[]
        private Response<MipFindRemoteFileResult> FindSubmissionInFolder_Output(
            MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor)
        {
            var remoteDirs = RemoteFeedOutputFolderPathes( mipFeedSubmissionDescriptor.MipFeedDescriptor.GetName() );
            var prefix = mipFeedSubmissionDescriptor.FileNamePrefix();

            return SftpHelper.FindRemoteFile( prefix, remoteDirs );
        }
Пример #5
0
 // --------------------------------------------------------[]
 private Response<MipGetFeedSubmissionOverallStatusResult> GetSubmissionOverallStatusFromOutput(
     MipFeedType feedType,
     Response< MipFindSubmissionResult > response,
     MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor)
 {
     return new Response< MipGetFeedSubmissionOverallStatusResult > {
         ArgsInfo = MakeSubmissionStatusArgsInfo( mipFeedSubmissionDescriptor ),
         Result = ReadSubmissionOverallStatus( feedType, response )
     };
 }
        // --------------------------------------------------------[]
        private static void _TestReadItemId( MipFeedType mipFeedType, IMipConnector mipConnector )
        {
            var feed = new MipFeedDescriptor( mipFeedType );
            var request = new MipFeedSubmissionDescriptor( feed, MipConnectorTestInitializer.ItemRequestId );

            var response = mipConnector.GetFeedSubmissionOverallStatus( request );
            Console.WriteLine( response );

            Assert.IsNotNull( response.Result );
            Assert.AreEqual( MipConnectorTestInitializer.ProductItemId,
                response.Result.MipItemId,
                "{0}.ItemId".SafeFormat( feed.Type ) );
        }
Пример #7
0
        public void FindRequest_Inprocess_Unknown()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );
            var request = new MipFeedSubmissionDescriptor( feed, MipFeedSubmissionDescriptor.GenerateId() );

            var findResponse = MipConnector.Instance.FindSubmission( request,
                MipFeedSubmissionProcessingStatus.InProgress );
            Console.WriteLine( findResponse );

            Assert.IsFalse( findResponse.IsSuccessful );
            Assert.IsNull( findResponse.Result );
            Assert_That_Text_Contains( findResponse, @"not found in [store/product/inprocess]" );
        }
Пример #8
0
        public void FindRequest_Inprocess_Wrong()
        {
            var feed = new MipFeedDescriptor( MipFeedType.None );
            var request = new MipFeedSubmissionDescriptor( feed, MipFeedSubmissionDescriptor.GenerateId() );

            var findResponse = MipConnector.Instance.FindSubmission( request,
                MipFeedSubmissionProcessingStatus.InProgress );
            Console.WriteLine( findResponse );

            Assert.IsFalse( findResponse.IsSuccessful );
            Assert.IsNull( findResponse.Result );
            Assert.IsTrue( findResponse.ToString().Contains( "Exception" ) );
        }
Пример #9
0
        public void FindRequest_Inprocess()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );
            var sendResponse = MipConnector.Instance.SubmitFeed( feed );
            IgnoreMipQueueDepthErrorMessage( sendResponse );

            Console.WriteLine( sendResponse );

            Assert.IsNotNull( sendResponse.Result, "Result" );
            Assert.IsNotNull( sendResponse.InnerResponses, "InnerResponses" );

            var request = new MipFeedSubmissionDescriptor( feed, sendResponse.Result.FeedSubmissionId );
            var findResponse = MipConnector.Instance.FindSubmission( request,
                MipFeedSubmissionProcessingStatus.InProgress );
            Console.WriteLine();
            Console.WriteLine( findResponse );

            Assert.That( findResponse.IsSuccessful );
            Assert.IsNotNull( findResponse.Result.RemoteFileName );
            Assert.IsNotNull( findResponse.Result.RemoteDir );
            Assert.IsTrue( findResponse.Result.RemoteFileName.Length > 1 );
        }
Пример #10
0
        public void FindRequest_Output()
        {
            var fakeMipConnector = EbayMockHelper.GetMipConnectorSendingTestFeed();

            var feed = new MipFeedDescriptor( MipFeedType.Product );
            var sendResponse = fakeMipConnector.SubmitFeed( feed );
            IgnoreMipQueueDepthErrorMessage( sendResponse );

            Console.WriteLine( sendResponse );
            Assert.IsNotNull( sendResponse.Result );

            var request = new MipFeedSubmissionDescriptor( feed, sendResponse.Result.FeedSubmissionId );
            var findResponse = MipConnector.Instance.FindSubmission( request, MipFeedSubmissionProcessingStatus.Complete );
            Console.WriteLine( findResponse );

            Assert.That( findResponse.IsSuccessful );
            Assert.IsNotNull( findResponse.Result.RemoteFileName );
            Assert.IsNotNull( findResponse.Result.RemoteDir );
            Assert.IsTrue( findResponse.Result.RemoteFileName.Length > 1 );
            Assert.IsTrue( findResponse.Result.RemoteDir.Length > 1 );
        }
Пример #11
0
        public void Response_Contains_ArgsInfo()
        {
            var feed = new MipFeedDescriptor( MipFeedType.None );
            var request = new MipFeedSubmissionDescriptor( feed, MipFeedSubmissionDescriptor.GenerateId() );

            var response = MipConnector.Instance.GetFeedSubmissionOverallStatus( request );
            Console.WriteLine( response );

            Assert_That_Text_Contains( response, "ArgsInfo" );
        }
Пример #12
0
        public void GetRequestStatus_Success()
        {
            var fakeMipConnector = EbayMockHelper.GetMipConnectorIgnoringInprocessAndSendingTestFeed();

            var feed = new MipFeedDescriptor( MipFeedType.Availability );
            var sendResponse = fakeMipConnector.SubmitFeed( feed );
            IgnoreMipQueueDepthErrorMessage( sendResponse );

            Console.WriteLine( sendResponse );
            Assert.IsNotNull( sendResponse.Result );

            var request = new MipFeedSubmissionDescriptor( feed, sendResponse.Result.FeedSubmissionId );
            var submissionStatusResponse = fakeMipConnector.GetFeedSubmissionOverallStatus( request );
            Console.WriteLine( submissionStatusResponse );

            if( submissionStatusResponse.Result.Status
                != MipFeedSubmissionOverallStatus.Success ) {
                Console.WriteLine(
                    "\n\nIt can be 'cause your tests have been not started for a logn period (2-3 days)\n\n" );
            }

            Assert.That( submissionStatusResponse.IsSuccessful );
            Assert.AreEqual( MipFeedSubmissionOverallStatus.Success,
                submissionStatusResponse.Result.Status );
        }
Пример #13
0
        public void GetRequestStatus_Unknown()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );
            var request = new MipFeedSubmissionDescriptor( feed, MipFeedSubmissionDescriptor.GenerateId() );

            var submissionStatusResponse = MipConnector.Instance.GetFeedSubmissionOverallStatus( request );
            Console.WriteLine( submissionStatusResponse );

            Assert.That( submissionStatusResponse.IsSuccessful );
            Assert.AreEqual( MipFeedSubmissionOverallStatus.Unknown,
                submissionStatusResponse.Result.Status );
        }
Пример #14
0
        public void FindRequest_Output_Unknown()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );
            var request = new MipFeedSubmissionDescriptor( feed, MipFeedSubmissionDescriptor.GenerateId() );

            var findResponse = MipConnector.Instance.FindSubmission( request, MipFeedSubmissionProcessingStatus.Complete );

            Console.WriteLine( findResponse );

            Assert.IsFalse( findResponse.IsSuccessful );
            Assert.IsNull( findResponse.Result );
        }
Пример #15
0
        public void GetRequestStatus_Inproc()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );
            var sendResponse = MipConnector.Instance.SubmitFeed( feed );
            IgnoreMipQueueDepthErrorMessage( sendResponse );

            var request = new MipFeedSubmissionDescriptor( feed, sendResponse.Result.FeedSubmissionId );
            var response = MipConnector.Instance.GetFeedSubmissionOverallStatus( request );
            Console.WriteLine( response );

            Assert.That( response.IsSuccessful );
            Assert.AreEqual( MipFeedSubmissionOverallStatus.InProgress, response.Result.Status );
        }
Пример #16
0
 // --------------------------------------------------------[]
 private Response<MipFindSubmissionResult> _FindSubmission(
     MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor,
     MipFeedSubmissionProcessingStatus processingStatus)
 {
     Response< MipFindRemoteFileResult > findResponse;
     try {
         switch( processingStatus ) {
             case MipFeedSubmissionProcessingStatus.InProgress :
                 findResponse = FindSubmissionInFolder_Inprocess( mipFeedSubmissionDescriptor );
                 break;
             case MipFeedSubmissionProcessingStatus.Complete :
                 findResponse = FindSubmissionInFolder_Output( mipFeedSubmissionDescriptor );
                 break;
             default :
                 throw new SpreadbotException( "Wrong processing status {0}", processingStatus );
         }
         findResponse.Check();
     }
     catch( Exception exception ) {
         return new Response< MipFindSubmissionResult >( exception );
     }
     return new Response< MipFindSubmissionResult > {
         Result =
             new MipFindSubmissionResult {
                 RemoteDir = findResponse.Result.RemoteDir,
                 RemoteFileName = findResponse.Result.RemoteFileName
             },
         InnerResponses = { findResponse }
     };
 }
Пример #17
0
        // --------------------------------------------------------[]
        private Response<MipGetFeedSubmissionOverallStatusResult> _GetFeedSubmissionOverallStatus(
            MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor)
        {
            try {
                var response = FindSubmission( mipFeedSubmissionDescriptor, MipFeedSubmissionProcessingStatus.InProgress );
                if( response.IsSuccessful ) {
                    return new Response< MipGetFeedSubmissionOverallStatusResult > {
                        ArgsInfo = MakeSubmissionStatusArgsInfo( mipFeedSubmissionDescriptor ),
                        Result =
                            new MipGetFeedSubmissionOverallStatusResult {
                                Status = MipFeedSubmissionOverallStatus.InProgress
                            }
                    };
                }

                response = FindSubmission( mipFeedSubmissionDescriptor, MipFeedSubmissionProcessingStatus.Complete );
                if( response.IsSuccessful ) {
                    return GetSubmissionOverallStatusFromOutput( mipFeedSubmissionDescriptor.MipFeedDescriptor.Type,
                        response,
                        mipFeedSubmissionDescriptor );
                }

                return new Response< MipGetFeedSubmissionOverallStatusResult > {
                    ArgsInfo = MakeSubmissionStatusArgsInfo( mipFeedSubmissionDescriptor ),
                    Result =
                        new MipGetFeedSubmissionOverallStatusResult {
                            Status = MipFeedSubmissionOverallStatus.Unknown
                        },
                    InnerResponses = { response }
                };
            }
            catch( Exception exception ) {
                return new Response< MipGetFeedSubmissionOverallStatusResult >( exception ) {
                    ArgsInfo = MakeSubmissionStatusArgsInfo( mipFeedSubmissionDescriptor )
                };
            }
        }
Пример #18
0
 // --------------------------------------------------------[]
 public Response<MipGetFeedSubmissionOverallStatusResult> GetFeedSubmissionOverallStatus(
     MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor)
 {
     return _GetFeedSubmissionOverallStatus( mipFeedSubmissionDescriptor );
 }
Пример #19
0
 // --------------------------------------------------------[]
 public Response<MipFindSubmissionResult> FindSubmission(
     MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor,
     MipFeedSubmissionProcessingStatus processingStatus)
 {
     return _FindSubmission( mipFeedSubmissionDescriptor, processingStatus );
 }
Пример #20
0
 // --------------------------------------------------------[]
 private static string MakeSubmissionStatusArgsInfo( MipFeedSubmissionDescriptor mipFeedSubmissionDescriptor )
 {
     return "(MipSubmissionId = {0})".SafeFormat( mipFeedSubmissionDescriptor.FeedSubmissionId );
 }