diff --git a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs index c37cd0cf18..8a43876960 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs @@ -9,13 +9,14 @@ using Examine; using Examine.LuceneEngine; using Examine.LuceneEngine.Providers; using Lucene.Net.Analysis.Standard; +using Lucene.Net.Store; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; using Umbraco.Tests.TestHelpers; -using Umbraco.Tests.TestHelpers.ExamineHelpers; +using Umbraco.Tests.UmbracoExamine; using Umbraco.Web; using UmbracoExamine; using UmbracoExamine.DataServices; @@ -111,93 +112,98 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Children_With_Examine() { - var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString())); - var indexInit = new IndexInitializer(); - var indexer = indexInit.GetUmbracoIndexer(newIndexFolder); - indexer.RebuildIndex(); + using (var luceneDir = new RAMDirectory()) + { + var indexer = IndexInitializer.GetUmbracoIndexer(luceneDir); + indexer.RebuildIndex(); - var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder)); + var store = new DefaultPublishedMediaStore(IndexInitializer.GetUmbracoSearcher(luceneDir)); - //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace - var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111); - var rootChildren = publishedMedia.Children(); - Assert.IsTrue(rootChildren.Select(x => x.Id).ContainsAll(new[] { 2222, 1113, 1114, 1115, 1116 })); + //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace + var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111); + var rootChildren = publishedMedia.Children(); + Assert.IsTrue(rootChildren.Select(x => x.Id).ContainsAll(new[] { 2222, 1113, 1114, 1115, 1116 })); - var publishedChild1 = store.GetDocumentById(GetUmbracoContext("/test", 1234), 2222); - var subChildren = publishedChild1.Children(); - Assert.IsTrue(subChildren.Select(x => x.Id).ContainsAll(new[] { 2112 })); + var publishedChild1 = store.GetDocumentById(GetUmbracoContext("/test", 1234), 2222); + var subChildren = publishedChild1.Children(); + Assert.IsTrue(subChildren.Select(x => x.Id).ContainsAll(new[] { 2112 })); + } } [Test] public void Descendants_With_Examine() { - var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString())); - var indexInit = new IndexInitializer(); - var indexer = indexInit.GetUmbracoIndexer(newIndexFolder); - indexer.RebuildIndex(); + using (var luceneDir = new RAMDirectory()) + { + var indexer = IndexInitializer.GetUmbracoIndexer(luceneDir); + indexer.RebuildIndex(); - var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder)); + var store = new DefaultPublishedMediaStore(IndexInitializer.GetUmbracoSearcher(luceneDir)); - //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace - var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111); - var rootDescendants = publishedMedia.Descendants(); - Assert.IsTrue(rootDescendants.Select(x => x.Id).ContainsAll(new[] { 2112, 2222, 1113, 1114, 1115, 1116 })); + //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace + var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111); + var rootDescendants = publishedMedia.Descendants(); + Assert.IsTrue(rootDescendants.Select(x => x.Id).ContainsAll(new[] { 2112, 2222, 1113, 1114, 1115, 1116 })); - var publishedChild1 = store.GetDocumentById(GetUmbracoContext("/test", 1234), 2222); - var subDescendants = publishedChild1.Descendants(); - Assert.IsTrue(subDescendants.Select(x => x.Id).ContainsAll(new[] { 2112, 3113 })); + var publishedChild1 = store.GetDocumentById(GetUmbracoContext("/test", 1234), 2222); + var subDescendants = publishedChild1.Descendants(); + Assert.IsTrue(subDescendants.Select(x => x.Id).ContainsAll(new[] { 2112, 3113 })); + } } [Test] public void DescendantsOrSelf_With_Examine() { - var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString())); - var indexInit = new IndexInitializer(); - var indexer = indexInit.GetUmbracoIndexer(newIndexFolder); - indexer.RebuildIndex(); + using (var luceneDir = new RAMDirectory()) + { + var indexer = IndexInitializer.GetUmbracoIndexer(luceneDir); + indexer.RebuildIndex(); + var store = new DefaultPublishedMediaStore(IndexInitializer.GetUmbracoSearcher(luceneDir)); - var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder)); + //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace + var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111); + var rootDescendants = publishedMedia.DescendantsOrSelf(); + Assert.IsTrue(rootDescendants.Select(x => x.Id).ContainsAll(new[] { 1111, 2112, 2222, 1113, 1114, 1115, 1116 })); - //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace - var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111); - var rootDescendants = publishedMedia.DescendantsOrSelf(); - Assert.IsTrue(rootDescendants.Select(x => x.Id).ContainsAll(new[] { 1111, 2112, 2222, 1113, 1114, 1115, 1116 })); - - var publishedChild1 = store.GetDocumentById(GetUmbracoContext("/test", 1234), 2222); - var subDescendants = publishedChild1.DescendantsOrSelf(); - Assert.IsTrue(subDescendants.Select(x => x.Id).ContainsAll(new[] { 2222, 2112, 3113 })); + var publishedChild1 = store.GetDocumentById(GetUmbracoContext("/test", 1234), 2222); + var subDescendants = publishedChild1.DescendantsOrSelf(); + Assert.IsTrue(subDescendants.Select(x => x.Id).ContainsAll(new[] { 2222, 2112, 3113 })); + } } [Test] public void Ancestors_With_Examine() { - var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString())); - var indexInit = new IndexInitializer(); - var indexer = indexInit.GetUmbracoIndexer(newIndexFolder); - indexer.RebuildIndex(); + using (var luceneDir = new RAMDirectory()) + { + var indexer = IndexInitializer.GetUmbracoIndexer(luceneDir); + indexer.RebuildIndex(); - var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder)); + var store = new DefaultPublishedMediaStore(IndexInitializer.GetUmbracoSearcher(luceneDir)); - //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace - var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 3113); - var ancestors = publishedMedia.Ancestors(); - Assert.IsTrue(ancestors.Select(x => x.Id).ContainsAll(new[] { 2112, 2222, 1111 })); + //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace + var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 3113); + var ancestors = publishedMedia.Ancestors(); + Assert.IsTrue(ancestors.Select(x => x.Id).ContainsAll(new[] { 2112, 2222, 1111 })); + } + } [Test] public void AncestorsOrSelf_With_Examine() { - var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString())); - var indexInit = new IndexInitializer(); - var indexer = indexInit.GetUmbracoIndexer(newIndexFolder); - indexer.RebuildIndex(); + using (var luceneDir = new RAMDirectory()) + { + var indexer = IndexInitializer.GetUmbracoIndexer(luceneDir); + indexer.RebuildIndex(); - var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder)); + var store = new DefaultPublishedMediaStore(IndexInitializer.GetUmbracoSearcher(luceneDir)); - //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace - var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 3113); - var ancestors = publishedMedia.AncestorsOrSelf(); - Assert.IsTrue(ancestors.Select(x => x.Id).ContainsAll(new[] { 3113, 2112, 2222, 1111 })); + //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace + var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 3113); + var ancestors = publishedMedia.AncestorsOrSelf(); + Assert.IsTrue(ancestors.Select(x => x.Id).ContainsAll(new[] { 3113, 2112, 2222, 1111 })); + } } [Test] diff --git a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/IndexInitializer.cs b/src/Umbraco.Tests/TestHelpers/ExamineHelpers/IndexInitializer.cs deleted file mode 100644 index bf295d7211..0000000000 --- a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/IndexInitializer.cs +++ /dev/null @@ -1,360 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml.Linq; -using System.Xml.XPath; -using Examine; -using Examine.LuceneEngine; -using Examine.LuceneEngine.Providers; -using Lucene.Net.Analysis.Standard; -using UmbracoExamine; -using UmbracoExamine.DataServices; - -namespace Umbraco.Tests.TestHelpers.ExamineHelpers -{ - /// - /// Used internally by test classes to initialize a new index from the template - /// - internal class IndexInitializer - { - - public IndexInitializer() - { - //ensure the umbraco.config and media.xml files exist at the location where we need to load them - var appData = Path.Combine(TestHelper.CurrentAssemblyDirectory, "App_Data"); - Directory.CreateDirectory(appData); - var umbConfig = Path.Combine(appData, "umbraco.config"); - File.Delete(umbConfig); - using (var s = File.CreateText(umbConfig)) - { - s.Write(ExamineResources.umbraco); - } - - var umbMedia = Path.Combine(appData, "media.xml"); - File.Delete(umbMedia); - using (var s = File.CreateText(umbMedia)) - { - s.Write(ExamineResources.media); - } - } - - public UmbracoContentIndexer GetUmbracoIndexer(DirectoryInfo d) - { - var i = new UmbracoContentIndexer(new IndexCriteria( - new[] - { - new TestIndexField { Name = "id", EnableSorting = true, Type = "Number" }, - new TestIndexField { Name = "nodeName", EnableSorting = true }, - new TestIndexField { Name = "updateDate", EnableSorting = true, Type = "DateTime" }, - new TestIndexField { Name = "writerName" }, - new TestIndexField { Name = "path" }, - new TestIndexField { Name = "nodeTypeAlias" }, - new TestIndexField { Name = "parentID" } - }, - Enumerable.Empty(), - //new[] - // { - // new TestIndexField { Name = "headerText" }, - // new TestIndexField { Name = "bodyText" }, - // new TestIndexField { Name = "metaDescription" }, - // new TestIndexField { Name = "metaKeywords" }, - // new TestIndexField { Name = "bodyTextColOne" }, - // new TestIndexField { Name = "bodyTextColTwo" }, - // new TestIndexField { Name = "xmlStorageTest" } - // }, - Enumerable.Empty(), - //new[] - // { - // "CWS_Home", - // "CWS_Textpage", - // "CWS_TextpageTwoCol", - // "CWS_NewsEventsList", - // "CWS_NewsItem", - // "CWS_Gallery", - // "CWS_EventItem", - // "Image", - // }, - new string[] { }, - -1), - d, - new TestDataService(), - new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), - false); - - //i.IndexSecondsInterval = 1; - - i.IndexingError += IndexingError; - - return i; - } - public UmbracoExamineSearcher GetUmbracoSearcher(DirectoryInfo d) - { - return new UmbracoExamineSearcher(d, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)); - } - //public SimpleDataIndexer GetSimpleIndexer(DirectoryInfo d) - //{ - // var i = new SimpleDataIndexer(new IndexCriteria( - // new IIndexField[] { }, - // new[] - // { - // new TestIndexField { Name = "Author" }, - // new TestIndexField { Name = "DateCreated", EnableSorting = true, Type = "DateTime" }, - // new TestIndexField { Name = "Title" }, - // new TestIndexField { Name = "Photographer" }, - // new TestIndexField { Name = "YearCreated", Type = "Date.Year" }, - // new TestIndexField { Name = "MonthCreated", Type = "Date.Month" }, - // new TestIndexField { Name = "DayCreated", Type = "Date.Day" }, - // new TestIndexField { Name = "HourCreated", Type = "Date.Hour" }, - // new TestIndexField { Name = "MinuteCreated", Type = "Date.Minute" }, - // new TestIndexField { Name = "SomeNumber", Type = "Number" }, - // new TestIndexField { Name = "SomeFloat", Type = "Float" }, - // new TestIndexField { Name = "SomeDouble", Type = "Double" }, - // new TestIndexField { Name = "SomeLong", Type = "Long" } - // }, - // new string[] { }, - // new string[] { }, - // -1), - // d, - // new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), - // new TestSimpleDataProvider(), - // new[] { "Documents", "Pictures" }, - // false); - // i.IndexingError += IndexingError; - - // return i; - //} - public LuceneSearcher GetLuceneSearcher(DirectoryInfo d) - { - return new LuceneSearcher(d, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)); - } - //public PDFIndexer GetPdfIndexer(DirectoryInfo d) - //{ - // var i = new PDFIndexer(d, - // new TestDataService(), - // new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), - // false); - - // i.IndexingError += IndexingError; - - // return i; - //} - public MultiIndexSearcher GetMultiSearcher(DirectoryInfo pdfDir, DirectoryInfo simpleDir, DirectoryInfo conventionDir, DirectoryInfo cwsDir) - { - var i = new MultiIndexSearcher(new[] { pdfDir, simpleDir, conventionDir, cwsDir }, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)); - return i; - } - - - internal void IndexingError(object sender, IndexingErrorEventArgs e) - { - throw new ApplicationException(e.Message, e.InnerException); - } - - internal class TestIndexField : IIndexField - { - public string Name { get; set; } - public bool EnableSorting { get; set; } - public string Type { get; set; } - } - - internal class TestDataService : IDataService - { - - public TestDataService() - { - ContentService = new TestContentService(); - LogService = new TestLogService(); - MediaService = new TestMediaService(); - } - - #region IDataService Members - - public IContentService ContentService { get; private set; } - - public ILogService LogService { get; private set; } - - public IMediaService MediaService { get; private set; } - - public string MapPath(string virtualPath) - { - return new DirectoryInfo(TestHelper.CurrentAssemblyDirectory) + "\\" + virtualPath.Replace("/", "\\"); - } - - #endregion - } - - /// - /// A mock data service used to return content from the XML data file created with CWS - /// - internal class TestContentService : IContentService - { - public const int ProtectedNode = 1142; - - public TestContentService() - { - var xmlFile = new DirectoryInfo(TestHelper.CurrentAssemblyDirectory).GetDirectories("App_Data") - .Single() - .GetFiles("umbraco.config") - .Single(); - - _xDoc = XDocument.Load(xmlFile.FullName); - } - - #region IContentService Members - - /// - /// Return the XDocument containing the xml from the umbraco.config xml file - /// - /// - /// - /// - /// This is no different in the test suite as published content - /// - public XDocument GetLatestContentByXPath(string xpath) - { - var xdoc = XDocument.Parse(""); - xdoc.Root.Add(_xDoc.XPathSelectElements(xpath)); - - return xdoc; - } - - /// - /// Return the XDocument containing the xml from the umbraco.config xml file - /// - /// - /// - public XDocument GetPublishedContentByXPath(string xpath) - { - var xdoc = XDocument.Parse(""); - xdoc.Root.Add(_xDoc.XPathSelectElements(xpath)); - - return xdoc; - } - - public string StripHtml(string value) - { - const string pattern = @"<(.|\n)*?>"; - return Regex.Replace(value, pattern, string.Empty); - } - - public bool IsProtected(int nodeId, string path) - { - // single node is marked as protected for test indexer - // hierarchy is not important for this test - return nodeId == ProtectedNode; - } - - public IEnumerable GetAllUserPropertyNames() - { - return GetPublishedContentByXPath("//*[count(@id)>0]") - .Root - .Elements() - .Select(x => x.Name.LocalName) - .ToList(); - } - - public IEnumerable GetAllSystemPropertyNames() - { - return new Dictionary() - { - {"id", FieldIndexTypes.NOT_ANALYZED}, - {"version", FieldIndexTypes.NOT_ANALYZED}, - {"parentID", FieldIndexTypes.NOT_ANALYZED}, - {"level", FieldIndexTypes.NOT_ANALYZED}, - {"writerID", FieldIndexTypes.NOT_ANALYZED}, - {"creatorID", FieldIndexTypes.NOT_ANALYZED}, - {"nodeType", FieldIndexTypes.NOT_ANALYZED}, - {"template", FieldIndexTypes.NOT_ANALYZED}, - {"sortOrder", FieldIndexTypes.NOT_ANALYZED}, - {"createDate", FieldIndexTypes.NOT_ANALYZED}, - {"updateDate", FieldIndexTypes.NOT_ANALYZED}, - {"nodeName", FieldIndexTypes.ANALYZED}, - {"urlName", FieldIndexTypes.NOT_ANALYZED}, - {"writerName", FieldIndexTypes.ANALYZED}, - {"creatorName", FieldIndexTypes.ANALYZED}, - {"nodeTypeAlias", FieldIndexTypes.ANALYZED}, - {"path", FieldIndexTypes.NOT_ANALYZED} - }.Select(x => x.Key); - } - - #endregion - - private readonly XDocument _xDoc; - - - - - - - - } - - internal class TestLogService : ILogService - { - #region ILogService Members - - public string ProviderName { get; set; } - - public void AddErrorLog(int nodeId, string msg) - { - Trace.WriteLine("ERROR: (" + nodeId.ToString() + ") " + msg); - } - - public void AddInfoLog(int nodeId, string msg) - { - Trace.WriteLine("INFO: (" + nodeId.ToString() + ") " + msg); - } - - public void AddVerboseLog(int nodeId, string msg) - { - if (LogLevel == LoggingLevel.Verbose) - Trace.WriteLine("VERBOSE: (" + nodeId.ToString() + ") " + msg); - } - - public LoggingLevel LogLevel - { - get - { - return LoggingLevel.Verbose; - } - set - { - //do nothing - } - } - - #endregion - } - - internal class TestMediaService : IMediaService - { - - public TestMediaService() - { - var xmlFile = new DirectoryInfo(TestHelper.CurrentAssemblyDirectory).GetDirectories("App_Data") - .Single() - .GetFiles("media.xml") - .Single(); - - m_Doc = XDocument.Load(xmlFile.FullName); - } - - #region IMediaService Members - - public System.Xml.Linq.XDocument GetLatestMediaByXpath(string xpath) - { - var xdoc = XDocument.Parse(""); - xdoc.Root.Add(m_Doc.XPathSelectElements(xpath)); - return xdoc; - } - - #endregion - - private XDocument m_Doc; - } - } -} diff --git a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/umbraco.config b/src/Umbraco.Tests/TestHelpers/ExamineHelpers/umbraco.config deleted file mode 100644 index 99beb03a90..0000000000 --- a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/umbraco.config +++ /dev/null @@ -1,656 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -]> - - - - - - - - - - - - - 0 - - It's the KING of all CMS's, what more do you -need to know about it?

