Beispiel #1
0
        [SetUp] public void SetUp()
        {
            try
            {
                string[] files = System.IO.Directory.GetFiles(".", "_*");
                foreach (string fileName in files)
                {
                    System.IO.File.Delete(fileName);
                }
            }
            catch (Exception exc)
            {
                Assert.Fail(exc.Message);
            }

            OMEnv.DataDir = ".\\Data";
            InitStorage();
            for (int i = 0; i < _processors.Length; ++i)
            {
                _processors[i] = new AsyncProcessor(new AsyncExceptionHandler(ExceptionHandler), false);
            }

            MockPluginEnvironment env = new MockPluginEnvironment(_storage);

            env.SetCoreProps(new MockCoreProps());

            indexer = new FullTextIndexer();
            indexer.Initialize();
            Core.ResourceStore.ResourceTypes.Register("TestType", "TestType", "Name", ResourceTypeFlags.Normal);
        }
Beispiel #2
0
        [Test] public void ConsistencyAfterUpdates()
        {
            MockPluginEnvironment env = new MockPluginEnvironment(_storage);

            env = env;
            FullTextIndexer indexer = new FullTextIndexer();

            //-----------------------------------------------------------------
            indexer.AddDocumentFragment(100, "token1 token2 token3");
            indexer.AddDocumentFragment(200, "token1 token2 token3");
            indexer.EndBatchUpdate();
            Entry[] aentry_Result = indexer.ProcessQueryInternal("token1");
            Assert.IsTrue(aentry_Result.Length == 2, "Failed to find all documents");

            //-----------------------------------------------------------------
            indexer.AddDocumentFragment(300, "token1 token2 token3");
            indexer.AddDocumentFragment(400, "token1 token4 token5");
            indexer.EndBatchUpdate();
            aentry_Result = indexer.ProcessQueryInternal("token1");
            Assert.IsTrue(aentry_Result.Length == 4, "Failed to find all documents");

            //-----------------------------------------------------------------
            indexer.AddDocumentFragment(500, "token1 token2 token3");
            indexer.AddDocumentFragment(600, "token1 token4 token5");
            indexer.EndBatchUpdate();
            aentry_Result = indexer.ProcessQueryInternal("token1");
            Assert.IsTrue(aentry_Result.Length == 6, "Failed to find all documents");

            //-----------------------------------------------------------------
            indexer.DeleteDocument(100);
            aentry_Result = indexer.ProcessQueryInternal("token1");
            Assert.IsTrue(aentry_Result.Length == 5, "Failed to find all documents");

            indexer.DeleteDocument(600);
            aentry_Result = indexer.ProcessQueryInternal("token1");
            Assert.IsTrue(aentry_Result.Length == 4, "Failed to find all documents");

            //-----------------------------------------------------------------
            for (int i = 0; i < 200000; i++)
            {
                indexer.AddDocumentFragment(i + 1000, "Term" + i);
                if (i % 100000 == 0)
                {
                    indexer.AddDocumentFragment(i + 1000, "Token1");
                    Console.Write(".");
                }
            }
            indexer.EndBatchUpdate();
            aentry_Result = indexer.ProcessQueryInternal("token1");
            Assert.IsTrue(aentry_Result.Length == 6, "Failed to find all documents");

            //-----------------------------------------------------------------
            indexer.AddDocumentFragment(300, "token1 token2 token3");
            indexer.AddDocumentFragment(400, "token1 token4 token5");
            indexer.EndBatchUpdate();
            aentry_Result = indexer.ProcessQueryInternal("token1");
            Assert.IsTrue(aentry_Result.Length == 8, "Failed to find all documents");

            indexer.DiscardTextIndex();
        }
Beispiel #3
0
 [SetUp] public void SetUp()
 {
     _listener = new MAPIListenerStub(null);
     InitStorage();
     _core = new MockPluginEnvironment(_storage);
     OutlookSession.Initialize( );
 }
Beispiel #4
0
        [Test] public void  TestMemoryAccessorsMerge()
        {
            MockPluginEnvironment env = new MockPluginEnvironment(_storage);

            env = env;
            FullTextIndexer indexer = new FullTextIndexer();

            indexer.AddDocumentFragment(1, "one two\n\nthree fourplay");
            indexer.AddDocumentFragment(2, "fourplay.\n\nthreeplay. ");
            indexer.EndBatchUpdate();

            for (int i = 3; i < 50000; i++)
            {
                indexer.AddDocumentFragment(i, "Term" + i);
            }

            Console.WriteLine("Finished addition");
            indexer.EndBatchUpdate();
            Console.WriteLine("Finished Linking");
            Entry[] aentry_Result;
            for (int i = 3; i < 50000; i++)
            {
                aentry_Result = indexer.ProcessQueryInternal("Term" + i);
                Assert.IsTrue(aentry_Result.Length == 1, "We must find exactly one instance of every term");
            }
            Console.WriteLine("Finished quering");
            indexer.DiscardTextIndex();
        }
Beispiel #5
0
 protected void SetUpOutlook()
 {
     InitStorage();
     _core = new MockPluginEnvironment(_storage);
     _core.RegisterComponentImplementation(typeof(FileResourceManager));
     OutlookSession.Initialize( );
 }
Beispiel #6
0
 [SetUp] public void SetUp()
 {
     InitStorage();
     _core = new MockPluginEnvironment(_storage);
     _core = _core;
     //OutlookSession.Initialize( null );
 }
Beispiel #7
0
        [SetUp] public void SetUp()
        {
#pragma warning disable 1717
            _environment = _environment;
#pragma warning restore 1717
            _environment   = new MockPluginEnvironment(null);
            _mainMenu      = new MenuStrip();
            _contextMenu   = new ContextMenuStrip();
            _actionManager = new ActionManager(_mainMenu, _contextMenu, null);
        }
Beispiel #8
0
        [SetUp] public void SetUp()
        {
            _environment = _environment;
            InitStorage();
            RegisterResourcesAndProperties();
            _environment = new MockPluginEnvironment(_storage);
            _composite   = new CompositeAction("Delete");

            _storage.NewResource("Person");
            _storage.NewResource("Email");
        }
Beispiel #9
0
 public ListenersTests()
 {
     _tracer = _tracer;
     _core   = _core;
 }
Beispiel #10
0
Datei: Base.cs Projekt: mo5h/omeo
 public void SetUp()
 {
     _environment = new MockPluginEnvironment(null);
     _srv         = new RemoteControlServer(_port);
     _srv.Start();
 }