示例#1
0
        public void Indicies_are_reflected_in_Indicies_property()
        {
            //--- Arrange ---
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager manager  = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));
            List <IndexInfo>     indicies = new List <IndexInfo>(manager.Indicies);

            //--- Assert ---
            // check datacatalog expectations were met

            // check Indicies return value
            Assert.AreEqual(2, indicies.Count);
            bool foundFoo = false;
            bool foundBar = false;

            foreach (IndexInfo info in indicies)
            {
                if (info.Name == "foo")
                {
                    foundFoo = true;
                }
                if (info.Name == "bar")
                {
                    foundBar = true;
                }
            }
            Assert.IsTrue(foundBar);
            Assert.IsTrue(foundFoo);
        }
示例#2
0
        public void Indicies_are_wiped_on_data_store_drop()
        {
            //--- Arrange ---
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager.DropDataStore(_catalog, testStore);

            //--- Assert ---
            // check datacatalog expectations were met
        }
示例#3
0
        public void Can_wipe_store_tables()
        {
            //--- Arrange ---
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager.DropDataStore(_catalog, testStore);

            //--- Assert ---
            // check datacatalog expectations were met
        }
示例#4
0
        public void Can_update_items()
        {
            //--- Arrange ---
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager manager = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));

            manager.QueueUpdate(1, 2, new XDoc("x").Elem("foo", "a"));

            //--- Assert ---
            // verify that queued update updates index
        }
示例#5
0
        public void Can_create_indicies()
        {
            //--- Arrange ---
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager manager = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));

            manager.AddIndex("foo", "/foo");
            manager.AddIndex("bar", "/bar");

            //--- Assert ---
            // check datacatalog expectations were met
        }
示例#6
0
        public void Can_get_index_info_by_key_name()
        {
            //--- Arrange ---
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager manager = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));
            IndexInfo            info    = manager.GetIndexInfo("foo");

            //--- Assert ---
            // check datacatalog expectations were met

            // check indexinfo
            Assert.IsNotNull(info);
            Assert.AreEqual("foo", info.Name);
        }
示例#7
0
        public void Can_remove_indicies()
        {
            //--- Arrange ---
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager manager = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));

            manager.RemoveIndex("foo");
            manager.RemoveIndex("bar");
            List <IndexInfo> indicies = new List <IndexInfo>(manager.Indicies);

            //--- Assert ---
            // check datacatalog expectations were met

            // check the Indicies property is empty
            Assert.AreEqual(0, indicies.Count);
        }
示例#8
0
        public void Can_delete_indexed_items()
        {
            //--- Arrange ---
            int  id1  = 1;
            XDoc doc1 = new XDoc("x").Attr("id", "a").Elem("foo", "x");
            int  id2  = 2;
            XDoc doc2 = new XDoc("x").Attr("id", "b").Elem("foo", "b1").Elem("foo", "b2");

            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager manager = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));

            manager.QueueDelete(id1);
            manager.QueueDelete(id2);


            //--- Assert ---
            // verify that queued deletes remove index values
        }
示例#9
0
        public void Can_rebuild_index_for_document()
        {
            //--- Arrange ---

/*
 *          int id1 = 1;
 *          XDoc doc1 = new XDoc("x").Attr("id", "a").Elem("foo", "x");
 *          int id2 = 2;
 *          XDoc doc2 = new XDoc("x").Attr("id", "b").Elem("foo", "b1").Elem("foo", "b2");
 */
            // set up DataCatalog expectations

            //--- Act ---
            MysqlDocStoreManager manager = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));

            manager.RebuildIndex("x");

            //--- Assert ---
            // verify that rebuild called routines to build indicies off existing docs
        }
示例#10
0
        public void Can_create_store_tables()
        {
            //--- Arrange ---
            // set up DataCatalog expectations
            _catalog.ExpectNewQuery(@"
CREATE TABLE IF NOT EXISTS teststore_store (
    id int primary key auto_increment not null,
    revision int not null default 1,
    doc_id varchar(255) unique not null, 
    doc text not null )", 1).Execute();
            _catalog.ExpectNewQuery(@"
CREATE TABLE IF NOT EXISTS teststore_store_indicies (
  idx_name varchar(255) primary key not null,
  idx_xpath text not null )", 1).Execute();
            _catalog.ExpectNewQuery(@"SELECT idx_name, idx_xpath FROM teststore_store_indicies", 1)
            .Execute(new MockDataCatalog.MockDataReader(new[] { "idx_name", "idx_xpath" }, new object[0][]));
            //--- Act ---
            MysqlDocStoreManager manager = new MysqlDocStoreManager(_catalog, new XDoc("config").Elem("name", testStore).Elem("id-xpath", "@id"));

            //--- Assert ---
            // check datacatalog expectations were met
            Assert.IsTrue(_catalog.Verify(), _catalog.VerificationFailure);
        }