Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: Importer getImporterForMode(String mode, org.neo4j.helpers.Args parsedArgs, org.neo4j.kernel.configuration.Config config, org.neo4j.commandline.admin.OutsideWorld outsideWorld) throws org.neo4j.commandline.admin.IncorrectUsage, org.neo4j.commandline.admin.CommandFailed
        internal virtual Importer GetImporterForMode(string mode, Args parsedArgs, Config config, OutsideWorld outsideWorld)
        {
            Importer importer;

            switch (mode)
            {
            case "database":
                importer = new DatabaseImporter(parsedArgs, config, outsideWorld);
                break;

            case "csv":
                importer = new CsvImporter(parsedArgs, config, outsideWorld);
                break;

            default:
                throw new CommandFailed("Invalid mode specified.");                           // This won't happen because mode is mandatory.
            }
            return(importer);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void writesReportToSpecifiedReportFile() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void WritesReportToSpecifiedReportFile()
        {
            File dbDir          = _testDir.directory("db");
            File logDir         = _testDir.directory("logs");
            File reportLocation = _testDir.file("the_report");

            File           inputFile = _testDir.file("foobar.csv");
            IList <string> lines     = Collections.singletonList("foo\\tbar\\tbaz");

            Files.write(inputFile.toPath(), lines, Charset.defaultCharset());

            using (RealOutsideWorld outsideWorld = new RealOutsideWorld(System.out, System.err, new MemoryStream(new sbyte[0])))
            {
                Config config = Config.builder().withSettings(AdditionalConfig()).withSetting(GraphDatabaseSettings.database_path, dbDir.AbsolutePath).withSetting(GraphDatabaseSettings.logs_directory, logDir.AbsolutePath).build();

                CsvImporter csvImporter = new CsvImporter(Args.parse(string.Format("--report-file={0}", reportLocation.AbsolutePath), string.Format("--nodes={0}", inputFile.AbsolutePath), "--delimiter=TAB"), config, outsideWorld);
                csvImporter.DoImport();
            }

            assertTrue(reportLocation.exists());
        }