Lots of initialization, configuration clean up.

pull/7/merge
kay.one 13 years ago
parent 62013f6f87
commit 51518787d8

@ -1,6 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -8,6 +8,7 @@ using NzbDrone.Common;
using NzbDrone.Common.Model; using NzbDrone.Common.Model;
using NzbDrone.Providers; using NzbDrone.Providers;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.App.Test namespace NzbDrone.App.Test
{ {

@ -1,11 +1,11 @@
using System.ServiceProcess; using System.ServiceProcess;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Model; using NzbDrone.Model;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.App.Test namespace NzbDrone.App.Test
{ {

@ -1,13 +1,13 @@
using System.IO; using System.Linq;
using AutoMoq; using System.IO;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Model; using NzbDrone.Common.Model;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Common.Test
namespace NzbDrone.Core.Test.ProviderTests
{ {
[TestFixture] [TestFixture]
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
@ -23,8 +23,6 @@ namespace NzbDrone.Core.Test.ProviderTests
if (File.Exists(configFile)) if (File.Exists(configFile))
File.Delete(configFile); File.Delete(configFile);
Mocker.Resolve<ConfigFileProvider>().CreateDefaultConfigFile();
} }
[Test] [Test]
@ -133,19 +131,6 @@ namespace NzbDrone.Core.Test.ProviderTests
result.Should().Be(value); result.Should().Be(value);
} }
[Test]
public void GetValue_New_Key_with_new_parent()
{
const string key = "Hello";
const string value = "World";
//Act
var result = Mocker.Resolve<ConfigFileProvider>().GetValue(key, value, "Universe");
//Assert
result.Should().Be(value);
}
[Test] [Test]
public void GetAuthenticationType_No_Existing_Value() public void GetAuthenticationType_No_Existing_Value()
{ {
@ -169,5 +154,17 @@ namespace NzbDrone.Core.Test.ProviderTests
//Assert //Assert
result.Should().Be(AuthenticationType.Windows); result.Should().Be(AuthenticationType.Windows);
} }
[Test]
public void Guid_should_return_the_same_every_time()
{
//Act
var firstResponse = Mocker.Resolve<ConfigFileProvider>().Guid;
var secondResponse = Mocker.Resolve<ConfigFileProvider>().Guid;
//Assert
secondResponse.Should().Be(firstResponse);
}
} }
} }

