//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void runTest(Fixture fixture) throws InterruptedException, java.util.concurrent.ExecutionException private static void RunTest(Fixture fixture) { int iterations = fixture.Iterations(); ResourceType resourceType = fixture.CreateResourceType(); Locks manager = fixture.CreateLockManager(resourceType); try { using (Org.Neo4j.Kernel.impl.locking.Locks_Client a = manager.NewClient(), Org.Neo4j.Kernel.impl.locking.Locks_Client b = manager.NewClient()) { BinaryLatch startLatch = new BinaryLatch(); BlockedCallable callA = new BlockedCallable(startLatch, () => workloadA(fixture, a, resourceType, iterations)); BlockedCallable callB = new BlockedCallable(startLatch, () => workloadB(fixture, b, resourceType, iterations)); Future <Void> futureA = _executor.submit(callA); Future <Void> futureB = _executor.submit(callB); callA.AwaitBlocked(); callB.AwaitBlocked(); startLatch.Release(); futureA.get(); futureB.get(); } } finally { manager.Close(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void loadSimpleStatementLocksFactoryWhenNoServices() public virtual void LoadSimpleStatementLocksFactoryWhenNoServices() { Locks locks = mock(typeof(Locks)); Locks_Client locksClient = mock(typeof(Locks_Client)); when(locks.NewClient()).thenReturn(locksClient); StatementLocksFactorySelector loader = NewLoader(locks); StatementLocksFactory factory = loader.Select(); StatementLocks statementLocks = factory.NewInstance(); assertThat(factory, instanceOf(typeof(SimpleStatementLocksFactory))); assertThat(statementLocks, instanceOf(typeof(SimpleStatementLocks))); assertSame(locksClient, statementLocks.Optimistic()); assertSame(locksClient, statementLocks.Pessimistic()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void newInstanceCreatesDeferredLocksWhenConfigSet() public virtual void NewInstanceCreatesDeferredLocksWhenConfigSet() { Locks locks = mock(typeof(Locks)); Locks_Client client = mock(typeof(Locks_Client)); when(locks.NewClient()).thenReturn(client); Config config = Config.defaults(deferred_locks_enabled, Settings.TRUE); DeferringStatementLocksFactory factory = new DeferringStatementLocksFactory(); factory.Initialize(locks, config); StatementLocks statementLocks = factory.NewInstance(); assertThat(statementLocks, instanceOf(typeof(DeferringStatementLocks))); assertThat(statementLocks.Optimistic(), instanceOf(typeof(DeferringLockClient))); assertSame(client, statementLocks.Pessimistic()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static KernelTransactions newKernelTransactions(boolean testKernelTransactions, TransactionCommitProcess commitProcess, org.neo4j.storageengine.api.StorageReader firstReader, org.neo4j.storageengine.api.StorageReader... otherReaders) throws Throwable private static KernelTransactions NewKernelTransactions(bool testKernelTransactions, TransactionCommitProcess commitProcess, StorageReader firstReader, params StorageReader[] otherReaders) { Locks locks = mock(typeof(Locks)); Org.Neo4j.Kernel.impl.locking.Locks_Client client = mock(typeof(Org.Neo4j.Kernel.impl.locking.Locks_Client)); when(locks.NewClient()).thenReturn(client); StorageEngine storageEngine = mock(typeof(StorageEngine)); when(storageEngine.NewReader()).thenReturn(firstReader, otherReaders); doAnswer(invocation => { ICollection <StorageCommand> argument = invocation.getArgument(0); argument.add(mock(typeof(StorageCommand))); return(null); }).when(storageEngine).createCommands(anyCollection(), any(typeof(ReadableTransactionState)), any(typeof(StorageReader)), any(typeof(ResourceLocker)), anyLong(), any(typeof(TxStateVisitor.Decorator))); return(NewKernelTransactions(locks, storageEngine, commitProcess, testKernelTransactions)); }
internal LockWorkerState(Locks locks) { this.Grabber = locks; this.Client = locks.NewClient(); }