示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSeedNewCluster() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSeedNewCluster()
        {
            // given
            _backupCluster.start();
            Optional <File> backup = InitialStore.generate(_baseBackupDir, _backupCluster);

            _backupCluster.shutdown();

            if (backup.Present)
            {
                foreach (CoreClusterMember coreClusterMember in _cluster.coreMembers())
                {
                    restoreFromBackup(backup.get(), _fileSystemRule.get(), coreClusterMember);
                }
            }

            // we want the cluster to seed from backup. No instance should delete and re-copy the store.
            _cluster.coreMembers().forEach(ccm => ccm.monitors().addMonitorListener(_fileCopyDetector));

            // when
            _cluster.start();

            // then
            if (backup.Present)
            {
                Config config = Config.defaults(GraphDatabaseSettings.active_database, backup.get().Name);
                dataMatchesEventually(DbRepresentation.of(backup.get(), config), _cluster.coreMembers());
            }
            assertEquals(ShouldStoreCopy, _fileCopyDetector.hasDetectedAnyFileCopied());
        }
示例#2
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);
        }
示例#3
0
 /// <summary>
 /// Used by non-cc </summary>
 /// <param name="db">
 /// @return </param>
 public static DbRepresentation CreateSomeData(GraphDatabaseService db)
 {
     using (Transaction tx = Db.beginTx())
     {
         CreateSomeData(db, tx);
     }
     return(DbRepresentation.of(db));
 }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRestoreBySeedingAllMembers() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRestoreBySeedingAllMembers()
        {
            // given
            GraphDatabaseService database = (new GraphDatabaseFactory()).newEmbeddedDatabaseBuilder(TestDir.storeDir()).setConfig(GraphDatabaseSettings.allow_upgrade, Settings.TRUE).setConfig(GraphDatabaseSettings.record_format, HighLimit.NAME).setConfig(OnlineBackupSettings.online_backup_enabled, false.ToString()).newGraphDatabase();

            database.Shutdown();
            Config           config = Config.defaults(OnlineBackupSettings.online_backup_enabled, Settings.FALSE);
            DbRepresentation before = DbRepresentation.of(TestDir.storeDir(), config);

            // when
            _fsa.copyRecursively(TestDir.databaseDir(), _cluster.getCoreMemberById(0).databaseDirectory());
            _fsa.copyRecursively(TestDir.databaseDir(), _cluster.getCoreMemberById(1).databaseDirectory());
            _fsa.copyRecursively(TestDir.databaseDir(), _cluster.getCoreMemberById(2).databaseDirectory());
            _cluster.start();

            // then
            dataMatchesEventually(before, _cluster.coreMembers());
        }