Beispiel #1
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();
        }
Beispiel #2
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();
        }