예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void descriptorsGetTransmitted()
        public virtual void DescriptorsGetTransmitted()
        {
            // given
            File[] files = new File[]
            {
                new File("File a.txt"),
                new File("file-b"),
                new File("aoifnoasndfosidfoisndfoisnodainfsonidfaosiidfna"),
                new File("")
            };
            LongSet indexIds = LongSets.immutable.of(13);

            // when
            PrepareStoreCopyResponse prepareStoreCopyResponse = PrepareStoreCopyResponse.Success(files, indexIds, 1L);

            SendToChannel(prepareStoreCopyResponse, _embeddedChannel);

            // then it can be deserialised
            PrepareStoreCopyResponse readPrepareStoreCopyResponse = _embeddedChannel.readInbound();

            assertEquals(prepareStoreCopyResponse.Files.Length, readPrepareStoreCopyResponse.Files.Length);
            foreach (File file in files)
            {
                assertEquals(1, Stream.of(readPrepareStoreCopyResponse.Files).map(File.getName).filter(f => f.Equals(file.Name)).count());
            }
            assertEquals(prepareStoreCopyResponse.IndexIds, readPrepareStoreCopyResponse.IndexIds);
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private PrepareStoreCopyResponse createSuccessfulResponse(org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointer checkPointer, PrepareStoreCopyFiles prepareStoreCopyFiles) throws java.io.IOException
        private PrepareStoreCopyResponse CreateSuccessfulResponse(CheckPointer checkPointer, PrepareStoreCopyFiles prepareStoreCopyFiles)
        {
            LongSet indexIds = prepareStoreCopyFiles.NonAtomicIndexIds;

            File[] files             = prepareStoreCopyFiles.ListReplayableFiles();
            long   lastCommittedTxId = checkPointer.LastCheckPointedTransactionId();

            return(PrepareStoreCopyResponse.Success(files, indexIds, lastCommittedTxId));
        }
예제 #3
0
            protected internal override void channelRead0(ChannelHandlerContext channelHandlerContext, PrepareStoreCopyRequest prepareStoreCopyRequest)
            {
                channelHandlerContext.writeAndFlush(ResponseMessageType.PREPARE_STORE_COPY_RESPONSE);
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
                IList <File> list = _outerInstance.filesystem.Select(FakeFile::getFile).ToList();

                File[] files = new File[list.Count];
                files = list.toArray(files);
                long    transactionId = 123L;
                LongSet indexIds      = LongSets.immutable.of(13);

                channelHandlerContext.writeAndFlush(PrepareStoreCopyResponse.Success(files, indexIds, transactionId));
                _catchupServerProtocol.expect(CatchupServerProtocol.State.MESSAGE_TYPE);
            }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void transactionIdGetsTransmitted()
        public virtual void TransactionIdGetsTransmitted()
        {
            // given
            long transactionId = long.MaxValue;

            // when a transaction id is serialised
            PrepareStoreCopyResponse prepareStoreCopyResponse = PrepareStoreCopyResponse.Success(new File[0], LongSets.immutable.empty(), transactionId);

            SendToChannel(prepareStoreCopyResponse, _embeddedChannel);

            // then it can be deserialised
            PrepareStoreCopyResponse readPrepareStoreCopyResponse = _embeddedChannel.readInbound();

            assertEquals(prepareStoreCopyResponse.LastTransactionId(), readPrepareStoreCopyResponse.LastTransactionId());
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetSuccessfulResponseFromPrepareStoreCopyRequest() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGetSuccessfulResponseFromPrepareStoreCopyRequest()
        {
            // given storeId matches
            LongSet indexIds = LongSets.immutable.of(1);

            File[] files          = new File[] { new File("file") };
            long   lastCheckpoint = 1;

            ConfigureProvidedStoreCopyFiles(new StoreResource[0], files, indexIds, lastCheckpoint);

            // when store listing is requested
            _embeddedChannel.writeInbound(_channelHandlerContext, new PrepareStoreCopyRequest(_storeIdMatching));

            // and the contents of the store listing response is sent
            assertEquals(ResponseMessageType.PREPARE_STORE_COPY_RESPONSE, _embeddedChannel.readOutbound());
            PrepareStoreCopyResponse response = PrepareStoreCopyResponse.Success(files, indexIds, lastCheckpoint);

            assertEquals(response, _embeddedChannel.readOutbound());

            // and the protocol is reset to expect any message type after listing has been transmitted
            assertTrue(_catchupServerProtocol.isExpecting(CatchupServerProtocol.State.MESSAGE_TYPE));
        }
예제 #6
0
 protected internal override void channelRead0(ChannelHandlerContext ctx, PrepareStoreCopyRequest msg)
 {
     ctx.write(ResponseMessageType.PREPARE_STORE_COPY_RESPONSE);
     ctx.writeAndFlush(PrepareStoreCopyResponse.Success(new File[] { new File(_outerInstance.fileName) }, LongSets.immutable.empty(), 1));
     _catchupServerProtocol.expect(CatchupServerProtocol.State.MESSAGE_TYPE);
 }