1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

removed dead code

This commit is contained in:
Keivan Beigi 2014-10-03 16:29:52 -07:00
parent 7b49669b95
commit 6a743a8792
19 changed files with 15 additions and 342 deletions

View File

@ -11,7 +11,6 @@ namespace NzbDrone.Api.Authentication
{
public interface IAuthenticationService : IUserValidator
{
bool Enabled { get; }
bool IsAuthenticated(NancyContext context);
}
@ -43,7 +42,7 @@ public IUserIdentity Validate(string username, string password)
return null;
}
public bool Enabled
private bool Enabled
{
get
{

View File

@ -14,7 +14,7 @@
using Nancy.ModelBinding;
using NzbDrone.Api.Extensions;
using NzbDrone.Common.Cache;
using SystemNetHttpStatusCode = System.Net.HttpStatusCode;
using HttpStatusCode = System.Net.HttpStatusCode;
namespace NzbDrone.Api.Indexers
{
@ -69,7 +69,7 @@ private Response DownloadRelease(ReleaseResource release)
catch (ReleaseDownloadException ex)
{
_logger.ErrorException(ex.Message, ex);
throw new NzbDroneClientException(SystemNetHttpStatusCode.Conflict, "Getting release from indexer failed");
throw new NzbDroneClientException(HttpStatusCode.Conflict, "Getting release from indexer failed");
}
return release.AsResponse();

View File

@ -12,7 +12,6 @@ namespace NzbDrone.Common
public interface IArchiveService
{
void Extract(string compressedFile, string destination);
void ExtractZip(string compressedFile, string destination);
void CreateZip(string path, params string[] files);
}
@ -57,7 +56,7 @@ public void CreateZip(string path, params string[] files)
}
}
public void ExtractZip(string compressedFile, string destination)
private void ExtractZip(string compressedFile, string destination)
{
using (var fileStream = File.OpenRead(compressedFile))
{

View File

@ -1,60 +0,0 @@
using System;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Notifications.Xbmc;
using NzbDrone.Core.Notifications.Xbmc.Model;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.NotificationTests.Xbmc
{
[TestFixture]
public class GetJsonVersionFixture : CoreTest<XbmcService>
{
private XbmcSettings _settings;
[SetUp]
public void Setup()
{
_settings = Builder<XbmcSettings>.CreateNew()
.Build();
}
private void GivenVersionResponse(String response)
{
Mocker.GetMock<IXbmcJsonApiProxy>()
.Setup(s => s.GetJsonVersion(_settings))
.Returns(response);
}
[TestCase(3)]
[TestCase(2)]
[TestCase(0)]
public void should_get_version_from_major_only(int number)
{
GivenVersionResponse("{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"version\":" + number + "}}");
Subject.GetJsonVersion(_settings).Should().Be(new XbmcVersion(number));
}
[TestCase(5, 0, 0)]
[TestCase(6, 0, 0)]
[TestCase(6, 1, 0)]
[TestCase(6, 0, 23)]
[TestCase(0, 0, 0)]
public void should_get_version_from_semantic_version(int major, int minor, int patch)
{
GivenVersionResponse("{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"version\":{\"major\":" + major + ",\"minor\":" + minor + ",\"patch\":" + patch + "}}}");
Subject.GetJsonVersion(_settings).Should().Be(new XbmcVersion(major, minor, patch));
}
[Test]
public void should_get_version_zero_when_an_error_is_received()
{
GivenVersionResponse("{\"error\":{\"code\":-32601,\"message\":\"Method not found.\"},\"id\":10,\"jsonrpc\":\"2.0\"}");
Subject.GetJsonVersion(_settings).Should().Be(new XbmcVersion(0));
}
}
}

View File

@ -226,7 +226,6 @@
<Compile Include="MetadataSourceTests\TvdbProxyFixture.cs" />
<Compile Include="NotificationTests\PlexProviderTest.cs" />
<Compile Include="NotificationTests\ProwlProviderTest.cs" />
<Compile Include="NotificationTests\Xbmc\GetJsonVersionFixture.cs" />
<Compile Include="NotificationTests\Xbmc\Http\ActivePlayersFixture.cs" />
<Compile Include="NotificationTests\Xbmc\Http\CheckForErrorFixture.cs" />
<Compile Include="NotificationTests\Xbmc\Http\GetSeriesPathFixture.cs" />
@ -269,11 +268,9 @@
<Compile Include="ProviderTests\RecycleBinProviderTests\DeleteDirectoryFixture.cs" />
<Compile Include="ProviderTests\RecycleBinProviderTests\DeleteFileFixture.cs" />
<Compile Include="ProviderTests\RecycleBinProviderTests\EmptyFixture.cs" />
<Compile Include="Qualities\QualityDefinitionRepositoryFixture.cs" />
<Compile Include="Qualities\QualityDefinitionServiceFixture.cs" />
<Compile Include="Qualities\QualityFixture.cs" />
<Compile Include="Qualities\QualityModelComparerFixture.cs" />
<Compile Include="RootFolderTests\FreeSpaceOnDrivesFixture.cs" />
<Compile Include="RootFolderTests\RootFolderServiceFixture.cs" />
<Compile Include="SeriesStatsTests\SeriesStatisticsFixture.cs" />
<Compile Include="ThingiProvider\ProviderBaseFixture.cs" />

View File

@ -1,40 +0,0 @@
using NUnit.Framework;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using FluentAssertions;
using System.Collections.Generic;
namespace NzbDrone.Core.Test.Qualities
{
[TestFixture]
public class QualityDefinitionRepositoryFixture : DbTest<QualityDefinitionRepository, QualityDefinition>
{
[SetUp]
public void Setup()
{
foreach (var qualityDefault in Quality.DefaultQualityDefinitions)
{
qualityDefault.Id = 0;
Storage.Insert(qualityDefault);
}
}
[Test]
public void should_get_qualitydefinition_by_id()
{
var size = Subject.GetByQualityId((int)Quality.Bluray1080p);
size.Should().NotBeNull();
}
[Test]
public void should_throw_with_id_if_not_exist()
{
var id = 123;
Assert.Throws<ModelNotFoundException>(()=> Subject.GetByQualityId(id)).Message.Contains(id.ToString());
}
}
}

View File

@ -1,109 +0,0 @@

using System;
using System.Collections.Generic;
using System.IO;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.RootFolderTests
{
[TestFixture]
public class FreeSpaceOnDrivesFixture : CoreTest<RootFolderService>
{
[Test]
public void should_return_one_drive_when_only_one_root_dir_exists()
{
Mocker.GetMock<IRootFolderRepository>()
.Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" } });
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetPathRoot(@"C:\Test\TV"))
.Returns(@"C:\");
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetAvailableSpace(@"C:\"))
.Returns(123456);
var result = Subject.FreeSpaceOnDrives();
result.Should().HaveCount(1);
}
[Test]
public void should_return_one_drive_when_two_rootDirs_on_the_same_drive_exist()
{
Mocker.GetMock<IRootFolderRepository>()
.Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" },
new RootFolder { Id = 2, Path = @"C:\Test\TV2" }});
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetPathRoot(It.IsAny<String>()))
.Returns(@"C:\");
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetAvailableSpace(@"C:\"))
.Returns(123456);
var result = Subject.FreeSpaceOnDrives();
result.Should().HaveCount(1);
}
[Test]
public void should_return_two_drives_when_two_rootDirs_on_the_different_drive_exist()
{
Mocker.GetMock<IRootFolderRepository>()
.Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" },
new RootFolder { Id = 2, Path = @"D:\Test\TV" }});
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetPathRoot(@"C:\Test\TV"))
.Returns(@"C:\");
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetPathRoot(@"D:\Test\TV"))
.Returns(@"D:\");
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetAvailableSpace(It.IsAny<string>()))
.Returns(123456);
var result = Subject.FreeSpaceOnDrives();
result.Should().HaveCount(2);
}
[Test]
public void should_skip_rootDir_if_not_found_on_disk()
{
Mocker.GetMock<IRootFolderRepository>()
.Setup(s => s.All())
.Returns(new List<RootFolder> { new RootFolder { Id = 1, Path = @"C:\Test\TV" } });
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetPathRoot(@"C:\Test\TV"))
.Returns(@"C:\");
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetAvailableSpace(It.IsAny<string>()))
.Throws(new DirectoryNotFoundException());
var result = Subject.FreeSpaceOnDrives();
result.Should().HaveCount(0);
ExceptionVerification.ExpectedWarns(1);
}
}
}

