// --------------------------------------------------------[]
        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 ) );
        }
Exemplo n.º 2
0
        // --------------------------------------------------------[]
        protected Response<MipSubmitFeedResult> _SubmitFeed(
            MipFeedDescriptor mipFeedDescriptor,
            string reqId)
        {
            Response< MipZipFeedResult > zipResponse;
            Response< MipSftpSendFilesResult > sendResponse;

            try {
                var localFiles = LocalZippedFeedFile( mipFeedDescriptor.GetName(), reqId );
                var remoteFiles = RemoteFeedOutgoingZipFilePath( mipFeedDescriptor.GetName(), reqId );

                zipResponse = ZipHelper.ZipFeed( mipFeedDescriptor, reqId );
                zipResponse.Check();

                sendResponse = SftpHelper.SendFiles( localFiles, remoteFiles );
                sendResponse.Check();
            }
            catch( Exception exception ) {
                return new Response< MipSubmitFeedResult >( exception );
            }

            return new Response< MipSubmitFeedResult > {
                Result = new MipSubmitFeedResult { FeedSubmissionId = reqId },
                InnerResponses = { zipResponse, sendResponse }
            };
        }
Exemplo n.º 3
0
        public void ZipFeed()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );
            var reqId = MipFeedSubmissionDescriptor.GenerateZeroId();

            var response = MipConnector.Instance.ZipHelper.ZipFeed( feed, reqId );
            Console.WriteLine( response );

            Assert.That( response.IsSuccessful );
            Assert.IsTrue( File.Exists( response.Result.ZipFileName ) );
        }
        // --------------------------------------------------------[]
        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 ) );
        }
Exemplo n.º 5
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]" );
        }
Exemplo n.º 6
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" ) );
        }
Exemplo n.º 7
0
        public void SendZippedFeed()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );

            var reqId = MipFeedSubmissionDescriptor.GenerateZeroId();
            var localFiles = MipConnector.LocalZippedFeedFile( feed.GetName(), reqId );
            var remoteFiles = MipConnector.RemoteFeedOutgoingZipFilePath( feed.GetName(), reqId );

            var response = MipConnector.Instance.SftpHelper.SendFiles( localFiles, remoteFiles );
            IgnoreMipQueueDepthErrorMessage( response.ToString() );

            Console.WriteLine( response );

            Assert.That( response.IsSuccessful );
        }
Exemplo n.º 8
0
 // --------------------------------------------------------[]
 public Response<MipZipFeedResult> ZipFeed( MipFeedDescriptor mipFeedDescriptor, string reqId )
 {
     string zipFileName;
     try {
         zipFileName = MipConnector.LocalZippedFeedFile( mipFeedDescriptor.GetName(), reqId );
         ZipFolderFiles(
             MipConnector.LocalFeedFolder( mipFeedDescriptor ),
             zipFileName
             );
     }
     catch( Exception exception ) {
         return new Response< MipZipFeedResult >( exception );
     }
     return new Response< MipZipFeedResult > {
         Result = new MipZipFeedResult { ZipFileName = zipFileName }
     };
 }
Exemplo n.º 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 );
        }
Exemplo n.º 10
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 );
        }
Exemplo n.º 11
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 );
        }
Exemplo n.º 12
0
 public MipFeedSubmissionDescriptor( MipFeedDescriptor mipFeedDescriptor, string feedSubmissionId )
 {
     MipFeedDescriptor = mipFeedDescriptor;
     FeedSubmissionId = feedSubmissionId;
 }
Exemplo n.º 13
0
 // --------------------------------------------------------[]
 public Response<MipSubmitFeedResult> SubmitFeed( MipFeedDescriptor mipFeedDescriptor, string reqId )
 {
     return _SubmitFeed( mipFeedDescriptor, reqId );
 }
Exemplo n.º 14
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" );
        }
Exemplo n.º 15
0
        public void SendZippedFeedFolder()
        {
            var feed = new MipFeedDescriptor( MipFeedType.Product );

            var response = MipConnector.Instance.SubmitFeed( feed );
            Console.WriteLine( response );
            IgnoreMipQueueDepthErrorMessage( response );

            Assert.That( response.IsSuccessful );
            Assert.IsTrue( MipFeedSubmissionDescriptor.VerifySubmissionId( response.Result.FeedSubmissionId ) );
            Assert_That_Text_Contains( response, "InnerResponses" );
        }
Exemplo n.º 16
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 );
        }
Exemplo n.º 17
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 );
        }
Exemplo n.º 18
0
 // --------------------------------------------------------[]
 private static string _LocalFeedXmlFilePath( MipFeedDescriptor mipFeedDescriptor )
 {
     return string.Format(
         @"{0}\{1}.{2}.xml",
         _LocalFeedFolder( mipFeedDescriptor.GetName() ),
         mipFeedDescriptor.GetName(),
         mipFeedDescriptor.Id
         );
 }
Exemplo n.º 19
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 );
        }
Exemplo n.º 20
0
 // --------------------------------------------------------[]
 public static string LocalFeedFolder( MipFeedDescriptor mipFeedDescriptor )
 {
     return _LocalFeedFolder( mipFeedDescriptor.GetName() );
 }
Exemplo n.º 21
0
 // --------------------------------------------------------[]
 public static string LocalFeedXmlFilePath( MipFeedDescriptor mipFeedDescriptor )
 {
     return _LocalFeedXmlFilePath( mipFeedDescriptor );
 }
Exemplo n.º 22
0
 // --------------------------------------------------------[]
 public virtual Response<MipSubmitFeedResult> SubmitFeed( MipFeedDescriptor mipFeedDescriptor )
 {
     return SubmitFeed( mipFeedDescriptor, MipFeedSubmissionDescriptor.GenerateId() );
 }