-]]> -
- /media/171/umbraco_tshirt.jpg - - Umbraco CMS is free - -

It means that you are not bound and locked to the licensing -rules about the number of content items / processors / web / -domains, etc. Many products are very expensive as the license cost -escalates with the number of websites. In many cases, one is soon -up in the 500' before one can even start to implement the -solution.

- -

Umbraco is Open Source

- -

In an Open Source product one has at any time full access to -source code. This provides insight and leads to better quality, as -"shortcuts" and bad code can easily be penetrated. Moreover, one -has the ability to influence and further develop the product.

- -

Umbraco is based on open source and is therefore not -lisence-plated or subject to an enterprise's ownership. The Umbraco -publishing tool places great emphasis on simplicity, standards, -flexibility and integration. Umbraco was launched in 2005 and has -had a tremendous growth since that time. Umbraco is today among the -most popular systems based on open source for Microsoft. NET -platform.

- -

100% Microsoft .NET

- -

Umbraco is built 100% on the Microsoft. NET 2.0. This means that -you can use 3rd party .NET components directly in Umbraco. -Moreover, integration with other .NET-based solutions is well -adapted from Umbracos part. Umbraco won an award for the -Integration possibilities on BNP Awards 2006.

- -

Fast results

- -

Umbraco is a powerful tool with a focus on core functionality -and openness. This efficiently allows you to achieve exactly what -you want - rather than be restricted to a "finished" module, which -makes only half of what you really wanted.