View File

@ -61,28 +61,6 @@ public void should_be_able_to_remove_root_dir()
Mocker.GetMock<IRootFolderRepository>().Verify(c => c.Delete(1), Times.Once());
}
[Test]
public void should_return_empty_list_when_folder_doesnt_exist()
{
WithNonExistingFolder();
Mocker.GetMock<IRootFolderRepository>().Setup(c => c.All()).Returns(new List<RootFolder>());
const string path = "d:\\bad folder";
var result = Subject.GetUnmappedFolders(path);
result.Should().NotBeNull();
result.Should().BeEmpty();
Mocker.GetMock<IDiskProvider>().Verify(c => c.GetDirectories(It.IsAny<String>()), Times.Never());
}
[Test]
public void GetUnmappedFolders_throw_on_empty_folders()
{
Assert.Throws<ArgumentException>(() => Mocker.Resolve<RootFolderService>().GetUnmappedFolders(""));
}
[TestCase("")]
[TestCase(null)]
[TestCase("BAD PATH")]
@ -101,25 +79,6 @@ public void adding_duplicated_root_folder_should_throw()
Assert.Throws<InvalidOperationException>(() => Subject.Add(new RootFolder { Path = @"C:\TV".AsOsAgnostic() }));
}
[Test]
public void should_not_include_system_files_and_folders()
{
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetDirectories(It.IsAny<String>()))
.Returns(new string[]
{
@"C:\30 Rock".AsOsAgnostic(),
@"C:\$Recycle.Bin".AsOsAgnostic(),
@"C:\.AppleDouble".AsOsAgnostic(),
@"C:\Test\.AppleDouble".AsOsAgnostic()
});
Mocker.GetMock<ISeriesService>()
.Setup(s => s.GetAllSeries())
.Returns(new List<Series>());
Subject.GetUnmappedFolders(@"C:\")
.Should().OnlyContain(u => u.Path == @"C:\30 Rock".AsOsAgnostic());
}
}
}

