ClearAndPopulateAll() public method

public ClearAndPopulateAll ( ) : void
return void
示例#1
0
        public static void InitializeAllTests(TestContext context)
        {
            DataProvider.InitializeForTests();

            var pluginsPath = context.TestDeploymentDir;

            pluginsPath = System.IO.Path.GetFullPath(System.IO.Path.Combine(pluginsPath, @"..\..\..\WebSite\bin"));
            if (!System.IO.Directory.Exists(pluginsPath))
            {
                pluginsPath = System.IO.Directory.GetCurrentDirectory();
            }
            var settings = new RepositoryStartSettings
            {
                PluginsPath        = pluginsPath,
                StartLuceneManager = false,
                RestoreIndex       = false
            };
            var repo = Repository.Start(settings);

            //try
            //{
            //    pluginsPath = System.IO.Path.GetFullPath(System.IO.Path.Combine(pluginsPath, @"..\..\..\ContentExplorer\bin"));
            //    SenseNet.ContentRepository.Storage.TypeHandler.LoadAssembliesFrom(pluginsPath);
            //}
            //catch (System.IO.DirectoryNotFoundException)
            //{
            //    pluginsPath = System.IO.Directory.GetCurrentDirectory();
            //    SenseNet.ContentRepository.Storage.TypeHandler.LoadAssembliesFrom(pluginsPath);
            //}

            var populator = new SenseNet.Search.Indexing.DocumentPopulator();

            populator.ClearAndPopulateAll();
            repo.StartLucene();

            SetRootPermissions();

            ContentTypeInstaller.InstallContentType(SenseNet.ContentRepository.Tests.ContentHandlers.TestSystemFolder.ContentTypeDefinition);

            //PatchSystemFolder_All(typeof(SystemFolder).Name, "TestSurvey", "BoolTest", "Car_Bug5527", "Car1_AutoNamingTests", "Car2_AutoNamingTests", "File2", "ForMultiPagingSearch", "RepositoryTest_RefTestNode");
            PatchSystemFolder_All("PortalRoot", "RepositoryTest_RefTestNode", "Automobile", "Automobile5", "Automobile6", "DefaultValueTest"
                                  , "FieldSetting_Analyzer", "OuterFieldTestContentType", "ReferredContent", "TypeForIndexingTest", "ValidatedContent"
                                  , "XmlNamespaceCompatibility", "ContentList_for_AllowChildTypes", "TestSystemFolder");

            PatchSystemFolder_Add("Site", "WebContent", "File");
            PatchSystemFolder_Add("Car", "Car");
            PatchSystemFolder_Add("ContentLink", "Car", "Page");
            PatchSystemFolder_Add("ContentList", "Car", "Folder", "OuterFieldTestContentType", "Task");
            PatchSystemFolder_Add("Page", "Page", "WebContent", "File");
            PatchSystemFolder_Add("Site", "ContentList");
            PatchSystemFolder_Add("TrashBag", "Folder");
        }
示例#2
0
        public static void InitializeAllTests(TestContext context)
        {
            var pluginsPath = context.TestDeploymentDir;
            pluginsPath = System.IO.Path.GetFullPath(System.IO.Path.Combine(pluginsPath, @"..\..\..\WebSite\bin"));
            if(!System.IO.Directory.Exists(pluginsPath))
                pluginsPath = System.IO.Directory.GetCurrentDirectory();
            var settings = new RepositoryStartSettings
            {
                PluginsPath = pluginsPath,
                StartLuceneManager = false,
                RestoreIndex = false
            };
            var repo = Repository.Start(settings);

            //try
            //{
            //    pluginsPath = System.IO.Path.GetFullPath(System.IO.Path.Combine(pluginsPath, @"..\..\..\ContentExplorer\bin"));
            //    SenseNet.ContentRepository.Storage.TypeHandler.LoadAssembliesFrom(pluginsPath);
            //}
            //catch (System.IO.DirectoryNotFoundException)
            //{
            //    pluginsPath = System.IO.Directory.GetCurrentDirectory();
            //    SenseNet.ContentRepository.Storage.TypeHandler.LoadAssembliesFrom(pluginsPath);
            //}

            var populator = new SenseNet.Search.Indexing.DocumentPopulator();
            populator.ClearAndPopulateAll();
            repo.StartLucene();

            //PatchSystemFolder_All(typeof(SystemFolder).Name, "TestSurvey", "BoolTest", "Car_Bug5527", "Car1_AutoNamingTests", "Car2_AutoNamingTests", "File2", "ForMultiPagingSearch", "RepositoryTest_RefTestNode");
            PatchSystemFolder_All("PortalRoot", "RepositoryTest_RefTestNode", "Automobile", "Automobile5", "Automobile6", "DefaultValueTest"
                , "FieldSetting_Analyzer", "OuterFieldTestContentType", "ReferredContent", "TypeForIndexingTest", "ValidatedContent"
                , "XmlNamespaceCompatibility", "ContentList_for_AllowChildTypes");

            PatchSystemFolder_Add("Site", "WebContent", "File");
            PatchSystemFolder_Add("Car", "Car");
            PatchSystemFolder_Add("ContentLink", "Car", "Page");
            PatchSystemFolder_Add("ContentList", "Car", "Folder", "OuterFieldTestContentType", "Task");
            PatchSystemFolder_Add("Page", "Page", "WebContent", "File");
            PatchSystemFolder_Add("Site", "ContentList");
            PatchSystemFolder_Add("TrashBag", "Folder");
        }
示例#3
0
        private static void Run(string repositoryPath, string indexPath, string asmPath)
        {
            using (var x = SenseNet.ContentRepository.Repository.Start(
                new SenseNet.ContentRepository.RepositoryStartSettings { Console = Console.Out, StartLuceneManager = false, StartWorkflowEngine = false, PluginsPath = asmPath }))
            {
                var y = (SenseNet.ContentRepository.RepositoryInstance)x;
                var z = y.StartupTrace;

                SenseNet.ContentRepository.Storage.Data.RepositoryConfiguration.WorkingModeIsPopulating = true;

                if (indexPath != null)
                    StorageContext.Search.SetIndexDirectoryPath(indexPath);

                _versionCount = SenseNet.ContentRepository.Storage.Data.DataProvider.GetVersionCount(repositoryPath);
                _factor = Convert.ToDouble(_versionCount) / Convert.ToDouble(_progressHead.Length);
                //Console.WriteLine("Progress of populating {0} items:", _versionCount);
                //Console.WriteLine(_progressHead);
                Console.WriteLine("Populating {0} items:", _versionCount);
                Console.Write("Initializing ... ");

                var populator = new DocumentPopulator();
                populator.NodeIndexed += new EventHandler<NodeIndexedEvenArgs>(IndexBuilder_NodeIndexed);
                if (repositoryPath == null)
                    populator.ClearAndPopulateAll();
                else
                    populator.RepopulateTree(repositoryPath);
                populator.NodeIndexed -= new EventHandler<NodeIndexedEvenArgs>(IndexBuilder_NodeIndexed);

                Console.WriteLine();
                Console.WriteLine("Populating has been finished.");
            }
        }