Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateTransactionInformationWhenLogsAreEmpty() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGenerateTransactionInformationWhenLogsAreEmpty()
        {
            // given
            long           txId           = 1;
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           neoStore       = databaseLayout.MetadataStore();

            neoStore.createNewFile();
            Config     config     = mock(typeof(Config));
            LogService logService = new SimpleLogService(NullLogProvider.Instance, NullLogProvider.Instance);

            // when
            // ... transaction info not in neo store
            assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_ID));
            assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_CHECKSUM));
            assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP));
            // ... and with migrator
            StoreMigrator migrator = new StoreMigrator(_fileSystemRule.get(), _pageCache, config, logService, _jobScheduler);
            TransactionId actual   = migrator.ExtractTransactionIdInformation(neoStore, txId);

            // then
            assertEquals(txId, actual.TransactionIdConflict());
            assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_CHECKSUM, actual.Checksum());
            assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_COMMIT_TIMESTAMP, actual.CommitTimestamp());
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExtractTransactionInformationFromMetaDataStore() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldExtractTransactionInformationFromMetaDataStore()
        {
            // given
            // ... variables
            long          txId      = 42;
            long          checksum  = 123456789123456789L;
            long          timestamp = 919191919191919191L;
            TransactionId expected  = new TransactionId(txId, checksum, timestamp);

            // ... and files
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           neoStore       = databaseLayout.MetadataStore();

            neoStore.createNewFile();

            // ... and mocks
            Config     config     = mock(typeof(Config));
            LogService logService = mock(typeof(LogService));

            // when
            // ... data in record
            setRecord(_pageCache, neoStore, LAST_TRANSACTION_ID, txId);
            setRecord(_pageCache, neoStore, LAST_TRANSACTION_CHECKSUM, checksum);
            setRecord(_pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP, timestamp);

            // ... and with migrator
            StoreMigrator migrator = new StoreMigrator(_fileSystemRule.get(), _pageCache, config, logService, _jobScheduler);
            TransactionId actual   = migrator.ExtractTransactionIdInformation(neoStore, txId);

            // then
            assertEquals(expected, actual);
        }