Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void configureProvidedStoreCopyFiles(StoreResource[] atomicFiles, java.io.File[] files, org.eclipse.collections.api.set.primitive.LongSet indexIds, long lastCommitedTx) throws java.io.IOException
        private void ConfigureProvidedStoreCopyFiles(StoreResource[] atomicFiles, File[] files, LongSet indexIds, long lastCommitedTx)
        {
            when(_prepareStoreCopyFiles.AtomicFilesSnapshot).thenReturn(atomicFiles);
            when(_prepareStoreCopyFiles.NonAtomicIndexIds).thenReturn(indexIds);
            when(_prepareStoreCopyFiles.listReplayableFiles()).thenReturn(files);
            when(_checkPointer.lastCheckPointedTransactionId()).thenReturn(lastCommitedTx);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPerformSuccessfulStoreCopyProcess() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPerformSuccessfulStoreCopyProcess()
        {
            // given
            StoreStreamingProcess process = new StoreStreamingProcess(_protocol, _checkPointerSupplier, _mutex, _resourceStream);

            // mocked behaviour
            ImmediateEventExecutor eventExecutor     = ImmediateEventExecutor.INSTANCE;
            Promise <Void>         completionPromise = eventExecutor.newPromise();
            long lastCheckpointedTxId = 1000L;
            RawCursor <StoreResource, IOException> resources = rawCursorOf();

            when(_checkPointer.tryCheckPoint(any())).thenReturn(lastCheckpointedTxId);
            when(_checkPointer.lastCheckPointedTransactionId()).thenReturn(lastCheckpointedTxId);
            when(_protocol.end(_ctx, SUCCESS)).thenReturn(completionPromise);
            when(_resourceStream.create()).thenReturn(resources);

            // when
            process.Perform(_ctx);

            // then
            InOrder inOrder = Mockito.inOrder(_protocol, _checkPointer);

            inOrder.verify(_checkPointer).tryCheckPoint(any());
            inOrder.verify(_protocol).end(_ctx, SUCCESS);
            inOrder.verifyNoMoreInteractions();

            assertEquals(1, @lock.ReadLockCount);

            // when
            completionPromise.Success = null;

            // then
            assertEquals(0, @lock.ReadLockCount);
        }