Fixed update client path issue

This commit is contained in:
kay.one 2011-11-13 19:09:34 -08:00
parent 6369d4f817
commit fbf7d20c5d
6 changed files with 17 additions and 15 deletions

View File

@ -92,7 +92,7 @@
<Compile Include="JobTests\SearchJobTest.cs" />
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessDownloadFixture.cs" />
<Compile Include="ProviderTests\JobProviderTests\TestJobs.cs" />
<Compile Include="ProviderTests\UpdateProviderTests\PreformUpdateFixture.cs" />
<Compile Include="ProviderTests\UpdateProviderTests\StartUpdateFixture.cs" />
<Compile Include="ProviderTests\UpdateProviderTests\GetAvilableUpdateFixture.cs" />
<Compile Include="SortHelperTest.cs" />
<Compile Include="ProviderTests\EpisodeProviderTest_DeleteInvalidEpisodes.cs" />

View File

@ -14,7 +14,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
{
[TestFixture]
internal class PreformUpdateFixture : CoreTest
internal class StartUpdateFixture : CoreTest
{
private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\";
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true);
//Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true));
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false);
//Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
//Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert
Mocker.GetMock<HttpProvider>().Verify(
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
//Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert
Mocker.GetMock<ArchiveProvider>().Verify(
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
var updateClientFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientFolder();
//Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert
Mocker.GetMock<DiskProvider>().Verify(
@ -108,13 +108,13 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
//Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert
Mocker.GetMock<ProcessProvider>().Verify(
c => c.Start(It.Is<ProcessStartInfo>(p =>
p.FileName == updateClientPath &&
p.Arguments == "/12 /" + _clientGuid.ToString())
p.Arguments == "12 " + _clientGuid.ToString())
));
}
@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
Mocker.Resolve<HttpProvider>();
Mocker.Resolve<DiskProvider>();
Mocker.Resolve<ArchiveProvider>();
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
updateSubFolder.Refresh();
//Assert

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Providers.Jobs
var updatePackage = _updateProvider.GetAvilableUpdate();
_updateProvider.StartUpgrade(updatePackage);
_updateProvider.StartUpdate(updatePackage);
}
}
}

View File

@ -78,7 +78,7 @@ namespace NzbDrone.Core.Providers
return null;
}
public virtual void StartUpgrade(UpdatePackage updatePackage)
public virtual void StartUpdate(UpdatePackage updatePackage)
{
var packageDestination = Path.Combine(_enviromentProvider.GetUpdateSandboxFolder(), updatePackage.FileName);
@ -104,7 +104,7 @@ namespace NzbDrone.Core.Providers
var startInfo = new ProcessStartInfo()
{
FileName = _enviromentProvider.GetUpdateClientExePath(),
Arguments = string.Format("/{0} /{1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
Arguments = string.Format("{0} {1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
};
_processProvider.Start(startInfo);

View File

@ -64,7 +64,7 @@ namespace NzbDrone.Update.Test
_program.Start(new[] { "12", "" });
//Assert
Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(ProcessPath), Times.Once());
Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once());
}

View File

@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Common;
@ -52,7 +53,8 @@ namespace NzbDrone.Update
VerfityArguments(args);
int processId = ParseProcessId(args);
string appPath = _processProvider.GetProcessById(processId).StartPath;
FileInfo exeFileInfo = new FileInfo(_processProvider.GetProcessById(processId).StartPath);
string appPath = exeFileInfo.Directory.FullName;
logger.Info("Starting update process");
_updateProvider.Start(appPath);