Пример #1
0
 public void Push_LargeFileSizeBundle_Success()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
         using (var provider = GetTransportProviderForTest(e))
         {
             e.LocalAddAndCommit();
             e.CloneRemoteFromLocal();
             e.LocalAddAndCommitLargeFile();
             var transport = provider.Transport;
             transport.Push();
             Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
         }
 }
Пример #2
0
 public void Push_SuccessfulPush_PushDataCacheDestroyed()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
         using (var provider = GetTransportProviderForTest(e))
         {
             e.LocalAddAndCommit();
             e.CloneRemoteFromLocal();
             e.LocalAddAndCommitLargeFile();
             var transport = provider.Transport;
             transport.Push();
             Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
             var dirInfo = new DirectoryInfo(Path.Combine(transport.PathToLocalStorage, "pushData"));
             Assert.That(dirInfo.GetFiles().Length, Is.EqualTo(0));
         }
 }
Пример #3
0
 public void Push_ServerNotAvailableMidTransaction_NotAvailableMessage()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
         using (var provider = GetTransportProviderForTest(e))
         {
             e.LocalAddAndCommit();
             e.CloneRemoteFromLocal();
             e.LocalAddAndCommitLargeFile();
             var serverMessage = "The server is down for scheduled maintenance";
             e.ApiServer.AddServerUnavailableResponse(4, serverMessage);
             var transport = provider.Transport;
             transport.Push();
             Assert.That(e.Progress.AllMessages, Contains.Item("Server temporarily unavailable: " + serverMessage));
             Assert.That(e.Progress.AllMessages, Has.No.Member("Finished sending"));
         }
 }
Пример #4
0
 public void Push_UserCancelsMidwayThenRepoChanges_PushDoesNotResume()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
         using (var provider = GetTransportProviderForTest(e))
         {
             e.LocalAddAndCommit();
             e.CloneRemoteFromLocal();
             e.LocalAddAndCommitLargeFile();
             e.ApiServer.AddCancelResponse(2);
             var transport = provider.Transport;
             Assert.That(() => transport.Push(), Throws.Exception.TypeOf <UserCancelledException>());
             e.Progress.CancelRequested = false;
             e.RemoteAddAndCommit();
             transport.Push();
             Assert.That(e.Progress.AllMessagesString().Contains("Resuming push operation at"), Is.Not.True);
             Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
         }
 }
Пример #5
0
 public void Push_UserCancelsMidwayAndBeginsAgainWithAdditionalPush_Resumes()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
         using (var provider = GetTransportProviderForTest(e))
         {
             e.LocalAddAndCommit();
             e.CloneRemoteFromLocal();
             e.LocalAddAndCommitLargeFile();
             e.ApiServer.AddCancelResponse(3);
             var transport = provider.Transport;
             Assert.That(() => transport.Push(), Throws.Exception.TypeOf <UserCancelledException>());
             e.Progress.CancelRequested = false;
             e.ApiServer.AddCancelResponse(6);
             Assert.That(() => transport.Push(), Throws.Exception.TypeOf <UserCancelledException>());
             e.Progress.CancelRequested = false;
             transport.Push();
             Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 126KB sent"));
             Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 249KB sent"));
             Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
         }
 }
Пример #6
0
 public void Push_UserCancelsMidwayThenRepoChanges_PushDoesNotResume()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
     using (var provider = GetTransportProviderForTest(e))
     {
         e.LocalAddAndCommit();
         e.CloneRemoteFromLocal();
         e.LocalAddAndCommitLargeFile();
         e.ApiServer.AddCancelResponse(2);
         var transport = provider.Transport;
         Assert.That(() => transport.Push(), Throws.Exception.TypeOf<UserCancelledException>());
         e.Progress.CancelRequested = false;
         e.RemoteAddAndCommit();
         transport.Push();
         Assert.That(e.Progress.AllMessagesString().Contains("Resuming push operation at"), Is.Not.True);
         Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
     }
 }
Пример #7
0
 public void Push_UserCancelsMidwayAndBeginsAgainWithAdditionalPush_Resumes()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
     using (var provider = GetTransportProviderForTest(e))
     {
         e.LocalAddAndCommit();
         e.CloneRemoteFromLocal();
         e.LocalAddAndCommitLargeFile();
         e.ApiServer.AddCancelResponse(3);
         var transport = provider.Transport;
         Assert.That(() => transport.Push(), Throws.Exception.TypeOf<UserCancelledException>());
         e.Progress.CancelRequested = false;
         e.ApiServer.AddCancelResponse(6);
         Assert.That(() => transport.Push(), Throws.Exception.TypeOf<UserCancelledException>());
         e.Progress.CancelRequested = false;
         transport.Push();
         Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 126KB sent"));
         Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 249KB sent"));
         Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
     }
 }
Пример #8
0
 public void Push_SuccessfulPush_PushDataCacheDestroyed()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
     using (var provider = GetTransportProviderForTest(e))
     {
         e.LocalAddAndCommit();
         e.CloneRemoteFromLocal();
         e.LocalAddAndCommitLargeFile();
         var transport = provider.Transport;
         transport.Push();
         Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
         var dirInfo = new DirectoryInfo(Path.Combine(transport.PathToLocalStorage, "pushData"));
         Assert.That(dirInfo.GetFiles().Length, Is.EqualTo(0));
     }
 }
Пример #9
0
 public void Push_ServerNotAvailableMidTransaction_NotAvailableMessage()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
     using (var provider = GetTransportProviderForTest(e))
     {
         e.LocalAddAndCommit();
         e.CloneRemoteFromLocal();
         e.LocalAddAndCommitLargeFile();
         var serverMessage = "The server is down for scheduled maintenance";
         e.ApiServer.AddServerUnavailableResponse(4, serverMessage);
         var transport = provider.Transport;
         transport.Push();
         Assert.That(e.Progress.AllMessages, Contains.Item("Server temporarily unavailable: " + serverMessage));
         Assert.That(e.Progress.AllMessages, Has.No.Member("Finished sending"));
     }
 }
Пример #10
0
 public void Push_LargeFileSizeBundle_Success()
 {
     using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push))
     using (var provider = GetTransportProviderForTest(e))
     {
         e.LocalAddAndCommit();
         e.CloneRemoteFromLocal();
         e.LocalAddAndCommitLargeFile();
         var transport = provider.Transport;
         transport.Push();
         Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending"));
     }
 }