- -

Easy-to-use

- -

Umbraco has a focus on content and facilitate rapid and -intuitive content management. The system strives to be elegant, -usable and effective.

- -

Based on standards

- -

Umbraco is based on standards from the W3C as XHTML, CSS, XML -and XSLT. This gives a greater flexibility and independence, which -in turn provides more value for the money.

- -

Integration

- -

Umbraco is known to be among the best CMS on integration. Much -of the reason for this is the way to expose Microsoft ASP.NET -components as elements of, or so-called "macro's" for use in -templates, as well as in the WYSIWYG editor that writers and -editors use. Elements is also possible to "cache" on several levels -and is based on standard Microsoft .NET technology. Below are some -examples:

- -
    -
  • External XML sources (ex RSS) can be directly implemented via -XSLT elements (macros).
  • - -
  • ASP.NET controls that retrieve data from external or internal -posterior systems via standard Web Services.
  • -
- -

 

- -

 

-]]> -
-
- - /media/227/warren-buckley.jpg - /media/228/sam-grady.jpg - - Sam Grady - -

Sam Grady, me, is a graphic designer. I loves graphic design. -Great graphic design and simple solutions makes this man very -happy. Photography is also very close to my heart and I'd like to -be better, so I practice a lot and annoy people with my -requests.
-
- I haven't got a blog, yet, don't Twitter and cancelled my Facebook -account as I felt uncomfortable with people knowing my business. -Anyone else feel that way? I do, however, have a Flickr account, so -go check it out: www.flickr.com/photos/mrgrady
-
- I also have my own business, G72, which has a website that -desperately needs updating. Also, as of today (03/03/09), it's -currently down due to inept web hosts. Hopefully it won't be if you -want to take a look: www.g-72.co.uk
-
- Regarding this project, Warren asked me if I wanted to design his -website starter package for the fantastic Umbraco CMS, which I -jumped at the chance to do. Hopefully you'll find the design -appropriate and the package very useful, as that's what we really -want from this project.
-
- Finally, Warren says the layout is work in progress and I have a, -typically fussy, list of designer layout requests that I've asked -Warren to do, but time being what it is, these changes won't be -made on version 2.0, so if you spot anything, do mail the man as -we'll be compiling a list of tweaks to be made.
-
- Enjoy.

