Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSetLastPulledTransactionId() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSetLastPulledTransactionId()
        {
            // given
            long    lastFlushedTxId           = 12;
            StoreId wantedStoreId             = new StoreId(1, 2, 3, 4);
            AdvertisedSocketAddress localhost = new AdvertisedSocketAddress("127.0.0.1", 1234);
            CatchupAddressProvider  catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(localhost);

            StoreCopyClient storeCopyClient = mock(typeof(StoreCopyClient));

            when(storeCopyClient.CopyStoreFiles(eq(catchupAddressProvider), eq(wantedStoreId), any(typeof(StoreFileStreamProvider)), any(), any())).thenReturn(lastFlushedTxId);

            TxPullClient txPullClient = mock(typeof(TxPullClient));

            when(txPullClient.PullTransactions(eq(localhost), eq(wantedStoreId), anyLong(), any())).thenReturn(new TxPullRequestResult(SUCCESS_END_OF_STREAM, 13));

            TransactionLogCatchUpWriter writer = mock(typeof(TransactionLogCatchUpWriter));

            RemoteStore remoteStore = new RemoteStore(NullLogProvider.Instance, mock(typeof(FileSystemAbstraction)), null, storeCopyClient, txPullClient, Factory(writer), Config.defaults(), new Monitors());

            // when
            remoteStore.Copy(catchupAddressProvider, wantedStoreId, DatabaseLayout.of(new File("destination")), true);

            // then
            long previousTxId = lastFlushedTxId - 1;               // the interface is defined as asking for the one preceding

            verify(txPullClient).pullTransactions(eq(localhost), eq(wantedStoreId), eq(previousTxId), any());
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void putStoreInDirectory(java.nio.file.Path databaseDirectory) throws java.io.IOException
        private static void PutStoreInDirectory(Path databaseDirectory)
        {
            Files.createDirectories(databaseDirectory);
            Path storeFile = DatabaseLayout.of(databaseDirectory.toFile()).metadataStore().toPath();

            Files.createFile(storeFile);
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void makeSureBackupCanBePerformed() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MakeSureBackupCanBePerformed()
        {
            // Run backup
            CoreGraphDatabase leader = createSomeData(_cluster);

            ReadReplicaGraphDatabase readReplica = _cluster.findAnyReadReplica().database();

            awaitEx(() => ReadReplicasUpToDateAsTheLeader(leader, readReplica), 1, TimeUnit.MINUTES);

            DbRepresentation beforeChange  = DbRepresentation.of(readReplica);
            string           backupAddress = transactionAddress(readReplica);

            string[] args = backupArguments(backupAddress, _backupPath, "readreplica");

            File configFile = ConfigFileBuilder.builder(ClusterRule.clusterDirectory()).build();

            assertEquals(STATUS_SUCCESS, runBackupToolFromOtherJvmToGetExitCode(ClusterRule.clusterDirectory(), args));

            // Add some new data
            DbRepresentation afterChange = DbRepresentation.of(createSomeData(_cluster));

            // Verify that backed up database can be started and compare representation
            DbRepresentation backupRepresentation = DbRepresentation.of(DatabaseLayout.of(_backupPath, "readreplica").databaseDirectory(), Config);

            assertEquals(beforeChange, backupRepresentation);
            assertNotEquals(backupRepresentation, afterChange);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseDownTxLogWriterIfTxStreamingFails() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCloseDownTxLogWriterIfTxStreamingFails()
        {
            // given
            StoreId                     storeId                = new StoreId(1, 2, 3, 4);
            StoreCopyClient             storeCopyClient        = mock(typeof(StoreCopyClient));
            TxPullClient                txPullClient           = mock(typeof(TxPullClient));
            TransactionLogCatchUpWriter writer                 = mock(typeof(TransactionLogCatchUpWriter));
            CatchupAddressProvider      catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(null);

            RemoteStore remoteStore = new RemoteStore(NullLogProvider.Instance, mock(typeof(FileSystemAbstraction)), null, storeCopyClient, txPullClient, Factory(writer), Config.defaults(), new Monitors());

            doThrow(typeof(CatchUpClientException)).when(txPullClient).pullTransactions(Null, eq(storeId), anyLong(), any());

            // when
            try
            {
                remoteStore.Copy(catchupAddressProvider, storeId, DatabaseLayout.of(new File(".")), true);
            }
            catch (StoreCopyFailedException)
            {
                // expected
            }

            // then
            verify(writer).close();
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.nio.channels.FileLock createLockedStoreLockFileIn(java.nio.file.Path databaseDir) throws java.io.IOException
        private FileLock CreateLockedStoreLockFileIn(Path databaseDir)
        {
            Path storeLockFile = Files.createFile(DatabaseLayout.of(databaseDir.toFile()).StoreLayout.storeLockFile().toPath());

            _channel = FileChannel.open(storeLockFile, READ, WRITE);
            return(_channel.@lock(0, long.MaxValue, true));
        }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void execute() throws java.io.IOException, org.neo4j.commandline.admin.CommandFailed
        public virtual void Execute()
        {
            if (!_fs.fileExists(_fromDatabasePath))
            {
                throw new System.ArgumentException(format("Source directory does not exist [%s]", _fromDatabasePath));
            }

            try
            {
                Validators.CONTAINS_EXISTING_DATABASE.validate(_fromDatabasePath);
            }
            catch (System.ArgumentException)
            {
                throw new System.ArgumentException(format("Source directory is not a database backup [%s]", _fromDatabasePath));
            }

            if (_fs.fileExists(_toDatabaseDir) && !_forceOverwrite)
            {
                throw new System.ArgumentException(format("Database with name [%s] already exists at %s", _toDatabaseName, _toDatabaseDir));
            }

            checkLock(DatabaseLayout.of(_toDatabaseDir).StoreLayout);

            _fs.deleteRecursively(_toDatabaseDir);

            if (!isSameOrChildFile(_toDatabaseDir, _transactionLogsDirectory))
            {
                _fs.deleteRecursively(_transactionLogsDirectory);
            }
            LogFiles backupLogFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_fromDatabasePath, _fs).build();

            RestoreDatabaseFiles(backupLogFiles, _fromDatabasePath.listFiles());
        }
Exemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public TemporaryStoreDirectory(org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache, java.io.File parent) throws java.io.IOException
        public TemporaryStoreDirectory(FileSystemAbstraction fs, PageCache pageCache, File parent)
        {
            this._tempStoreDir       = new File(parent, TEMP_COPY_DIRECTORY_NAME);
            this._tempDatabaseLayout = DatabaseLayout.of(_tempStoreDir, GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
            _storeFiles   = new StoreFiles(fs, pageCache, (directory, name) => true);
            _tempLogFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_tempDatabaseLayout.databaseDirectory(), fs).build();
            _storeFiles.delete(_tempStoreDir, _tempLogFiles);
        }
Exemplo n.º 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.io.File createNeoStoreFile() throws java.io.IOException
        private File CreateNeoStoreFile()
        {
            FsRule.get().mkdir(_databaseDirectory.toFile());
            File neoStoreFile = DatabaseLayout.of(_databaseDirectory.toFile()).metadataStore();

            FsRule.get().create(neoStoreFile).close();
            return(neoStoreFile);
        }
Exemplo n.º 9
0
 public LuceneKernelExtension(File databaseDirectory, Config config, System.Func <IndexConfigStore> indexStore, FileSystemAbstraction fileSystemAbstraction, IndexProviders indexProviders, OperationalMode operationalMode)
 {
     this._databaseLayout        = DatabaseLayout.of(databaseDirectory);
     this._config                = config;
     this._indexStore            = indexStore;
     this._fileSystemAbstraction = fileSystemAbstraction;
     this._indexProviders        = indexProviders;
     this._operationalMode       = operationalMode;
 }
Exemplo n.º 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            File txLogLocation = new File(TestDirectory.directory(), "txLogLocation");

            _config = Config.builder().withSetting(GraphDatabaseSettings.logical_logs_location, txLogLocation.AbsolutePath).build();
            File storeDir = TestDirectory.storeDir();

            _databaseLayout    = DatabaseLayout.of(storeDir, _config.get(GraphDatabaseSettings.active_database));
            _fsa               = TestDirectory.FileSystem;
            _commitStateHelper = new CommitStateHelper(PageCacheRule.getPageCache(_fsa), _fsa, _config);
        }
Exemplo n.º 11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void writePartialTx(java.io.File storeDir) throws java.io.IOException
        private void WritePartialTx(File storeDir)
        {
            using (PageCache pageCache = this.PageCache.getPageCache(_fs))
            {
                LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(DatabaseLayout.of(storeDir), _fs, pageCache).build();
                using (Lifespan ignored = new Lifespan(logFiles))
                {
                    LogEntryWriter writer = new LogEntryWriter(logFiles.LogFile.Writer);
                    writer.WriteStartEntry(0, 0, 0x123456789ABCDEFL, logFiles.LogFileInformation.LastEntryId + 1, new sbyte[] { 0 });
                }
            }
        }
Exemplo n.º 12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void tryCatchingUpDelegatesToRemoteStore() throws org.neo4j.causalclustering.catchup.storecopy.StoreCopyFailedException, java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TryCatchingUpDelegatesToRemoteStore()
        {
            // given
            AdvertisedSocketAddress fromAddress = new AdvertisedSocketAddress("neo4j.com", 5432);
            StoreId        expectedStoreId      = new StoreId(7, 2, 5, 98);
            DatabaseLayout databaseLayout       = DatabaseLayout.of(new File("."));

            // when
            Subject.tryCatchingUp(fromAddress, expectedStoreId, databaseLayout);

            // then
            verify(_remoteStore).tryCatchingUp(fromAddress, expectedStoreId, databaseLayout, true, true);
        }
Exemplo n.º 13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldRespectTheStoreLock() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldRespectTheStoreLock()
        {
            Path databaseDirectory = _homeDir.resolve("data/databases/foo.db");

            Files.createDirectories(databaseDirectory);
            StoreLayout storeLayout = DatabaseLayout.of(databaseDirectory.toFile()).StoreLayout;

            using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), StoreLocker locker = new StoreLocker(fileSystem, storeLayout))
            {
                locker.CheckLock();
                CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => execute("foo.db", "--force"));
                assertEquals("the database is in use -- stop Neo4j and try again", commandFailed.Message);
            }
        }
