Example #1
0
 /// <summary>
 /// The entry point for neo4j admin tool's online backup functionality.
 /// </summary>
 /// <param name="outsideWorld"> provides a way to interact with the filesystem and output streams </param>
 /// <param name="contextBuilder"> helper class to validate, process and return a grouped result of processing the command line arguments </param>
 /// <param name="backupSupportingClassesFactory"> necessary for constructing the strategy for backing up over the causal clustering transaction protocol </param>
 /// <param name="backupStrategyCoordinatorFactory"> class that actually handles the logic of performing a backup </param>
 internal OnlineBackupCommand(OutsideWorld outsideWorld, OnlineBackupContextFactory contextBuilder, BackupSupportingClassesFactory backupSupportingClassesFactory, BackupStrategyCoordinatorFactory backupStrategyCoordinatorFactory)
 {
     this._outsideWorld   = outsideWorld;
     this._contextBuilder = contextBuilder;
     this._backupSupportingClassesFactory   = backupSupportingClassesFactory;
     this._backupStrategyCoordinatorFactory = backupStrategyCoordinatorFactory;
 }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @Nonnull public org.neo4j.commandline.admin.AdminCommand create(java.nio.file.Path homeDir, java.nio.file.Path configDir, org.neo4j.commandline.admin.OutsideWorld outsideWorld)
        public override AdminCommand Create(Path homeDir, Path configDir, OutsideWorld outsideWorld)
        {
            bool        debug       = System.getenv().get("NEO4J_DEBUG") != null;
            LogProvider logProvider = FormattedLogProvider.withDefaultLogLevel(debug ? Level.DEBUG : Level.NONE).toOutputStream(outsideWorld.OutStream());
            Monitors    monitors    = new Monitors();

            OnlineBackupContextFactory contextBuilder = new OnlineBackupContextFactory(homeDir, configDir);
            BackupModule backupModule = new BackupModule(outsideWorld, logProvider, monitors);

            BackupSupportingClassesFactoryProvider classesFactoryProvider   = ProvidersByPriority.findFirst().orElseThrow(NoProviderException());
            BackupSupportingClassesFactory         supportingClassesFactory = classesFactoryProvider.GetFactory(backupModule);
            BackupStrategyCoordinatorFactory       coordinatorFactory       = new BackupStrategyCoordinatorFactory(backupModule);

            return(new OnlineBackupCommand(outsideWorld, contextBuilder, supportingClassesFactory, coordinatorFactory));
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void communityBackupSupportingFactory()
        public virtual void CommunityBackupSupportingFactory()
        {
            AssertableLogProvider logProvider = new AssertableLogProvider();

            //OutsideWorld outsideWorld = mock( OutsideWorld.class );

            RealOutsideWorld      outsideWorld   = new RealOutsideWorld();
            FileSystemAbstraction fileSystemMock = mock(typeof(FileSystemAbstraction));

            //outsideWorld.fileSystemAbstraction = fileSystemMock;
            Monitors monitors = mock(typeof(Monitors));

            BackupModule backupModule = new BackupModule(outsideWorld, logProvider, monitors);

            // when( backupModule.getOutsideWorld() ).thenReturn( outsideWorld );

            BackupSupportingClassesFactoryProvider provider = ProvidersByPriority.findFirst().get();

            BackupSupportingClassesFactory factory = provider.GetFactory(backupModule);

            /*
             * SecurePipelineWrapperFactory pipelineWrapperFactory = new SecurePipelineWrapperFactory();
             * SslPolicyLoader sslPolicyLoader;
             * // and
             * Config config = Config.defaults();
             * config.augment( CausalClusteringSettings.ssl_policy, "default" );
             *
             * // We want to create dependencies the same way factory.createPipelineWrapper does so.s
             * Dependencies dependencies = new Dependencies(  );
             * dependencies.satisfyDependencies(new Object[]{SslPolicyLoader.create(config, logProvider)});
             *
             * assertEquals( pipelineWrapperFactory.forClient(config, dependencies, logProvider, CausalClusteringSettings.ssl_policy),
             *      factory.createPipelineWrapper( Config.defaults() ) );
             */

            assertEquals(typeof(SecureClientPipelineWrapper), factory.CreatePipelineWrapper(Config.defaults()).GetType());
        }
Example #4
0
        private static OnlineBackupCommand NewOnlineBackupCommand(OutsideWorld outsideWorld, OnlineBackupContext onlineBackupContext, BackupSupportingClassesFactory backupSupportingClassesFactory, BackupStrategyCoordinatorFactory backupStrategyCoordinatorFactory)
        {
            OnlineBackupContextFactory contextBuilder = mock(typeof(OnlineBackupContextFactory));

            try
            {
                when(contextBuilder.CreateContext(any())).thenReturn(onlineBackupContext);
            }
            catch (Exception e) when(e is IncorrectUsage || e is CommandFailed)
            {
                throw new Exception("Shouldn't happen", e);
            }

            return(new OnlineBackupCommand(outsideWorld, contextBuilder, backupSupportingClassesFactory, backupStrategyCoordinatorFactory));
        }