-]]> -
- - Warren Buckley - -

Warren Buckley is a web developer who specialises in using the -Umbraco CMS platform to build content managed websites for Xeed in -Norway. I run a blog called Creative Web -Specialist, where I mainly write tips and tutorial articles -around Umbraco.

- -

I have teamed up with ex-collegue Sam Grady to help me design -the new version of CWS as he produces wonderfully sexy designs for -the web. If you have seen my previous version/s of CWS you will -know that my design skills are far from stunning.

- -

I decided to create this website starter site nicknamed CWS -(Creative Website Starter site) as a learning tool to help you -understand how all the elements of a site work together in -Umbraco.

- -

From this NEW CWS package comes the -following:

- -
    -
  • Obviously a BRAND NEW spanking design from -ex-collegue Sam Grady of G-72
  • - -
  • A focus for this site to be used to help teach new users to the -Umbraco CMS platform.
  • - -
  • .NET usercontrols written in C#
  • - -
  • XSLT & .NET code heavily commented to help understand what -is going on.
  • - -
  • With supporting documentation coming in the near future.
  • -
- -

Want to see where else you can find me on the net?
- Blog - www.creativewebspecialist.co.uk
- Flickr - www.flickr.com/photos/warrenbuckley
- Last.FM - www.last.fm/user/warrenbuckley
- Twitter - twitter.com/warrenbuckley

-]]> -
- - - - - - - - - - 1 - 2 - 3 - 4 - 5 - - - - - - 0 - - This website has been produced to help you understand -Umbraco.

-]]> -
-
- - - - - - 0 - This is a good place to put a service message or something to help define your site or company.

]]>
- - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ullamcorper condimentum lorem. Curabitur placerat nunc ut leo. Integer eros ligula, vestibulum at, eleifend id, dignissim vel, est.

-

Fusce tristique. Cras faucibus porta nunc. Aliquam ultrices, arcu quis ornare sagittis, lectus augue ornare nulla, eu lobortis velit lectus id nibh. Aliquam condimentum aliquet purus. Quisque blandit ante non sapien. Sed justo libero, sollicitudin ac, pretium et, luctus nec, nisl. Nulla semper neque nec magna. Cras ut nibh ut urna bibendum sodales. Quisque venenatis euismod lacus. Pellentesque dapibus turpis at urna.

-

Sub Header

-

Sed scelerisque adipiscing mauris. Mauris egestas dapibus quam. Integer in libero eget eros dignissim pretium. Proin luctus sem nec lorem. Praesent lorem. Vivamus eget nunc quis sapien condimentum egestas. Maecenas facilisis, nunc at sodales facilisis, quam magna pretium nibh, vel ultrices lectus lorem quis neque. Nam sit amet leo ac lectus gravida convallis. Phasellus at enim vel dui porta porttitor. Morbi id dolor adipiscing erat egestas consequat.

-

Phasellus diam. Morbi dolor. Donec consequat sodales nunc. Nam dapibus lectus id lectus. Sed ultrices metus sit amet est. Morbi porttitor. Proin vel risus. Phasellus sodales convallis justo. Sed luctus hendrerit risus. Sed est lorem, feugiat et, rutrum quis, condimentum non, nunc. Aenean urna leo, sagittis a, commodo eget, lobortis nec, eros. Vivamus pharetra, lectus eu ultrices pulvinar, nunc quam consectetur nibh, sed pulvinar leo dolor ut felis.

