Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void testPermutation(byte[] unfragmented, io.netty.buffer.ByteBuf[] fragments) throws Exception
        private void TestPermutation(sbyte[] unfragmented, ByteBuf[] fragments)
        {
            // Given
            _channel = new EmbeddedChannel();
            BoltChannel boltChannel = NewBoltChannel(_channel);

            BoltStateMachine          machine        = mock(typeof(BoltStateMachine));
            SynchronousBoltConnection boltConnection = new SynchronousBoltConnection(machine);
            NullLogService            logging        = NullLogService.Instance;
            BoltProtocol boltProtocol = new BoltProtocolV1(boltChannel, (ch, s) => boltConnection, (v, ch) => machine, logging);

            boltProtocol.Install();

            // When data arrives split up according to the current permutation
            foreach (ByteBuf fragment in fragments)
            {
                _channel.writeInbound(fragment.readerIndex(0).retain());
            }

            // Then the session should've received the specified messages, and the protocol should be in a nice clean state
            try
            {
                RequestMessage run = new RunMessage("Mjölnir", EMPTY_MAP);
                verify(machine).process(eq(run), any(typeof(BoltResponseHandler)));
            }
            catch (AssertionError e)
            {
                throw new AssertionError("Failed to handle fragmented delivery.\n" + "Messages: " + Arrays.ToString(_messages) + "\n" + "Chunk size: " + _chunkSize + "\n" + "Serialized data delivered in fragments: " + DescribeFragments(fragments) + "\n" + "Unfragmented data: " + HexPrinter.hex(unfragmented) + "\n", e);
            }
        }
Example #2
0
        private StoreUpgrader NewUpgrader(UpgradableDatabase upgradableDatabase, PageCache pageCache, Config config, MigrationProgressMonitor progressMonitor)
        {
            NullLogService      instance        = NullLogService.Instance;
            StoreMigrator       defaultMigrator = new StoreMigrator(_fileSystem, pageCache, TuningConfig, instance, _jobScheduler);
            CountsMigrator      countsMigrator  = new CountsMigrator(_fileSystem, pageCache, TuningConfig);
            SchemaIndexMigrator indexMigrator   = new SchemaIndexMigrator(_fileSystem, IndexProvider.EMPTY);

            StoreUpgrader upgrader = new StoreUpgrader(upgradableDatabase, progressMonitor, config, _fileSystem, pageCache, NullLogProvider.Instance);

            upgrader.AddParticipant(indexMigrator);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(defaultMigrator);
            upgrader.AddParticipant(countsMigrator);
            return(upgrader);
        }