Beispiel #1
0
        public void LockIndex()
        {
            using (var store = GetDocumentStore())
            {
                var index = new IndexEmployee
                {
                    Conventions = new DocumentConventions()
                };
                index.Execute(store);

                store.Admin.Send(new SetIndexLockOperation("IndexEmployee", IndexLockMode.Unlock));
                var indexDefinition = store.Admin.Send(new GetIndexOperation("IndexEmployee"));
                Assert.Equal(IndexLockMode.Unlock, indexDefinition.LockMode);

                store.Admin.Send(new SetIndexLockOperation("IndexEmployee", IndexLockMode.LockedError));
                indexDefinition = store.Admin.Send(new GetIndexOperation("IndexEmployee"));
                Assert.Equal(IndexLockMode.LockedError, indexDefinition.LockMode);

                store.Admin.Send(new SetIndexLockOperation("IndexEmployee", IndexLockMode.LockedIgnore));
                indexDefinition = store.Admin.Send(new GetIndexOperation("IndexEmployee"));
                Assert.Equal(IndexLockMode.LockedIgnore, indexDefinition.LockMode);

                store.Admin.Send(new SetIndexLockOperation("IndexEmployee", IndexLockMode.LockedIgnore));
                indexDefinition = store.Admin.Send(new GetIndexOperation("IndexEmployee"));
                Assert.Equal(IndexLockMode.LockedIgnore, indexDefinition.LockMode);
            }
        }
Beispiel #2
0
        public void LockIndex()
        {
            using (var store = NewRemoteDocumentStore(fiddler: true))
            {
                var index = new IndexEmployee
                {
                    Conventions = new DocumentConvention()
                };
                index.Execute(store);

                store.DatabaseCommands.SetIndexLock("IndexEmployee", IndexLockMode.Unlock);
                var indexDefinition = store.DatabaseCommands.GetIndex("IndexEmployee");
                Assert.Equal(IndexLockMode.Unlock, indexDefinition.LockMode);

                store.DatabaseCommands.SetIndexLock("IndexEmployee", IndexLockMode.LockedError);
                var indexDefinition1 = store.DatabaseCommands.GetIndex("IndexEmployee");
                Assert.Equal(IndexLockMode.LockedError, indexDefinition1.LockMode);

                store.DatabaseCommands.SetIndexLock("IndexEmployee", IndexLockMode.LockedIgnore);
                var indexDefinition2 = store.DatabaseCommands.GetIndex("IndexEmployee");
                Assert.Equal(IndexLockMode.LockedIgnore, indexDefinition2.LockMode);

                store.DatabaseCommands.SetIndexLock("IndexEmployee", IndexLockMode.LockedIgnore);
                var indexDefinition3 = store.DatabaseCommands.GetIndex("IndexEmployee");
                Assert.Equal(IndexLockMode.LockedIgnore, indexDefinition3.LockMode);


                store.DatabaseCommands.SetIndexLock("IndexEmployee", IndexLockMode.SideBySide);
                var indexDefinition4 = store.DatabaseCommands.GetIndex("IndexEmployee");
                Assert.Equal(IndexLockMode.SideBySide, indexDefinition4.LockMode);
            }
        }