-
    -
  1. Item one
  2. -
  3. Item two
  4. -
  5. Item three
  6. -
-

Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus, a elementum ligula dolor vitae sem. Suspendisse at quam. Praesent neque. Vestibulum at justo. Nulla rutrum velit et eros.

-
    -
  • Integer convallis augue in tellus
  • -
  • Magna quam sollicitudin mauris
  • -
-

Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus, a elementum ligula dolor vitae sem. Suspendisse at quam.

]]> -
-
- - - - - - - - - - - 0 - - The Bookhouse Boys. Live at the ICA, London.

-]]> -
- - - /media/1239/bookhouse-boys_gallery.jpg - - Credit: Sam Grady - /media/1277/bookhouse-boys_3.jpg - /media/1314/bookhouse-boys_3_thumb.jpg - - - - - - - - - 0 - - - Credit: Sam Grady - /media/1250/bookhouse-boys_1.jpg - /media/1296/bookhouse-boys_1_thumb.jpg - - - - - - - - - 0 - - - Credit: Sam Grady - /media/1331/bookhouse-boys_2.jpg - /media/1350/bookhouse-boys_2_thumb.jpg - - - - - - - - - 0 - -
- - - - - - - - - - 0 - - Where all the great minds of umbraco meet!

-]]> -
- - - /media/993/codegarden-08_gallery.jpg - - Credit: Douglas Robar - /media/825/darren-ferguson_david-conlisk.jpg - /media/835/darren-ferguson_david-conlisk_thumb.jpg - - - - - - - - - 0 - - - Credit: Warren Buckley - /media/394/codegarden08-t-shirt.jpg - /media/799/codegarden08-t-shirt_thumb.jpg - - - - - - - - - 0 - - - Credit: Douglas Robar - /media/852/bingo-callers.jpg - /media/871/bingo-callers_thumb.jpg - - - - - - - - - 0 - - - Credit: Douglas Robar - /media/879/christian-palm.jpg - /media/889/christian-palm_thumb.jpg - - - - - - - - - 0 - -
- - - - - - - - - - 0 - - Photos from a trip to Bath in November 2008

-]]> -
- - - /media/935/bath_gallery.jpg - - Credit: Warren Buckley - /media/995/royal-crescent.jpg - /media/1014/royal-crescent_thumb.jpg - - - - - - - - - 0 - -
- - - - - - 0 - This first page displays all the albums featured within your site.
Please have a browse through.

]]>
- - -
- - - 2009-06-22T00:00:00 - - Come join the annual umbraco developer conference in Wonderful -Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers, -great conversations and friendly people. - -

The who's who of umbraco will be gathered and share their -knowledge through talks, tutorials and via un-conference formats -like open space or hacking sessions. We have booked a cool, old and -huge industrial venue in central Copenhagen where we'll have one -huge room, three rooms for breakout sessions and a Café that -serves your taste of espresso.

- -

Come join the annual umbraco developer conference in Wonderful -Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers, -great conversations and friendly people.

- -

We've planned a program that fits both experienced umbraco users -as well as new comers. The conference is kicked off with a Keynote -and after that we'll have two or three tracks of sessions and the -first day is rounded with an open Q/A session with the umbraco core -team.

- -

The second day features an un-conference format called open -space, which we also used with great success at last year's -conference. It's a format where everybody can suggest a topic and -as we have plenty of break-out rooms rest assured that there'll be -room for your topic as well. Last year's more than 20 topics -covered Silverlight, High performance websites with umbraco, -building custom data types and much more.

- -

But it doesn't ends there. We've ensured that we can stay at the -venue until midnight both days which means that when the first day -ends, the fun begins. With more than hundred people gathered at a -place with loads of umbraco knowledge, wifi, great food and plenty -of space, who knows what could happen. A BBQ, new packages, -improvised demos and talks, or...?

- -

 

-]]> -
- /media/445/umbraco_tshirt.jpg - - - - - - - - - 0 -
- - - After Warren Buckley's success of the first Creative Website -Starter site package, with over 20K downloads he has decided to -work on CWS2. - -

As of today Wednesday the 4th March 2009, the CWS2 package is -now available to download from the built in package repository -inside Umbraco.

- -

With this new version comes the following:

- -
    -
  • A BRAND NEW spanking design from ex-collegue -Sam Grady of G-72
  • - -
  • A focus for this site to be used to help teach new users to the -Umbraco CMS platform.
  • - -
  • .NET usercontrols written in C#
  • - -
  • XSLT & .NET code heavily commented to help understand what -is going on.
  • - -
  • With supporting documentation coming in the near future.
  • -
-]]> -
- - - - - - - - - - - 0 -
- - - - - - 0 - - - - Please browse through our news archive and event listings -below.

-]]> -
-
- - you@yourcompany.co.uk - Email from Contact form on website - - - - you@yourcompany.co.uk - Thank you for your message - - - - 0 - - - - - - 0 - - Everything you need to
- get in touch.

-]]> -
- - Enquiry Form - -

If you have a particular enquiry, please fill out the form below -and provide as much information as you can, so that one of our -representatives can deal with your enquiry as effciently as -possible.

-]]> -
- - Thank you. We will be in touch shortly.

-]]> -
- - Thanks for filling out our contact form we will get back to you -shortly.

- -

Regards,
- My Company

-]]> -
-
- - you@yourcompany.co.uk - [YourName] has sent you a link to read - - - - 0 - - - - - - 1 - Send a page onto your friend.

]]>
- Thank you. We appreciate the love you are giving our site.

]]>
- Thanks for sending that link onto your friend, we really appreciate it here at My Company.

]]>
-
- - - 0 - Your logo/name - Sam Grady designed this for Warren Buckley. "This" idea was first created by the incredible Robert Brownjohn and has been copied many times since.

]]>
- - - Thank you for installing the umbraco website package created and developed by Warren Buckley. This should website package be used to help you understand how all the components of an Umbraco site works.

-

