fixes tests

This commit is contained in:
Shannon
2018-11-26 14:43:08 +11:00
parent 985572690f
commit 9368c71ced
5 changed files with 37 additions and 22 deletions

View File

@@ -23,6 +23,7 @@ using Umbraco.Tests.Testing;
using LightInject;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Tests.PublishedContent
{
@@ -113,7 +114,8 @@ namespace Umbraco.Tests.PublishedContent
public void Ensure_Children_Sorted_With_Examine()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
{
indexer.RebuildIndex();
@@ -138,7 +140,7 @@ namespace Umbraco.Tests.PublishedContent
public void Do_Not_Find_In_Recycle_Bin()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext,
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
//include unpublished content since this uses the 'internal' indexer, it's up to the media cache to filter
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
@@ -184,7 +186,8 @@ namespace Umbraco.Tests.PublishedContent
public void Children_With_Examine()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
{
indexer.RebuildIndex();
@@ -209,7 +212,8 @@ namespace Umbraco.Tests.PublishedContent
public void Descendants_With_Examine()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
{
indexer.RebuildIndex();
@@ -234,7 +238,8 @@ namespace Umbraco.Tests.PublishedContent
public void DescendantsOrSelf_With_Examine()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
{
indexer.RebuildIndex();
@@ -259,7 +264,8 @@ namespace Umbraco.Tests.PublishedContent
public void Ancestors_With_Examine()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
{
indexer.RebuildIndex();
@@ -281,7 +287,8 @@ namespace Umbraco.Tests.PublishedContent
public void AncestorsOrSelf_With_Examine()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
{
indexer.RebuildIndex();

View File

@@ -1,10 +1,12 @@
using System;
using System.Linq;
using Examine;
using LightInject;
using Lucene.Net.Store;
using NUnit.Framework;
using Umbraco.Tests.Testing;
using Umbraco.Examine;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Tests.UmbracoExamine
{
@@ -16,7 +18,7 @@ namespace Umbraco.Tests.UmbracoExamine
public void Events_Ignoring_Node()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext,
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
//make parent id 999 so all are ignored
options: new UmbracoContentIndexerOptions(false, false, 999)))
using (indexer.ProcessNonAsync())

View File

@@ -13,6 +13,7 @@ using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
@@ -32,6 +33,7 @@ namespace Umbraco.Tests.UmbracoExamine
ProfilingLogger profilingLogger,
Directory luceneDir,
ISqlContext sqlContext,
PropertyEditorCollection propertyEditors,
Analyzer analyzer = null,
IContentService contentService = null,
IMediaService mediaService = null,
@@ -179,14 +181,12 @@ namespace Umbraco.Tests.UmbracoExamine
var i = new UmbracoContentIndexer(
"testIndexer",
Enumerable.Empty<FieldDefinition>(),
UmbracoExamineIndexer.UmbracoIndexFieldDefinitions,
luceneDir,
analyzer,
profilingLogger,
//fixme: need a property editor collection here
new ContentValueSetBuilder(null, new[] { new DefaultUrlSegmentProvider() }, userService),
//fixme: need a property editor collection here
new MediaValueSetBuilder(null, new[] { new DefaultUrlSegmentProvider() }, userService),
new ContentValueSetBuilder(propertyEditors, new[] { new DefaultUrlSegmentProvider() }, userService),
new MediaValueSetBuilder(propertyEditors, new[] { new DefaultUrlSegmentProvider() }, userService),
contentService,
mediaService,
languageService,

View File

@@ -8,6 +8,8 @@ using Lucene.Net.Store;
using NUnit.Framework;
using Umbraco.Tests.Testing;
using Umbraco.Examine;
using Umbraco.Core.PropertyEditors;
using LightInject;
namespace Umbraco.Tests.UmbracoExamine
{
@@ -24,7 +26,8 @@ namespace Umbraco.Tests.UmbracoExamine
public void Rebuild_Index()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
{
var searcher = indexer.GetSearcher();
@@ -46,7 +49,7 @@ namespace Umbraco.Tests.UmbracoExamine
public void Index_Protected_Content_Not_Indexed()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>()))
using (indexer.ProcessNonAsync())
using (var searcher = ((LuceneSearcher)indexer.GetSearcher()).GetLuceneSearcher())
{
@@ -77,7 +80,7 @@ namespace Umbraco.Tests.UmbracoExamine
public void Index_Move_Media_From_Non_Indexable_To_Indexable_ParentID()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext,
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
//make parent id 1116
options: new UmbracoContentIndexerOptions(false, false, 1116)))
using (indexer.ProcessNonAsync())
@@ -119,7 +122,7 @@ namespace Umbraco.Tests.UmbracoExamine
public void Index_Move_Media_To_Non_Indexable_ParentID()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer1 = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext,
using (var indexer1 = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
//make parent id 2222
options: new UmbracoContentIndexerOptions(false, false, 2222)))
using (indexer1.ProcessNonAsync())
@@ -169,7 +172,8 @@ namespace Umbraco.Tests.UmbracoExamine
public void Index_Reindex_Content()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, options: new UmbracoContentIndexerOptions(true, false, null)))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>(),
options: new UmbracoContentIndexerOptions(true, false, null)))
using (indexer.ProcessNonAsync())
{
var searcher = indexer.GetSearcher();
@@ -209,7 +213,7 @@ namespace Umbraco.Tests.UmbracoExamine
public void Index_Delete_Index_Item_Ensure_Heirarchy_Removed()
{
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, Container.GetInstance<PropertyEditorCollection>()))
using (indexer.ProcessNonAsync())
{
var searcher = indexer.GetSearcher();

View File

@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using LightInject;
using Examine;
using Lucene.Net.Store;
using NUnit.Framework;
using Examine.LuceneEngine.SearchCriteria;
using Moq;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Services;
using Umbraco.Examine;
using Umbraco.Tests.Testing;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Tests.UmbracoExamine
{
@@ -54,7 +54,9 @@ namespace Umbraco.Tests.UmbracoExamine
allRecs);
using (var luceneDir = new RandomIdRamDirectory())
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext, contentService: contentService))
using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, ScopeProvider.SqlContext,
Container.GetInstance<PropertyEditorCollection>(),
contentService: contentService))
using (indexer.ProcessNonAsync())
{
indexer.RebuildIndex();