View File

@ -15,7 +15,6 @@ public interface IMakeDownloadDecision
{
List<DownloadDecision> GetRssDecision(List<ReleaseInfo> reports);
List<DownloadDecision> GetSearchDecision(List<ReleaseInfo> reports, SearchCriteriaBase searchCriteriaBase);
DownloadDecision GetDecisionForReport(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria = null);
}
public class DownloadDecisionMaker : IMakeDownloadDecision
@ -109,7 +108,7 @@ private IEnumerable<DownloadDecision> GetDecisions(List<ReleaseInfo> reports, Se
}
}
public DownloadDecision GetDecisionForReport(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria = null)
private DownloadDecision GetDecisionForReport(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria = null)
{
var reasons = _specifications.Select(c => EvaluateSpec(c, remoteEpisode, searchCriteria))
.Where(c => c != null);

View File

@ -7,7 +7,6 @@
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Tv.Events;

View File

@ -12,12 +12,7 @@
namespace NzbDrone.Core.Indexers
{
public interface IRssSyncService
{
List<DownloadDecision> Sync();
}
public class RssSyncService : IRssSyncService, IExecute<RssSyncCommand>
public class RssSyncService : IExecute<RssSyncCommand>
{
private readonly IFetchAndParseRss _rssFetcherAndParser;
private readonly IMakeDownloadDecision _downloadDecisionMaker;
@ -45,7 +40,7 @@ public RssSyncService(IFetchAndParseRss rssFetcherAndParser,
}
public List<DownloadDecision> Sync()
private List<DownloadDecision> Sync()
{
_logger.ProgressInfo("Starting RSS Sync");

View File

@ -5,7 +5,6 @@ namespace NzbDrone.Core.Messaging.Commands
public interface ICommandExecutor
{
void PublishCommand<TCommand>(TCommand command) where TCommand : Command;
void PublishCommand(string commandTypeName);
void PublishCommand(string commandTypeName, DateTime? lastEecutionTime);
Command PublishCommandAsync<TCommand>(TCommand command) where TCommand : Command;
Command PublishCommandAsync(string commandTypeName);

View File

@ -16,7 +16,6 @@ public interface IXbmcService
void Notify(XbmcSettings settings, string title, string message);
void Update(XbmcSettings settings, Series series);
void Clean(XbmcSettings settings);
XbmcVersion GetJsonVersion(XbmcSettings settings);
ValidationFailure Test(XbmcSettings settings);
}
@ -58,7 +57,7 @@ public void Clean(XbmcSettings settings)
provider.Clean(settings);
}
public XbmcVersion GetJsonVersion(XbmcSettings settings)
private XbmcVersion GetJsonVersion(XbmcSettings settings)
{
try
{

View File

@ -4,7 +4,6 @@
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.DataAugmentation.Scene;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
@ -20,7 +19,6 @@ public interface IParsingService
RemoteEpisode Map(ParsedEpisodeInfo parsedEpisodeInfo, Int32 seriesId, IEnumerable<Int32> episodeIds);
List<Episode> GetEpisodes(ParsedEpisodeInfo parsedEpisodeInfo, Series series, bool sceneSource, SearchCriteriaBase searchCriteria = null);
ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, int tvRageId, SearchCriteriaBase searchCriteria = null);
ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, Series series);
}
public class ParsingService : IParsingService
@ -311,7 +309,7 @@ public ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, int tvRageId, Se
return ParseSpecialEpisodeTitle(title, series);
}
public ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, Series series)
private ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, Series series)
{
// find special episode in series season 0
var episode = _episodeService.FindEpisodeByName(series.Id, 0, title);

View File

@ -8,7 +8,6 @@ namespace NzbDrone.Core.Qualities
{
public interface IQualityDefinitionRepository : IBasicRepository<QualityDefinition>
{
QualityDefinition GetByQualityId(int qualityId);
}
public class QualityDefinitionRepository : BasicRepository<QualityDefinition>, IQualityDefinitionRepository
@ -18,16 +17,6 @@ public QualityDefinitionRepository(IDatabase database, IEventAggregator eventAgg
{
}
public QualityDefinition GetByQualityId(int qualityId)
{
try
{
return Query.Where(q => (int) q.Quality == qualityId).Single();
}
catch (InvalidOperationException)
{
throw new ModelNotFoundException(typeof(QualityDefinition), qualityId);
}
}
}
}

View File

@ -17,8 +17,6 @@ public interface IRootFolderService
List<RootFolder> AllWithUnmappedFolders();
RootFolder Add(RootFolder rootDir);
void Remove(int id);
List<UnmappedFolder> GetUnmappedFolders(string path);
Dictionary<string, long?> FreeSpaceOnDrives();
RootFolder Get(int id);
}
@ -109,7 +107,7 @@ public void Remove(int id)
_rootFolderRepository.Delete(id);
}
public List<UnmappedFolder> GetUnmappedFolders(string path)
private List<UnmappedFolder> GetUnmappedFolders(string path)
{
Logger.Debug("Generating list of unmapped folders");
if (String.IsNullOrEmpty(path))
@ -140,32 +138,6 @@ public List<UnmappedFolder> GetUnmappedFolders(string path)
return results;
}
public Dictionary<string, long?> FreeSpaceOnDrives()
{
var freeSpace = new Dictionary<string, long?>();
var rootDirs = All();
foreach (var rootDir in rootDirs)
{
var pathRoot = _diskProvider.GetPathRoot(rootDir.Path);
if (!freeSpace.ContainsKey(pathRoot))
{
try
{
freeSpace.Add(pathRoot, _diskProvider.GetAvailableSpace(rootDir.Path));
}
catch (Exception ex)
{
Logger.WarnException("Error getting disk space for: " + pathRoot, ex);
}
}
}
return freeSpace;
}
public RootFolder Get(int id)
{
var rootFolder = _rootFolderRepository.Get(id);

View File

@ -13,7 +13,6 @@ public interface ISeriesRepository : IBasicRepository<Series>
Series FindByTitle(string cleanTitle, int year);
Series FindByTvdbId(int tvdbId);
Series FindByTvRageId(int tvRageId);
void SetSeriesType(int seriesId, SeriesTypes seriesTypes);
}
public class SeriesRepository : BasicRepository<Series>, ISeriesRepository
@ -54,10 +53,5 @@ public Series FindByTvRageId(int tvRageId)
{
return Query.Where(s => s.TvRageId == tvRageId).SingleOrDefault();
}
public void SetSeriesType(int seriesId, SeriesTypes seriesType)
{
SetFields(new Series { Id = seriesId, SeriesType = seriesType }, s => s.SeriesType);
}
}
}

