//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void unblockNewTransactionsFromWrongThreadThrows() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UnblockNewTransactionsFromWrongThreadThrows() { KernelTransactions kernelTransactions = NewKernelTransactions(); kernelTransactions.BlockNewTransactions(); Future <KernelTransaction> txOpener = T2.execute(state => kernelTransactions.NewInstance(@explicit, AnonymousContext.write(), 0L)); T2.get().waitUntilWaiting(location => location.isAt(typeof(KernelTransactions), "newInstance")); AssertNotDone(txOpener); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.concurrent.Future<?> wrongUnblocker = unblockTxsInSeparateThread(kernelTransactions); Future <object> wrongUnblocker = UnblockTxsInSeparateThread(kernelTransactions); try { wrongUnblocker.get(); } catch (Exception e) { assertThat(e, instanceOf(typeof(ExecutionException))); assertThat(e.InnerException, instanceOf(typeof(System.InvalidOperationException))); } AssertNotDone(txOpener); kernelTransactions.UnblockNewTransactions(); assertNotNull(txOpener.get()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void exceptionWhenStartingNewTransactionOnShutdownInstance() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ExceptionWhenStartingNewTransactionOnShutdownInstance() { KernelTransactions kernelTransactions = NewKernelTransactions(); _databaseAvailabilityGuard.shutdown(); ExpectedException.expect(typeof(DatabaseShutdownException)); kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AUTH_DISABLED, 0L); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void incrementalUserTransactionId() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void IncrementalUserTransactionId() { KernelTransactions kernelTransactions = NewKernelTransactions(); using (KernelTransaction kernelTransaction = kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AnonymousContext.none(), 0L)) { assertEquals(1, kernelTransactions.ActiveTransactions().GetEnumerator().next().UserTransactionId); } using (KernelTransaction kernelTransaction = kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AnonymousContext.none(), 0L)) { assertEquals(2, kernelTransactions.ActiveTransactions().GetEnumerator().next().UserTransactionId); } using (KernelTransaction kernelTransaction = kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AnonymousContext.none(), 0L)) { assertEquals(3, kernelTransactions.ActiveTransactions().GetEnumerator().next().UserTransactionId); } }
private static void StartAndCloseTransaction(KernelTransactions kernelTransactions) { try { kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AUTH_DISABLED, 0L).close(); } catch (TransactionFailureException e) { throw new Exception(e); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotLeakTransactionOnSecurityContextFreezeFailure() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotLeakTransactionOnSecurityContextFreezeFailure() { KernelTransactions kernelTransactions = NewKernelTransactions(); LoginContext loginContext = mock(typeof(LoginContext)); when(loginContext.Authorize(any(), any())).thenThrow(new AuthorizationExpiredException("Freeze failed.")); assertException(() => kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, loginContext, 0L), typeof(AuthorizationExpiredException), "Freeze failed."); assertThat("We should not have any transaction", kernelTransactions.ActiveTransactions(), @is(empty())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void exceptionWhenStartingNewTransactionOnStoppedKernelTransactions() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ExceptionWhenStartingNewTransactionOnStoppedKernelTransactions() { KernelTransactions kernelTransactions = NewKernelTransactions(); T2.execute((OtherThreadExecutor.WorkerCommand <Void, Void>)state => { StopKernelTransactions(kernelTransactions); return(null); }).get(); ExpectedException.expect(typeof(System.InvalidOperationException)); kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AUTH_DISABLED, 0L); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void blockNewTransactions() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BlockNewTransactions() { KernelTransactions kernelTransactions = NewKernelTransactions(); kernelTransactions.BlockNewTransactions(); Future <KernelTransaction> txOpener = T2.execute(state => kernelTransactions.NewInstance(@explicit, AnonymousContext.write(), 0L)); T2.get().waitUntilWaiting(location => location.isAt(typeof(KernelTransactions), "newInstance")); AssertNotDone(txOpener); kernelTransactions.UnblockNewTransactions(); assertNotNull(txOpener.get()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void threadThatBlocksNewTxsCantStartNewTxs() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ThreadThatBlocksNewTxsCantStartNewTxs() { KernelTransactions kernelTransactions = NewKernelTransactions(); kernelTransactions.BlockNewTransactions(); try { kernelTransactions.NewInstance(KernelTransaction.Type.@implicit, AnonymousContext.write(), 0L); fail("Exception expected"); } catch (Exception e) { assertThat(e, instanceOf(typeof(System.InvalidOperationException))); } }
private static KernelTransaction GetKernelTransaction(KernelTransactions transactions) { return(transactions.NewInstance(KernelTransaction.Type.@implicit, AnonymousContext.none(), 0L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void startNewTransactionOnRestartedKErnelTransactions() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void StartNewTransactionOnRestartedKErnelTransactions() { KernelTransactions kernelTransactions = NewKernelTransactions(); kernelTransactions.Stop(); kernelTransactions.Start(); assertNotNull("New transaction created by restarted kernel transactions component.", kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AUTH_DISABLED, 0L)); }