Example #1
0
        private WorkThread CreateWorker(string name)
        {
            WorkThread workThread = new WorkThread(name, _index, _graphDb, _node);

            _workers.Add(workThread);
            return(workThread);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void deleteAndCommitShouldBePublishedToOtherTransaction2() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DeleteAndCommitShouldBePublishedToOtherTransaction2()
        {
            WorkThread firstTx  = CreateWorker("First");
            WorkThread secondTx = CreateWorker("Second");

            firstTx.BeginTransaction();
            secondTx.BeginTransaction();

            firstTx.CreateNodeAndIndexBy(_key, "some value");
            secondTx.CreateNodeAndIndexBy(_key, "some other value");

            firstTx.DeleteIndex();
            firstTx.Commit();

            try
            {
                secondTx.QueryIndex(_key, "some other value");
                fail("Should throw exception");
            }
            catch (ExecutionException e)
            {
                assertThat(e.InnerException, instanceOf(typeof(NotFoundException)));
                assertThat(e.InnerException.Message.ToLower(), containsString("index 'index' doesn't exist"));
            }

            secondTx.Rollback();

            // Since $Before will start a tx, add a value and keep tx open and
            // workers will delete the index so this test will fail in @After
            // if we don't rollback this tx
            RollbackTx();
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void deleteInOneTxShouldNotAffectTheOther() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DeleteInOneTxShouldNotAffectTheOther()
        {
            _index.delete();

            WorkThread firstTx = CreateWorker("Single");

            firstTx.BeginTransaction();
            firstTx.CreateNodeAndIndexBy(_key, "another value");
            firstTx.Commit();
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void indexDeletesShouldNotByVisibleUntilCommit() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndexDeletesShouldNotByVisibleUntilCommit()
        {
            CommitTx();

            WorkThread firstTx = CreateWorker("First");

            firstTx.BeginTransaction();
            firstTx.RemoveFromIndex(_key, _value);

            using (Transaction transaction = _graphDb.beginTx())
            {
                IndexHits <Node> indexHits = _index.get(_key, _value);
                assertThat(indexHits, Contains.ContainsConflict(_node));
            }

            firstTx.Rollback();
        }
Example #5
0
 public UniqueNodeFactoryAnonymousInnerClass(WorkThread outerInstance, Index <Node> index, string key, object initialValue) : base(index)
 {
     this.outerInstance = outerInstance;
     this._key          = key;
     this._initialValue = initialValue;
 }