View File

@ -18,12 +18,10 @@ public interface ISeriesService
Series GetSeries(int seriesId);
List<Series> GetSeries(IEnumerable<int> seriesIds);
Series AddSeries(Series newSeries);
Series FindByTvdbId(int tvdbId);
Series FindByTvRageId(int tvRageId);
Series FindByTitle(string title);
Series FindByTitle(string title, int year);
Series FindByTitleInexact(string title);
void SetSeriesType(int seriesId, SeriesTypes seriesTypes);
void DeleteSeries(int seriesId, bool deleteFiles);
List<Series> GetAllSeries();
Series UpdateSeries(Series series);
@ -87,11 +85,6 @@ public Series AddSeries(Series newSeries)
return newSeries;
}
public Series FindByTvdbId(int tvdbId)
{
return _seriesRepository.FindByTvdbId(tvdbId);
}
public Series FindByTvRageId(int tvRageId)
{
return _seriesRepository.FindByTvRageId(tvRageId);
@ -103,7 +96,7 @@ public Series FindByTitle(string title)
if (tvdbId.HasValue)
{
return FindByTvdbId(tvdbId.Value);
return _seriesRepository.FindByTvdbId(tvdbId.Value);
}
return _seriesRepository.FindByTitle(title.CleanSeriesTitle());
@ -159,11 +152,6 @@ public Series FindByTitle(string title, int year)
return _seriesRepository.FindByTitle(title, year);
}
public void SetSeriesType(int seriesId, SeriesTypes seriesTypes)
{
_seriesRepository.SetSeriesType(seriesId, seriesTypes);
}
public void DeleteSeries(int seriesId, bool deleteFiles)
{
var series = _seriesRepository.Get(seriesId);

View File

@ -14,12 +14,8 @@
namespace NzbDrone.Core.Update
{
public interface IInstallUpdates
{
void InstallUpdate(UpdatePackage updatePackage);
}
public class InstallUpdateService : IInstallUpdates, IExecute<ApplicationUpdateCommand>, IExecute<InstallUpdateCommand>
public class InstallUpdateService : IExecute<ApplicationUpdateCommand>, IExecute<InstallUpdateCommand>
{
private readonly ICheckUpdateService _checkUpdateService;
private readonly Logger _logger;
@ -61,7 +57,7 @@ public InstallUpdateService(ICheckUpdateService checkUpdateService, IAppFolderIn
_logger = logger;
}
public void InstallUpdate(UpdatePackage updatePackage)
private void InstallUpdate(UpdatePackage updatePackage)
{
try
{