Example #1
0
 private string ResolvePortOnlyHost(HostnamePort host)
 {
     try
     {
         return(host.ToString(InetAddress.LocalHost.HostAddress));
     }
     catch (UnknownHostException e)
     {
         throw new Exception(e);
     }
 }
Example #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
            ManagedCluster               cluster      = ClusterRule.startCluster();
            DbRepresentation             beforeChange = DbRepresentation.of(cluster.Master);
            HighlyAvailableGraphDatabase hagdb        = cluster.AllMembers.GetEnumerator().next();
            HostnamePort address      = cluster.GetBackupAddress(hagdb);
            string       databaseName = "basic";

            assertEquals(0, runBackupToolFromOtherJvmToGetExitCode(_backupPath, BackupArguments(address.ToString(), _backupPath, databaseName)));

            // Add some new data
            DbRepresentation afterChange = createSomeData(cluster.Master);

            cluster.Sync();

            // Verify that backed up database can be started and compare representation
            Config           config = Config.builder().withSetting(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).withSetting(GraphDatabaseSettings.active_database, databaseName).build();
            DbRepresentation backupRepresentation = DbRepresentation.of(DatabaseLayout.of(_backupPath, databaseName).databaseDirectory(), config);

            assertEquals(beforeChange, backupRepresentation);
            assertNotEquals(backupRepresentation, afterChange);
        }