Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws java.io.IOException, org.neo4j.causalclustering.catchup.storecopy.StoreIdDownloadFailedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            when(AddressResolver.resolveCorrectCCAddress(any(), any())).thenReturn(ResolvedFromAddress);
            when(StoreFiles.readStoreId(any())).thenReturn(ExpectedStoreId);
            when(BackupDelegator.fetchStoreId(any())).thenReturn(ExpectedStoreId);
            Subject = new CausalClusteringBackupStrategy(BackupDelegator, AddressResolver, NullLogProvider.Instance, StoreFiles);
        }
Exemple #2
0
        public override Fallible <BackupStageOutcome> PerformFullBackup(DatabaseLayout targetDatabaseLayout, Config config, OptionalHostnamePort userProvidedAddress)
        {
            AdvertisedSocketAddress fromAddress = _addressResolver.resolveCorrectCCAddress(config, userProvidedAddress);

            _log.info("Resolved address for catchup protocol is " + fromAddress);
            StoreId storeId;

            try
            {
                storeId = _backupDelegator.fetchStoreId(fromAddress);
                _log.info("Remote store id is " + storeId);
            }
            catch (StoreIdDownloadFailedException e)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.WrongProtocol, e));
            }

            Optional <StoreId> expectedStoreId = ReadLocalStoreId(targetDatabaseLayout);

            if (expectedStoreId.Present)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Failure, new StoreIdDownloadFailedException(format("Cannot perform a full backup onto preexisting backup. Remote store id was %s but local is %s", storeId, expectedStoreId))));
            }

            try
            {
                _backupDelegator.copy(fromAddress, storeId, targetDatabaseLayout);
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Success, null));
            }
            catch (StoreCopyFailedException e)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Failure, e));
            }
        }
Exemple #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void noPortResolvesToDefault_cc()
        public virtual void NoPortResolvesToDefaultCc()
        {
            Config config = Config.builder().withSetting(OnlineBackupSettings.online_backup_server, "any:1234").build();
            AdvertisedSocketAddress resolved = Subject.resolveCorrectCCAddress(config, new OptionalHostnamePort("localhost", null, null));

            // then
            assertEquals(1234, resolved.Port);
        }