Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void letImporterDecideAboutDatabaseExistence() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void LetImporterDecideAboutDatabaseExistence()
        {
            File          report        = _testDir.file("report");
            Path          homeDir       = _testDir.directory("home").toPath();
            PrintStream   nullOutput    = new PrintStream(NULL_OUTPUT_STREAM);
            OutsideWorld  outsideWorld  = new RealOutsideWorld(nullOutput, nullOutput, new MemoryStream(new sbyte[0]));
            Path          confPath      = _testDir.directory("conf").toPath();
            ImportCommand importCommand = new ImportCommand(homeDir, confPath, outsideWorld);
            File          nodesFile     = CreateTextFile("nodes.csv", ":ID", "1", "2");

            string[] arguments = new string[] { "--mode=csv", "--database=existing.db", "--nodes=" + nodesFile.AbsolutePath, "--report-file=" + report.AbsolutePath };

            // First run an import so that a database gets created
            importCommand.Execute(arguments);

            // When
            ImporterFactory importerFactory = mock(typeof(ImporterFactory));
            Importer        importer        = mock(typeof(Importer));

            when(importerFactory.GetImporterForMode(any(), any(), any(), any())).thenReturn(importer);
            (new ImportCommand(homeDir, confPath, outsideWorld, importerFactory)).Execute(arguments);

            // Then no exception about database existence should be thrown
        }