//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void backupRenamesWork() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BackupRenamesWork() { // given a prexisting backup from a different store string backupName = "preexistingBackup_" + RecordFormat; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = startCluster(recordFormat); Cluster <object> cluster = StartCluster(RecordFormat); string firstBackupAddress = CausalClusteringTestHelpers.transactionAddress(ClusterLeader(cluster).database()); assertEquals(0, RunBackupOtherJvm(firstBackupAddress, backupName)); DbRepresentation firstDatabaseRepresentation = DbRepresentation.of(ClusterLeader(cluster).database()); // and a different database //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster2 = startCluster2(recordFormat); Cluster <object> cluster2 = StartCluster2(RecordFormat); DbRepresentation secondDatabaseRepresentation = DbRepresentation.of(ClusterLeader(cluster2).database()); assertNotEquals(firstDatabaseRepresentation, secondDatabaseRepresentation); string secondBackupAddress = CausalClusteringTestHelpers.transactionAddress(ClusterLeader(cluster2).database()); // when backup is performed assertEquals(0, RunBackupOtherJvm(secondBackupAddress, backupName)); cluster2.Shutdown(); // then the new backup has the correct name assertEquals(secondDatabaseRepresentation, GetBackupDbRepresentation(backupName, _backupStoreDir)); // and the old backup is in a renamed location assertEquals(firstDatabaseRepresentation, GetBackupDbRepresentation(backupName + ".err.0", _backupStoreDir)); // and the data isn't equal (sanity check) assertNotEquals(firstDatabaseRepresentation, secondDatabaseRepresentation); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void reportsProgress() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ReportsProgress() { // given //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = startCluster(recordFormat); Cluster <object> cluster = StartCluster(RecordFormat); ClusterHelper.createIndexes(cluster.GetMemberWithAnyRole(Role.LEADER).database()); string customAddress = CausalClusteringTestHelpers.backupAddress(ClusterLeader(cluster).database()); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String backupName = "reportsProgress_" + recordFormat; string backupName = "reportsProgress_" + RecordFormat; assertEquals(0, RunBackupOtherJvm(customAddress, backupName)); // then string output = _suppressOutput.OutputVoice.ToString(); string location = Paths.get(_backupStoreDir.ToString(), backupName).ToString(); assertTrue(output.Contains("Start receiving store files")); assertTrue(output.Contains("Finish receiving store files")); string tested = Paths.get(location, "neostore.nodestore.db.labels").ToString(); assertTrue(tested, output.Contains(format("Start receiving store file %s", tested))); assertTrue(tested, output.Contains(format("Finish receiving store file %s", tested))); assertTrue(output.Contains("Start receiving transactions from ")); assertTrue(output.Contains("Finish receiving transactions at ")); assertTrue(output.Contains("Start receiving index snapshots")); assertTrue(output.Contains("Finished receiving index snapshots")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void backupCanBePerformedOverCcWithCustomPort() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BackupCanBePerformedOverCcWithCustomPort() { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = startCluster(recordFormat); Cluster <object> cluster = StartCluster(RecordFormat); string customAddress = CausalClusteringTestHelpers.transactionAddress(ClusterLeader(cluster).database()); assertEquals(0, RunBackupOtherJvm(customAddress, DATABASE_NAME)); assertEquals(DbRepresentation.of(ClusterDatabase(cluster)), GetBackupDbRepresentation(DATABASE_NAME, _backupStoreDir)); CreateSomeData(cluster); assertEquals(0, RunBackupOtherJvm(customAddress, DATABASE_NAME)); assertEquals(DbRepresentation.of(ClusterDatabase(cluster)), GetBackupDbRepresentation(DATABASE_NAME, _backupStoreDir)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void backupDoesntDisplayExceptionWhenSuccessful() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BackupDoesntDisplayExceptionWhenSuccessful() { // given //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = startCluster(recordFormat); Cluster <object> cluster = StartCluster(RecordFormat); string customAddress = CausalClusteringTestHelpers.transactionAddress(ClusterLeader(cluster).database()); // when assertEquals(0, RunBackupOtherJvm(customAddress, DATABASE_NAME)); // then assertFalse(_suppressOutput.ErrorVoice.ToString().ToLower().contains("exception")); assertFalse(_suppressOutput.OutputVoice.ToString().ToLower().contains("exception")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void onlyTheLatestTransactionIsKeptAfterIncrementalBackup() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void OnlyTheLatestTransactionIsKeptAfterIncrementalBackup() { // given database exists with data //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = startCluster(recordFormat); Cluster <object> cluster = StartCluster(RecordFormat); CreateSomeData(cluster); // and backup client is told to rotate conveniently Config config = Config.builder().withSetting(GraphDatabaseSettings.logical_log_rotation_threshold, "1m").build(); File configOverrideFile = _testDirectory.file("neo4j-backup.conf"); OnlineBackupCommandBuilder.WriteConfigToFile(config, configOverrideFile); // and we have a full backup //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String backupName = "backupName" + recordFormat; string backupName = "backupName" + RecordFormat; string address = CausalClusteringTestHelpers.backupAddress(ClusterLeader(cluster).database()); assertEquals(0, RunBackupToolFromOtherJvmToGetExitCode("--from", address, "--cc-report-dir=" + _backupStoreDir, "--backup-dir=" + _backupStoreDir, "--additional-config=" + configOverrideFile, "--name=" + backupName)); // and the database contains a few more transactions Transactions1M(cluster); Transactions1M(cluster); // rotation, second tx log file // when we perform an incremental backup assertEquals(0, RunBackupToolFromOtherJvmToGetExitCode("--from", address, "--cc-report-dir=" + _backupStoreDir, "--backup-dir=" + _backupStoreDir, "--additional-config=" + configOverrideFile, "--name=" + backupName, Arg(ARG_NAME_FALLBACK_FULL, false))); // then there has been a rotation LogFiles logFiles = BackupTransactionLogFilesHelper.ReadLogFiles(DatabaseLayout.of(new File(_backupStoreDir, backupName))); long highestTxIdInLogFiles = logFiles.HighestLogVersion; assertEquals(2, highestTxIdInLogFiles); // and the original log has not been removed since the transactions are applied at start long lowestTxIdInLogFiles = logFiles.LowestLogVersion; assertEquals(0, lowestTxIdInLogFiles); }
public virtual ClusterRule WithDatabaseNames(ISet <string> dbNames) { this._dbNames = dbNames; IDictionary <int, string> coreDBMap = CausalClusteringTestHelpers.distributeDatabaseNamesToHostNums(_noCoreMembers, dbNames); IDictionary <int, string> rrDBMap = CausalClusteringTestHelpers.distributeDatabaseNamesToHostNums(_noReadReplicas, dbNames); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IDictionary <string, long> minCoresPerDb = coreDBMap.SetOfKeyValuePairs().collect(Collectors.groupingBy(DictionaryEntry.getValue, Collectors.counting())); IDictionary <int, string> minCoresSettingsMap = new Dictionary <int, string>(); foreach (KeyValuePair <int, string> entry in coreDBMap.SetOfKeyValuePairs()) { long?minNumCores = Optional.ofNullable(minCoresPerDb[entry.Value]); minNumCores.ifPresent(n => minCoresSettingsMap.put(entry.Key, n.ToString())); } WithInstanceCoreParam(CausalClusteringSettings.database, coreDBMap.get); WithInstanceCoreParam(CausalClusteringSettings.minimum_core_cluster_size_at_formation, minCoresSettingsMap.get); WithInstanceReadReplicaParam(CausalClusteringSettings.database, rrDBMap.get); return(this); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBuildMemberAttributedWithSpecifiedDBNames() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBuildMemberAttributedWithSpecifiedDBNames() { //given int numMembers = 10; ISet <Member> hazelcastMembers = new HashSet <Member>(); IList <MemberId> coreMembers = new List <MemberId>(); IDictionary <int, string> dbNames = CausalClusteringTestHelpers.distributeDatabaseNamesToHostNums(numMembers, _dbNames); System.Func <int, Dictionary <string, string> > generator = i => { Dictionary <string, string> settings = _defaultSettingsGenerator.apply(i); settings.put(CausalClusteringSettings.database.name(), dbNames[i]); return(settings); }; IList <Config> configs = GenerateConfigs(numMembers, generator); for (int i = 0; i < configs.Count; i++) { MemberId mId = new MemberId(System.Guid.randomUUID()); coreMembers.Add(mId); Config c = configs[i]; IDictionary <string, object> attributes = buildMemberAttributesForCore(mId, c).Attributes; hazelcastMembers.Add(new MemberImpl(new Address("localhost", i), null, attributes, false)); } // when IDictionary <MemberId, CoreServerInfo> coreMemberMap = toCoreMemberMap(hazelcastMembers, NullLog.Instance, _hzInstance); // then for (int i = 0; i < numMembers; i++) { CoreServerInfo coreServerInfo = coreMemberMap[coreMembers[i]]; string expectedDBName = dbNames[i]; assertEquals(expectedDBName, coreServerInfo.DatabaseName); } }