//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCalculateCorrectEstimates() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCalculateCorrectEstimates() { // given a couple of input files of various layouts Input input = GenerateData(); RecordFormats format = LATEST_RECORD_FORMATS; [email protected]_Estimates estimates = input.CalculateEstimates(new PropertyValueRecordSizeCalculator(format.Property().getRecordSize(NO_STORE_HEADER), parseInt(GraphDatabaseSettings.string_block_size.DefaultValue), 0, parseInt(GraphDatabaseSettings.array_block_size.DefaultValue), 0)); // when DatabaseLayout databaseLayout = Directory.databaseLayout(); Config config = Config.defaults(); FileSystemAbstraction fs = new DefaultFileSystemAbstraction(); using (JobScheduler jobScheduler = new ThreadPoolJobScheduler()) { (new ParallelBatchImporter(databaseLayout, fs, null, Configuration.DEFAULT, NullLogService.Instance, ExecutionMonitors.invisible(), AdditionalInitialIds.EMPTY, config, format, NO_MONITOR, jobScheduler)).doImport(input); // then compare estimates with actual disk sizes VersionContextSupplier contextSupplier = EmptyVersionContextSupplier.EMPTY; using (PageCache pageCache = (new ConfiguringPageCacheFactory(fs, config, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, NullLog.Instance, contextSupplier, jobScheduler)).OrCreatePageCache, NeoStores stores = (new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(fs), pageCache, fs, NullLogProvider.Instance, contextSupplier)).openAllNeoStores()) { AssertRoughlyEqual(estimates.NumberOfNodes(), stores.NodeStore.NumberOfIdsInUse); AssertRoughlyEqual(estimates.NumberOfRelationships(), stores.RelationshipStore.NumberOfIdsInUse); AssertRoughlyEqual(estimates.NumberOfNodeProperties() + estimates.NumberOfRelationshipProperties(), CalculateNumberOfProperties(stores)); } AssertRoughlyEqual(PropertyStorageSize(), estimates.SizeOfNodeProperties() + estimates.SizeOfRelationshipProperties()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCalculateCorrectEstimatesOnEmptyData() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCalculateCorrectEstimatesOnEmptyData() { // given Groups groups = new Groups(); ICollection <DataFactory> nodeData = asList(GenerateData(defaultFormatNodeFileHeader(), new MutableLong(), 0, 0, ":ID", "nodes-1.csv", groups)); ICollection <DataFactory> relationshipData = asList(GenerateData(defaultFormatRelationshipFileHeader(), new MutableLong(), 0, 0, ":START_ID,:TYPE,:END_ID", "rels-1.csv", groups)); Input input = new CsvInput(nodeData, defaultFormatNodeFileHeader(), relationshipData, defaultFormatRelationshipFileHeader(), IdType.Integer, COMMAS, Collector.EMPTY, CsvInput.NoMonitor, groups); // when [email protected]_Estimates estimates = input.CalculateEstimates(new PropertyValueRecordSizeCalculator(LATEST_RECORD_FORMATS.property().getRecordSize(NO_STORE_HEADER), parseInt(GraphDatabaseSettings.string_block_size.DefaultValue), 0, parseInt(GraphDatabaseSettings.array_block_size.DefaultValue), 0)); // then assertEquals(0, estimates.NumberOfNodes()); assertEquals(0, estimates.NumberOfRelationships()); assertEquals(0, estimates.NumberOfRelationshipProperties()); assertEquals(0, estimates.NumberOfNodeProperties()); assertEquals(0, estimates.NumberOfNodeLabels()); }