Exemplo n.º 14
0
 private BatchingNeoStores(FileSystemAbstraction fileSystem, PageCache pageCache, File databaseDirectory, RecordFormats recordFormats, Config neo4jConfig, Configuration importConfiguration, LogService logService, AdditionalInitialIds initialIds, bool externalPageCache, IoTracer ioTracer)
 {
     this._fileSystem              = fileSystem;
     this._recordFormats           = recordFormats;
     this._importConfiguration     = importConfiguration;
     this._initialIds              = initialIds;
     this._logProvider             = logService.InternalLogProvider;
     this._databaseLayout          = DatabaseLayout.of(databaseDirectory);
     this._temporaryDatabaseLayout = DatabaseLayout.of(_databaseLayout.file(TEMP_STORE_NAME), TEMP_STORE_NAME);
     this._neo4jConfig             = neo4jConfig;
     this._pageCache          = pageCache;
     this._ioTracer           = ioTracer;
     this._externalPageCache  = externalPageCache;
     this._idGeneratorFactory = new DefaultIdGeneratorFactory(fileSystem);
 }
Exemplo n.º 15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void failsWhenInconsistenciesAreFound() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void FailsWhenInconsistenciesAreFound()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir         = _testDir.directory("home").toPath();
            File databasesFolder = GetDatabasesFolder(homeDir);
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);
            DatabaseLayout          databaseLayout          = DatabaseLayout.of(databasesFolder, "mydb");

            when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(true), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.failure(new File("/the/report/path")));

            CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => checkConsistencyCommand.execute(new string[] { "--database=mydb", "--verbose" }));

            assertThat(commandFailed.Message, containsString((new File("/the/report/path")).ToString()));
        }