@ -1,10 +1,10 @@
using FluentAssertions; using System.Linq;
using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
namespace NzbDrone.App.Test namespace NzbDrone.Common.Test
{ {
[TestFixture] [TestFixture]
public class PathExtentionFixture : TestBase public class PathExtentionFixture : TestBase
@ -16,7 +16,7 @@ namespace NzbDrone.App.Test
envMoq.SetupGet(c => c.ApplicationPath).Returns(@"C:\NzbDrone\"); envMoq.SetupGet(c => c.ApplicationPath).Returns(@"C:\NzbDrone\");
return envMoq.Object; return envMoq.Object;
} }
[Test] [Test]

@ -13,13 +13,27 @@ namespace NzbDrone.Common
private readonly EnviromentProvider _enviromentProvider; private readonly EnviromentProvider _enviromentProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private readonly string _configFile; private readonly string _configFile;
public ConfigFileProvider(EnviromentProvider enviromentProvider) public ConfigFileProvider(EnviromentProvider enviromentProvider)
{ {
_enviromentProvider = enviromentProvider; _enviromentProvider = enviromentProvider;
_configFile = _enviromentProvider.GetConfigPath(); _configFile = _enviromentProvider.GetConfigPath();
CreateDefaultConfigFile();
}
public virtual Guid Guid
{
get
{
var key = "Guid";
if (string.IsNullOrWhiteSpace(GetValue(key, string.Empty)))
{
SetValue(key, Guid.NewGuid().ToString());
}
return Guid.Parse(GetValue(key, string.Empty));
}
} }
public virtual int Port public virtual int Port
@ -40,27 +54,23 @@ namespace NzbDrone.Common
set { SetValue("AuthenticationType", (int)value); } set { SetValue("AuthenticationType", (int)value); }
} }
public virtual string GetValue(string key, object defaultValue, string parent = null) public virtual int GetValueInt(string key, int defaultValue)
{
return Convert.ToInt32(GetValue(key, defaultValue));
}
public virtual bool GetValueBoolean(string key, bool defaultValue)
{
return Convert.ToBoolean(GetValue(key, defaultValue));
}
public virtual string GetValue(string key, object defaultValue)
{ {
var xDoc = XDocument.Load(_configFile); var xDoc = XDocument.Load(_configFile);
var config = xDoc.Descendants("Config").Single(); var config = xDoc.Descendants("Config").Single();
var parentContainer = config; var parentContainer = config;
if (!String.IsNullOrEmpty(parent))
{
//Add the parent
if (config.Descendants(parent).Count() != 1)
{
SetValue(key, defaultValue, parent);
//Reload the configFile
xDoc = XDocument.Load(_configFile);
config = xDoc.Descendants("Config").Single();
}
parentContainer = config.Descendants(parent).Single();
}
var valueHolder = parentContainer.Descendants(key).ToList(); var valueHolder = parentContainer.Descendants(key).ToList();
@ -68,40 +78,20 @@ namespace NzbDrone.Common
return valueHolder.First().Value; return valueHolder.First().Value;
//Save the value //Save the value
SetValue(key, defaultValue, parent); SetValue(key, defaultValue);
//return the default value //return the default value
return defaultValue.ToString(); return defaultValue.ToString();
} }
public virtual int GetValueInt(string key, int defaultValue, string parent = null)
{
return Convert.ToInt32(GetValue(key, defaultValue, parent));
}
public virtual bool GetValueBoolean(string key, bool defaultValue, string parent = null)
{
return Convert.ToBoolean(GetValue(key, defaultValue, parent));
}
public virtual void SetValue(string key, object value, string parent = null) public virtual void SetValue(string key, object value)
{ {
var xDoc = XDocument.Load(_configFile); var xDoc = XDocument.Load(_configFile);
var config = xDoc.Descendants("Config").Single(); var config = xDoc.Descendants("Config").Single();
var parentContainer = config; var parentContainer = config;
if (!String.IsNullOrEmpty(parent))
{
//Add the parent container if it doesn't already exist
if (config.Descendants(parent).Count() != 1)
{
config.Add(new XElement(parent));
}
parentContainer = config.Descendants(parent).Single();
}
var keyHolder = parentContainer.Descendants(key); var keyHolder = parentContainer.Descendants(key);
if (keyHolder.Count() != 1) if (keyHolder.Count() != 1)
@ -113,7 +103,7 @@ namespace NzbDrone.Common
xDoc.Save(_configFile); xDoc.Save(_configFile);
} }
public virtual void CreateDefaultConfigFile() private void CreateDefaultConfigFile()
{ {
if (!File.Exists(_configFile)) if (!File.Exists(_configFile))
{ {
@ -125,8 +115,6 @@ namespace NzbDrone.Common
} }
} }
public virtual void UpdateIISConfig(string configPath) public virtual void UpdateIISConfig(string configPath)
{ {
logger.Info(@"Server configuration file: {0}", configPath); logger.Info(@"Server configuration file: {0}", configPath);

@ -33,6 +33,8 @@ namespace NzbDrone.Common
consoleTarget.Layout = "${message} ${exception}"; consoleTarget.Layout = "${message} ${exception}";
LogManager.Configuration.AddTarget(consoleTarget.GetType().Name, consoleTarget); LogManager.Configuration.AddTarget(consoleTarget.GetType().Name, consoleTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule(loggerNamePattern, minLevel, consoleTarget)); LogManager.Configuration.LoggingRules.Add(new LoggingRule(loggerNamePattern, minLevel, consoleTarget));
LogManager.ConfigurationReloaded += (sender, args) => RegisterConsoleLogger(minLevel, loggerNamePattern);
} }
catch (Exception e) catch (Exception e)
{ {
@ -56,6 +58,8 @@ namespace NzbDrone.Common
udpTarget.IncludeNdc = true; udpTarget.IncludeNdc = true;
LogManager.Configuration.AddTarget(udpTarget.GetType().Name, udpTarget); LogManager.Configuration.AddTarget(udpTarget.GetType().Name, udpTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, udpTarget)); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, udpTarget));
LogManager.ConfigurationReloaded += (sender, args) => RegisterUdpLogger();
} }
catch (Exception e) catch (Exception e)
{ {
@ -76,6 +80,8 @@ namespace NzbDrone.Common
var exTarget = new ExceptioneerTarget(); var exTarget = new ExceptioneerTarget();
LogManager.Configuration.AddTarget("Exceptioneer", exTarget); LogManager.Configuration.AddTarget("Exceptioneer", exTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Error, exTarget)); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Error, exTarget));
LogManager.ConfigurationReloaded += (sender, args) => RegisterExceptioneer();
} }
catch (Exception e) catch (Exception e)
{ {

@ -19,21 +19,7 @@ namespace NzbDrone.Common
private const string UPDATE_SANDBOX_FOLDER_NAME = "nzbdrone_update\\"; private const string UPDATE_SANDBOX_FOLDER_NAME = "nzbdrone_update\\";
private const string UPDATE_PACKAGE_FOLDER_NAME = "nzbdrone\\"; private const string UPDATE_PACKAGE_FOLDER_NAME = "nzbdrone\\";
private const string UPDATE_BACKUP_FOLDER_NAME = "nzbdrone_backup\\"; private const string UPDATE_BACKUP_FOLDER_NAME = "nzbdrone_backup\\";
private const string UPDATE_CLIENT_EXE = "nzbdrone.update.exe";
public static string GetUpdateSandboxFolder(this EnviromentProvider enviromentProvider)
{
return Path.Combine(enviromentProvider.SystemTemp, UPDATE_SANDBOX_FOLDER_NAME);
}
public static string GetUpdateBackUpFolder(this EnviromentProvider enviromentProvider)
{
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_BACKUP_FOLDER_NAME);
}
public static string GetUpdatePackageFolder(this EnviromentProvider enviromentProvider)
{
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME);
}
public static string GetIISFolder(this EnviromentProvider enviromentProvider) public static string GetIISFolder(this EnviromentProvider enviromentProvider)
{ {
@ -89,5 +75,25 @@ namespace NzbDrone.Common
{ {
return Path.Combine(enviromentProvider.GetWebRoot(), "Cache"); return Path.Combine(enviromentProvider.GetWebRoot(), "Cache");
} }
public static string GetUpdateSandboxFolder(this EnviromentProvider enviromentProvider)
{
return Path.Combine(enviromentProvider.SystemTemp, UPDATE_SANDBOX_FOLDER_NAME);
}
public static string GetUpdateBackUpFolder(this EnviromentProvider enviromentProvider)
{
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_BACKUP_FOLDER_NAME);
}
public static string GetUpdatePackageFolder(this EnviromentProvider enviromentProvider)
{
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME);
}
public static string GetUpdateClientExePath(this EnviromentProvider enviromentProvider)
{
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_CLIENT_EXE);
}
} }
} }

