コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void givenStartedAndAccessibleWhenNewLockSessionThenSucceeds() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void GivenStartedAndAccessibleWhenNewLockSessionThenSucceeds()
        {
            // Given
            MasterImpl.SPI spi    = MockedSpi();
            Config         config = config();

            when(spi.Accessible).thenReturn(true);
            when(spi.GetTransactionChecksum(anyLong())).thenReturn(1L);

            MasterImpl instance = new MasterImpl(spi, mock(typeof(ConversationManager)), mock(typeof(MasterImpl.Monitor)), config);

            instance.Start();
            HandshakeResult handshake = instance.Handshake(1, newStoreIdForCurrentVersion()).response();

            // When
            try
            {
                instance.NewLockSession(new RequestContext(handshake.Epoch(), 1, 2, 0, 0));
            }
            catch (Exception e)
            {
                fail(e.Message);
            }
        }
コード例 #2
0
        protected internal virtual RequestContext CreateRequestContext(MasterImpl master)
        {
            HandshakeResult handshake = master.Handshake(1, newStoreIdForCurrentVersion()).response();

            return(new RequestContext(handshake.Epoch(), 1, 2, 0, 0));
        }