コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void terminateSingleInstanceRestTransactionThatWaitsForLock() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TerminateSingleInstanceRestTransactionThatWaitsForLock()
        {
            ServerControls server = _cleanupRule.add(TestServerBuilders.newInProcessBuilder().withConfig(GraphDatabaseSettings.auth_enabled, Settings.FALSE).withConfig(GraphDatabaseSettings.lock_manager, LockManagerName).withConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).newServer());

            GraphDatabaseService db = server.Graph();

            HTTP.Builder http = withBaseUri(server.HttpURI());

            long value1 = 1L;
            long value2 = 2L;

            CreateNode(db);

            HTTP.Response tx1 = StartTx(http);
            HTTP.Response tx2 = StartTx(http);

            AssertNumberOfActiveTransactions(2, db);

            HTTP.Response update1 = ExecuteUpdateStatement(tx1, value1, http);
            assertThat(update1.Status(), equalTo(200));
            assertThat(update1, containsNoErrors());

            System.Threading.CountdownEvent latch = new System.Threading.CountdownEvent(1);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.concurrent.Future<?> tx2Result = executeInSeparateThread("tx2", () ->
            Future <object> tx2Result = ExecuteInSeparateThread("tx2", () =>
            {
                latch.Signal();
                Response update2 = ExecuteUpdateStatement(tx2, value2, http);
                AssertTxWasTerminated(update2);
            });

            Await(latch);
            SleepForAWhile();

            Terminate(tx2, http);
            Commit(tx1, http);

            HTTP.Response update3 = ExecuteUpdateStatement(tx2, value2, http);
            assertThat(update3.Status(), equalTo(404));

            tx2Result.get(1, TimeUnit.MINUTES);

            AssertNodeExists(db, value1);
        }
コード例 #2
0
 public Neo4jRule(File workingDirectory) : this(TestServerBuilders.newInProcessBuilder(workingDirectory))
 {
 }
コード例 #3
0
 public Neo4jRule() : this(TestServerBuilders.newInProcessBuilder())
 {
 }