示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @Resources.Life(STARTED) public void shouldRotateWithCorrectVersion() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRotateWithCorrectVersion()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Store store = resourceManager.managed(createTestStore());
            Store store = _resourceManager.managed(CreateTestStore());

            UpdateStore(store, 1);

            PreparedRotation rotation = store.PrepareRotation(2);

            UpdateStore(store, 2);
            rotation.Rotate();

            // then
            assertEquals(2, store.Headers().get(TX_ID).longValue());
            store.PrepareRotation(2).rotate();
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @Resources.Life(STARTED) public void postStateUpdatesCountedOnlyForTransactionsGreaterThanRotationVersion() throws java.io.IOException, InterruptedException, java.util.concurrent.ExecutionException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PostStateUpdatesCountedOnlyForTransactionsGreaterThanRotationVersion()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Store store = resourceManager.managed(createTestStore());
            Store store = _resourceManager.managed(CreateTestStore());

            PreparedRotation rotation = store.PrepareRotation(2);

            UpdateStore(store, 4);
            UpdateStore(store, 3);
            UpdateStore(store, 1);
            UpdateStore(store, 2);

            assertEquals(2, rotation.Rotate());

            Future <long> rotationFuture = _threading.executeAndAwait(store.Rotation, 5L, thread => Thread.State.TIMED_WAITING == thread.State, 100, SECONDS);

            Thread.Sleep(TimeUnit.SECONDS.toMillis(1));

            assertFalse(rotationFuture.Done);
            UpdateStore(store, 5);

            assertEquals(5, rotationFuture.get().longValue());
        }