Exemplo n.º 16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void enablesVerbosity() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void EnablesVerbosity()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir         = _testDir.directory("home").toPath();
            File databasesFolder = GetDatabasesFolder(homeDir);
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            DatabaseLayout databaseLayout = DatabaseLayout.of(databasesFolder, "mydb");

            when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(true), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null));

            checkConsistencyCommand.Execute(new string[] { "--database=mydb", "--verbose" });

            verify(consistencyCheckService).runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(true), any(), any(typeof(ConsistencyFlags)));
        }
Exemplo n.º 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void lastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped()
        public virtual void LastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.StoreFactory storeFactory = new org.neo4j.kernel.impl.store.StoreFactory(org.neo4j.io.layout.DatabaseLayout.of(new java.io.File("store")), org.neo4j.kernel.configuration.Config.defaults(), new org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory(fs.get()), pageCacheRule.getPageCache(fs.get()), fs.get(), org.neo4j.logging.NullLogProvider.getInstance(), org.neo4j.io.pagecache.tracing.cursor.context.EmptyVersionContextSupplier.EMPTY);
            StoreFactory storeFactory = new StoreFactory(DatabaseLayout.of(new File("store")), Config.defaults(), new DefaultIdGeneratorFactory(Fs.get()), PageCacheRule.getPageCache(Fs.get()), Fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.NeoStores neoStores = storeFactory.openAllNeoStores(true);
            NeoStores neoStores = storeFactory.OpenAllNeoStores(true);

            neoStores.Close();

            System.Func <long>   supplier           = () => neoStores.MetaDataStore.LastCommittedTransactionId;
            OnDiskLastTxIdGetter diskLastTxIdGetter = new OnDiskLastTxIdGetter(supplier);

            assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_ID, diskLastTxIdGetter.LastTxId);
        }