@ -1,9 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NLog; using NLog;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;

@ -1,6 +1,7 @@
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using Ninject; using Ninject;
using NzbDrone.Common;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using PetaPoco; using PetaPoco;
@ -11,6 +12,7 @@ namespace NzbDrone.Core.Test.Framework
{ {
static CoreTest() static CoreTest()
{ {
//Delete old db files
var oldDbFiles = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sdf", SearchOption.AllDirectories); var oldDbFiles = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sdf", SearchOption.AllDirectories);
foreach (var file in oldDbFiles) foreach (var file in oldDbFiles)
{ {
@ -21,6 +23,14 @@ namespace NzbDrone.Core.Test.Framework
catch { } catch { }
} }
//Delete App_data folder
var appData = new EnviromentProvider().GetAppDataPath();
if (Directory.Exists(appData))
{
Directory.Delete(appData, true);
}
MockLib.CreateDataBaseTemplate(); MockLib.CreateDataBaseTemplate();
} }

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.ServiceModel.Syndication; using System.ServiceModel.Syndication;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -17,6 +17,7 @@ using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Test.ProviderTests; using NzbDrone.Core.Test.ProviderTests;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -8,6 +8,7 @@ using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.JobTests namespace NzbDrone.Core.Test.JobTests
{ {

@ -1,6 +1,6 @@
using System.IO; using System.IO;
using System.Net; using System.Net;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;

@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.JobTests namespace NzbDrone.Core.Test.JobTests
{ {

@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.JobTests namespace NzbDrone.Core.Test.JobTests
{ {

@ -1,9 +1,10 @@
using System; using System;
using AutoMoq;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.JobTests namespace NzbDrone.Core.Test.JobTests
{ {

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -9,6 +9,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.JobTests namespace NzbDrone.Core.Test.JobTests
{ {

@ -1,11 +1,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.JobTests namespace NzbDrone.Core.Test.JobTests
{ {

@ -1,13 +1,14 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
using PetaPoco; using PetaPoco;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests

@ -3,13 +3,14 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests.DiskProviderTests namespace NzbDrone.Core.Test.ProviderTests.DiskProviderTests
{ {

@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -10,6 +10,7 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -13,6 +13,7 @@ using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,5 +1,5 @@
using System; using System;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -8,6 +8,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming

@ -3,7 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -14,6 +14,7 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
using PetaPoco; using PetaPoco;
using TvdbLib.Data; using TvdbLib.Data;

@ -2,13 +2,14 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
using TvdbLib.Data; using TvdbLib.Data;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
@ -10,6 +10,7 @@ using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,13 +1,14 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using AutoMoq;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Model.Xbmc; using NzbDrone.Core.Model.Xbmc;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.Xbmc; using NzbDrone.Core.Providers.Xbmc;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,5 +1,5 @@
using System; using System;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -9,6 +9,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming

@ -1,6 +1,6 @@
using System; using System;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -9,6 +9,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -4,7 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.ServiceModel.Syndication; using System.ServiceModel.Syndication;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
@ -13,6 +13,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -4,13 +4,14 @@ using System.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
{ {

@ -2,7 +2,7 @@
using System; using System;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -13,6 +13,7 @@ using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
using PetaPoco; using PetaPoco;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
@ -31,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void Setup() public void Setup()
{ {
db = MockLib.GetEmptyDatabase(true); db = MockLib.GetEmptyDatabase(true);
LogConfiguration.RegisterDatabaseLogger(new DatabaseTarget(db)); new DatabaseTarget(db).Register();
Logger = LogManager.GetCurrentClassLogger(); Logger = LogManager.GetCurrentClassLogger();
} }

@ -1,7 +1,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -11,6 +11,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,7 +1,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
@ -9,6 +9,7 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,5 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -7,6 +7,7 @@ using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,5 +1,6 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System.Linq;
using System; using System;
using System.IO; using System.IO;
using FluentAssertions; using FluentAssertions;
@ -8,7 +9,7 @@ using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
{ {
[TestFixture] [TestFixture]
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming

@ -3,7 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -14,6 +14,7 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
{ {

@ -1,5 +1,5 @@
using System; using System;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -10,6 +10,7 @@ using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
using Prowlin; using Prowlin;
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming

@ -1,13 +1,14 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -2,7 +2,7 @@
using System; using System;
using System.Linq; using System.Linq;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -11,6 +11,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -3,7 +3,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -15,6 +15,7 @@ using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -14,6 +14,7 @@ using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -13,6 +13,7 @@ using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,6 +1,6 @@
using System; using System;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -10,6 +10,7 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests

@ -3,13 +3,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,5 +1,5 @@
using System; using System;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -7,6 +7,7 @@ using NzbDrone.Common;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
{ {

@ -1,7 +1,10 @@
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using FluentAssertions; using FluentAssertions;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using Ninject.Activation.Strategies;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
@ -13,44 +16,68 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
[TestFixture] [TestFixture]
internal class PreformUpdateFixture : CoreTest internal class PreformUpdateFixture : CoreTest
{ {
private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\"; private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\";
[SetUp] private readonly UpdatePackage updatePackage = new UpdatePackage
public void setup()
{ {
WithStrictMocker(); FileName = "NzbDrone.kay.one.0.6.0.2031.zip",
Url = "http://update.nzbdrone.com/_test/NzbDrone.zip",
Version = new Version("0.6.0.2031")
};
[SetUp]
public void Setup()
{
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
} }
[Test] [Test]
public void Should_call_download_and_extract_using_correct_arguments() public void Should_download_update_package()
{ {
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\"); var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
var updatePackage = new UpdatePackage //Act
{ Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
FileName = "NzbDrone.kay.one.0.6.0.2031.zip",
Url = "http://update.nzbdrone.com/kayone/NzbDrone.kay.one.0.6.0.2031.zip", //Assert
Version = new Version("0.6.0.2031") Mocker.GetMock<HttpProvider>().Verify(
}; c => c.DownloadFile(updatePackage.Url, updateArchive));
}
[Test]
public void Should_call_download_and_extract_using_correct_arguments()
{
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
Mocker.GetMock<HttpProvider>().Setup( //Act
c => c.DownloadFile(updatePackage.Url, updateArchive)); Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
Mocker.GetMock<ArchiveProvider>().Setup( //Assert
Mocker.GetMock<ArchiveProvider>().Verify(
c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER)); c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER));
}
[Test]
public void should_start_update_client()
{
//Setup
var updateClientPath = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientExePath();
//Act //Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
//Assert
Mocker.GetMock<ProcessProvider>().Verify(
c => c.Start(It.Is<ProcessStartInfo>(p =>
p.FileName == updateClientPath &&
p.Arguments == "/12 /"
)));
} }
[Test] [Test]
[Category(IntegrationTest)]
public void Should_download_and_extract_to_temp_folder() public void Should_download_and_extract_to_temp_folder()
{ {
@ -58,13 +85,6 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
var updateSubFolder = new DirectoryInfo(Mocker.GetMock<EnviromentProvider>().Object.GetUpdateSandboxFolder()); var updateSubFolder = new DirectoryInfo(Mocker.GetMock<EnviromentProvider>().Object.GetUpdateSandboxFolder());
var updatePackage = new UpdatePackage
{
FileName = "NzbDrone.kay.one.0.6.0.2031.zip",
Url = "http://update.nzbdrone.com/_test/NzbDrone.zip",
Version = new Version("0.6.0.2031")
};
//Act //Act
updateSubFolder.Exists.Should().BeFalse(); updateSubFolder.Exists.Should().BeFalse();
@ -81,6 +101,5 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
updateSubFolder.GetDirectories().Should().HaveCount(1); updateSubFolder.GetDirectories().Should().HaveCount(1);
updateSubFolder.GetFiles().Should().HaveCount(1); updateSubFolder.GetFiles().Should().HaveCount(1);
} }
} }
} }

@ -1,7 +1,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -12,6 +12,7 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.Xbmc; using NzbDrone.Core.Providers.Xbmc;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests namespace NzbDrone.Core.Test.ProviderTests
{ {

@ -1,7 +1,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
@ -9,6 +9,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {

@ -1,9 +1,10 @@
using AutoMoq; 
using FizzWare.NBuilder; using FizzWare.NBuilder;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {

@ -1,7 +1,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Threading; using System.Threading;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
@ -10,6 +10,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
using PetaPoco; using PetaPoco;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test

@ -1,5 +1,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using Ninject; using Ninject;
using NLog; using NLog;
@ -7,68 +8,58 @@ using NzbDrone.Common;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification; using NzbDrone.Core.Providers.ExternalNotification;
using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using PetaPoco; using PetaPoco;
using LogConfiguration = NzbDrone.Core.Instrumentation.LogConfiguration;
namespace NzbDrone.Core namespace NzbDrone.Core
{ {
public class CentralDispatch public class CentralDispatch
{ {
private readonly Object KernelLock = new object();
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public StandardKernel Kernel { get; private set; }
public CentralDispatch() public CentralDispatch()
{ {
InitializeApp(); Logger.Debug("Initializing Kernel:");
} Kernel = new StandardKernel();
public StandardKernel Kernel { get; private set; } InitDatabase();
private void InitializeApp() InitQuality();
InitExternalNotifications();
InitIndexers();
InitJobs();
}
private void InitDatabase()
{ {
BindKernel(); Logger.Info("Initializing Database...");
Kernel.Get<LogConfiguration>().Setup(); var appDataPath = new EnviromentProvider().GetAppDataPath();
if (!Directory.Exists(appDataPath)) Directory.CreateDirectory(appDataPath);
var mainConnectionString = Kernel.Get<Connection>().MainConnectionString; var connection = Kernel.Get<Connection>();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetMainPetaPocoDb()).InTransientScope();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb(false)).WhenInjectedInto<DatabaseTarget>().InSingletonScope();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb()).WhenInjectedInto<LogProvider>().InSingletonScope();
MigrationsHelper.Run(mainConnectionString, true); Kernel.Get<DatabaseTarget>().Register();
LogConfiguration.RegisterDatabaseLogger(Kernel.Get<DatabaseTarget>());
LogConfiguration.Reload(); LogConfiguration.Reload();
Kernel.Get<QualityProvider>().SetupDefaultProfiles();
Kernel.Get<QualityTypeProvider>().SetupDefault();
Kernel.Get<ConfigFileProvider>().CreateDefaultConfigFile();
BindExternalNotifications();
BindIndexers();
BindJobs();
} }
private void BindKernel() private void InitQuality()
{ {
lock (KernelLock) Logger.Info("Initializing Quality...");
{ Kernel.Get<QualityProvider>().SetupDefaultProfiles();
Logger.Debug("Binding Ninject's Kernel"); Kernel.Get<QualityTypeProvider>().SetupDefault();
Kernel = new StandardKernel();
var connection = Kernel.Get<Connection>();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetMainPetaPocoDb()).InTransientScope();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb(false)).WhenInjectedInto<DatabaseTarget>().InSingletonScope();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb()).WhenInjectedInto<LogProvider>().InSingletonScope();
Kernel.Bind<JobProvider>().ToSelf().InSingletonScope();
}
} }
private void BindIndexers() private void InitIndexers()
{ {
Logger.Info("Initializing Indexers...");
Kernel.Bind<IndexerBase>().To<NzbsOrg>(); Kernel.Bind<IndexerBase>().To<NzbsOrg>();
Kernel.Bind<IndexerBase>().To<NzbMatrix>(); Kernel.Bind<IndexerBase>().To<NzbMatrix>();
Kernel.Bind<IndexerBase>().To<NzbsRUs>(); Kernel.Bind<IndexerBase>().To<NzbsRUs>();
@ -78,8 +69,12 @@ namespace NzbDrone.Core
Kernel.Get<IndexerProvider>().InitializeIndexers(indexers.ToList()); Kernel.Get<IndexerProvider>().InitializeIndexers(indexers.ToList());
} }
private void BindJobs() private void InitJobs()
{ {
Logger.Info("Initializing Background Jobs...");
Kernel.Bind<JobProvider>().ToSelf().InSingletonScope();
Kernel.Bind<IJob>().To<RssSyncJob>().InSingletonScope(); Kernel.Bind<IJob>().To<RssSyncJob>().InSingletonScope();
Kernel.Bind<IJob>().To<ImportNewSeriesJob>().InSingletonScope(); Kernel.Bind<IJob>().To<ImportNewSeriesJob>().InSingletonScope();
Kernel.Bind<IJob>().To<UpdateInfoJob>().InSingletonScope(); Kernel.Bind<IJob>().To<UpdateInfoJob>().InSingletonScope();
@ -101,8 +96,9 @@ namespace NzbDrone.Core
Kernel.Get<WebTimer>().StartTimer(30); Kernel.Get<WebTimer>().StartTimer(30);
} }
private void BindExternalNotifications() private void InitExternalNotifications()
{ {
Logger.Info("Initializing External Notifications...");
Kernel.Bind<ExternalNotificationBase>().To<Xbmc>(); Kernel.Bind<ExternalNotificationBase>().To<Xbmc>();
Kernel.Bind<ExternalNotificationBase>().To<Smtp>(); Kernel.Bind<ExternalNotificationBase>().To<Smtp>();
Kernel.Bind<ExternalNotificationBase>().To<Twitter>(); Kernel.Bind<ExternalNotificationBase>().To<Twitter>();
@ -113,9 +109,6 @@ namespace NzbDrone.Core
Kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList()); Kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
} }
/// <summary>
/// Forces IISExpress process to exit with the host application
/// </summary>
public void DedicateToHost() public void DedicateToHost()
{ {
try try
@ -143,7 +136,7 @@ namespace NzbDrone.Core
private static void ShutDown() private static void ShutDown()
{ {
Logger.Info("Shutting down application."); Logger.Info("Shutting down application...");
WebTimer.Stop(); WebTimer.Stop();
Process.GetCurrentProcess().Kill(); Process.GetCurrentProcess().Kill();
} }

@ -53,6 +53,7 @@ namespace NzbDrone.Core.Datastore
private static void EnsureDatabase(string constr) private static void EnsureDatabase(string constr)
{ {
var connection = new SqlCeConnection(constr); var connection = new SqlCeConnection(constr);
if (!File.Exists(connection.Database)) if (!File.Exists(connection.Database))
{ {
var engine = new SqlCeEngine(constr); var engine = new SqlCeEngine(constr);

@ -9,6 +9,7 @@
*/ */
//#define PETAPOCO_NO_DYNAMIC //in your project settings on .NET 3.5 //#define PETAPOCO_NO_DYNAMIC //in your project settings on .NET 3.5
// ReSharper disable CheckNamespace
using System; using System;
using System.Collections; using System.Collections;
@ -23,7 +24,6 @@ using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using System.Linq.Expressions; using System.Linq.Expressions;
namespace PetaPoco namespace PetaPoco
{ {
// Poco's marked [Explicit] require all column properties to be marked // Poco's marked [Explicit] require all column properties to be marked

@ -1,4 +1,5 @@
using System; using System;
using NLog.Config;
using Ninject; using Ninject;
using NLog; using NLog;
using NLog.Targets; using NLog.Targets;
@ -19,6 +20,15 @@ namespace NzbDrone.Core.Instrumentation
_database = database; _database = database;
} }
public void Register()
{
LogManager.Configuration.AddTarget("DbLogger", this);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, this));
LogManager.ConfigurationReloaded += (sender, args) => Register();
LogConfiguration.Reload();
}
protected override void Write(LogEventInfo logEvent) protected override void Write(LogEventInfo logEvent)

@ -1,49 +0,0 @@
using System.IO;
using Ninject;
using NLog;
using NLog.Config;
using NzbDrone.Common;
using NzbDrone.Core.Providers;
namespace NzbDrone.Core.Instrumentation
{
public class LogConfiguration
{
private readonly EnviromentProvider _enviromentProvider;
private readonly DatabaseTarget _databaseTarget;
public LogConfiguration(EnviromentProvider enviromentProvider, DatabaseTarget databaseTarget)
{
_enviromentProvider = enviromentProvider;
_databaseTarget = databaseTarget;
}
public void Setup()
{
if (Common.EnviromentProvider.IsProduction)
{
LogManager.ThrowExceptions = false;
}
LogManager.Configuration = new XmlLoggingConfiguration(_enviromentProvider.GetNlogConfigPath(), false);
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication");
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
LogManager.ConfigurationReloaded += ((s, e) => RegisterDatabaseLogger(_databaseTarget));
}
public static void RegisterDatabaseLogger(DatabaseTarget databaseTarget)
{
LogManager.Configuration.AddTarget("DbLogger", databaseTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, databaseTarget));
Reload();
}
public static void Reload()
{
Common.LogConfiguration.Reload();
}
}
}

@ -288,7 +288,6 @@
<Compile Include="Providers\XbmcProvider.cs" /> <Compile Include="Providers\XbmcProvider.cs" />
<Compile Include="Repository\EpisodeFile.cs" /> <Compile Include="Repository\EpisodeFile.cs" />
<Compile Include="Model\Notification\ProgressNotificationStatus.cs" /> <Compile Include="Model\Notification\ProgressNotificationStatus.cs" />
<Compile Include="Instrumentation\LogConfiguration.cs" />
<Compile Include="Parser.cs" /> <Compile Include="Parser.cs" />
<Compile Include="Providers\MediaFileProvider.cs" /> <Compile Include="Providers\MediaFileProvider.cs" />
<Compile Include="Model\Notification\ProgressNotification.cs" /> <Compile Include="Model\Notification\ProgressNotification.cs" />

@ -1,17 +1,18 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using AutoMoq.Unity;
using Microsoft.Practices.Unity; using Microsoft.Practices.Unity;
using Moq; using Moq;
using Moq.Language.Flow; using Moq.Language.Flow;
using NzbDrone.Test.Common.AutoMoq.Unity;
[assembly: InternalsVisibleTo("AutoMoq.Tests")] [assembly: InternalsVisibleTo("AutoMoq.Tests")]
namespace AutoMoq namespace NzbDrone.Test.Common.AutoMoq
{ {
public class AutoMoqer public class AutoMoqer
{ {

@ -1,4 +1,5 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -7,7 +8,7 @@ using Microsoft.Practices.ObjectBuilder2;
using Microsoft.Practices.Unity; using Microsoft.Practices.Unity;
using Moq; using Moq;
namespace AutoMoq.Unity namespace NzbDrone.Test.Common.AutoMoq.Unity
{ {
internal class AutoMockingBuilderStrategy : BuilderStrategy internal class AutoMockingBuilderStrategy : BuilderStrategy
{ {

@ -1,10 +1,12 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Practices.Unity; using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.ObjectBuilder; using Microsoft.Practices.Unity.ObjectBuilder;
namespace AutoMoq.Unity namespace NzbDrone.Test.Common.AutoMoq.Unity
{ {
internal class AutoMockingContainerExtension : UnityContainerExtension internal class AutoMockingContainerExtension : UnityContainerExtension
{ {

@ -1,15 +1,19 @@
using System.Linq; using System.Linq;
using System.IO; using System.IO;
using AutoMoq;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Test.Common namespace NzbDrone.Test.Common
{ {
public class TestBase : LoggingTest public class TestBase : LoggingTest
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
{ {
protected const string IntegrationTest = "Integration Test";
protected AutoMoqer Mocker; protected AutoMoqer Mocker;
protected string VirtualPath protected string VirtualPath

@ -1,12 +1,13 @@
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
using System; using System;
using System.IO; using System.IO;
using AutoMoq;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
using NzbDrone.Update.Providers; using NzbDrone.Update.Providers;
namespace NzbDrone.Update.Test namespace NzbDrone.Update.Test

@ -7,7 +7,7 @@
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// ReSharper disable CheckNamespace
namespace Resources { namespace Resources {
using System; using System;

@ -8,9 +8,11 @@ using System.Web.Caching;
using System.Web.Mvc; using System.Web.Mvc;
using System.Web.Routing; using System.Web.Routing;
using MvcMiniProfiler; using MvcMiniProfiler;
using NLog.Config;
using Ninject; using Ninject;
using Ninject.Web.Mvc; using Ninject.Web.Mvc;
using NLog; using NLog;
using NzbDrone.Common;
using NzbDrone.Core; using NzbDrone.Core;
using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Instrumentation;
using Telerik.Web.Mvc; using Telerik.Web.Mvc;
@ -54,6 +56,12 @@ namespace NzbDrone.Web
protected override IKernel CreateKernel() protected override IKernel CreateKernel()
{ {
Common.LogConfiguration.RegisterUdpLogger();
Common.LogConfiguration.RegisterExceptioneer();
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication");
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
LogManager.Configuration = new XmlLoggingConfiguration(new EnviromentProvider().GetNlogConfigPath(), false);
var dispatch = new CentralDispatch(); var dispatch = new CentralDispatch();
Logger.Info("NzbDrone Starting up."); Logger.Info("NzbDrone Starting up.");

@ -1,8 +1,9 @@
using System; using System.Linq;
using System;
using System.Web.Mvc; using System.Web.Mvc;
using System.Web.Mvc.Html; using System.Web.Mvc.Html;
namespace Helpers namespace NzbDrone.Web.Helpers
{ {
public static class IsCurrentActionHelper public static class IsCurrentActionHelper
{ {

@ -63,6 +63,10 @@
<Reference Include="System.ComponentModel.DataAnnotations"> <Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\SqlServerCompact.4.0.8482.1\lib\System.Data.SqlServerCe.dll</HintPath>
</Reference>
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions"> <Reference Include="System.Web.Abstractions">
<Private>True</Private> <Private>True</Private>

@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@using Helpers;
@using NzbDrone.Common @using NzbDrone.Common
@using NzbDrone.Web.Helpers
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"> <head runat="server">
<link rel="SHORTCUT ICON" href="../../favicon.ico" /> <link rel="SHORTCUT ICON" href="../../favicon.ico" />

@ -1,24 +1,10 @@
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true"> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true">
<targets> <targets>
<target name="udpTarget" xsi:type="Chainsaw" address="udp://127.0.0.1:20480"
includeCallSite="true" includeSourceInfo="true" includeNLogData="true" includeNDC="true" includeMDC="true">
<parameter name="exception" layout="${exception:format=ToString}" xsi:type="NLogViewerParameterInfo" />
<parameter name="processname" layout="${processname}" xsi:type="NLogViewerParameterInfo" />
<parameter name="stacktrace" layout="${stacktrace:topFrames=99}" xsi:type="NLogViewerParameterInfo" />
<parameter name="ThreadName" layout="${threadname}" xsi:type="NLogViewerParameterInfo" />
</target>
<target name="file" xsi:type="File" keepFileOpen="true" openFileCacheTimeout="1" <target name="file" xsi:type="File" keepFileOpen="true" openFileCacheTimeout="1"
layout="${longdate} [${level}] ${logger}: ${message} ${exception:ToString}" layout="${longdate} [${level}] ${logger}: ${message} ${exception:ToString}"
fileName="${basedir}/App_Data/logs/${shortdate}.txt" /> fileName="${basedir}/App_Data/logs/${shortdate}.txt" />
<target name ="xmlFile" xsi:type="File" keepFileOpen="true" openFileCacheTimeout="1"
fileName="${basedir}/App_Data/logs/${shortdate}.xml"
layout="${log4jxmlevent:includeSourceInfo=true:includeCallSite=true:includeMDC=true:appInfo=true:includeNDC=true:includeNLogData=true}"/>
</targets> </targets>
<rules> <rules>
<logger name="*" minlevel="Debug" writeTo="udpTarget"/> <logger name="*" minlevel="Trace" writeTo="file"/>
<logger name="*" minlevel="Off" writeTo="xmlFile"/>
<logger name="*" minlevel="Warn" writeTo="file"/>
</rules> </rules>
</nlog> </nlog>

@ -47,7 +47,6 @@ namespace NzbDrone
LogConfiguration.RegisterUdpLogger(); LogConfiguration.RegisterUdpLogger();
LogConfiguration.RegisterExceptioneer(); LogConfiguration.RegisterExceptioneer();
LogConfiguration.Reload(); LogConfiguration.Reload();
_kernel.Get<ConfigFileProvider>().CreateDefaultConfigFile();
Logger.Info("Start-up Path:'{0}'", _kernel.Get<EnviromentProvider>().ApplicationPath); Logger.Info("Start-up Path:'{0}'", _kernel.Get<EnviromentProvider>().ApplicationPath);
} }
} }

@ -1,2 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Config /> <Config>
<Port>8989</Port>
<AuthenticationType>0</AuthenticationType>
<LaunchBrowser>true</LaunchBrowser>
</Config>
Loading…
Cancel
Save