Remove IMediaFactory

This commit is contained in:
Shannon
2016-03-16 15:56:52 +01:00
parent 3b191239be
commit f594a1132d
5 changed files with 0 additions and 138 deletions

View File

@@ -1,101 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.media;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Profiling;
namespace Umbraco.Tests
{
[TestFixture]
public class MediaFactoryTests
{
[SetUp]
public void Initialize()
{
var logger = new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>());
//this ensures its reset
PluginManager.Current = new PluginManager(new ActivatorServiceProvider(), new NullCacheProvider(),
logger,
false)
{
AssembliesToScan = new[]
{
this.GetType().Assembly
}
};
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
}
[TearDown]
public void TearDown()
{
PluginManager.Current = null;
}
#region Classes for tests
public class MediaFactory1 : IMediaFactory
{
public List<string> Extensions
{
get { throw new NotImplementedException(); }
}
public int Priority
{
get { return 1; }
}
public bool CanHandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
{
throw new NotImplementedException();
}
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
{
throw new NotImplementedException();
}
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user, bool replaceExisting)
{
throw new NotImplementedException();
}
}
public class MediaFactory2 : IMediaFactory
{
public List<string> Extensions
{
get { throw new NotImplementedException(); }
}
public int Priority
{
get { return 2; }
}
public bool CanHandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
{
throw new NotImplementedException();
}
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
{
throw new NotImplementedException();
}
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user, bool replaceExisting)
{
throw new NotImplementedException();
}
}
#endregion
}
}

View File

@@ -513,7 +513,6 @@
<Compile Include="UriUtilityTests.cs" />
<Compile Include="Resolvers\MacroFieldEditorsResolverTests.cs" />
<Compile Include="Macros\MacroEngineFactoryTests.cs" />
<Compile Include="MediaFactoryTests.cs" />
<Compile Include="Resolvers\PackageActionsResolverTests.cs" />
<Compile Include="Plugins\PluginManagerExtensions.cs" />
<Compile Include="Plugins\PluginManagerTests.cs" />

View File

@@ -33,18 +33,5 @@ namespace umbraco.cms
return resolver.ResolveTypes<IMacroEngine>();
}
/// <summary>
/// Returns all available IMediaFactory in application
/// </summary>
/// <param name="resolver"></param>
/// <returns></returns>
[Obsolete("We don't use IMediaFactory anymore, we need to remove this when we remove the MediaFactory instance that uses this method")]
internal static IEnumerable<Type> ResolveMediaFactories(this PluginManager resolver)
{
return resolver.ResolveTypes<IMediaFactory>();
}
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.BusinessLogic;
namespace umbraco.cms.businesslogic.media
{
[Obsolete("This interface is no longer used and will be removed from the codebase in future versions")]
public interface IMediaFactory
{
List<string> Extensions { get; }
int Priority { get; }
bool CanHandleMedia(int parentNodeId, PostedMediaFile postedFile, User user);
Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user);
[Obsolete("Use HandleMedia(int, PostedMediaFile, User) and set the ReplaceExisting property on PostedMediaFile instead")]
Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user, bool replaceExisting);
}
}

View File

@@ -177,7 +177,6 @@
<Compile Include="businesslogic\macro\MacroEngineFactory.cs" />
<Compile Include="businesslogic\macro\MacroModel.cs" />
<Compile Include="businesslogic\macro\MacroPropertyModel.cs" />
<Compile Include="businesslogic\media\IMediaFactory.cs" />
<Compile Include="businesslogic\media\MediaFactory.cs" />
<Compile Include="businesslogic\Packager\FileResources\PackageFiles.Designer.cs">
<AutoGen>True</AutoGen>