Exemplo n.º 18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void retrieveStoreDelegatesToStoreCopyService() throws org.neo4j.causalclustering.catchup.storecopy.StoreCopyFailedException, org.neo4j.causalclustering.catchup.CatchupAddressResolutionException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RetrieveStoreDelegatesToStoreCopyService()
        {
            // given
            StoreId        storeId        = new StoreId(92, 5, 7, 32);
            DatabaseLayout databaseLayout = DatabaseLayout.of(new File("."));

            // when
            Subject.copy(_anyAddress, storeId, databaseLayout);

            // then
            ArgumentCaptor <CatchupAddressProvider> argumentCaptor = ArgumentCaptor.forClass(typeof(CatchupAddressProvider));

            verify(_remoteStore).copy(argumentCaptor.capture(), eq(storeId), eq(databaseLayout), eq(true));

            //and
            assertEquals(_anyAddress, argumentCaptor.Value.primary());
        }
Exemplo n.º 19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowIfAlreadyShutdown()
        public virtual void ShouldThrowIfAlreadyShutdown()
        {
            // Given
            CopiedStoreRecovery copiedStoreRecovery = new CopiedStoreRecovery(Config.defaults(), Iterables.empty(), mock(typeof(PageCache)));

            copiedStoreRecovery.Shutdown();

            try
            {
                // when
                copiedStoreRecovery.RecoverCopiedStore(DatabaseLayout.of(new File("nowhere")));
                fail("should have thrown");
            }
            catch (DatabaseShutdownException ex)
            {
                // then
                assertEquals("Abort store-copied store recovery due to database shutdown", ex.Message);
            }
        }
Exemplo n.º 20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void deleteIfNecessary(java.nio.file.Path databaseDirectory, java.nio.file.Path transactionLogsDirectory, boolean force) throws org.neo4j.commandline.admin.CommandFailed
        private void DeleteIfNecessary(Path databaseDirectory, Path transactionLogsDirectory, bool force)
        {
            try
            {
                if (force)
                {
                    checkLock(DatabaseLayout.of(databaseDirectory.toFile()).StoreLayout);
                    FileUtils.deletePathRecursively(databaseDirectory);
                    if (!isSameOrChildPath(databaseDirectory, transactionLogsDirectory))
                    {
                        FileUtils.deletePathRecursively(transactionLogsDirectory);
                    }
                }
            }
            catch (IOException e)
            {
                wrapIOException(e);
            }
        }
