Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrintKilobytesEvenForByteSizeBelowAKiloByte()
        public virtual void ShouldPrintKilobytesEvenForByteSizeBelowAKiloByte()
        {
            // given
            long bytesBelowK    = 176;
            long bytesBelow10K  = 1762;
            long bytesBelow100K = 17625;

            // when
            string stringBelowK    = MemoryRecommendationsCommand.BytesToString(bytesBelowK);
            string stringBelow10K  = MemoryRecommendationsCommand.BytesToString(bytesBelow10K);
            string stringBelow100K = MemoryRecommendationsCommand.BytesToString(bytesBelow100K);

            // then
            assertThat(stringBelowK, @is("1k"));
            assertThat(stringBelow10K, @is("2k"));
            assertThat(stringBelow100K, @is("18k"));
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustPrintRecommendationsAsConfigReadableOutput() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustPrintRecommendationsAsConfigReadableOutput()
        {
            StringBuilder output                 = new StringBuilder();
            Path          homeDir                = Paths.get("home");
            Path          configDir              = Paths.get("home", "config");
            OutsideWorld  outsideWorld           = new RealOutsideWorldAnonymousInnerClass(this, output);
            MemoryRecommendationsCommand command = new MemoryRecommendationsCommand(homeDir, configDir, outsideWorld);
            string heap      = bytesToString(recommendHeapMemory(gibiBytes(8)));
            string pagecache = bytesToString(recommendPageCacheMemory(gibiBytes(8)));

            command.Execute(new string[] { "--memory=8g" });

            IDictionary <string, string> stringMap = load(new StringReader(output.ToString()));

            assertThat(stringMap[initialHeapSize.name()], @is(heap));
            assertThat(stringMap[maxHeapSize.name()], @is(heap));
            assertThat(stringMap[pagecache_memory.name()], @is(pagecache));
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustPrintMinimalPageCacheMemorySettingForConfiguredDb() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustPrintMinimalPageCacheMemorySettingForConfiguredDb()
        {
            // given
            StringBuilder output    = new StringBuilder();
            Path          homeDir   = Directory.directory().toPath();
            Path          configDir = homeDir.resolve("conf");

            configDir.toFile().mkdirs();
            Path   configFile   = configDir.resolve(DEFAULT_CONFIG_FILE_NAME);
            string databaseName = "mydb";

            store(stringMap(data_directory.name(), homeDir.ToString()), configFile.toFile());
            File databaseDirectory = fromFile(configFile).withHome(homeDir).withSetting(active_database, databaseName).build().get(database_path);

            CreateDatabaseWithNativeIndexes(databaseDirectory);
            OutsideWorld outsideWorld            = new OutputCaptureOutsideWorld(output);
            MemoryRecommendationsCommand command = new MemoryRecommendationsCommand(homeDir, configDir, outsideWorld);
            string heap      = bytesToString(recommendHeapMemory(gibiBytes(8)));
            string pagecache = bytesToString(recommendPageCacheMemory(gibiBytes(8)));

            // when
            command.Execute(array("--database", databaseName, "--memory", "8g"));

            // then
            string memrecString = output.ToString();
            IDictionary <string, string> stringMap = load(new StringReader(memrecString));

            assertThat(stringMap[initialHeapSize.name()], @is(heap));
            assertThat(stringMap[maxHeapSize.name()], @is(heap));
            assertThat(stringMap[pagecache_memory.name()], @is(pagecache));

            long[] expectedSizes         = CalculatePageCacheFileSize(DatabaseLayout.of(databaseDirectory));
            long   expectedPageCacheSize = expectedSizes[0];
            long   expectedLuceneSize    = expectedSizes[1];

            assertThat(memrecString, containsString("Lucene indexes: " + bytesToString(expectedLuceneSize)));
            assertThat(memrecString, containsString("Data volume and native indexes: " + bytesToString(expectedPageCacheSize)));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Nonnull @Override public org.neo4j.commandline.arguments.Arguments allArguments()
        public override Arguments AllArguments()
        {
            return(MemoryRecommendationsCommand.BuildArgs());
        }