test1

]]> -
- - - - 0 -
-
\ No newline at end of file diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index cec6f57632..6a5e7dcaac 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -116,10 +116,6 @@ - - False - ..\packages\UmbracoExamine.0.1.42.2941\lib\UmbracoExamine.dll - @@ -267,17 +263,23 @@ - - True - True - ExamineResources.resx - - + + + + + True + True + TestFiles.resx + + + + + @@ -309,6 +311,7 @@ + Always @@ -354,16 +357,19 @@ {651E1350-91B6-44B7-BD60-7207006D7003} Umbraco.Web + + {07fbc26b-2927-4a22-8d96-d644c667fecc} + UmbracoExamine + ResXFileCodeGenerator SqlResources.Designer.cs - + ResXFileCodeGenerator - ExamineResources.Designer.cs - Designer + TestFiles.Designer.cs @@ -397,7 +403,9 @@ + + xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\amd64\*.* "$(TargetDir)amd64\" /Y /F /E /D diff --git a/src/Umbraco.Tests/UmbracoExamine/EventsTest.cs b/src/Umbraco.Tests/UmbracoExamine/EventsTest.cs new file mode 100644 index 0000000000..77c0465be2 --- /dev/null +++ b/src/Umbraco.Tests/UmbracoExamine/EventsTest.cs @@ -0,0 +1,62 @@ +using System; +using System.Linq; +using Examine; +using Lucene.Net.Store; +using NUnit.Framework; +using Umbraco.Tests.PartialTrust; +using UmbracoExamine; + +namespace Umbraco.Tests.UmbracoExamine +{ + [TestFixture] + public class EventsTest : AbstractPartialTrustFixture + { + [Test] + public void Events_Ignoring_Node() + { + //change the parent id so that they are all ignored + var existingCriteria = ((IndexCriteria)_indexer.IndexerData); + _indexer.IndexerData = new IndexCriteria(existingCriteria.StandardFields, existingCriteria.UserFields, existingCriteria.IncludeNodeTypes, existingCriteria.ExcludeNodeTypes, + 999); //change to 999 + + var isIgnored = false; + + EventHandler ignoringNode = (s, e) => + { + isIgnored = true; + }; + + _indexer.IgnoringNode += ignoringNode; + + //get a node from the data repo + var node = _contentService.GetPublishedContentByXPath("//*[string-length(@id)>0 and number(@id)>0]") + .Root + .Elements() + .First(); + + _indexer.ReIndexNode(node, IndexTypes.Content); + + + Assert.IsTrue(isIgnored); + + } + + private readonly TestContentService _contentService = new TestContentService(); + private static UmbracoExamineSearcher _searcher; + private static UmbracoContentIndexer _indexer; + private Lucene.Net.Store.Directory _luceneDir; + + public override void TestSetup() + { + _luceneDir = new RAMDirectory(); + _indexer = IndexInitializer.GetUmbracoIndexer(_luceneDir); + _indexer.RebuildIndex(); + _searcher = IndexInitializer.GetUmbracoSearcher(_luceneDir); + } + + public override void TestTearDown() + { + _luceneDir.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/UmbracoExamine/IndexInitializer.cs b/src/Umbraco.Tests/UmbracoExamine/IndexInitializer.cs new file mode 100644 index 0000000000..b7559e4e29 --- /dev/null +++ b/src/Umbraco.Tests/UmbracoExamine/IndexInitializer.cs @@ -0,0 +1,128 @@ +using System; +using Examine; +using Examine.LuceneEngine.Providers; +using Lucene.Net.Analysis.Standard; +using UmbracoExamine; + +namespace Umbraco.Tests.UmbracoExamine +{ + /// + /// Used internally by test classes to initialize a new index from the template + /// + internal static class IndexInitializer + { + public static UmbracoContentIndexer GetUmbracoIndexer(Lucene.Net.Store.Directory luceneDir) + { + + var i = new UmbracoContentIndexer(new IndexCriteria( + new[] + { + new TestIndexField { Name = "id", EnableSorting = true, Type = "Number" }, + new TestIndexField { Name = "nodeName", EnableSorting = true }, + new TestIndexField { Name = "updateDate", EnableSorting = true, Type = "DateTime" }, + new TestIndexField { Name = "writerName" }, + new TestIndexField { Name = "path" }, + new TestIndexField { Name = "nodeTypeAlias" }, + new TestIndexField { Name = "parentID" } + }, + new[] + { + new TestIndexField { Name = "headerText" }, + new TestIndexField { Name = "bodyText" }, + new TestIndexField { Name = "metaDescription" }, + new TestIndexField { Name = "metaKeywords" }, + new TestIndexField { Name = "bodyTextColOne" }, + new TestIndexField { Name = "bodyTextColTwo" }, + new TestIndexField { Name = "xmlStorageTest" } + }, + new[] + { + "CWS_Home", + "CWS_Textpage", + "CWS_TextpageTwoCol", + "CWS_NewsEventsList", + "CWS_NewsItem", + "CWS_Gallery", + "CWS_EventItem", + "Image", + }, + new string[] { }, + -1), + luceneDir, //custom lucene directory + new TestDataService(), + new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), + false); + + //i.IndexSecondsInterval = 1; + + i.IndexingError += IndexingError; + + return i; + } + public static UmbracoExamineSearcher GetUmbracoSearcher(Lucene.Net.Store.Directory luceneDir) + { + + return new UmbracoExamineSearcher(luceneDir, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)); + } + //public static SimpleDataIndexer GetSimpleIndexer(Lucene.Net.Store.Directory luceneDir) + //{ + // var i = new SimpleDataIndexer(new IndexCriteria( + // new IIndexField[] { }, + // new[] + // { + // new TestIndexField { Name = "Author" }, + // new TestIndexField { Name = "DateCreated", EnableSorting = true, Type = "DateTime" }, + // new TestIndexField { Name = "Title" }, + // new TestIndexField { Name = "Photographer" }, + // new TestIndexField { Name = "YearCreated", Type = "Date.Year" }, + // new TestIndexField { Name = "MonthCreated", Type = "Date.Month" }, + // new TestIndexField { Name = "DayCreated", Type = "Date.Day" }, + // new TestIndexField { Name = "HourCreated", Type = "Date.Hour" }, + // new TestIndexField { Name = "MinuteCreated", Type = "Date.Minute" }, + // new TestIndexField { Name = "SomeNumber", Type = "Number" }, + // new TestIndexField { Name = "SomeFloat", Type = "Float" }, + // new TestIndexField { Name = "SomeDouble", Type = "Double" }, + // new TestIndexField { Name = "SomeLong", Type = "Long" } + // }, + // new string[] { }, + // new string[] { }, + // -1), + // luceneDir, + // new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), + // new TestSimpleDataProvider(), + // new[] { "Documents", "Pictures" }, + // false); + // i.IndexingError += IndexingError; + + // return i; + //} + public static LuceneSearcher GetLuceneSearcher(Lucene.Net.Store.Directory luceneDir) + { + return new LuceneSearcher(luceneDir, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)); + } + //public static PDFIndexer GetPdfIndexer(Lucene.Net.Store.Directory luceneDir) + //{ + // var i = new PDFIndexer(luceneDir, + // new TestDataService(), + // new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), + // false); + + // i.IndexingError += IndexingError; + + // return i; + //} + public static MultiIndexSearcher GetMultiSearcher(Lucene.Net.Store.Directory pdfDir, Lucene.Net.Store.Directory simpleDir, Lucene.Net.Store.Directory conventionDir, Lucene.Net.Store.Directory cwsDir) + { + var i = new MultiIndexSearcher(new[] { pdfDir, simpleDir, conventionDir, cwsDir }, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)); + return i; + } + + + internal static void IndexingError(object sender, IndexingErrorEventArgs e) + { + throw new ApplicationException(e.Message, e.InnerException); + } + + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/UmbracoExamine/TestContentService.cs b/src/Umbraco.Tests/UmbracoExamine/TestContentService.cs new file mode 100644 index 0000000000..059b93c824 --- /dev/null +++ b/src/Umbraco.Tests/UmbracoExamine/TestContentService.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Xml.Linq; +using System.Xml.XPath; +using UmbracoExamine; +using UmbracoExamine.DataServices; + +namespace Umbraco.Tests.UmbracoExamine +{ + /// + /// A mock data service used to return content from the XML data file created with CWS + /// + public class TestContentService : IContentService + { + public const int ProtectedNode = 1142; + + public TestContentService() + { + _xDoc = XDocument.Parse(TestFiles.umbraco); + } + + #region IContentService Members + + /// + /// Return the XDocument containing the xml from the umbraco.config xml file + /// + /// + /// + /// + /// This is no different in the test suite as published content + /// + public XDocument GetLatestContentByXPath(string xpath) + { + var xdoc = XDocument.Parse(""); + xdoc.Root.Add(_xDoc.XPathSelectElements(xpath)); + + return xdoc; + } + + /// + /// Return the XDocument containing the xml from the umbraco.config xml file + /// + /// + /// + public XDocument GetPublishedContentByXPath(string xpath) + { + var xdoc = XDocument.Parse(""); + xdoc.Root.Add(_xDoc.XPathSelectElements(xpath)); + + return xdoc; + } + + public string StripHtml(string value) + { + const string pattern = @"<(.|\n)*?>"; + return Regex.Replace(value, pattern, string.Empty); + } + + public bool IsProtected(int nodeId, string path) + { + // single node is marked as protected for test indexer + // hierarchy is not important for this test + return nodeId == ProtectedNode; + } + + public IEnumerable GetAllUserPropertyNames() + { + return GetPublishedContentByXPath("//*[count(@id)>0]") + .Root + .Elements() + .Select(x => x.Name.LocalName) + .ToList(); + } + + public IEnumerable GetAllSystemPropertyNames() + { + return UmbracoContentIndexer.IndexFieldPolicies.Select(x => x.Key); + } + + #endregion + + private readonly XDocument _xDoc; + + + + + + + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/UmbracoExamine/TestDataService.cs b/src/Umbraco.Tests/UmbracoExamine/TestDataService.cs new file mode 100644 index 0000000000..0dc36e94d6 --- /dev/null +++ b/src/Umbraco.Tests/UmbracoExamine/TestDataService.cs @@ -0,0 +1,32 @@ +using System.IO; +using Umbraco.Tests.TestHelpers; +using UmbracoExamine.DataServices; + +namespace Umbraco.Tests.UmbracoExamine +{ + public class TestDataService : IDataService + { + + public TestDataService() + { + ContentService = new TestContentService(); + LogService = new TestLogService(); + MediaService = new TestMediaService(); + } + + #region IDataService Members + + public IContentService ContentService { get; private set; } + + public ILogService LogService { get; private set; } + + public IMediaService MediaService { get; private set; } + + public string MapPath(string virtualPath) + { + return new DirectoryInfo(TestHelper.CurrentAssemblyDirectory) + "\\" + virtualPath.Replace("/", "\\"); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/ExamineResources.Designer.cs b/src/Umbraco.Tests/UmbracoExamine/TestFiles.Designer.cs similarity index 76% rename from src/Umbraco.Tests/TestHelpers/ExamineHelpers/ExamineResources.Designer.cs rename to src/Umbraco.Tests/UmbracoExamine/TestFiles.Designer.cs index 4d3c1d1ce6..15f92d7c50 100644 --- a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/ExamineResources.Designer.cs +++ b/src/Umbraco.Tests/UmbracoExamine/TestFiles.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Umbraco.Tests.TestHelpers.ExamineHelpers { +namespace Umbraco.Tests.UmbracoExamine { using System; @@ -22,14 +22,14 @@ namespace Umbraco.Tests.TestHelpers.ExamineHelpers { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class ExamineResources { + internal class TestFiles { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal ExamineResources() { + internal TestFiles() { } /// @@ -39,7 +39,7 @@ namespace Umbraco.Tests.TestHelpers.ExamineHelpers { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Umbraco.Tests.TestHelpers.ExamineHelpers.ExamineResources", typeof(ExamineResources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Umbraco.Tests.UmbracoExamine.TestFiles", typeof(TestFiles).Assembly); resourceMan = temp; } return resourceMan; @@ -65,7 +65,7 @@ namespace Umbraco.Tests.TestHelpers.ExamineHelpers { ///<media> /// <node id="1111" version="902e13f7-5793-482a-9e06-cd94eebd1de0" parentID="-1" level="1" writerID="0" nodeType="1031" template="0" sortOrder="2" createDate="2010-05-19T15:26:08" updateDate="2010-05-19T15:26:09" nodeName="Product Images" urlName="productimages" writerName="Administrator" nodeTypeAlias="Folder" path="-1,1111"> /// <data alias="contents"></data> - /// <node id="2222" version="902e13f7-5793-482a-9e06-cd94eebd1de0" parentID="-1" level="1" writerID="0" [rest of string was truncated]";. + /// <node id="2222" version="902e13f7-5793-482a-9e06-cd94eebd1de0" parentID="1111" level="1" writerID="0 [rest of string was truncated]";. /// internal static string media { get { @@ -75,20 +75,20 @@ namespace Umbraco.Tests.TestHelpers.ExamineHelpers { /// /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> - ///<!DOCTYPE root[ - /// <!ELEMENT CWS_Contact ANY> - /// <!ATTLIST CWS_Contact id ID #REQUIRED> - /// <!ELEMENT CWS_EmailAFriend ANY> - /// <!ATTLIST CWS_EmailAFriend id ID #REQUIRED> - /// <!ELEMENT CWS_EventItem ANY> - /// <!ATTLIST CWS_EventItem id ID #REQUIRED> - /// <!ELEMENT CWS_Galleries ANY> - /// <!ATTLIST CWS_Galleries id ID #REQUIRED> - /// <!ELEMENT CWS_Gallery ANY> - /// <!ATTLIST CWS_Gallery id ID #REQUIRED> - /// <!ELEMENT CWS_Home ANY> - /// <!ATTLIST CWS_Home id ID #REQUIRED> - /// <!ELEMENT CWS_NewsEven [rest of string was truncated]";. + ///<!DOCTYPE root[ + ///<!ELEMENT CWS_Contact ANY> + ///<!ATTLIST CWS_Contact id ID #REQUIRED> + ///<!ELEMENT CWS_EmailAFriend ANY> + ///<!ATTLIST CWS_EmailAFriend id ID #REQUIRED> + ///<!ELEMENT CWS_EventItem ANY> + ///<!ATTLIST CWS_EventItem id ID #REQUIRED> + ///<!ELEMENT CWS_Galleries ANY> + ///<!ATTLIST CWS_Galleries id ID #REQUIRED> + ///<!ELEMENT CWS_Gallery ANY> + ///<!ATTLIST CWS_Gallery id ID #REQUIRED> + ///<!ELEMENT CWS_Home ANY> + ///<!ATTLIST CWS_Home id ID #REQUIRED> + ///<!ELEMENT CWS_NewsEventsList ANY> /// [rest of string was truncated]";. /// internal static string umbraco { get { diff --git a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/ExamineResources.resx b/src/Umbraco.Tests/UmbracoExamine/TestFiles.resx similarity index 93% rename from src/Umbraco.Tests/TestHelpers/ExamineHelpers/ExamineResources.resx rename to src/Umbraco.Tests/UmbracoExamine/TestFiles.resx index 4d91faaa26..233cffeebf 100644 --- a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/ExamineResources.resx +++ b/src/Umbraco.Tests/UmbracoExamine/TestFiles.resx @@ -119,9 +119,9 @@ - media.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + testfiles\media.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - umbraco.config;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + testfiles\umbraco.config;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 \ No newline at end of file diff --git a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/media.xml b/src/Umbraco.Tests/UmbracoExamine/TestFiles/media.xml similarity index 98% rename from src/Umbraco.Tests/TestHelpers/ExamineHelpers/media.xml rename to src/Umbraco.Tests/UmbracoExamine/TestFiles/media.xml index dd645c6d71..ec364ddac7 100644 --- a/src/Umbraco.Tests/TestHelpers/ExamineHelpers/media.xml +++ b/src/Umbraco.Tests/UmbracoExamine/TestFiles/media.xml @@ -17,7 +17,7 @@ 10726 jpg - + diff --git a/src/Umbraco.Tests/UmbracoExamine/TestIndexField.cs b/src/Umbraco.Tests/UmbracoExamine/TestIndexField.cs new file mode 100644 index 0000000000..ee648f180a --- /dev/null +++ b/src/Umbraco.Tests/UmbracoExamine/TestIndexField.cs @@ -0,0 +1,11 @@ +using Examine; + +namespace Umbraco.Tests.UmbracoExamine +{ + public class TestIndexField : IIndexField + { + public string Name { get; set; } + public bool EnableSorting { get; set; } + public string Type { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/UmbracoExamine/TestLogService.cs b/src/Umbraco.Tests/UmbracoExamine/TestLogService.cs new file mode 100644 index 0000000000..acdc528914 --- /dev/null +++ b/src/Umbraco.Tests/UmbracoExamine/TestLogService.cs @@ -0,0 +1,43 @@ +using System.Diagnostics; +using UmbracoExamine; +using UmbracoExamine.DataServices; + +namespace Umbraco.Tests.UmbracoExamine +{ + public class TestLogService : ILogService + { + #region ILogService Members + + public string ProviderName { get; set; } + + public void AddErrorLog(int nodeId, string msg) + { + Trace.WriteLine("ERROR: (" + nodeId.ToString() + ") " + msg); + } + + public void AddInfoLog(int nodeId, string msg) + { + Trace.WriteLine("INFO: (" + nodeId.ToString() + ") " + msg); + } + + public void AddVerboseLog(int nodeId, string msg) + { + if (LogLevel == LoggingLevel.Verbose) + Trace.WriteLine("VERBOSE: (" + nodeId.ToString() + ") " + msg); + } + + public LoggingLevel LogLevel + { + get + { + return LoggingLevel.Verbose; + } + set + { + //do nothing + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/UmbracoExamine/TestMediaService.cs b/src/Umbraco.Tests/UmbracoExamine/TestMediaService.cs new file mode 100644 index 0000000000..305763d2a6 --- /dev/null +++ b/src/Umbraco.Tests/UmbracoExamine/TestMediaService.cs @@ -0,0 +1,33 @@ +using System; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using System.Xml.XPath; +using Umbraco.Tests.TestHelpers; +using UmbracoExamine.DataServices; + +namespace Umbraco.Tests.UmbracoExamine +{ + public class TestMediaService : IMediaService + { + + public TestMediaService() + { + m_Doc = XDocument.Parse(TestFiles.media); + } + + #region IMediaService Members + + public System.Xml.Linq.XDocument GetLatestMediaByXpath(string xpath) + { + var xdoc = XDocument.Parse(""); + xdoc.Root.Add(m_Doc.XPathSelectElements(xpath)); + return xdoc; + } + + #endregion + + private XDocument m_Doc; + } +}