Exemplo n.º 21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCountFileSizeRecursively() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCountFileSizeRecursively()
        {
            // file structure:
            //   storeDir/indexDir/indexFile (1 kB)
            //   storeDir/neostore (3 kB)
            File           storeDir = DirectoryConflict.directory("storeDir");
            DatabaseLayout layout   = DatabaseLayout.of(storeDir);
            File           indexDir = Directory(storeDir, "indexDir");

            File(indexDir, "indexFile", ( int )kibiBytes(1));
            File(storeDir, layout.MetadataStore().Name, (int)kibiBytes(3));

            AssertableLogProvider logProvider = new AssertableLogProvider();

            KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles(layout);
            storeFiles.Dump(logProvider.getLog(this.GetType()).debugLogger());

            logProvider.RawMessageMatcher().assertContains("Total size of store: 4.00 kB");
            logProvider.RawMessageMatcher().assertContains("Total size of mapped files: 3.00 kB");
        }
Exemplo n.º 22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCopyStoreFilesAndPullTransactions() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCopyStoreFilesAndPullTransactions()
        {
            // given
            StoreId         storeId         = new StoreId(1, 2, 3, 4);
            StoreCopyClient storeCopyClient = mock(typeof(StoreCopyClient));
            TxPullClient    txPullClient    = mock(typeof(TxPullClient));

            when(txPullClient.PullTransactions(any(), any(), anyLong(), any())).thenReturn(new TxPullRequestResult(SUCCESS_END_OF_STREAM, 13));
            TransactionLogCatchUpWriter writer = mock(typeof(TransactionLogCatchUpWriter));

            RemoteStore remoteStore = new RemoteStore(NullLogProvider.Instance, mock(typeof(FileSystemAbstraction)), null, storeCopyClient, txPullClient, Factory(writer), Config.defaults(), new Monitors());

            // when
            AdvertisedSocketAddress localhost = new AdvertisedSocketAddress("127.0.0.1", 1234);
            CatchupAddressProvider  catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(localhost);

            remoteStore.Copy(catchupAddressProvider, storeId, DatabaseLayout.of(new File("destination")), true);

            // then
            verify(storeCopyClient).copyStoreFiles(eq(catchupAddressProvider), eq(storeId), any(typeof(StoreFileStreamProvider)), any(), any());
            verify(txPullClient).pullTransactions(eq(localhost), eq(storeId), anyLong(), any());
        }
Exemplo n.º 23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBehaveCorrectlyUnderStress() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBehaveCorrectlyUnderStress()
        {
            int  durationInMinutes = parseInt(fromEnv("TX_APPENDER_STRESS_DURATION", DEFAULT_DURATION_IN_MINUTES));
            File workingDirectory  = new File(fromEnv("TX_APPENDER_WORKING_DIRECTORY", _defaultWorkingDir));
            int  threads           = parseInt(fromEnv("TX_APPENDER_NUM_THREADS", DEFAULT_NUM_THREADS));

            Callable <long> runner = (new Builder()).with(untilTimeExpired(durationInMinutes, MINUTES)).withWorkingDirectory(DatabaseLayout.of(ensureExistsAndEmpty(workingDirectory))).withNumThreads(threads).build();

            long appendedTxs = runner.call();

            assertEquals((new TransactionIdChecker(workingDirectory)).parseAllTxLogs(), appendedTxs);

            // let's cleanup disk space when everything went well
            FileUtils.deleteRecursively(workingDirectory);
        }
Exemplo n.º 24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createUnlockedFakeDbDir(java.nio.file.Path homeDir) throws java.io.IOException
        private void CreateUnlockedFakeDbDir(Path homeDir)
        {
            Path fakeDbDir = CreateFakeDbDir(homeDir);

            Files.createFile(DatabaseLayout.of(fakeDbDir.toFile()).StoreLayout.storeLockFile().toPath());
        }